[Bug lto/56700] New: 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
Sat Mar 23 19:34:00 GMT 2013


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

             Bug #: 56700
           Summary: Optimizing at compile and link result in different
                    binary size than only optimizing at link time
    Classification: Unclassified
           Product: gcc
           Version: lto
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: uran238@web.de


When I'm building wget (1.14) with CFLAGS=LDFLAGS="-Os -flto" the resulting
binary is about 5-8% smaller than building with CFLGAS="-flto" LDFLAGS="-Os
-flto".

Adding -fno-fat-lto-objects leads to very similar results (~50 Bytes
difference).

Here are the (stripped) sizes:
CFLAGS=-Os LDFLAGS=-Os
gcc-4.7.2: 353904
gcc-4.8.0: 349808

CFLAGS=-O0 -flto LDFLAGS=-Os -flto
gcc-4.7.2: 353408
gcc-4.8.0: 360696

CFLAGS=-Os -flto LDFLAGS=-Os -flto
gcc-4.7.2: 336896
gcc-4.8.0: 332784

So not optimizing for size during compile leads to worse results than omitting
lto at all for gcc-4.8

I thought optimizations can be ommitted completely during compile, when doing
lto.



More information about the Gcc-bugs mailing list