Skip to content

llvm error when building compiler_builtins with rustc with sancov since update to llvm 23 #161855

Closed

Description

@matthiaskrgr

I was trying to build rustc with coverage for afl once again but since the upgrade to llvm 23, llvm crashes in the process.

my repro looks somewhat like this

export RUSTC_BOOTSTRAP=1
echo "cargo afl config --update --force"
export AFLP=`cargo afl config --update --force |& grep home/matthias | awk 'NF>1{print $NF}'` #will not work for you like this but you get the idea
echo $AFLP # /home/matthias/.local/share/afl.rs/rustc-1.100.0-nightly-bff8e12/afl.rs-0.18.2
export AFL_LLVM_DENYLIST="/home/matthias/vcs/github/rust_fuzz/ignore_list.txt" #just just excludes ~/.cargo, can probably be skipped
export RUSTFLAGS=" -Clink-arg=${AFLP}/afl-llvm/afl-compiler-rt.o  -Ccodegen-units=1 -Copt-level=3 -Zvalidate-mir -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares --cfg=fuzzing -Ctarget-cpu=native -Clinker-plugin-lto -Zverify-llvm-ir  -Cllvm-args=--verify-machineinstrs   -Cllvm-args=--verify-memoryssa    -Cllvm-args=--verify-scev  -Cllvm-args=--verify-loop-info -Cllvm-args=--verify-memoryssa  -Cllvm-args=--verify-dom-info   -Cllvm-args=--verify-loop-lcssa  -Cllvm-args=--verify-regalloc -Cllvm-args=--verify-coalescing   -Cllvm-args=--verify-region-info  " # I threw in some llvm verifyer flags to see if they would catch anything
export AFL_MAP_SIZE=2996019

./x.py build --stage=1 compiler -j 5  # I "only" have 32 gb of ram so I needed to limit job count
export LD_BIND_LAZY="whatever"  #this fixed something for me but I dont remember what it was 

./x.py build library --target x86_64-unknown-linux-gnu  # this is the step that actually crashed
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
    Finished `release` profile [optimized + debuginfo] target(s) in 0.43s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 lld-wrapper (stage0 -> stage1, x86_64-unknown-linux-gnu)
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
    Finished `release` profile [optimized + debuginfo] target(s) in 0.15s
Building stage1 library artifacts{alloc, compiler_builtins, core, panic_abort, panic_unwind, proc_macro, rustc-std-workspace-core, std, std_detect, sysroot, test, unwind} (stage1 -> stage1, x86_64-unknown-linux-gnu)
   Compiling compiler_builtins v0.1.160 (/home/matthias/vcs/github/rust_fuzz2/library/compiler-builtins/compiler-builtins)
   Compiling core v0.0.0 (/home/matthias/vcs/github/rust_fuzz2/library/core)
   Compiling libc v0.2.189
   Compiling object v0.39.1
   Compiling std v0.0.0 (/home/matthias/vcs/github/rust_fuzz2/library/std)
   Compiling test v0.0.0 (/home/matthias/vcs/github/rust_fuzz2/library/test)
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
   Compiling rustc-std-workspace-core v1.99.0 (/home/matthias/vcs/github/rust_fuzz2/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/matthias/vcs/github/rust_fuzz2/library/alloc)
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
   Compiling adler2 v2.0.1
   Compiling memchr v2.8.3
   Compiling cfg-if v1.0.4
   Compiling panic_abort v0.0.0 (/home/matthias/vcs/github/rust_fuzz2/library/panic_abort)
   Compiling rustc-demangle v0.1.28
   Compiling rustc-literal-escaper v0.0.8
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2998000 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 5399589 to be able to run this instrumented program if this crashes!
Warning: AFL++ tools might need to set AFL_MAP_SIZE to 2996024 to be able to run this instrumented program if this crashes!
error: rustc interrupted by SIGSEGV, printing backtrace

/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(+0x1d02a25) [0x7f1efc102a25]
/usr/lib/libc.so.6(+0x3e6f0) [0x7f1efa03e6f0]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(_ZNK4llvm18ModuleSummaryIndex21getGlobalValueSummaryEmb+0x2e) [0x7f1ef53fa3ee]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(+0xa375bcf) [0x7f1ef9375bcf]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(_ZN4llvm26ModuleSummaryIndexAnalysis3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0xc4) [0x7f1ef850689e]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(+0x9504d6a) [0x7f1ef8504d6a]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(_ZN4llvm15AnalysisManagerINS_6ModuleEJEE13getResultImplEPNS_11AnalysisKeyERS1_+0x1cb) [0x7f1ef8506f4b]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(_ZN4llvm24ThinLTOBitcodeWriterPass3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x5d) [0x7f1ef85057e7]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM.so.23.1-rust-1.99.0-nightly(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x1c9) [0x7f1ef85077e5]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(+0x1abc646) [0x7f1efbebc646]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(+0x236bf42) [0x7f1efc76bf42]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(_RNvXs1_Cskf4YuM4rH4g_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCs9550KEFd23i_17rustc_codegen_ssa6traits5write19WriteBackendMethods8optimize+0x4c7) [0x7f1efc7fd9b7]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(_RINvNtNtCs30yU1cfpkQp_3std3sys9backtrace28___rust_begin_short_backtraceNCINvNtNtCs9550KEFd23i_17rustc_codegen_ssa4back5write10spawn_workNtCskf4YuM4rH4g_18rustc_codegen_llvm18LlvmCodegenBackendE0uEB2c_+0x207) [0x7f1efc5cf777]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(+0x2287af6) [0x7f1efc687af6]
/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-9ab9d1c29af0b044.so(+0x1b2a14f) [0x7f1efbf2a14f]
/usr/lib/libc.so.6(+0x980a2) [0x7f1efa0980a2]
/usr/lib/libc.so.6(+0x12080c) [0x7f1efa12080c]

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
rustc exited with signal: 11 (SIGSEGV)
error: could not compile `compiler_builtins` (lib)

Caused by:
  process didn't exit successfully: `/home/matthias/vcs/github/rust_fuzz2/build/bootstrap/debug/rustc /home/matthias/vcs/github/rust_fuzz2/build/bootstrap/debug/rustc --crate-name compiler_builtins --edition=2024 library/compiler-builtins/compiler-builtins/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=157 --crate-type lib --emit=dep-info,metadata,link -Z embed-metadata=no -C opt-level=3 -C embed-bitcode=no -C codegen-units=10000 -C debuginfo=2 -Cembed-bitcode=yes -Zunstable-options -Cforce-frame-pointers=non-leaf -C debug-assertions=on --cfg 'feature="arch"' --cfg 'feature="compiler-builtins"' --cfg 'feature="default"' --cfg 'feature="unmangled-names"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("arch", "c", "compiler-builtins", "default", "mem", "unmangled-names", "unstable-public-internals"))' -C metadata=b0ff770c38593253 -C extra-filename=-432d535274f3888d --out-dir /home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/compiler_builtins/432d535274f3888d/out --target x86_64-unknown-linux-gnu -L dependency=/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/core/ad7eacf41182b861/out -L dependency=/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1-std/dist/build/compiler_builtins/432d535274f3888d/out --extern core=/home/matthias/vcs/github/rust_fuzz2/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/dist/build/core/ad7eacf41182b861/out/libcore-ad7eacf41182b861.rmeta -Zannotate-moves '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Clink-arg=/home/matthias/.local/share/afl.rs/rustc-1.100.0-nightly-bff8e12/afl.rs-0.18.2/afl-llvm/afl-compiler-rt.o -Ccodegen-units=1 -Copt-level=3 -Zvalidate-mir -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares --cfg=fuzzing -Ctarget-cpu=native -Clinker-plugin-lto -Zverify-llvm-ir -Cllvm-args=--verify-machineinstrs -Cllvm-args=--verify-memoryssa -Cllvm-args=--verify-scev -Cllvm-args=--verify-loop-info -Cllvm-args=--verify-memoryssa -Cllvm-args=--verify-dom-info -Cllvm-args=--verify-loop-lcssa -Cllvm-args=--verify-regalloc -Cllvm-args=--verify-coalescing -Cllvm-args=--verify-region-info -Z binary-dep-depinfo --cfg intrinsics_enabled --cfg optimizations_enabled --cfg f16_enabled --cfg f128_enabled --cfg mem_unaligned --check-cfg 'cfg(thumb)' --check-cfg 'cfg(thumb_1)' --check-cfg 'cfg(x86_no_sse2)' --check-cfg 'cfg(assert_no_panic)' --check-cfg 'cfg(intrinsics_enabled)' --check-cfg 'cfg(optimizations_enabled)' --check-cfg 'cfg(f16_enabled)' --check-cfg 'cfg(f128_enabled)' --check-cfg 'cfg(__ashldi3, values("optimized-c"))' --check-cfg 'cfg(__ashlsi3, values("optimized-c"))' --check-cfg 'cfg(__ashrdi3, values("optimized-c"))' --check-cfg 'cfg(__ashrsi3, values("optimized-c"))' --check-cfg 'cfg(__bswapsi2, values("optimized-c"))' --check-cfg 'cfg(__bswapdi2, values("optimized-c"))' --check-cfg 'cfg(__bswapti2, values("optimized-c"))' --check-cfg 'cfg(__divdi3, values("optimized-c"))' --check-cfg 'cfg(__divsi3, values("optimized-c"))' --check-cfg 'cfg(__divmoddi4, values("optimized-c"))' --check-cfg 'cfg(__divmodsi4, values("optimized-c"))' --check-cfg 'cfg(__divmodsi4, values("optimized-c"))' --check-cfg 'cfg(__divmodti4, values("optimized-c"))' --check-cfg 'cfg(__lshrdi3, values("optimized-c"))' --check-cfg 'cfg(__lshrsi3, values("optimized-c"))' --check-cfg 'cfg(__moddi3, values("optimized-c"))' --check-cfg 'cfg(__modsi3, values("optimized-c"))' --check-cfg 'cfg(__muldi3, values("optimized-c"))' --check-cfg 'cfg(__udivdi3, values("optimized-c"))' --check-cfg 'cfg(__udivmoddi4, values("optimized-c"))' --check-cfg 'cfg(__udivmodsi4, values("optimized-c"))' --check-cfg 'cfg(__udivsi3, values("optimized-c"))' --check-cfg 'cfg(__umoddi3, values("optimized-c"))' --check-cfg 'cfg(__umodsi3, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_cas16_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldadd8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldclr8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldeor8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_ldset8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp1_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp2_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp4_acq_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_relax, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_acq, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_rel, values("optimized-c"))' --check-cfg 'cfg(__aarch64_swp8_acq_rel, values("optimized-c"))' --check-cfg 'cfg(target_feature, values("vis3"))' --check-cfg 'cfg(mem_unaligned)' --check-cfg 'cfg(kernel_user_helpers)'` (exit status: 254)
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:01:54

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Aug 27, 2026
  2. added
    I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)
    on Aug 27, 2026
  3. im-lunex commented on Aug 27, 2026

    @im-lunex
    Contributor

    im not sure but this one looks like LLVMs fault.. cuz recently i mean 1-2days ago while working on a PR i saw that there was some issues going on the llvm's main stream.. that's why several test's failed --- it might be related to that issue..

  4. matthiaskrgr commented on Aug 27, 2026

    @matthiaskrgr
    MemberAuthor

    with debug-assertions stage0, we end up here

    rustc: /checkout/src/llvm-project/llvm/lib/IR/Globals.cpp:106: GlobalValue::GUID llvm::GlobalValue::getGUID() const: Assertion `MaybeGUID.has_value() && "GUID was not assigned before calling GetGUID()"' failed.
    rustc exited with signal: 6 (SIGABRT)
    error: could not compile `compiler_builtins` (lib)
    

    https://github.com/rust-lang/llvm-project/blob/rustc/23.1-2026-07-22/llvm/lib/IR/Globals.cpp#L106

  5. matthiaskrgr commented on Aug 30, 2026

    @matthiaskrgr
    MemberAuthor

    I was wondering if this was maybe some kind of mismatch between my local clang 22.1.8 and rustc being on llvm 23 already, but so far I have not been able to reproduce this kind of error when compiling other random crates outside of the rustc repo 🤔

    @nikic do you have an idea what could be going on here?

  6. added
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Sep 2, 2026
  7. matthiaskrgr commented on Sep 4, 2026

    @matthiaskrgr
    MemberAuthor

    From playing around with minimization a for a couple of hours, I suspect that the culprint is somewhere within a combination of libm (which lives inside compiler_builtins) + instrumented core / alloc

    maybe its possible to get a compiler-builtins standalone repro using -Zbuild-std

  8. matthiaskrgr commented on Sep 4, 2026

    @matthiaskrgr
    MemberAuthor

    sooo it seems that in library/Cargo.toml , we override codegen-units for compiler-builtins and set debug=0 opt-level=s for some of its dependencies.
    When I remove all of that, the build seems to pass 😵
    not sure if this is worth investigating further

  9. Gelbpunkt commented on Sep 12, 2026

    @Gelbpunkt
    Contributor

    I'm seeing what I believe to be the same issues when attempting to build Rust with LLVM 23 in Alpine Linux. We're compiling 1.98.1 (with LLVM 23) with a stage0 compiler that is 1.97.0 (with LLVM 22). The stage1 build succeeds, the stage2 build then fails. If I raise the stack size with export RUST_MIN_STACK=16777216, it crashes with Assertion failed: MaybeGUID.has_value() && "GUID was not assigned before calling GetGUID()" (/builds/Aelin/aports/main/llvm23/src/llvm-project-23.1.1.src/llvm/lib/IR/Globals.cpp: getGUID: 105) (had to build LLVM 23 with assertions, otherwise the error is very cryptic in libstdc++ headers).

    EDIT: This does not happen on x86_64, but apparently on virtually every other architecture.

  10. nikic commented on Sep 12, 2026

    @nikic
    Contributor

    1.98 does not support LLVM 23. Did you backport all the necessary patches? In particular, do you have #158961?

  11. Gelbpunkt commented on Sep 12, 2026

    @Gelbpunkt
    Contributor

    Ah, I thought 1.98 supported LLVM 23. I do not have #158961 at the moment, I only cherry-picked the patches to remove AMX-TF32.

  12. lbrooney commented on Oct 4, 2026

    @lbrooney

    Minimal reproducer (no AFL, no build-std). With an LLVM-assertions rustc (alt build of c36f145):

    #![no_builtins]
    #![no_std]
    #[unsafe(no_mangle)]
    pub extern "C" fn first(x: i32) -> i32 { if x > 3 { x * 7 } else { x - 1 } }
    rustc -O -Ccodegen-units=1 --crate-type=rlib -Cpasses=sancov-module \
      -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard \
      -Clinker-plugin-lto nobuiltins.rs

    This hits the GUID was not assigned before calling GetGUID() assertion in ThinLTOBitcodeWriterPass → ModuleSummaryIndexAnalysis → buildModuleSummaryIndex. A release nightly (nightly-2026-10-02) segfaults in ModuleSummaryIndex::getGlobalValueSummary instead. It needs all of #![no_builtins], sancov, -Clinker-plugin-lto, and -Cembed-bitcode=yes (the default). Passing -Cembed-bitcode=no, as cargo does, hides it. compiler_builtins is #![no_builtins], which is why it's the crate that fails. -Zmerge-functions=disabled makes no difference.

    Bisecting confirms it regressed in #158734 (Update to LLVM 23), and stable 1.99 is affected too. LLVM 23 (llvm/llvm-project#184065) stopped computing GUIDs from the name on demand. They're now assigned once by AssignGUIDPass, so globals created after it have none.

    Cause: for the #![no_builtins] crate, LLVMRustOptimize runs buildThinLTOPreLinkDefaultPipeline (which assigns GUIDs), then the -Cpasses passes, then ThinLTOBitcodeWriterPass, without assigning GUIDs again (NeedThinLTOBufferPasses = false). So the globals sancov-module creates have no GUID when the summary is built. Other crates are fine because LLVMRustModuleSerialize assigns GUIDs before writing their bitcode. Only no_builtins crates built with -Cembed-bitcode=yes take this path.

    Same crash with plain opt:

    target triple = "x86_64-unknown-linux-gnu"
    define void @f() {
      ret void
    }
    opt -passes='assign-guid,sancov-module,embed-bitcode<thinlto;emit-summary>' \
      -sanitizer-coverage-level=1 -sanitizer-coverage-trace-pc-guard f.ll -o /dev/null

    Adding assign-guid after sancov-module avoids it.

    The codegen-units = 10000 override doesn't seem to matter, since the later -Ccodegen-units=1 in RUSTFLAGS takes precedence and the build still crashes without it. Removing -Cembed-bitcode=yes from [profile.dist]'s rustflags might be what allowed the build to pass.

  13. nikic commented on Oct 4, 2026

    @nikic
    Contributor

    The basic problem here is that -Cpasses gets scheduled at the very end of the pass pipeline, after a number of passes that are required to run at the end, directly prior to bitcode emission. This is the CanonicalizeAliases/NameAnonGlobals/AssignGUIDs group.

    We should probably switch -Cpasses to insert into OptimizerLastEP instead. (Alternatively we could rerun just the required passes afterwards.)

    Though the real problem is that Rust apparently has a thriving fuzzer ecosystem based around the -Cpasses option which ought to be perma-unstable, but was accidentally stabilized via grandfathering---and nobody ever considered that this should actually be exposed as a first-class -Z sanitizer=coverage (or so) option, which allows Rust to schedule and configure the pass correctly, rather than having the user muck around with LLVM internals?

  14. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 7, 2026
  15. graydon commented on Oct 16, 2026

    @graydon
    Contributor

    Just a bump: ran into this in the field today on nightly-2026-10-15. Looks like you already have a minimal reproducer.

  16. self-assigned this
    on Oct 19, 2026
  17. removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Oct 19, 2026
  18. added a commit that references this issue on Oct 21, 2026
  19. added a commit that references this issue on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions