If I want to compile my project with -flto
is it enough to have built gcc with --enable-gold
or do I also need to build gold and replace ld with it? And do I need any other flags? Ie I'm doing this
gcc -flto one.c two.c
If I want to compile my project with -flto
is it enough to have built gcc with --enable-gold
or do I also need to build gold and replace ld with it? And do I need any other flags? Ie I'm doing this
gcc -flto one.c two.c
According to https://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements,
Furthermore, the GCC documentation for
-fuse-linker-plugin
says:So you don't need
gold
at all, even if you want to use the special "linker plugin" feature to pick up optimization information from object files in library archives.There are usage examples in the
-flto
documentation. Eitheror
will work.
As of GCC 4.9, you don't even need
-flto
for linking:And as of GCC 5: