Commit 09f15d1b by Tobias Burnus Committed by Tobias Burnus

invoke.texi (-flto): Expand section about using static libraries with LTO.

2014-03-24  Tobias Burnus  <burnus@net-b.de>

        * doc/invoke.texi (-flto): Expand section about
        using static libraries with LTO.

From-SVN: r208798
parent 6f6c00f3
2014-03-24 Tobias Burnus <burnus@net-b.de>
* doc/invoke.texi (-flto): Expand section about
using static libraries with LTO.
2014-03-24 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> 2014-03-24 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
PR rtl-optimization/60501 PR rtl-optimization/60501
......
...@@ -8664,8 +8664,13 @@ regular (non-LTO) compilation. ...@@ -8664,8 +8664,13 @@ regular (non-LTO) compilation.
If object files containing GIMPLE bytecode are stored in a library archive, say If object files containing GIMPLE bytecode are stored in a library archive, say
@file{libfoo.a}, it is possible to extract and use them in an LTO link if you @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
are using a linker with plugin support. To enable this feature, use are using a linker with plugin support. To create static libraries suitable
the flag @option{-fuse-linker-plugin} at link time: for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
and @code{ranlib}; to show the symbols of object files with GIMPLE bytecode, use
@command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
and @command{nm} have been compiled with plugin support. At link time, use the the
flag @option{-fuse-linker-plugin} to ensure that the library participates in
the LTO optimization process:
@smallexample @smallexample
gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
...@@ -8678,7 +8683,9 @@ to make them part of the aggregated GIMPLE image to be optimized. ...@@ -8678,7 +8683,9 @@ to make them part of the aggregated GIMPLE image to be optimized.
If you are not using a linker with plugin support and/or do not If you are not using a linker with plugin support and/or do not
enable the linker plugin, then the objects inside @file{libfoo.a} enable the linker plugin, then the objects inside @file{libfoo.a}
are extracted and linked as usual, but they do not participate are extracted and linked as usual, but they do not participate
in the LTO optimization process. in the LTO optimization process. In order to make a static library suitable
for both LTO optimization and usual linkage, compile its object files with
@option{-flto} @code{-ffat-lto-objects}.
Link-time optimizations do not require the presence of the whole program to Link-time optimizations do not require the presence of the whole program to
operate. If the program does not require any symbols to be exported, it is operate. If the program does not require any symbols to be exported, it is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment