Skip to content

Latest master toolchains are broken when linking LLVM: "__morestack: invalid needed version 2" #81554

Closed
@RalfJung

Description

@RalfJung
Member

When I install the latest master toolchains via rustup-toolchain-install-master and try to build Miri with them, linking fails:

error: linking with `cc` failed: exit code: 1
  |
  [...]
  = note: /usr/bin/ld: /home/r/.rustup/toolchains/miri/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-11-rust-1.51.0-nightly.so: __morestack: invalid needed version 2
          /usr/bin/ld: /home/r/.rustup/toolchains/miri/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-11-rust-1.51.0-nightly.so: error adding symbols: bad value
          collect2: error: ld returned 1 exit status

I did some bisection, and it looks like the problem started happening with #81489.

Cc @rust-lang/infra

Activity

RalfJung

RalfJung commented on Jan 30, 2021

@RalfJung
MemberAuthor

The error is actually already mentioned in #81489. However, I am building Miri with cargo, so I don't know how I'd "use LLD instead".

changed the title [-]Latest master toolchains are broken[/-] [+]Latest master toolchains are broken when linking LLVM: "__morestack: invalid needed version 2"[/+] on Jan 30, 2021
Mark-Simulacrum

Mark-Simulacrum commented on Jan 30, 2021

@Mark-Simulacrum
Member

Hm, we probably need to revert that PR. I did not realize we'd need lld downstream too, I thought that was only on our builder.

cc @nikic @cuviper

added
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
P-highHigh priority
T-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.
on Jan 30, 2021
cuviper

cuviper commented on Jan 30, 2021

@cuviper
Member

Yes, a revert seems appropriate. We're going to have to figure out where that's actually coming from. The only change I saw between 10 and 11 by grepping morestack was the removal of llgo, but maybe there's some bad remnant.

nikic

nikic commented on Jan 30, 2021

@nikic
Contributor

Yeah, I thought this issue would be limited to the rustc build, but it makes sense that it can also affect project linking against rustc shared objects.

I've looked a bit into what the root cause is, and what I have so far as that the symbol comes from https://github.com/llvm/llvm-project/blob/b10d445307a0f3c7e5522836b4331090aacaf349/llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp#L217 and is present as a weak symbol both when compiling with clang-10 and clang-11. The only difference I see from objdump -T is this:

; clang-10
0000000000000000  w   D  *UND*  0000000000000000  LLVM_11     __morestack
; clang-11
0000000000000000  w   D  *UND*  0000000000000000  Base        __morestack

So apparently __morestack was treated as a symbol of the LLVM_11 library, while now it's treated as a symbol of Base -- I'm not sure what that actually means, but presumably that refers to the compiler runtime libraries. My guess is that previously it just ended up being nulled out as a missing weak symbol, but now it's actually being found and linking fails because ... reasons. I'm not good at linkers :)

Edit: readelf -Ws shows these as:

; clang-10
   315: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __morestack
; clang-11
   315: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __morestack@@<corrupt>
RalfJung

RalfJung commented on Jan 30, 2021

@RalfJung
MemberAuthor

@nikic can you prepare a revert PR?

nikic

nikic commented on Jan 30, 2021

@nikic
Contributor

@RalfJung Done in #81565.

If nobody has an idea on how to avoid the linker error, two more options would be to comment out the symbol in our llvm-project fork, or to avoid upgrading clang altogether and just build both Python 2 and Python 3 for that image.

nagisa

nagisa commented on Jan 30, 2021

@nagisa
Member

The issue is probably going to be in how exactly the objects that comprise libLLVM.so are compiled, not linked. I suspect lld just ends up ignoring the malformed object or otherwise not reporting the issue, but the object and the relevant symbols ultimately end up in the so anyway.

Alas, reasons these obscure failures can occur are many – I've seen them occur from things as trivial as forgetting to -fPIC.

The question is: is there perhaps a way to disable ExecutionEngine entirely? Intuitively nothing we do should depend on that code. And if not, I'm comfortable patching out __morestack in our fork as we get closer to Feb 11 and continue having trouble pinpointing exact cause of this problem.

