Launchpad has imported 2 comments from the remote bug at
http://llvm.org/bugs/show_bug.cgi?id=13262.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2012-07-03T17:14:31+00:00 Felix Geyer wrote:

Created attachment 8821
Patch to pass LTO flags to LDFLAGS and LIBS

LLVMgold.so is not linked against libLTO.so when ld defaults to --as-
needed (which is the default on Ubuntu and afaik Fedora).

LLVMgold is built like this:
x86_64-linux-gnu-g++ [...] -lLTO [...] -o 
/build/buildd/llvm-3.1-3.1/build-llvm/Release/lib/LLVMgold.so 
/build/buildd/llvm-3.1-3.1/build-llvm/tools/gold/Release/gold-plugin.o [...] 
-lpthread -lffi -ldl -lm 

-lLTO is passed before gold-plugin.o so it is ignored.

I'm attaching a patch that adds "-L$(SharedLibDir)/$(SharedPrefix)" to LDFLAGS 
and "-lLTO" to LIBS instead of appending both to CXXFLAGS.
Makefile.config overwrites LIBS so I've added that at the bottom of the 
Makefile.
Maybe there is a better solution for this?

With these changes LLVMgold is built like this:
x86_64-linux-gnu-g++ [...] -o 
/tmp/buildd/llvm-3.1-3.1/build-llvm/Release/lib/LLVMgold.so 
/tmp/buildd/llvm-3.1-3.1/build-llvm/tools/gold/Release/gold-plugin.o [...] 
-lpthread -lffi -ldl -lm  -lLTO

Reply at: https://bugs.launchpad.net/llvm/+bug/1026359/comments/0

------------------------------------------------------------------------
On 2012-07-03T20:00:54+00:00 Rafael Ávila de Espíndola wrote:

cmake gets this right:

g++  -fPIC  -fPIC -fvisibility-inlines-hidden -fno-rtti -O3 -DNDEBUG
-shared -Wl,-soname,LLVMgold.so -o lib/LLVMgold.so
tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o ... -lpthread
lib/libLTO.so ....

Reply at: https://bugs.launchpad.net/llvm/+bug/1026359/comments/1


** Changed in: llvm
       Status: Unknown => Confirmed

** Changed in: llvm
   Importance: Unknown => Wishlist

-- 
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