[LLVMdev] problem using LTO

Rafael Espindola espindola at google.com
Thu Jul 22 09:23:15 PDT 2010

On 21 July 2010 22:14, Reza Yazdani <ry.yazdani at gmail.com> wrote:
> Hello,
> I down loaded "llvm-gcc4.2-2.7-x86_64-linux" and I built Spec2006 with it.
> It is great and except for one benchmark the rest work fine. I want to build
> them with LTO now. I followed the directions in
> "http://llvm.org/docs/GoldPlugin.html" and built ar, nm-new, and ld-new in
> binutils. I also built libLLVMgold.so.
> I get the following error:
> llvm-gcc: -use-gold-plugin, but libLLVMgold.so not found.
> The command I used with the example in
> "http://llvm.org/docs/GoldPlugin.html" is:
> /home/reza/llvm-gcc4.2-2.7-x86_64-linux/bin/llvm-gcc -use-gold-plugin a.a
> b.o -o main
> I put libLLVMgold.so to /usr/lib/bfd-plugins and ar, nm-new and ld-new in
> /usr/bin/ar and /usr/bin/nm and /usr/bin/ld respectively.

You have to put a link to libLLVMgold.so in a place where llvm-gcc
will find it. An easy one is the directory with cc1 in it.

> If I use the load by itself I get:
> ld -plugin /usr/lib/bfd-plugins/libLLVMgold.so a.a b.o -o main
> it loads but I get:
> reza at reza-desktop:~/gcc/trunk/test/mytest$ ./main
> Segmentation fault

GCC adds other objects to the link that include startup code.

> Thanks,
> Reza

Rafael Ávila de Espíndola

More information about the llvm-dev mailing list