Closed
Description
This was discovered in #81942 which lowers the UI test default CGU count to 1. The test was modified to explicitly request a higher CGU count to make it pass, but the underlying issue remains.
Steps to reproduce:
- add the compile flag
-Ccodegen-units=1
tosrc/test/ui/asm/sym.rs
- run UI test
output
---- [ui] ui/asm/sym.rs stdout ----
error: test compilation failed although it shouldn't!
status: exit code: 1
command: "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/the8472/workspace/rust/src/test/ui/asm/sym.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "-C" "prefer-dynamic" "-o" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Clink-args=-fuse-ld=lld" "-Clink-arg=-Wl,--threads=1" "-C" "codegen-units=1" "-L" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/auxiliary"
stdout:
------------------------------------------
------------------------------------------
stderr:
------------------------------------------
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a.sym.7rcbfp3g-cgu.0.rcgu.o" "-o" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/auxiliary" "-L" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-L" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-43e6546d3a194262" "-Wl,--end-group" "-Wl,-Bstatic" "/home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-cde4ccb55295e33e.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,-rpath,$ORIGIN/../../../../stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/home/the8472/workspace/rust/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags" "-fuse-ld=lld" "-Wl,--threads=1"
= note: ld.lld: error: can't create dynamic relocation R_X86_64_TPOFF32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a.sym.7rcbfp3g-cgu.0.rcgu.o
>>> referenced by sym.7rcbfp3g-cgu.0
>>> /home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a.sym.7rcbfp3g-cgu.0.rcgu.o:(std::sys_common::backtrace::__rust_begin_short_backtrace::h6af211e3164ab612)
ld.lld: error: can't create dynamic relocation R_X86_64_TPOFF32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a.sym.7rcbfp3g-cgu.0.rcgu.o
>>> referenced by sym.7rcbfp3g-cgu.0
>>> /home/the8472/workspace/rust/build/x86_64-unknown-linux-gnu/test/ui/asm/sym/a.sym.7rcbfp3g-cgu.0.rcgu.o:(sym::main::h2d3f4ca36c63deb0)
collect2: error: ld returned 1 exit status
error: aborting due to previous error
------------------------------------------
failures:
[ui] ui/asm/sym.rs