added a commit that references this issue on Jan 30, 2021

Auto merge of rust-lang#81565 - nikic:revert, r=nagisa

04caa63
nikic

nikic commented on Jan 30, 2021

@nikic
Contributor

The question is: is there perhaps a way to disable ExecutionEngine entirely? Intuitively nothing we do should depend on that code.

We normally don't link ExecutionEngine, but dist-x86_64-linux in particular builds LLVM with ThinLTO, in which case we link libLLVM.so as shared, instead of statically linking individual components into rustc_llvm.

nikic

nikic commented on Jan 30, 2021

@nikic
Contributor

It seems to be possible to configure the components in libLLVM.so using LLVM_DYLIB_COMPONENTS, but I'm not sure to what degree we can restrict those (not sure if this job also ships LLVM tools).

nikic

nikic commented on Jan 31, 2021

@nikic
Contributor

So, I think we could have used LLVM_DYLIB_COMPONENTS to exclude unnecessary parts from libLLVM.so, as LLVM tools can still statically link the parts not in the dylib. But in the end, we can't use the option anyway due to https://bugs.llvm.org/show_bug.cgi?id=48974.

matthiaskrgr

matthiaskrgr commented on Mar 6, 2021

@matthiaskrgr
Member

Looks like I'm getting this locally when trying to bootstrap rustc (while building rustc_driver), might happen since the llvm upgrade but I'm not 100% sure.
Are there some workarounds I can put into my config.toml for this?
I'm using lld to link.

Backtrace

Updating only changed submodules
Submodules updated in 0.03 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.19s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc_driver v0.0.0 (/home/matthias/vcs/github/rust/compiler/rustc_driver)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_driver-8a4e692bfe6731a9.rustc_driver.118v6stn-cgu.0.rcgu.o" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_driver-8a4e692bfe6731a9.rustc_driver.118v6stn-cgu.1.rcgu.o" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_driver-8a4e692bfe6731a9.rustc_driver.118v6stn-cgu.2.rcgu.o" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_driver-8a4e692bfe6731a9.rustc_driver.118v6stn-cgu.3.rcgu.o" "-o" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_driver-8a4e692bfe6731a9.so" "-Wl,--version-script=/tmp/rustcGYhEAU/list" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_driver-8a4e692bfe6731a9.1hgshg3cxrlhudyx.rcgu.o" "-shared" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/psm-ce575543779f6829/out" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/rustc_llvm-2b8944c4df3e12e2/out" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/llvm/build/lib" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_error_codes-c87e3d5ac793ee35.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_save_analysis-79f3e7026830c358.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librls_data-271e5744e599b199.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librls_span-5b706634921bf70f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_interface-b2d6e5a6988bedbf.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_codegen_llvm-72e6347ceb466df3.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_llvm-c2e1008c0a09c820.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_ty_utils-76929eaaa3440c39.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_traits-cb901472ea65a083.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libchalk_engine-aa5879920a24b24d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libchalk_solve-3da06f260cc478df.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtracing_tree-1fe178bebeaa5fdc.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtracing_subscriber-de53c01dd8a70b2e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libchrono-efb6d71c512cbef6.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libnum_integer-e40400ea458afd1f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libnum_traits-553c553692257cbb.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libsharded_slab-49f8651e45564f62.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtracing_serde-6869aa3f682e893d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libserde_json-118fc88acd0aebf7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libryu-8a6faee8413e2e99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libitoa-d1d5e01c95c0e190.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtracing_log-245941a857c512a1.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libansi_term-af9b938b994f469c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmatchers-351300adabc454b6.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libregex_automata-4ca3b8b7cb682793.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libbyteorder-f0318d61775de3f1.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libpetgraph-96782e04adc0acb7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libfixedbitset-871e3ea915edabdf.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_privacy-3399f38309fa3a12.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_builtin_macros-fed6208846affaed.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_typeck-6f8222a3e9c1058e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_resolve-1c92d43afc4b86cf.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_ast_lowering-bf4ef74f6030fcdd.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_query_impl-06615d36f1a01a94.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_passes-a71e10c66700ee54.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_mir_build-f939e51d1ab81ee0.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_mir-38ca578f8c6afde9.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libgsgdt-28a3530d0ee8cd1d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libserde-6d320828d7ca8e35.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libregex-36f462e54524191b.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libthread_local-4aae3e4636378654.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libregex_syntax-2bebc5e3bf839d13.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libaho_corasick-f9363b0a27f97ef8.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmemchr-01e1d7418bf753b3.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_codegen_ssa-c61b2c3454cba99f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_symbol_mangling-58c6c38ce837707b.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_demangle-ea536d224ed95fa6.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libpunycode-944ef0fe97f04246.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_incremental-ef91e16cd9155a3e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libpathdiff-6f14fdec609aff9a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcc-bf9f5b4f4f928daf.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_plugin_impl-33e8506081dfb95c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_metadata-24ecf71972ce3ddd.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmemmap-9d00f7f3be0d5498.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_hir_pretty-459507ed8e63c595.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libsnap-6c890d769a2df980.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_expand-df50308126af8053.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_ast_passes-f5bd3f12fea22a82.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libitertools-b4c72a45a2149324.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libeither-d1bc76e50e77f042.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_parse-2e88474c383ec979.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libproc_macro-68b267e36468a10d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_lint-ac6053037c621f4c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libunicode_security-448a01014c3a571d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libunicode_script-f52c949a5247cb90.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libunicode_normalization-b4dd183fba92a91f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtinyvec-745218022b7ec94b.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_trait_selection-84ab237fa320ef44.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_parse_format-c9a5d7674e5cded3.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_infer-8d7eeb69054fddb2.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_middle-e6b9a1d2cf641b1a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_rayon_core-4b38a042c145ccc3.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcrossbeam_queue-94ab3b2b5480046a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcrossbeam_utils-a9d6770c3449bd05.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcrossbeam_deque-0f8901ec43d9a39f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcrossbeam_epoch-39e32a32f553b2a9.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmemoffset-3f3982842b101023.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcrossbeam_utils-59938035e0af0c91.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmaybe_uninit-862714ff17b6e9ba.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libchalk_ir-7eac3e836f65e826.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_type_ir-12c6e801065f8a7a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_apfloat-26d38b2c0b7e5ba0.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libpolonius_engine-eafbb5e98882647a.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libdatafrog-48636ca9c0e75cbd.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_attr-c2f36e8108c8facc.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_ast_pretty-38e812f6c9165632.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_query_system-9064475601fa06fd.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_hir-924ae9a03ba52988.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_session-f2cf1f3016927366.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libnum_cpus-6439dd71e246f9a7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libgetopts-147d27c382bb312e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_fs_util-952dbdafcdf8abff.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_feature-5db5d0bedaa7f246.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_errors-33871b0fefd13eb8.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtermize-ca35ab4a378393ed.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libatty-37e5309e5234b6ad.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libannotate_snippets-f2b21c7005202a2d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtermcolor-a6b85a8fb70b1c0d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_lint_defs-2d18dc1dc4f3a811.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_target-8ee65045f65fd06b.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_ast-556842d0929818df.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_lexer-66d72ace3d25f9b5.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libunicode_xid-7c3db495c37329d5.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_span-4ae6ac0357eebc6d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libscoped_tls-a963bf0eb6e5add9.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libsha2-062cfcec50a2bcd1.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libsha1-589e4e219cb22066.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcpuid_bool-c78845d5235d044f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmd5-1a4312498fc661f9.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libopaque_debug-941a539a07a25e4f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libblock_buffer-1542cebd5be24f44.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libdigest-7cb2ba9c3db7f5b0.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libgeneric_array-ee3f74482474af88.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtypenum-841617d77b76fe15.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libunicode_width-2388ccf7eb45d654.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_arena-11060237e56c0355.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_data_structures-b32e1a39b8a36b80.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libstacker-047b0541a77cf0b2.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libpsm-6c32f7fa56dcb2e4.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtempfile-e902de1f15e3d8ed.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librand-25b230f7928062ca.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librand_chacha-964c838d8e136362.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libppv_lite86-1cfbe6875faa08e7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librand_core-57c853c1ea641cd6.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libgetrandom-ea91e5f5fb90be86.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libremove_dir_all-f0631eb4e4412da7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libmeasureme-9c216814255470ae.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libparking_lot-a0ded4bf9d6738a2.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libparking_lot_core-16c3cb228504dc0d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/liblock_api-67c531d5a58cbd55.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libscopeguard-ef852dd0090c34ef.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libinstant-1aea07bd2b820bd1.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libena-bf608237dd1f8b36.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/liblog-fc44c631fc2bdd61.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libstable_deref_trait-badd46b3c2660d03.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_graphviz-f78b77a37e9e57d3.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libjobserver-6e808eb2a3b73606.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/liblibc-e9e91a2c8a0bbdc9.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_hash-8ade21fc9fcbeba7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_index-85faaed310c1aa87.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/librustc_serialize-3fa4c1f26e2b1c9e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libindexmap-4fa5b020f93b6b00.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libhashbrown-fe535110b901fb79.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libsmallvec-8644906fdc153bc4.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libarrayvec-dac3f8a90fa8a082.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcfg_if-1f771992d75cf5f5.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libbitflags-68c54623cd4ecfc0.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtracing-481a9a4e7ca07611.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libpin_project_lite-277eed2438941437.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libtracing_core-5949046fb0b41a09.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/liblazy_static-f1e5bbc91181b6a3.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustcGYhEAU/libcfg_if-757e31c653cf467c.rlib" "-Wl,--no-whole-archive" "-Wl,--start-group" "-L" "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bdynamic" "-lstd-234ccdde557f9b78" "-Wl,--end-group" "-Wl,-Bstatic" "/tmp/rustcGYhEAU/libcompiler_builtins-47f2bf3e3cd164ed.rlib" "-Wl,-Bdynamic" "-lLLVM-12-rust-dev" "-lstdc++" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,-rpath,$ORIGIN/../lib"
  = note: /usr/bin/ld: /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/llvm/build/lib/libLLVM-12-rust-dev.so: __morestack: invalid needed version 2
          /usr/bin/ld: /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/llvm/build/lib/libLLVM-12-rust-dev.so: error adding symbols: bad value
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: could not compile `rustc_driver`

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "4" "--release" "--features" " llvm max_level_info" "--manifest-path" "/home/matthias/vcs/github/rust/compiler/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
failed to run: /home/matthias/vcs/github/rust/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:01:04

RalfJung

RalfJung commented on Mar 6, 2021

@RalfJung
MemberAuthor

@matthiaskrgr which commit are you trying to build?

matthiaskrgr

matthiaskrgr commented on Mar 6, 2021

@matthiaskrgr
Member

@RalfJung 51748a8 latest git master

RalfJung

RalfJung commented on Mar 6, 2021

@RalfJung
MemberAuthor

Probably best to open a new issue then; this one has been closed and the steps to reproduce it still work without error -- you might be having a different problem.

matthiaskrgr

matthiaskrgr commented on Mar 6, 2021

@matthiaskrgr
Member

Opened #82839

aaronpuchert

aaronpuchert commented on Apr 10, 2021

@aaronpuchert

Did anyone file an upstream bug report about this? I'm observing it outside of Rust, but with a similar setup (libLLVM.so with lld+ThinLTO, then linking it into a binary with ld.bfd). If not, I'd try to build a reproducer.

aaronpuchert

aaronpuchert commented on Apr 10, 2021

@aaronpuchert

I've opened bug 49915 for this.

aaronpuchert

aaronpuchert commented on May 12, 2021

@aaronpuchert

The bug has been fixed, the fix will be in LLVM 12.0.1.

nikic

nikic commented on May 13, 2021

@nikic
Contributor

Thanks! We can try updating clang again once the 12.0.1 tag is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.P-highHigh priorityT-infraRelevant to the infrastructure team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @cuviper@nikic@RalfJung@matthiaskrgr@nagisa

      Issue actions

        Latest master toolchains are broken when linking LLVM: "__morestack: invalid needed version 2" · Issue #81554 · rust-lang/rust