[LLVMdev] Gold plugin and LLVM tools documentation
Todd Jackson
quantum.skyline at gmail.com
Tue May 1 07:42:44 PDT 2012
Hi,
I've been following the instructions on how to use the LLVM Gold
plugin at http://llvm.org/docs/GoldPlugin.html while building an
multiple versions of WebKit. The documentation hasn't been updated
since 2010 and hasn't really matched my experiences, so I'd like to
ask if I'm doing these steps incorrectly. What I'm trying to do is
force all compilation steps to bitcode so I can use the LTO plugin.
I'm working with both LLVM/Clang 2.9 and 3.0 with binutils 2.22.
According to the documentation, I replaced the system ar, nm, and ld
with the versions from binutils 2.22, and placed LLVMgold.so in
/usr/bin/bfd-plugins. The host system is Ubuntu 11.10. CFLAGS and
CXXflags are all set to include "-emit-llvm".
First, I create libjscore.a with ar, where I've changed the command
line to load the plugin:
ar cqs --plugin
/home/tmjackso/multicompiler/llvm-3.0/release/lib/LLVMgold.so
libjscore.a <list of object files>
Then I link jsc against libjscore.a:
/home/tmjackso/multicompiler/llvm-3.0/release/bin/clang++
-Wl,-plugin,/home/tmjackso/multicompiler/llvm-3.0/release/lib/LLVMgold.so
-Wl,-rpath,/home/tmjackso/builds/qt/qt-4.8.1/lib
-Wl,-rpath,/home/tmjackso/builds/webkit/WebKit-r94287/WebKitBuild/Release/lib
-o ./jsc obj/release/jsc.o -L./release
-L/home/tmjackso/builds/qt/qt-4.8.1/lib -ljscore -lQtCore
-L/home/tmjackso/builds/qt/qt-4.8.1/lib -lpthread
/usr/bin/ld: error: jscore: malformed archive header name at 8
When I change the link command to not use "-ljscore" but the path to
libjscore.a, it works:
/home/tmjackso/multicompiler/llvm-3.0/release/bin/clang++
-Wl,-plugin,/home/tmjackso/multicompiler/llvm-3.0/release/lib/LLVMgold.so
-Wl,-rpath,/home/tmjackso/builds/qt/qt-4.8.1/lib
-Wl,-rpath,/home/tmjackso/builds/webkit/WebKit-r94287/WebKitBuild/Release/lib
-o ./jsc obj/release/jsc.o libjscore.a -L./release
-L/home/tmjackso/builds/qt/qt-4.8.1/lib -lQtCore
-L/home/tmjackso/builds/qt/qt-4.8.1/lib -lpthread
Does anyone know what I'm doing wrong in the first case? The build is
managed by qmake, and I'm working on coaxing it into generating the
second line.
Also, because the documentation is dated in 2010, is it current? I'll
have some time in about two weeks to take a look at it if it's not.
For example, using clang -O4 has never worked for me. That's why I
pass -Wl to load the linker plugin.
Thanks,
Todd Jackson
More information about the llvm-dev
mailing list