[LLVMbugs] [Bug 13262] New: LLVMgold not linked against LTO with ld --as-needed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 3 10:14:31 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13262

             Bug #: 13262
           Summary: LLVMgold not linked against LTO with ld --as-needed
           Product: Build scripts
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Makefiles
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: debfx at ubuntu.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8821
  --> http://llvm.org/bugs/attachment.cgi?id=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

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list