[LLVMdev] Problem compiling with clang + gold plugin: no archive symbol table

ryan stdstack at gmail.com
Thu Jun 28 14:58:11 PDT 2012


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 specified

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


More information about the llvm-dev mailing list