Repository navigation
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Description
The atomic function __atomic_load_4 is getting referenced somehow in libcompiler_builtins. I'm not sure how to trigger the linker issue, however we've started running into it on CI:
https://ci.betrusted.io/job/betrusted-ec-fw/117/console
22:12:25 = note: "rust-lld" "-flavor" "gnu" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/deps/sw-d670ba951948c61d.sw.eb99c8ab-cgu.0.rcgu.o" "--as-needed" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/deps" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/release/deps" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/build/sw-5aeb8f44ae52ec32/out" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/build/riscv-3af36cb162907fdc/out" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/build/riscv-rt-10c1a68888f3c71a/out" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/build/riscv-rt-10c1a68888f3c71a/out" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/build/wfx_sys-435e2ecbf8d2b6bf/out" "-L" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/build/vexriscv-ef796b3ba7eaa702/out" "-L" "/var/lib/jenkins/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32i-unknown-none-elf/lib" "-Bstatic" "/tmp/rustct4qDCB/libriscv_rt-23b03c226d1df842.rlib" "/tmp/rustct4qDCB/libvexriscv-abccfdbcb773d5aa.rlib" "/tmp/rustct4qDCB/libwfx_sys-b5ebfbb5dde2c0d0.rlib" "/tmp/rustct4qDCB/libriscv-5c53201af539b932.rlib" "/var/lib/jenkins/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32i-unknown-none-elf/lib/libcompiler_builtins-6af234694b8e479b.rlib" "-Bdynamic" "-znoexecstack" "-L" "/var/lib/jenkins/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32i-unknown-none-elf/lib" "-o" "/var/lib/jenkins/workspace/betrusted-ec/target/riscv32i-unknown-none-elf/release/deps/sw-d670ba951948c61d" "--gc-sections" "-Tmemory.x" "-Tlink.x" "-Map=betrusted-ec.map"
22:12:25 = note: rust-lld: error: undefined symbol: __atomic_load_4
22:12:25 >>> referenced by uint_macros.rs:1222 (/rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/num/uint_macros.rs:1222)
22:12:25 >>> compiler_builtins-6af234694b8e479b.compiler_builtins.3786cd3d-cgu.96.rcgu.o:(memcpy) in archive /var/lib/jenkins/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32i-unknown-none-elf/lib/libcompiler_builtins-6af234694b8e479b.rlib
Version it worked on
It used to work on Rust 1.57.1, however it has broken on Rust 1.58.0.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Activity
xobs commentedon Jan 14, 2022
More information: This symbol is clearly present in the object files. Inside
libcompiler_builtins-6af234694b8e479b.rlibthere is an object filecompiler_builtins-6af234694b8e479b.compiler_builtins.3786cd3d-cgu.96.rcgu.o. This contains references to this function, even though it doesn't appear to actually be used:Note that I previously opened #85736, however this seems to be different because it doesn't involve LTO and I can tell that
libcompiler_builtinsis actually getting shipped with these references in place.xobs commentedon Jan 14, 2022
A workaround we've done to get it to at least compile on
1.58.0is to add this code somewhere in the project:workaround for rust-lang/rust#92897
bump to absorb workaround for rust-lang/rust#92897
Amanieu commentedon Jan 14, 2022
This is fixed by rust-lang/compiler-builtins@e0187f1 which is included in compiler-builtins version 0.1.54. However Rust 1.58.0 uses compiler_builtins 0.1.53.
work around rust-lang/rust#92897
apiraino commentedon Feb 3, 2022
Nominating for stable backport as per Zulip discussion
@rustbot label +stable-nominated
apiraino commentedon Feb 3, 2022
Stable backport of rust-lang/compiler-builtins@e0187f1 approved as per compiler team on Zulip
@rustbot label +stable-accepted
cyrozap commentedon Jun 5, 2022
I was having the same issue, but updating to rustc 1.59.0 (and later versions) fixed it for me.
Mark-Simulacrum commentedon Jun 5, 2022
Based on the dates I believe this should be fixed across all channels at this point, so going to go ahead and close.