llvm gold plugin example

Hi all,

Following the example from http://llvm.org/docs/GoldPlugin.html#example1 gives the following error on Ubuntu Karmic:

/usr/bin/ld: error: a.a: no archive symbol table (run ranlib)
/usr/bin/ld: /usr/lib/crt1.o:…/sysdeps/i386/elf/start.S:115: error: undefined reference to ‘main’
/usr/bin/ld: b.o: in function foo1:b.c(.text+0x4): error: undefined reference to ‘foo2’
collect2: ld returned 1 exit status

I suppose this is due to missing “–plugin libLLVMgold.so” option.
Attached is a documentation patch that corrects this (also for nm).

Best regards,
Victor

docs-gold-plugin.diff (1.11 KB)

Hi all,
Following the example
from http://llvm.org/docs/GoldPlugin.html#example1 gives the following error
on Ubuntu Karmic:
/usr/bin/ld: error: a.a: no archive symbol table (run ranlib)
/usr/bin/ld: /usr/lib/crt1.o:../sysdeps/i386/elf/start.S:115: error:
undefined reference to 'main'
/usr/bin/ld: b.o: in function foo1:b.c(.text+0x4): error: undefined
reference to 'foo2'
collect2: ld returned 1 exit status
I suppose this is due to missing "--plugin libLLVMgold.so" option.

bfd (the library used by nm and ar) should try to search for the
plugin in the bfd-plugins. Can you check that there is a link for the
plugin in that directory?

Attached is a documentation patch that corrects this (also for nm).
Best regards,
Victor
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Thanks,

Checked once again and it turned out that I created a link in to libLLVMgold.so in $PREFIX/libexec/gcc/i686-pc-linux-gnu/4.2.1/ and $PREFIX/lib/bfd-plugins/, but not in /usr/lib/bfd-plugins. Creating the latter solved the problem.

Thanks Rafael and sorry for the noise.

Victor