This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Correct use of "-flto"
- From: John Frankish <j-frankish at slb dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 26 Mar 2013 11:54:08 +0000
- Subject: Correct use of "-flto"
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?
2. I'm removing "-O2" from the Makefiles - do I need to remove "-g" as well?
John