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
LLD emits corrupt version for weak symbol when using version script #49259
Comments
assigned to @MaskRay |
Just checked with llvm-readelf, which sees
So who is right? But even if llvm-readelf is right, this is obviously not what we want. Generally undefined symbols shouldn't get LLVM_13, but I can't find any syntax to exclude them in the version script. If you say this behavior is intentional, I guess we need to change the LLVM build. |
Created https://reviews.llvm.org/D100624 llvm-readelf -V should report in such a case. |
afterwards.
$ llvm-readelf -V test.so Version definition section '.gnu.version_d' contains 2 entries: Version needs section '.gnu.version_r' contains 1 entries: |
I have figured out the GNU readelf behavior. It maintains I don't think the constraint is necessary so llvm-readelf probably should stick with the current behavior. |
Fixed by 1c00530 (target: 13.0.0) |
It would be nice to pick this up for LLVM 12.0.1. |
Sounds good! |
I have same error libLLVM-12.so: __morestack in the LLVM 12 /usr/bin/ld: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libLLVM-12.so: __morestack: invalid needed version 2 It interferes build MESA 21.1.0 and RUST. This patch 1c00530 I found solution how to fixit - build LLVM with export LLVM_IAS=1 |
The linker using an assembler would surprise me a bit, but I don't know a lot about this. |
I
Can someone open a new bug for this? |
Merged: 6912082 |
I accidentally found a solution to the problem. Initially, I always bild LLVM with LLVM_IAS=1, but when I removed this line I got this errors in MESA. Only removal -DLLVM_USE_LINKER=lld helped. Then I decided to return LLVM_IAS=1 |
Today I double-checked, the error did not repeat itself. The files are identical. It’s strange. Yesterday, I applied a patch and cleaned up the build folder every time, and the patch didn't help. Today this patch is already in the llvm 12 branch. The mistake did not repeat itself today. |
Extended Description
When linking against a lld-linked libLLVM.so with ld.bfd I got the following error:
/usr/bin/ld: /usr/lib64/libLLVM.so: __morestack: invalid needed version 2
/usr/bin/ld: /usr/lib64/libLLVM.so: error adding symbols: bad value
clang-12.0: error: linker command failed with exit code 1 (use -v to see invocation)
Indeed:
This is coming from llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp. I've managed to build a small reproducer that should work with 12.0.0rc5:
unsigned long f() {
return (unsigned long)&__morestack;
}
Without -fuse-ld=lld, i.e. with ld.bfd I get
Now lld itself seems to fine with the corrupt version, so maybe binutils are just overly sensitive? I don't know.
The text was updated successfully, but these errors were encountered: