[LLVMdev] CVS binutils includes support for plugins, can use the llvm plugin.
Chris Lattner
clattner at apple.com
Tue Jul 7 11:46:51 PDT 2009
On May 26, 2009, at 10:52 AM, Rafael Espindola wrote:
> Today support for plugins has been committed to BFD. That is the file
> format abstraction library used by binutils. This now works
Very nice Rafael! Can you please update the web page to mention this,
e.g. in the LinkTimeOptimization.html document and wherever else
relevant?
-Chris
>
> $ llvm-gcc -emit-llvm -O2 -c a.c
> $ llvm-gcc -emit-llvm -O2 -c b.c
> $ ar --plugin libLLVMgold.so q a.a a.o
> $ llvm-gcc -use-gold-plugin b.o a.a -o t
> $ objdump -d t | grep main\>: -A 2
> 0000000000400330 <main>:
> 400330: 31 c0 xor %eax,%eax
> 400332: c3 retq
>
> with a.c being "int f(void) { return 0;}" and b.c being "int f(void);
> int main(void) { return f(); }".
>
> BFD will also search for plugins in <prefix>/lib/bfd-plugins. You can
> just put libLLVMgold.so there and all you will need for LTO is to pass
> -use-gold-plugin while linking :-)
>
> Note that you must use the gold linker for -use-gold-plugin to
> work :-)
>
> Cheers,
> --
> Rafael Avila de Espindola
>
> Google | Gordon House | Barrow Street | Dublin 4 | Ireland
> Registered in Dublin, Ireland | Registration Number: 368047
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list