Closed
Description
When compiling the following minimal AVR template in --release mode, the compiler aborts with an LLVM error
https://github.com/avr-rust/template-bin.git
(This is an empty template with an empty main that does nothing.)
$ cargo build --target avr-atmega328p.json -Z build-std=core --release
Compiling compiler_builtins v0.1.39
Compiling core v0.0.0 (.../rust-unstable/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling rustc-std-workspace-core v1.99.0 (.../rust-unstable/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc
-std-workspace-core)
Compiling avr-std-stub v1.0.2
LLVM ERROR: Not supported instr: <MCInst 258 <MCOperand Reg:1> <MCOperand Imm:15> <MCOperand Reg:47>>
error: could not compile `compiler_builtins`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
In debug mode the build works correctly:
$ cargo build --target avr-atmega328p.json -Z build-std=core
Compiling core v0.0.0 (.../rust-unstable/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling compiler_builtins v0.1.39
Compiling rustc-std-workspace-core v1.99.0 (.../rust-unstable/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc
-std-workspace-core)
Compiling avr-std-stub v1.0.2
Compiling template-bin v0.1.0 (.../avr-rust-template)
Finished dev [unoptimized + debuginfo] target(s) in 14.61s
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (8e54a2113 2021-02-13)
binary: rustc
commit-hash: 8e54a21139ae96a2aca3129100b057662e2799b9
commit-date: 2021-02-13
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1