Summary
cargo build --release fails during LLVM instruction selection on the
current esp Rust toolchains (1.94.0.0 through 1.95.0.0). The build aborts
before linking with:
rustc-LLVM ERROR: Cannot select: ... i32 = XtensaISD::PCREL_WRAPPER
TargetConstantPool:i32<@anon... = private unnamed_addr constant
[14 x i8] c"ADC Read Error", align 1> 0
In function: ..._usb_task_task0...poll
The Xtensa backend can't lower a PC-relative reference to an aggregate
constant in the constant pool. Here that's the "ADC Read Error" string
literal in src/control/adc.rs, pulled into the USB task by inlining.
Details
- Only optimized codegen is affected.
cargo check and cargo clippy
pass; debug builds (opt-level 0) get through codegen and only fail at
link for unrelated reasons.
- Independent of the release profile knobs: reproduces with
lto set to
fat, thin, or off, and at opt-level 2, 3, and s.
- Target:
xtensa-esp32s3-none-elf (our no_std firmware).
Toolchain bisect
| esp toolchain |
bundled LLVM |
result |
| 1.93.0.0 |
20.1.1 |
builds |
| 1.94.0.2 |
21.1.3 |
fails |
| 1.95.0.0 |
21.1.3 |
fails |
The regression tracks the esp-rs fork's LLVM 20 to 21 bump.
Known upstream regression
Workaround
Pin the esp toolchain to the last good version:
espup install --toolchain-version 1.93.0.0
Summary
cargo build --releasefails during LLVM instruction selection on thecurrent esp Rust toolchains (1.94.0.0 through 1.95.0.0). The build aborts
before linking with:
The Xtensa backend can't lower a PC-relative reference to an aggregate
constant in the constant pool. Here that's the
"ADC Read Error"stringliteral in
src/control/adc.rs, pulled into the USB task by inlining.Details
cargo checkandcargo clippypass; debug builds (opt-level 0) get through codegen and only fail at
link for unrelated reasons.
ltoset tofat, thin, or off, and at opt-level 2, 3, and s.
xtensa-esp32s3-none-elf(our no_std firmware).Toolchain bisect
The regression tracks the esp-rs fork's LLVM 20 to 21 bump.
Known upstream regression
Cannot select XtensaISD::PCREL_WRAPPERfailure, also a regression in 1.94.0.0+, from the LLVM 20 to 21 bump.
That reporter hit it on the std target with a
[2 x float]constant andsaid it did not reproduce on no_std for them. This case shows it does
affect no_std too, via a string (
[14 x i8]) constant.espressif/llvm-project@39a5993,
"[Xtensa] Fix ConstantPool lowering for aggregate constants"
(2026-05-13). Not confirmed in a released toolchain yet.
rustc-LLVM ERROR: Cannot select: 0x11c366ee0: i32 = Constant<4096> esp-rs/rust#275, Another cannot select issue esp-rs/rust#281.
Workaround
Pin the esp toolchain to the last good version: