Public bug reported:
clang-3.3/3.4 cannot link a simple binaries if -flto option is used (in
order to enable link-time-optimization), probably due to incorrect
packaging of LLVMgold.so which can be found in
/usr/lib/llvm-<version>/lib/LLVMgold.so, however the gold linker only
searchs /usr/lib for LLVMgold.so
The following command clearly shows the problem:
user@ubuntu:/tmp$ echo 'int main() {}' | clang -xc - -flto -v
Ubuntu clang version 3.4-1ubuntu1 (trunk) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
"/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-llvm-bc -disable-free
-disable-llvm-verifier -main-file-name - -mrelocation-model static
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version
2.23.52.20130727 -v -resource-dir /usr/bin/../lib/clang/3.4 -internal-isystem
/usr/local/include -internal-isystem /usr/bin/../lib/clang/3.4/include
-internal-isystem /usr/include/clang/3.4/include/ -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 105
-mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-o /tmp/--5RQxuk.o -x c -
clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.4/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include/clang/3.4/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
"/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m
elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtbegin.o
-L/usr/lib/gcc/x86_64-linux-gnu/4.8
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu
-L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -L/lib -L/usr/lib -plugin
/usr/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64 /tmp/--5RQxuk.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/4.8/crtend.o
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: /usr/bin/../lib/LLVMgold.so: error loading plugin:
/usr/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or
directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ubuntu release 13.10
BTW, there are other issues related to link-time-optimization on ubuntu,
probably upstream bugs.
** Affects: llvm-toolchain-snapshot (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1254970
Title:
clang failed to link binaries when -flto option is used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-snapshot/+bug/1254970/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs