From: Bill Wendling Date: Sun, 18 Sep 2011 12:37:20 +0000 (+0000) Subject: Remove mention of llvm-gcc/llvm-g++ from doc. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ea55c83e7f6e3a9b1081902ca50a4e12224894c0;p=oota-llvm.git Remove mention of llvm-gcc/llvm-g++ from doc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139998 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/GoldPlugin.html b/docs/GoldPlugin.html index e25c4575192..92ba4116a07 100644 --- a/docs/GoldPlugin.html +++ b/docs/GoldPlugin.html @@ -75,6 +75,7 @@ placed.

Usage

+

The linker takes a -plugin option that points to the path of the plugin .so file. To find out what link command gcc would run in a given situation, run gcc -v [...] and look @@ -82,19 +83,21 @@ placed. ld-new -plugin /path/to/LLVMgold.so to test it out. Once you're ready to switch to using gold, backup your existing /usr/bin/ld then replace it with ld-new.

-

You can produce bitcode files from llvm-gcc using + +

You can produce bitcode files from clang using -emit-llvm or -flto, or the -O4 flag which is synonymous with -O3 -flto.

-

llvm-gcc 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 + +

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.

+

If you want ar and nm to work seamlessly as well, install LLVMgold.so to /usr/lib/bfd-plugins. If you built your own gold, be sure to install the ar and nm-new you built to - /usr/bin. -

+ /usr/bin.

@@ -137,11 +140,12 @@ void foo4(void) { } --- command lines --- -$ llvm-gcc -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file +$ 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 -$ llvm-gcc b.c -c -o b.o # <-- b.o is native object file -$ llvm-gcc -use-gold-plugin a.a b.o -o main # <-- link with LLVMgold plugin +$ 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 +

Gold informs the plugin that foo3 is never referenced outside the IR, leading LLVM to delete that function. However, unlike in the libLTO @@ -158,20 +162,21 @@ $ llvm-gcc -use-gold-plugin a.a b.o -o main # <-- link with LLVMgold plugin

-

Once your system ld, ar and nm all support LLVM - bitcode, everything is in place for an easy to use LTO build of autotooled - projects:

+

Once your system ld, ar, and nm all support LLVM + bitcode, everything is in place for an easy to use LTO build of autotooled + projects:

+
  • 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 llvm-gcc and - binutils): -
    -export CC="$PREFIX/bin/llvm-gcc -use-gold-plugin"
    -export CXX="$PREFIX/bin/llvm-g++ -use-gold-plugin"
    +        $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 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
    @@ -179,18 +184,22 @@ export CFLAGS="-O4"
     
  • Or you can just set your path: -
    +
     export PATH="$PREFIX/bin:$PATH"
    -export CC="llvm-gcc -use-gold-plugin"
    -export CXX="llvm-g++ -use-gold-plugin"
    +export CC="clang -use-gold-plugin"
    +export CXX="clang++ -use-gold-plugin"
     export RANLIB=/bin/true
     export CFLAGS="-O4"
    -
    -
  • -
  • Configure & build the project as usual: ./configure && make && make check
  • + +
  • Configure & build the project as usual: +
    +% ./configure && make && make check
    +
-

The environment variable settings may work for non-autotooled projects - too, but you may need to set the LD environment variable as well.

+ +

The environment variable settings may work for non-autotooled projects + too, but you may need to set the LD environment variable as + well.