-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
error: relocation refers to local symbol "" [12], which is defined in a discarded section
only when using ld.gold linker with --gc-sections
#59652
Comments
UPDATE: ignore this comment. I was wrong about first bad nightly: it's not
And
|
8b8488c is the first bad commit, made from PR #59401
Just tested commit f8673e0 (HEAD -> master, origin/master, origin/HEAD) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 7429492f91..d508969d29 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -211,7 +211,7 @@ fn main() {
|| target.contains("-none-eabi")
|| target.ends_with("-none-elf"))
{
- cmd.arg("-Zemit-stack-sizes");
+ //cmd.arg("-Zemit-stack-sizes");
}
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") { and can confirm that firefox compiled past the issue. Will test without the patch next...done: confirmed the issue exists without the above patch! Will test again with the patch and allow firefox to fully compile&install (done, it worked!) |
CC @japaric |
triage: P-high. Leaving nominated for now (What is going on here with |
Sorry for the breakage here. If PR #59401 is blocking anything feel free to revert it. It will probably be several days before I have some free time to dig into this (though my guess is that one of the extra, custom linker flags that firefox uses in their builds (see |
If I remove
#!/bin/bash
rustup default master-stage1
export MOZ_CARGO_WRAP_LD='/usr/bin/clang -std=gnu99'
export MOZ_CARGO_WRAP_LDFLAGS='-lpthread -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,-rpath,/usr/lib/firefox -fuse-ld=gold -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,nocopyreloc -Wl,-Bsymbolic-functions -Wl,--build-id=sha1 -fstack-protector-strong -Wl,--icf=safe -Wl,-rpath-link,/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/dist/lib -fcolor-diagnostics'
# shellcheck disable=SC2016
#CARGO_PKG_REPOSITORY='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION_PATCH=27 CARGO_PKG_VERSION_PRE='' CARGO_TARGET_BINFILE_FULLPATH=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build-script-build CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_DESCRIPTION='A stable implementation of the upcoming new `proc_macro` API. Comes with an option, off by default, to also reimplement itself in terms of the upstream unstable API.' LD_LIBRARY_PATH='/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps:/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib' CARGO_MANIFEST_DIR=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/proc-macro2 CARGO_PKG_HOMEPAGE='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION=0.4.27 CARGO_PKG_VERSION_MINOR=4 CARGO_PKG_AUTHORS='Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_NAME=proc-macro2 CARGO=/home/user/build/2nonpkgs/rust.stuff/cargo/cargo/target/release/cargo /home/user/bin/rustc --crate-name build_script_build /home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/proc-macro2/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=2 -C codegen-units=1 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=3b19a3eb863545be -C extra-filename=-3b19a3eb863545be --out-dir /home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be -C linker=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/build/cargo-linker -L dependency=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps --cap-lints warn
err="-Wl,--gc-sections"
#err="" #uncomment this line to avoid errors like: /home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a9bb89774eb1c5f2.rlib(std-a9bb89774eb1c5f2.4ujdo36uwwum3zzu.rcgu.o)(.stack_sizes+0x0): error: relocation refers to local symbol "" [5], which is defined in a discarded section
"/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/build/cargo-linker" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be.build_script_build.ea30uw23-cgu.0.rcgu.o" "-o" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be.1zobs1pcbqt3rtjo.rcgu.o" "$err" "-pie" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps" "-L" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a9bb89774eb1c5f2.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-01499d126af771f6.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-8b152c95a80afef5.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-14c23aab33e6c5f4.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-41eb09b84b2625ab.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-44a20fe3a684e072.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-e5275540f2101631.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-9f560ba3dfa532fe.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1f1fadf3472d3239.rlib" "-Wl,--end-group" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9e3a9887668f9c30.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
|
Apparently one of these: rust/src/librustc_codegen_ssa/back/linker.rs Lines 297 to 305 in 3750348
rust/src/librustc_codegen_ssa/back/linker.rs Lines 950 to 952 in 3750348
|
By adding a digit to each of those two rust/src/librustc_codegen_ssa/back/linker.rs Lines 297 to 305 in 3750348
Does anyone think that maybe it's actual script ran#!/bin/bash
rustup default master-stage1
export MOZ_CARGO_WRAP_LD='/usr/bin/clang -std=gnu99'
export MOZ_CARGO_WRAP_LDFLAGS='-lpthread -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,-rpath,/usr/lib/firefox -fuse-ld=gold -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,nocopyreloc -Wl,-Bsymbolic-functions -Wl,--build-id=sha1 -fstack-protector-strong -Wl,--icf=safe -Wl,-rpath-link,/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/dist/lib -fcolor-diagnostics'
# shellcheck disable=SC2016
CARGO_PKG_REPOSITORY='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION_PATCH=27 CARGO_PKG_VERSION_PRE='' CARGO_TARGET_BINFILE_FULLPATH=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build-script-build CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_DESCRIPTION='A stable implementation of the upcoming new `proc_macro` API. Comes with an option, off by default, to also reimplement itself in terms of the upstream unstable API.' LD_LIBRARY_PATH='/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps:/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib' CARGO_MANIFEST_DIR=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/proc-macro2 CARGO_PKG_HOMEPAGE='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION=0.4.27 CARGO_PKG_VERSION_MINOR=4 CARGO_PKG_AUTHORS='Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_NAME=proc-macro2 CARGO=/home/user/build/2nonpkgs/rust.stuff/cargo/cargo/target/release/cargo /home/user/bin/rustc --crate-name build_script_build /home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/proc-macro2/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=2 -C codegen-units=1 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=3b19a3eb863545be -C extra-filename=-3b19a3eb863545be --out-dir /home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be -C linker=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/build/cargo-linker -L dependency=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps --cap-lints warn
|
Here's the output with both EDIT: #!/bin/bash
#rustup default master-stage1
#export MOZ_CARGO_WRAP_LD='/usr/bin/clang -std=gnu99'
#export MOZ_CARGO_WRAP_LDFLAGS='-lpthread -Wl,-rpath,/usr/lib/firefox -fuse-ld=gold -Wl,-z,noexecstack -Wl,-z,text -Wl,-Bsymbolic-functions -Wl,--build-id=sha1 -fstack-protector-strong -Wl,--icf=safe -Wl,-rpath-link,/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/dist/lib -fcolor-diagnostics'
# shellcheck disable=SC2016
#CARGO_PKG_REPOSITORY='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION_PATCH=27 CARGO_PKG_VERSION_PRE='' CARGO_TARGET_BINFILE_FULLPATH=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build-script-build CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_DESCRIPTION='A stable implementation of the upcoming new `proc_macro` API. Comes with an option, off by default, to also reimplement itself in terms of the upstream unstable API.' LD_LIBRARY_PATH='/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps:/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib' CARGO_MANIFEST_DIR=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/proc-macro2 CARGO_PKG_HOMEPAGE='https://github.com/alexcrichton/proc-macro2' CARGO_PKG_VERSION=0.4.27 CARGO_PKG_VERSION_MINOR=4 CARGO_PKG_AUTHORS='Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_NAME=proc-macro2 CARGO=/home/user/build/2nonpkgs/rust.stuff/cargo/cargo/target/release/cargo /home/user/bin/rustc --crate-name build_script_build /home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/proc-macro2/build.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=2 -C codegen-units=1 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=3b19a3eb863545be -C extra-filename=-3b19a3eb863545be --out-dir /home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be -C linker=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/build/cargo-linker -L dependency=/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps --cap-lints warn
#err=("-Wl,--print-gc-sections" "-Wl,--gc-sections")
##err="" #uncomment this line to avoid errors like: /home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a9bb89774eb1c5f2.rlib(std-a9bb89774eb1c5f2.4ujdo36uwwum3zzu.rcgu.o)(.stack_sizes+0x0): error: relocation refers to local symbol "" [5], which is defined in a discarded section
#"/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/build/cargo-linker" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be.build_script_build.ea30uw23-cgu.0.rcgu.o" "-o" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be.1zobs1pcbqt3rtjo.rcgu.o" "${err[@]}" "-pie" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps" "-L" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a9bb89774eb1c5f2.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-01499d126af771f6.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-8b152c95a80afef5.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-14c23aab33e6c5f4.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-41eb09b84b2625ab.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-44a20fe3a684e072.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-e5275540f2101631.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-9f560ba3dfa532fe.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1f1fadf3472d3239.rlib" "-Wl,--end-group" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9e3a9887668f9c30.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
#"/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/build/cargo-linker"
success=0 #1 if you want to see successful compilation(assuming $causetheissue is not 1), any other value(like 0) otherwise
causetheissue=1 #if 1 you will see 'discarded' type of errors, regardless of the value of $success
if test "$causetheissue" == '1'; then
err="-Wl,--gc-sections"
else
err="" #no errors
fi
#noeffect=("-pie" "-m64")
noeffect=("-nopie") #it's -pie by default if -nopie isn't specified
#debug=("-Wl,--no-threads" "-Wl,--debug=all") #XXX uncomment of lots of seemingly useless(to this issue) information ?!
debug=()
##Won't compile without the following but at least one of them is required to see the 'discarded' type of errors(set $pickone below):
oops1=(
"/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a9bb89774eb1c5f2.rlib"
"/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-01499d126af771f6.rlib"
"/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1f1fadf3472d3239.rlib"
)
oops2=(
"/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9e3a9887668f9c30.rlib"
)
if test "$success" != '1'; then
pickone=1 #0,1,2
oops1=("${oops1[$pickone]}")
oops2=()
fi
/usr/bin/clang -v "${noeffect[@]}" -std=gnu99 "${debug[@]}" -lpthread -fuse-ld=gold -fcolor-diagnostics "-L" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be.build_script_build.ea30uw23-cgu.0.rcgu.o" "-o" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/build/proc-macro2-3b19a3eb863545be/build_script_build-3b19a3eb863545be.1zobs1pcbqt3rtjo.rcgu.o" "$err" "-nodefaultlibs" "-L" "/home/user/build/1packages/4used/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/obj-x86_64-pc-linux-gnu/release/deps" "-L" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "${oops1[@]}" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-8b152c95a80afef5.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-14c23aab33e6c5f4.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-41eb09b84b2625ab.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-44a20fe3a684e072.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-e5275540f2101631.rlib" "/home/user/build/2nonpkgs/rust.stuff/rust/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-9f560ba3dfa532fe.rlib" "-Wl,--end-group" "${oops2[@]}" "-Wl,-Bdynamic" "-ldl" "-lgcc_s" "-lc" |
I don't think this is anything specific to firefox. I'm getting this error on today's nightly as well (rustc 1.35.0-nightly (96d700f 2019-04-10)). I don't set any linker flags manually as far as I know.
But maybe some of the dependencies do something?
Should I try finding some more info? |
@vorner any other details you can figure out would be appreciated. Even just a standalone test (so that we didn't have to try to recreate this via a firefox build) would be immensely helpful. |
assigning to self to:
|
It seems to fail on building a C or C++ code somewhere in numtraits. Assuming it is using the
The default ld is:
I expect this problem can be triggered by other things too, dipstick is just the first dependency in my project that caused it. |
tl;dr: can't trigger issue with dipstick 0.7.2 but can still trigger it with compiling firefox (used 3 different rustc compiler versions to test both disptick and firefox) @vorner By using the same rustc compiler( but my cc and ld versions differ from yours:
In the dipstick console, after having done all of the above, I cannot find any
EDIT1: That output made me realize and remember that I've this [target.'cfg(any(windows, unix))']
rustflags = ["-C", "target-cpu=native"]
# src: https://users.rust-lang.org/t/auto-vectorization-in-rust/24379/4 EDIT3: no effect if I comment out the contents of I even tried making sure
|
Reproduced with @vorner example using |
I can confirm. If I switch my linker to ld.bfd, the problem goes away. I have the vague impression that firefox somehow prefers to link with gold in its build system, but I might be wrong about that one. |
Confirmed! Issue triggered for me too(even though I can't use the This is really cool, thanks @mati865 and @vorner for easy reproduction steps[1,2] that don't involve firefox! EDIT:
yes, firefox does use |
error: relocation refers to local symbol "" [12], which is defined in a discarded section
only when using ld.gold linker with --gc-sections
So when using
rust/src/librustc_codegen_llvm/back/link.rs Lines 908 to 909 in 05b4554
--gc-sections is added by this code:rust/src/librustc_codegen_ssa/back/linker.rs Lines 297 to 304 in 3750348
|
@vorner How did you have
oh wait, it does say
that was unexpected, here's how it looks on ArchLinux:
|
Well, gentoo allows you to tweak the system a lot and you do a lot of compilation with that system. I discovered gold is a bit faster in most cases, so I set it as the my system default linker. It's not the general default if you get a fresh gentoo system. |
I have another workaround, for those who still want to use diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index 97e45da619..20a6fc0542 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -136,6 +136,8 @@ class Default_comdat_behavior
if (Layout::is_debug_info_section(name))
return CB_PRETEND;
if (strcmp(name, ".eh_frame") == 0
+ || strncmp(name, ".stack_sizes", 12+1) == 0
+ //|| strncmp(name, ".gnu.build.attributes", 21) == 0 // FIXME: We should really be checking the section type for ST_NOTE... // NOTE: this line(and inspiration for the above .stack_sizes line) from: https://bugzilla.redhat.com/show_bug.cgi?id=1600431#c6 ) // decided to comment out this line since I cannot repro that bug that it supposedly fixes with GNU gold (GNU Binutils 2.31.1) 1.16 or with GNU gold (GNU Binutils 2.32) 1.16
|| strcmp(name, ".gcc_except_table") == 0)
return CB_IGNORE;
return CB_ERROR; So, is there something that Rust can do here or shall this be solely I'm personally gonna be using this patch, for fun :)) For completion, other workarounds were:
|
Okay, thank you @vorner, that is very helpful. Just to share knowledge, I don't see the same problem with the
I'll see if I can switch either of those around on this box in order to try to replicate the bug. Update: Ooops, I should have reloaded the ticket before posting, there's been 16 hours of comments since @vorner posted. |
Okay so my next question is what action to take at this point.
|
I've posted a PR to do the revert. Rather than solely cherry-pick it to beta, I have posted it against master (that is, rather than let the issue persist on the nightly builds, I want the behavior on nightly to match that of beta here). I do welcome a more nuanced implementation, if someone wants to make one, for nightly. But I want to deploy the simplest way to address the regression on both master and beta right now. (And that's what PR #59911 is.) |
…t-stack-sizes-gc-sections-ld-gold-bug, r=alexcrichton Revert "compile crates under test w/ -Zemit-stack-sizes" Revert PR rust-lang#59401 to fix issue rust-lang#59652 (a stable-to-beta regression). This is result of squashing two revert commits: Revert "compile all crates under test w/ -Zemit-stack-sizes" This reverts commit 7d365cf. Revert "bootstrap: build compiler-builtins with -Z emit-stack-sizes" This reverts commit 8b8488c. ---- (My intention is that someone can re-add this code again later, either after the `ld.gold` issue itself is fixed, or with safe-guards to check whether `ld.gold` is in use and then issuing warnings about the problems here when they arise.)
…t-stack-sizes-gc-sections-ld-gold-bug, r=alexcrichton Revert "compile crates under test w/ -Zemit-stack-sizes" Revert PR rust-lang#59401 to fix issue rust-lang#59652 (a stable-to-beta regression). This is result of squashing two revert commits: Revert "compile all crates under test w/ -Zemit-stack-sizes" This reverts commit 7d365cf. Revert "bootstrap: build compiler-builtins with -Z emit-stack-sizes" This reverts commit 8b8488c. ---- (My intention is that someone can re-add this code again later, either after the `ld.gold` issue itself is fixed, or with safe-guards to check whether `ld.gold` is in use and then issuing warnings about the problems here when they arise.)
…t-stack-sizes-gc-sections-ld-gold-bug, r=alexcrichton Revert "compile crates under test w/ -Zemit-stack-sizes" Revert PR rust-lang#59401 to fix issue rust-lang#59652 (a stable-to-beta regression). This is result of squashing two revert commits: Revert "compile all crates under test w/ -Zemit-stack-sizes" This reverts commit 7d365cf. Revert "bootstrap: build compiler-builtins with -Z emit-stack-sizes" This reverts commit 8b8488c. ---- (My intention is that someone can re-add this code again later, either after the `ld.gold` issue itself is fixed, or with safe-guards to check whether `ld.gold` is in use and then issuing warnings about the problems here when they arise.)
Closing due to 633fc9e having landed |
Update to 4/18 Rust nightly. Contains the fix for rust-lang/rust#59652 which has been reported by several people on IRC. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23230) <!-- Reviewable:end -->
tl;dr: #59652 (comment)
Cannot compile firefox anymore due to:
error: linking with ... cargo-linker
error: relocation refers to local symbol "" [12], which is defined in a discarded section
UPDATE bisect shows it's PR 59401
https://bugzilla.mozilla.org/show_bug.cgi?id=1541214
old info
This issue doesn't happen with Last **good** nightly:nightly-2019-03-28-x86_64-unknown-linux-gnu (default) rustc 1.35.0-nightly (33ef0ba 2019-03-27) binary: rustc commit-hash: 33ef0ba commit-date: 2019-03-27 host: x86_64-unknown-linux-gnu release: 1.35.0-nightly LLVM version: 8.0nightly-2019-03-29-x86_64-unknown-linux-gnu (default) rustc 1.35.0-nightly (237bf32 2019-03-28) binary: rustc commit-hash: 237bf32 commit-date: 2019-03-28 host: x86_64-unknown-linux-gnu release: 1.35.0-nightly LLVM version: 8.0The issue happens with
First bad nightly:
nightly-2019-03-29-x86_64-unknown-linux-gnu (default)rustc 1.35.0-nightly (237bf32 2019-03-28)
binary: rustc
commit-hash: 237bf32
commit-date: 2019-03-28
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly
LLVM version: 8.0
nightly-2019-03-30-x86_64-unknown-linux-gnu (default)
rustc 1.35.0-nightly (e782d79 2019-03-29)
binary: rustc
commit-hash: e782d79
commit-date: 2019-03-29
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly
LLVM version: 8.0
For each test I was using the same cargo:
cargo 1.35.0-dev (025b01ed 2019-04-01)
release: 1.35.0
commit-hash: 025b01edd0bba49b7e49c1cacc65bb1f6462ee57
commit-date: 2019-04-01
Errors look like this:
0:16.63 = note: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-9b00dedc0dda6ebf.rlib(compiler_builtins-9b00dedc0dda6ebf.compiler_builtins.cqcjgied-cgu.0.rcgu.o)(.stack_sizes+0x0): error: relocation refers to local symbol "" [12], which is defined in a discarded section
0:16.84 section group signature: "(null)"
0:16.84 /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e4188d26f42911c5.rlib(std-e4188d26f42911c5.std.b8iklw2d-cgu.0.rcgu.o)(.stack_sizes+0x1b): error: relocation refers to local symbol "" [696], which is defined in a discarded section
0:16.84 section group signature: "(null)"
The text was updated successfully, but these errors were encountered: