[LLVMdev] gold plugin example

Sangmin Park sangmin.park at gmail.com
Mon Mar 21 19:35:16 PDT 2011


Hi,

I fixed error by using different version of ld with LLVM 2.7.
I used ld.gold that comes with Ubuntu 10.04.
Here is the version info:

sangmin at sangmin-desktop:/tmp$ ld -v
GNU gold (GNU Binutils for Ubuntu 2.20.1-system.20100303) 1.9

My experience of gold plugin is as follows:

LLVM 2.7 (with libLLVMgold.so) + ld 2.20.1 (from Ubuntu 10.04) : O
LLVM 2.7 (with libLLVMgold.so) + ld 2.21.51 (manually compiled) : X
LLVM 2.8 (with LLVMgold.so) + ld 2.20.1 (from Ubuntu 10.04): X
LLVM 2.8 (with LLVMgold.so) + ld 2.21.51 (manually compiled): X

When compiling (lib)LLVMgold.so file, I used the source file from ld
2.21.51.

I can work with LLVM 2.7 and ld 2.20.1 now, but am curious with the result.
Can you explain what part I did wrong?

Thanks,
Sangmin



On Mon, Mar 21, 2011 at 9:13 PM, Sangmin Park <sangmin.park at gmail.com>wrote:

> Hi all,
>
> I got an error from the gold plugin example in the following link:
> http://llvm.org/docs/GoldPlugin.html#example1
>
> Here is the error message:
>
> sangmin at sangmin-desktop:/tmp$ llvm-gcc -use-gold-plugin a.a b.o -o main
> /usr/bin/ld: error: a.a: no archive symbol table (run ranlib)
> /usr/bin/ld: /usr/lib/crt1.o:(.text+0x18): 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 followed the instructions from the previous thread below, but I still
> have the problem.
> http://old.nabble.com/llvm-gold-plugin-example-td28140005.html
>
> I got the error with both 2.7 and 2.8.
> Here are my settings:
>
> LLVMgold.so in  (with LLVM 2.8)
>
> - $HOME/llvm-gcc-4.2-2.8-i686-linux/libexec/gcc/i686-pc-linux-gnu/4.2.1/LLVMgold.so
> - $HOME/llvm-gcc-4.2-2.8-i686-linux/lib/bfd-plugins/LLVMgold.so
> - /usr/lib/bfd-plugins/LLVMgold.so
>
> libLLVMgold.so in (with LLVM 2.7)
>
> - $HOME/llvm-gcc-4.2-2.7-i686-linux/libexec/gcc/i686-pc-linux-gnu/4.2.1/libLLVMgold.so
> - $HOME/llvm-gcc-4.2-2.7-i686-linux/lib/bfd-plugins/libLLVMgold.so
> - /usr/lib/bfd-plugins/libLLVMgold.so
>
> Compiled ld-new, ar, nm-new are linked to /usr/bin/ld, /usr/bin/ar,
> /uar/bin/nm, respectively.
>
> sangmin at sangmin-desktop:/tmp$ ld -v
> GNU gold (GNU Binutils 2.21.51.20110316) 1.11
>
>
> Thanks in advance for your help.
>
> Sangmin
>



-- 
Sangmin Park / Ph.D. student
College of Computing
Georgia Institute of Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110321/07386d26/attachment.html>


More information about the llvm-dev mailing list