Skip to content

build: nRF52840 Adafruit-BSP LTO link failure — "offset out of range" in arm-gnu 15.2.1 LTO #2641

Closed

Description

@zackees

Symptom

All nRF52840 boards built against the Adafruit BSP + arm-gnu-toolchain 15.2.rel1 (15.2.1) under LTO fail at link with thousands of offset out of range errors in the LTO-temp assembly:

```
.../release/.lto-tmp/ccXXXXXX.s:13834: Error: offset out of range
.../release/.lto-tmp/ccXXXXXX.s:13863: Error: offset out of range
.../release/.lto-tmp/ccXXXXXX.s:13894: Error: offset out of range
lto-wrapper: fatal error: arm-none-eabi-gcc returned 1 exit status
arm-none-eabi/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```

This is happening on:

Toolchain path: `/home/runner/work/_temp/fbuild-cache/toolchains/developer-gnu/e0640e442d96f78c/15.2.Rel1/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/`.

Root cause hypothesis

`offset out of range` from the assembler on LTO output usually means a 16-bit branch offset overflowed. Common triggers for arm-none-eabi 15.x + Cortex-M4 + LTO:

  1. Code section bigger than the unconditional-branch reach (±16 MB for B/BL, ±20 MB for B.W) due to LTO-induced inlining — unlikely on 1 MB flash, so more likely:
  2. Long-call mismatch: LTO merges code into a different section than the linker expects, and short-form branches are emitted for what end up as long-distance calls. Workaround: add -mlong-calls (or selectively -mlong-calls -mno-long-calls per TU), or disable LTO entirely (-fno-lto).
  3. arm-gnu 15.2.rel1 LTO regression — worth checking the toolchain release notes.

Proposed fix

  1. Quick CI unblock: add -fno-lto (or equivalent disable) to the nRF52840 Adafruit-BSP boards in ci/boards.py until the toolchain interaction is properly understood. This affects only release-mode CI compile, not runtime behavior of user firmware (they choose their own linker flags).
  2. Better fix: downgrade the toolchain pin to a known-good arm-gnu (e.g. 13.x) for nRF52 builds, OR upgrade past 15.2.rel1 once a fix is available.
  3. Best fix: identify the specific source pattern in FastLED / Adafruit BSP that LTO is mis-laying-out, and pre-emptively annotate.

Not blocked on

The variant.h issue from #2634 is fixed — that error is gone from the log; this LTO failure is downstream.

Activity

  1. zackees commented on Jun 3, 2026

    @zackees
    MemberAuthor

    Closing after the nRF52840 LTO failure was covered by the merged follow-up PRs:

    Verified current workflow evidence on 2026-06-03: recent build_nrf52840_dk.yml and build_nrf52840_supermini.yml runs have completed successfully after these changes. The remaining post-build runtime/runner-duration concern was tracked separately in #2657.

  2. moved this from Triage to Done in FastLED Trackeron Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions