While the patch does indeed links the plugin correctly the original
example still does not work in multiple ways.

I have installed clang & llvm-3.0 packages:

$ dpkg-query -W llvm-3.0
llvm-3.0        3.0-9ubuntu1
$ dpkg-query -W clang
clang   3.0-6ubuntu3
$ cat foo.c 
int main(){return 0;}
$ clang -O4 -use-gold-plugin foo.c
/usr/bin/ld.bfd.real: /usr/bin/../lib/LLVMgold.so: error loading plugin
/usr/bin/ld.bfd.real: /usr/bin/../lib/LLVMgold.so: error in plugin cleanup 
(ignored)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ ld.gold -v -plugin /usr/lib/llvm-3.0/lib/LLVMgold.so
GNU gold (GNU Binutils for Ubuntu 2.22.90.20120816) 1.11
/usr/bin/ld.gold.real: error: /usr/lib/llvm-3.0/lib/LLVMgold.so: could not load 
plugin library: libLTO.so: cannot open shared object file: No such file or 
directory

So there is a missing dependency.... on llvm-dev (well current default 
llvm-3.0-dev)
To me this sounds a bit counter-intuitive, but maybe that's just the way to 
package llvm.
But why split the packages, if they still depend on each other....?

After installing llvm-dev I get slightly better results:

$ clang -O4 -use-gold-plugin foo.c -o foo
/tmp/foo-nf9h1L.o: file not recognized: File format not recognised
clang: error: linker command failed with exit code 1 (use -v to see invocation)

but...

$ clang -O3 -use-gold-plugin foo.c -o foo && echo $?
0

So is -O4 broken with gold linker?

This fix looks sane and I can test is by inspection with ldd, but can I
tell clang to use a different LLVM? Cause clang is currently compiled
against llvm-3.0, not llvm-3.1.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1026359

Title:
  clang -O4 -use-gold-plugin fails (LLVMgold.so: undefined symbol:
  lto_codegen_compile_to_file)

To manage notifications about this bug go to:
https://bugs.launchpad.net/llvm/+bug/1026359/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to