Re: Correct use of "-flto"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 26, 2013 at 4:54 AM, John Frankish <j-frankish@xxxxxxx> wrote:
> I've been experimenting with "-flto" to compile various source packages.
>
> Using binutils-2.23.1 and gcc-4.7.2, both compiled with "--enable-lto"
>
> and
>
> CC="gcc -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe  -fno-exceptions -fno-rtti" ./configure --yada-yada
>
>
> glibc-2.17 ./configure fails complaining that ld does not support array something or other (removing "-flto -fuse-linker-plugin" fixes this).
>
> apps are generally 0-20% smaller than without "-flto -fuse-linker-plugin"
>
> dynamic libs are generally 0-20% smaller than without "-flto -fuse-linker-plugin"
>
> static libs are generally much larger than without "-flto -fuse-linker-plugin" (a few 100kb without lto to several mb with lto)
>
>
> 1. Am I using "-flto" correctly?

Seems like it.


> 2. I'm removing "-O2" from the Makefiles - do I need to remove "-g" as well?

It depends on whether you want debug info or not.  It doesn't really
have anything to do with -flto.

-O2 vs. -Os also doesn't really have anything to do with -flto.  -flto
will work with both.

Your static libraries are larger because they now include LTO
information used at link time.  The increase in size is not relevant
to the final linked program.

Ian




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux