X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FGoldPlugin.html;h=2c08bd031b7ffdc8938fe2ceacf1840dacd8c78f;hb=1f2fa99b2ab6e29270d7d72e20153d933469287d;hp=92ba4116a071624a381615b810373ad58cf38bc1;hpb=ea55c83e7f6e3a9b1081902ca50a4e12224894c0;p=oota-llvm.git diff --git a/docs/GoldPlugin.html b/docs/GoldPlugin.html index 92ba4116a07..2c08bd031b7 100644 --- a/docs/GoldPlugin.html +++ b/docs/GoldPlugin.html @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM gold plugin @@ -88,11 +89,11 @@ placed. -emit-llvm or -flto, or the -O4 flag which is synonymous with -O3 -flto.

-

Clang has a -use-gold-plugin option which looks for the - gold plugin in the same directories as it looks for cc1 and passes - the -plugin option to ld. It will not look for an alternate - linker, which is why you need gold to be the installed system linker in your - path.

+

Any of these flags will also cause clang to look for the + gold plugin in the lib directory under its prefix and pass the + -plugin option to ld. It will not look for an alternate + linker, which is why you need gold to be the installed system linker in + your path.

If you want ar and nm to work seamlessly as well, install LLVMgold.so to /usr/lib/bfd-plugins. If you built your @@ -140,10 +141,10 @@ void foo4(void) { } --- command lines --- -$ clang -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file -$ ar q a.a a.o # <-- a.a is an archive with LLVM bitcode -$ clang b.c -c -o b.o # <-- b.o is native object file -$ clang -use-gold-plugin a.a b.o -o main # <-- link with LLVMgold plugin +$ clang -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file +$ ar q a.a a.o # <-- a.a is an archive with LLVM bitcode +$ clang b.c -c -o b.o # <-- b.o is native object file +$ clang -flto a.a b.o -o main # <-- link with LLVMgold plugin

Gold informs the plugin that foo3 is never referenced outside the IR, @@ -170,13 +171,12 @@ $ clang -use-gold-plugin a.a b.o -o main # <-- link with LLVMgold plugin

  • Follow the instructions on how to build LLVMgold.so.
  • Install the newly built binutils to $PREFIX
  • Copy Release/lib/LLVMgold.so to - $PREFIX/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/ and $PREFIX/lib/bfd-plugins/
  • Set environment variables ($PREFIX is where you installed clang and binutils):
    -export CC="$PREFIX/bin/clang -use-gold-plugin"
    -export CXX="$PREFIX/bin/clang++ -use-gold-plugin"
    +export CC="$PREFIX/bin/clang -flto"
    +export CXX="$PREFIX/bin/clang++ -flto"
     export AR="$PREFIX/bin/ar"
     export NM="$PREFIX/bin/nm"
     export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
    @@ -186,8 +186,8 @@ export CFLAGS="-O4"
          
  • Or you can just set your path:
     export PATH="$PREFIX/bin:$PATH"
    -export CC="clang -use-gold-plugin"
    -export CXX="clang++ -use-gold-plugin"
    +export CC="clang -flto"
    +export CXX="clang++ -flto"
     export RANLIB=/bin/true
     export CFLAGS="-O4"