Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling with Cranelift leads to Error 101 #1561

Open
smol-loli opened this issue Mar 4, 2025 · 1 comment
Open

Compiling with Cranelift leads to Error 101 #1561

smol-loli opened this issue Mar 4, 2025 · 1 comment
Labels
A-debuginfo Area: Debugging information at runtime in generated code. C-bug Category: This is a bug. O-arm Target: ARM processors (arm, thumb and AArch64 targets) O-macos Operating system: MacOS

Comments

@smol-loli
Copy link

Code

fn main() {}

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (e16a049ad 2025-03-03)
binary: rustc
commit-hash: e16a049adbf94d610787430b6efdf31d896dc5b6
commit-date: 2025-03-03
host: aarch64-apple-darwin
release: 1.87.0-nightly
LLVM version: 20.1.0

Error output

rustc-ice-2025-03-04T20_05_39-91243.txt

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/lore/Development/Advent of Code/2020/day15/Cargo.toml
workspace: /Users/lore/Development/Advent of Code/2020/Cargo.toml
   Compiling day15 v0.1.0 (/Users/lore/Development/Advent of Code/2020/day15)

thread 'rustc' panicked at 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(14), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
stack backtrace:
   0:        0x1128539d0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3959b7980ed3e272
   1:        0x10fff9f34 - core::fmt::write::haac92234bb96457c
   2:        0x112848104 - std::io::Write::write_fmt::h10a0cd5a63e727ee
   3:        0x112853890 - std::sys::backtrace::BacktraceLock::print::h55be4a34b934b0dd
   4:        0x112855ec0 - std::panicking::default_hook::{{closure}}::h766f3df9e3afc821
   5:        0x112855b88 - std::panicking::default_hook::h7c33a87c20ef2e6c
   6:        0x110aaf3cc - std[db59b894259804f0]::panicking::update_hook::<alloc[bcada68f88f3824a]::boxed::Box<rustc_driver_impl[b8773bc631419c9c]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x1128567f0 - std::panicking::rust_panic_with_hook::he752a00b5ed52782
   8:        0x1128564a0 - std::panicking::begin_panic_handler::{{closure}}::hecf0d4de334165ab
   9:        0x112853e6c - std::sys::backtrace::__rust_end_short_backtrace::h6604ea774ca6d31d
  10:        0x112856168 - _rust_begin_unwind
  11:        0x1154b78fc - core::panicking::panic_fmt::hdc0765de8316649c
  12:        0x1154b7d54 - core::result::unwrap_failed::hc36c25cb3fd4c2ca
  13:        0x1067f4654 - <cranelift_object[9ac6d1e9ae562095]::backend::ObjectProduct as rustc_codegen_cranelift[db9f0bf133b168d8]::debuginfo::object::WriteDebugInfo>::add_debug_reloc
  14:        0x10682477c - <rustc_codegen_cranelift[db9f0bf133b168d8]::unwind_module::UnwindModule<cranelift_object[9ac6d1e9ae562095]::backend::ObjectModule>>::finish
  15:        0x1068028a8 - rustc_codegen_cranelift[db9f0bf133b168d8]::driver::aot::run_aot
  16:        0x106828a58 - <rustc_codegen_cranelift[db9f0bf133b168d8]::CraneliftCodegenBackend as rustc_codegen_ssa[1cac79964c70214d]::traits::backend::CodegenBackend>::codegen_crate
  17:        0x111327580 - <rustc_interface[aaf83fe338feb43f]::queries::Linker>::codegen_and_build_linker
  18:        0x110a60568 - rustc_interface[aaf83fe338feb43f]::passes::create_and_enter_global_ctxt::<core[ebe7a8d70bd6893b]::option::Option<rustc_interface[aaf83fe338feb43f]::queries::Linker>, rustc_driver_impl[b8773bc631419c9c]::run_compiler::{closure#0}::{closure#2}>
  19:        0x110aac190 - rustc_interface[aaf83fe338feb43f]::interface::run_compiler::<(), rustc_driver_impl[b8773bc631419c9c]::run_compiler::{closure#0}>::{closure#1}
  20:        0x110a9e2d8 - std[db59b894259804f0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[aaf83fe338feb43f]::util::run_in_thread_with_globals<rustc_interface[aaf83fe338feb43f]::util::run_in_thread_pool_with_globals<rustc_interface[aaf83fe338feb43f]::interface::run_compiler<(), rustc_driver_impl[b8773bc631419c9c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  21:        0x110ab2e24 - <<std[db59b894259804f0]::thread::Builder>::spawn_unchecked_<rustc_interface[aaf83fe338feb43f]::util::run_in_thread_with_globals<rustc_interface[aaf83fe338feb43f]::util::run_in_thread_pool_with_globals<rustc_interface[aaf83fe338feb43f]::interface::run_compiler<(), rustc_driver_impl[b8773bc631419c9c]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ebe7a8d70bd6893b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:        0x11286104c - std::sys::pal::unix::thread::Thread::new::thread_start::hec3ba9ad0c005bd4
  23:        0x1888502e4 - __pthread_deallocate

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 `/Users/lore/Development/Advent of Code/2020/rustc-ice-2025-03-04T20_02_05-91133.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C panic=abort -C embed-bitcode=no -Z codegen-backend=cranelift -C codegen-units=1 -C strip=symbols -C target-cpu=native

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

thread '<unnamed>' panicked at 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(14), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
stack backtrace:
   0:        0x1128539d0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h3959b7980ed3e272
   1:        0x10fff9f34 - core::fmt::write::haac92234bb96457c
   2:        0x112848104 - std::io::Write::write_fmt::h10a0cd5a63e727ee
   3:        0x112853890 - std::sys::backtrace::BacktraceLock::print::h55be4a34b934b0dd
   4:        0x112855ec0 - std::panicking::default_hook::{{closure}}::h766f3df9e3afc821
   5:        0x112855b88 - std::panicking::default_hook::h7c33a87c20ef2e6c
   6:        0x110aaf3cc - std[db59b894259804f0]::panicking::update_hook::<alloc[bcada68f88f3824a]::boxed::Box<rustc_driver_impl[b8773bc631419c9c]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x1128567f0 - std::panicking::rust_panic_with_hook::he752a00b5ed52782
   8:        0x1128564a0 - std::panicking::begin_panic_handler::{{closure}}::hecf0d4de334165ab
   9:        0x112853e6c - std::sys::backtrace::__rust_end_short_backtrace::h6604ea774ca6d31d
  10:        0x112856168 - _rust_begin_unwind
  11:        0x1154b78fc - core::panicking::panic_fmt::hdc0765de8316649c
  12:        0x1154b7d54 - core::result::unwrap_failed::hc36c25cb3fd4c2ca
  13:        0x1067f4654 - <cranelift_object[9ac6d1e9ae562095]::backend::ObjectProduct as rustc_codegen_cranelift[db9f0bf133b168d8]::debuginfo::object::WriteDebugInfo>::add_debug_reloc
  14:        0x10682477c - <rustc_codegen_cranelift[db9f0bf133b168d8]::unwind_module::UnwindModule<cranelift_object[9ac6d1e9ae562095]::backend::ObjectModule>>::finish
  15:        0x1067fcd90 - rustc_codegen_cranelift[db9f0bf133b168d8]::driver::aot::module_codegen::{closure#0}
  16:        0x1067a0bd4 - std[db59b894259804f0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_codegen_cranelift[db9f0bf133b168d8]::driver::aot::module_codegen::{closure#0}, core[ebe7a8d70bd6893b]::result::Result<rustc_codegen_cranelift[db9f0bf133b168d8]::driver::aot::ModuleCodegenResult, alloc[bcada68f88f3824a]::string::String>>
  17:        0x1067a9310 - <<std[db59b894259804f0]::thread::Builder>::spawn_unchecked_<rustc_codegen_cranelift[db9f0bf133b168d8]::driver::aot::module_codegen::{closure#0}, core[ebe7a8d70bd6893b]::result::Result<rustc_codegen_cranelift[db9f0bf133b168d8]::driver::aot::ModuleCodegenResult, alloc[bcada68f88f3824a]::string::String>>::{closure#1} as core[ebe7a8d70bd6893b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  18:        0x11286104c - std::sys::pal::unix::thread::Thread::new::thread_start::hec3ba9ad0c005bd4
  19:        0x1888502e4 - __pthread_deallocate

error: could not compile `day15` (bin "day15")

Caused by:
  process didn't exit successfully: `/Users/lore/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name day15 --edition=2024 day15/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=227 --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C embed-bitcode=no -Z codegen-backend=cranelift -C codegen-units=1 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=9419ec99a32d1390 -C extra-filename=-2d5b922cfd183f72 --out-dir '/Users/lore/Development/Advent of Code/2020/target/release/deps' -C strip=symbols -L 'dependency=/Users/lore/Development/Advent of Code/2020/target/release/deps' -Ctarget-cpu=native` (exit status: 101)
Backtrace

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/lore/Development/Advent of Code/2020/day15/Cargo.toml
workspace: /Users/lore/Development/Advent of Code/2020/Cargo.toml
   Compiling day15 v0.1.0 (/Users/lore/Development/Advent of Code/2020/day15)

thread 'rustc' panicked at 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(14), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <cranelift_object::backend::ObjectProduct as rustc_codegen_cranelift::debuginfo::object::WriteDebugInfo>::add_debug_reloc
   4: <rustc_codegen_cranelift::unwind_module::UnwindModule<cranelift_object::backend::ObjectModule>>::finish
   5: rustc_codegen_cranelift::driver::aot::run_aot
   6: <rustc_codegen_cranelift::CraneliftCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
   7: <rustc_interface::queries::Linker>::codegen_and_build_linker
   8: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
   9: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 `/Users/lore/Development/Advent of Code/2020/rustc-ice-2025-03-04T20_05_39-91243.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C panic=abort -C embed-bitcode=no -Z codegen-backend=cranelift -C codegen-units=1 -C strip=symbols -C target-cpu=native

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

thread '<unnamed>' panicked at 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(14), addend: 0, flags: Generic { kind: Relative, encoding: Generic, size: 32 } }")
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <cranelift_object::backend::ObjectProduct as rustc_codegen_cranelift::debuginfo::object::WriteDebugInfo>::add_debug_reloc
   4: <rustc_codegen_cranelift::unwind_module::UnwindModule<cranelift_object::backend::ObjectModule>>::finish
   5: rustc_codegen_cranelift::driver::aot::module_codegen::{closure#0}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: could not compile `day15` (bin "day15")

Caused by:
  process didn't exit successfully: `/Users/lore/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name day15 --edition=2024 day15/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=227 --crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C embed-bitcode=no -Z codegen-backend=cranelift -C codegen-units=1 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=9419ec99a32d1390 -C extra-filename=-2d5b922cfd183f72 --out-dir '/Users/lore/Development/Advent of Code/2020/target/release/deps' -C strip=symbols -L 'dependency=/Users/lore/Development/Advent of Code/2020/target/release/deps' -Ctarget-cpu=native` (exit status: 101)

@smol-loli smol-loli added the C-bug Category: This is a bug. label Mar 4, 2025
@bjorn3 bjorn3 transferred this issue from rust-lang/rust Mar 5, 2025
@bjorn3
Copy link
Member

bjorn3 commented Mar 5, 2025

I don't actively watch the rust-lang/rust repo for cg_clif issues. In the future please report them at https://github.com/rust-lang/rustc_codegen_cranelift. For now I've moved it there for you.

It looks like the object crate doesn't yet support 32bit relative relocations on arm64 for Mach-O: https://github.com/gimli-rs/object/blob/e764a2d16958458e1f431628363f96cfb779f6a4/src/write/macho.rs#L292-L296 As workaround you can disable debuginfo using CARGO_PROFILE_DEV_DEBUG=0 or

[profile.dev]
debug = 0

in Cargo.toml.

@bjorn3 bjorn3 added A-debuginfo Area: Debugging information at runtime in generated code. O-macos Operating system: MacOS O-arm Target: ARM processors (arm, thumb and AArch64 targets) labels Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information at runtime in generated code. C-bug Category: This is a bug. O-arm Target: ARM processors (arm, thumb and AArch64 targets) O-macos Operating system: MacOS
Projects
None yet
Development

No branches or pull requests

2 participants