I am reading:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
It first suggests:
In combination with -flto
using this option (-fwhole-program
) should not be used. Instead relying on a linker plugin should provide safer and more precise information.
And then, it suggests:
If the program does not require any symbols to be exported, it is possible to combine -flto
and -fwhole-program
to allow the interprocedural optimizers to use more aggressive assumptions which may lead to improved optimization opportunities. Use of -fwhole-program
is not needed when linker plugin is active (see -fuse-linker-plugin
).
Does it mean that in theory, using -fuse-linker-plugin
with -flto
always gets a better optimized executable than using -fwhole-program
with -flto
?
I tried to use ld
to link with -fuse-linker-plugin
and -fwhole-program
separately, and the executables' sizes at least are different.
P.S. I am using gcc 4.6.2, and ld 2.21.53.0.1 on CentOS 6.