• Home
  • Raw
  • Download

Lines Matching +full:llvm +full:- +full:ranlib

2 The LLVM gold plugin
13 The LLVM gold plugin implements the gold plugin interface on top of
21 .. _lto-how-to-build:
27 Check whether you have gold running ``/usr/bin/ld -v``. It will report "GNU
29 by running ``/usr/bin/ld -plugin``. If it complains "missing argument" then
35 .. code-block:: bash
37 $ git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils
40 $ ../binutils/configure --enable-gold --enable-plugins --disable-werror
41 $ make all-gold
43 That should leave you with ``build/gold/ld-new`` which supports
44 the ``-plugin`` option. Running ``make`` will additionally build
45 ``build/binutils/ar`` and ``nm-new`` binaries supporting plugins.
48 ``-DLLVM_BINUTILS_INCDIR=/path/to/binutils/include``. The correct include
49 path will contain the file ``plugin-api.h``.
54 The linker takes a ``-plugin`` option that points to the path of
56 would run in a given situation, run ``gcc -v [...]`` and
58 ``ld-new -plugin /path/to/LLVMgold.so`` to test it out. Once you're
60 then replace it with ``ld-new``.
63 ``-flto``. This flag will also cause ``clang`` to look for the gold plugin in
64 the ``lib`` directory under its prefix and pass the ``-plugin`` option to
68 ``ar`` and ``nm`` also accept the ``-plugin`` option and it's possible to
69 to install ``LLVMgold.so`` to ``/usr/lib/bfd-plugins`` for a seamless setup.
70 If you built your own gold, be sure to install the ``ar`` and ``nm-new`` you
75 ---------------------------------
77 The following example shows a worked example of the gold plugin mixing LLVM
80 .. code-block:: c
82 --- a.c ---
100 --- b.c ---
113 .. code-block:: bash
115 --- command lines ---
116 $ clang -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file
117 $ ar q a.a a.o # <-- a.a is an archive with LLVM bitcode
118 $ clang b.c -c -o b.o # <-- b.o is native object file
119 $ clang -flto a.a b.o -o main # <-- link with LLVMgold plugin
122 leading LLVM to delete that function. However, unlike in the :ref:`libLTO
123 example <libLTO-example>` gold does not currently eliminate foo4.
128 Once your system ``ld``, ``ar``, and ``nm`` all support LLVM bitcode,
132 <lto-how-to-build>`.
136 * Copy ``Release/lib/LLVMgold.so`` to ``$PREFIX/lib/bfd-plugins/``
141 .. code-block:: bash
143 export CC="$PREFIX/bin/clang -flto"
144 export CXX="$PREFIX/bin/clang++ -flto"
147 export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
151 .. code-block:: bash
154 export CC="clang -flto"
155 export CXX="clang++ -flto"
156 export RANLIB=/bin/true
159 .. code-block:: bash
163 The environment variable settings may work for non-autotooled projects too,
170 ``plugin-api.h`` from gold which means that the resulting ``LLVMgold.so``
171 binary is also GPLv3. This can still be used to link non-GPLv3 programs