[Bug lto/56700] Optimizing at compile and link result in different binary size than only optimizing at link time

uran238 at web dot de gcc-bugzilla@gcc.gnu.org
Tue Mar 26 18:46:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56700

uran238 at web dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #2 from uran238 at web dot de 2013-03-26 18:46:25 UTC ---
> where did you get this info from?

>From the man page:

<snip>
The only important thing to keep in mind is that to enable link-time
optimizations the -flto flag needs to be passed to both the compile and the
link commands. 
[...]
Additionally, the optimization flags used to compile individual files are not
necessarily related to those used at link time. For instance, 



        gcc -c -O0 -flto foo.c
        gcc -c -O0 -flto bar.c
        gcc -o myprog -flto -O3 foo.o bar.o



 This produces individual object files with unoptimized assembler code, but the
resulting binary myprog is optimized at -O3. If, instead, the final binary is
generated without -flto, then myprog is not optimized.
</snip>

Misleading at best.
If "the resulting binary" "is optimized at -O3", but that's not the same as
optimizing the individual object files and the resulting binary at -O3, that's
definitely worth mentioning.
Please clarify that in the man page. It's not just me who concluded that wrong.



More information about the Gcc-bugs mailing list