ryan
2012-Jun-28 21:58 UTC
[LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
Hi, I build llvm with gold plugin, clang and the binutils(and it's put into the PATH) with plugins support. ld.gold is renamed to ld. A quick test of clang -flto -O0 hello.c can succeed. But when I try to export CC="clang -v -flto" and compile MySQL, it failed in the linking with the following error message: "/home/ryan/binutils/bin/ld" -export-dynamic -z relro --hash-style=gnu> --build-id --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o > factorial > /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu/crt1.o > /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu/crti.o > /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o > -L/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5 > -L/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu > -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu > -L/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.. -L/lib > -L/usr/lib -plugin > /home/ryan/llvm-build/Debug+Asserts/bin/../lib/LLVMgold.so my_main.o > factorial.o libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a > -lpthread -lcrypt -lnsl -lm -lpthread -lgcc --as-needed -lgcc_s > --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed > /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtend.o > /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu/crtn.o > /home/ryan/binutils/bin/ld: error: libdbug.a: no archive symbol table (run > ranlib) > /home/ryan/binutils/bin/ld: error: ../strings/libmystrings.a: no archive > symbol table (run ranlib) > my_main.c:23: error: undefined reference to 'my_thread_global_init'This does not seem to be specific on MySQL, tested on httpd, also emit similar error messages: /home/ryan/binutils/bin/ld: error:> /tmp/httpd-2.2.22/srclib/pcre/.libs/libpcre.a: no archive symbol table (run > ranlib)It looks like ar didn't run with gold plugin. Actually I did alias ar="ar --plugin /path/to/LLVMgold.so" and also similarly to nm. Still didn't help. If I export AR="ar --plugin /path/to/LLVMgold.so", it will complain:> /home/ryan/binutils/bin/ar: no operation specifiedwhich I found a related bug report to binutils on http://sourceware.org/bugzilla/show_bug.cgi?id=13256 . Does anyone have some clue on what's going on ? Thanks very much! Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120628/d9c9f532/attachment.html>
Rafael EspĂndola
2012-Jun-28 22:05 UTC
[LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
> Does anyone have some clue on what's going on ?You don't need to pass command line options to ar and nm if the plugin is installed in the correct directories. A guess is that the build system is running ranlib on the .a files and that is destroying the index created by nm. If you put the plugins in the bfd-plugins directory nm, ar and ranlib will use them.> Thanks very much! > > Ryan >Cheers, Rafael
ryan
2012-Jun-28 22:18 UTC
[LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
Thanks for replying! I didn't install the new binutils to system directory in case it messes thing up. For ranlib, from the error message, it seems to be the reason. But even I export RANLIB=/bin/true, clean the code and rebuild, it still fails with the same message. I created a symlink in /usr/lib/bfd-plugins as suggested in http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-March/030101.html. Still it doesn't work.. Really have no idea what to try next. Best regards, Ryan On Thu, Jun 28, 2012 at 3:05 PM, Rafael EspĂndola < rafael.espindola at gmail.com> wrote:> > Does anyone have some clue on what's going on ? > > You don't need to pass command line options to ar and nm if the plugin > is installed in the correct directories. A guess is that the build > system is running ranlib on the .a files and that is destroying the > index created by nm. > > If you put the plugins in the bfd-plugins directory nm, ar and ranlib > will use them. > > > Thanks very much! > > > > Ryan > > > > Cheers, > Rafael >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120628/a54f956d/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
- [LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
- [LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
- [LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table
- [LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table