Source: rustc
Version: 1.98.1+dfsg1-1
Severity: normal

Dear Maintainer,

rustc crashes with an internal compiler error whenever it builds a
shared library (crate type dylib or cdylib) and links by calling the
linker directly instead of going through a C compiler driver.

This was originally discovered when attempting to compile for targets
without a C compiler and always call the linker directly such as
`amdgcn-amd-amdhsa`, but it can be triggered on ordinary targets simply
by picking a direct linker.

The bug also exists on Ubuntu; I will forward a fix once we
have one.

The bug can be reproduced on sid simply by trying to build a shared
library and calling the linker directly:

$ touch empty.rs
$ rustc --crate-type cdylib -C linker-flavor=ld empty.rs

thread 'rustc' (1306) panicked at
/usr/src/rustc-1.98.1/compiler/rustc_codegen_ssa/src/back/linker.rs:227:5:
assertion failed: l.is_cc()
stack backtrace:
   0:     0x795673b31661 -
<<std[7fe79bafe4c86b4c]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace
as core[6c3da472cdac379e]::fmt::Display>::fmt
   1:     0x795673b73caa - core[6c3da472cdac379e]::fmt::write
   2:     0x795673b4374c - <unknown>
   3:     0x795673afeb32 - <unknown>
   4:     0x795673b21d9c - std[7fe79bafe4c86b4c]::panicking::default_hook
   5:     0x7956700b1934 - <unknown>
   6:     0x795673b22102 - std[7fe79bafe4c86b4c]::panicking::panic_with_hook
   7:     0x795673afec14 - <unknown>
   8:     0x795673af5779 - <unknown>
   9:     0x795673b002ad - __rustc[c8f6c1900a8e1dee]::rust_begin_unwind
  10:     0x79566fffa01c - core[6c3da472cdac379e]::panicking::panic_fmt
  11:     0x79566fff9fe2 - core[6c3da472cdac379e]::panicking::panic
  12:     0x79567242ea1c - <unknown>
  13:     0x795672421b74 - <unknown>
  14:     0x79567241ccbd -
rustc_codegen_ssa[fa19cb6208fdbd81]::back::link::link_binary
  15:     0x7956704012e2 -
<rustc_codegen_llvm[5a8c0bb1d9169099]::LlvmCodegenBackend as
rustc_codegen_ssa[fa19cb6208fdbd81]::traits::backend::CodegenBackend>::link
  16:     0x7956702e2da1 -
<rustc_interface[8e60d55e728e0a67]::queries::Linker>::link
  17:     0x7956700c7a0b - <unknown>
  18:     0x7956700bb0fb - <unknown>
  19:     0x79567006ac6f - <unknown>
  20:     0x7956700c84e3 - <unknown>
  21:     0x795673b2dc4f - <unknown>
  22:     0x79566f69edb8 - <unknown>
  23:     0x79566f71cf98 - <unknown>
  24:                0x0 - <unknown>

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: rustc 1.98.1 (48a229cea 2026-09-01) (built from a source tarball)
running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type cdylib -C linker-flavor=ld

query stack during panic:
end of query stack

Reply via email to