rust-lang / rust-lang/rustc_codegen_cranelift

[ICE]: Cranelift Unimplemented Relocation

Open
#1,633 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuginfo C-bug O-arm O-macos
Dominant language
Rust
Stars
2.1k
Forks
157
Avg merge
1d 19h
Merged PRs (30d)
3

Description

Code
fn main {}

Compile with -Zcodegen-backend=cranelift -Ctarget-cpu=native on an M4 system.

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (e370b60cf 2026-03-07)
binary: rustc
commit-hash: e370b60cf2b0d3e4b55923ec1558c5b5f8970cfb
commit-date: 2026-03-07
host: aarch64-apple-darwin
release: 1.96.0-nightly
LLVM version: 22.1.0
Error output
thread 'rustc' (1894541) panicked at /rustc-dev/e370b60cf2b0d3e4b55923ec1558c5b5f8970cfb/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs:89:14:
called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation Relocation { offset: 32, symbol: SymbolId(11), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
Backtrace

thread 'rustc' (1894912) panicked at /rustc-dev/e370b60cf2b0d3e4b55923ec1558c5b5f8970cfb/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs:89:14:
called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation Relocation { offset: 32, symbol: SymbolId(11), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
stack backtrace:
   0:        0x111ab0c28 - <<std[4363f048fae9c8af]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f1dce288aaae9328]::fmt::Display>::fmt
   1:        0x10ec7ac28 - core[f1dce288aaae9328]::fmt::write
   2:        0x111ac8418 - <std[4363f048fae9c8af]::sys::stdio::unix::Stderr as std[4363f048fae9c8af]::io::Write>::write_fmt
   3:        0x111a872f4 - std[4363f048fae9c8af]::panicking::default_hook::{closure#0}
   4:        0x111aa3110 - std[4363f048fae9c8af]::panicking::default_hook
   5:        0x10f8eec90 - std[4363f048fae9c8af]::panicking::update_hook::<alloc[d0e3ae77f8b00750]::boxed::Box<rustc_driver_impl[7f7da6b576ab5781]::install_ice_hook::{closure#1}>>::{closure#0}
   6:        0x111aa3474 - std[4363f048fae9c8af]::panicking::panic_with_hook
   7:        0x111a8739c - std[4363f048fae9c8af]::panicking::panic_handler::{closure#0}
   8:        0x111a7dd40 - std[4363f048fae9c8af]::sys::backtrace::__rust_end_short_backtrace::<std[4363f048fae9c8af]::panicking::panic_handler::{closure#0}, !>
   9:        0x111a8896c - __rustc[530e92af27cdbe53]::rust_begin_unwind
  10:        0x114ac3b8c - core[f1dce288aaae9328]::panicking::panic_fmt
  11:        0x114ac38f4 - core[f1dce288aaae9328]::result::unwrap_failed
  12:        0x1090d8bd4 - <cranelift_object[be37181448c0167]::backend::ObjectProduct as rustc_codegen_cranelift[44768bf7efe39717]::debuginfo::object::WriteDebugInfo>::add_debug_reloc
  13:        0x10908ee44 - <rustc_codegen_cranelift[44768bf7efe39717]::unwind_module::UnwindModule<cranelift_object[be37181448c0167]::backend::ObjectModule>>::finish
  14:        0x1090d5840 - rustc_codegen_cranelift[44768bf7efe39717]::driver::aot::run_aot
  15:        0x1090e59b4 - <rustc_codegen_cranelift[44768bf7efe39717]::CraneliftCodegenBackend as rustc_codegen_ssa[a3d2cc46dea2e7c2]::traits::backend::CodegenBackend>::codegen_crate
  16:        0x110213840 - <rustc_interface[69ef0626fe093afc]::queries::Linker>::codegen_and_build_linker
  17:        0x10f8a8a7c - rustc_interface[69ef0626fe093afc]::passes::create_and_enter_global_ctxt::<core[f1dce288aaae9328]::option::Option<rustc_interface[69ef0626fe093afc]::queries::Linker>, rustc_driver_impl[7f7da6b576ab5781]::run_compiler::{closure#0}::{closure#2}>
  18:        0x10f8f22d8 - rustc_interface[69ef0626fe093afc]::interface::run_compiler::<(), rustc_driver_impl[7f7da6b576ab5781]::run_compiler::{closure#0}>::{closure#1}
  19:        0x10f8e7e1c - std[4363f048fae9c8af]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[69ef0626fe093afc]::util::run_in_thread_with_globals<rustc_interface[69ef0626fe093afc]::util::run_in_thread_pool_with_globals<rustc_interface[69ef0626fe093afc]::interface::run_compiler<(), rustc_driver_impl[7f7da6b576ab5781]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  20:        0x10f8f80d0 - <std[4363f048fae9c8af]::thread::lifecycle::spawn_unchecked<rustc_interface[69ef0626fe093afc]::util::run_in_thread_with_globals<rustc_interface[69ef0626fe093afc]::util::run_in_thread_pool_with_globals<rustc_interface[69ef0626fe093afc]::interface::run_compiler<(), rustc_driver_impl[7f7da6b576ab5781]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f1dce288aaae9328]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:        0x111aae1a4 - <std[4363f048fae9c8af]::sys::thread::unix::Thread>::new::thread_start
  22:        0x193eabc08 - __pthread_cond_wait

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Volumes/hynixP41/systolic_array_performance/rustc-ice-2026-03-08T18_10_01-1819.txt` to your bug report

note: rustc 1.96.0-nightly (e370b60cf 2026-03-07) running on aarch64-apple-darwin

note: compiler flags: -Z codegen-backend=cranelift -C target-cpu=native

query stack during panic:
end of query stack

thread '<unnamed>' (1894922) panicked at /rustc-dev/e370b60cf2b0d3e4b55923ec1558c5b5f8970cfb/compiler/rustc_codegen_cranelift/src/debuginfo/object.rs:89:14:
called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation Relocation { offset: 32, symbol: SymbolId(13), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
stack backtrace:
   0:        0x111ab0c28 - <<std[4363f048fae9c8af]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f1dce288aaae9328]::fmt::Display>::fmt
   1:        0x10ec7ac28 - core[f1dce288aaae9328]::fmt::write
   2:        0x111ac8418 - <std[4363f048fae9c8af]::sys::stdio::unix::Stderr as std[4363f048fae9c8af]::io::Write>::write_fmt
   3:        0x111a872f4 - std[4363f048fae9c8af]::panicking::default_hook::{closure#0}
   4:        0x111aa3110 - std[4363f048fae9c8af]::panicking::default_hook
   5:        0x10f8eec90 - std[4363f048fae9c8af]::panicking::update_hook::<alloc[d0e3ae77f8b00750]::boxed::Box<rustc_driver_impl[7f7da6b576ab5781]::install_ice_hook::{closure#1}>>::{closure#0}
   6:        0x111aa3474 - std[4363f048fae9c8af]::panicking::panic_with_hook
   7:        0x111a8739c - std[4363f048fae9c8af]::panicking::panic_handler::{closure#0}
   8:        0x111a7dd40 - std[4363f048fae9c8af]::sys::backtrace::__rust_end_short_backtrace::<std[4363f048fae9c8af]::panicking::panic_handler::{closure#0}, !>
   9:        0x111a8896c - __rustc[530e92af27cdbe53]::rust_begin_unwind
  10:        0x114ac3b8c - core[f1dce288aaae9328]::panicking::panic_fmt
  11:        0x114ac38f4 - core[f1dce288aaae9328]::result::unwrap_failed
  12:        0x1090d8bd4 - <cranelift_object[be37181448c0167]::backend::ObjectProduct as rustc_codegen_cranelift[44768bf7efe39717]::debuginfo::object::WriteDebugInfo>::add_debug_reloc
  13:        0x10908ee44 - <rustc_codegen_cranelift[44768bf7efe39717]::unwind_module::UnwindModule<cranelift_object[be37181448c0167]::backend::ObjectModule>>::finish
  14:        0x10907f6f4 - rustc_codegen_cranelift[44768bf7efe39717]::driver::aot::module_codegen::{closure#0}
  15:        0x109070b4c - std[4363f048fae9c8af]::sys::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[44768bf7efe39717]::driver::aot::module_codegen::{closure#0}, core[f1dce288aaae9328]::result::Result<rustc_codegen_cranelift[44768bf7efe39717]::driver::aot::ModuleCodegenResult, alloc[d0e3ae77f8b00750]::string::String>>
  16:        0x1090839ac - <std[4363f048fae9c8af]::thread::lifecycle::spawn_unchecked<rustc_codegen_cranelift[44768bf7efe39717]::driver::aot::module_codegen::{closure#0}, core[f1dce288aaae9328]::result::Result<rustc_codegen_cranelift[44768bf7efe39717]::driver::aot::ModuleCodegenResult, alloc[d0e3ae77f8b00750]::string::String>>::{closure#1} as core[f1dce288aaae9328]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  17:        0x111aae1a4 - <std[4363f048fae9c8af]::sys::thread::unix::Thread>::new::thread_start
  18:        0x193eabc08 - __pthread_cond_wait

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Volumes/hynixP41/systolic_array_performance/rustc-ice-2026-03-08T18_10_01-1819.txt` to your bug report

note: rustc 1.96.0-nightly (e370b60cf 2026-03-07) running on aarch64-apple-darwin

note: compiler flags: -Z codegen-backend=cranelift -C target-cpu=native

query stack during panic:
end of query stack

rustc-ice-2026-03-08T18_10_01-1819.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in compiler/rustc_codegen_cranelift/src/debuginfo/object.rs at the add_debug_reloc path named in the panic, then reproduce with the provided main function and Cranelift flags on the reported target. Trace how the relative relocation reaches this path. Done means the reproducer no longer panics on the unimplemented relocation and the relevant codegen behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.