This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Correct use of "-flto"


> > On Tue, Mar 26, 2013 at 4:54 AM, John Frankish <j-frankish@slb.com> 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).

Is there a patch or another way to be able to compile glibc 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.

I'd seen several posts stating that there were problems with -flto and debug symbols with gcc-4.6.x

> -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.

Is there a way to remove this LTO information (with strip)?
Otherwise I'm going to have to compile with LTO for apps/so libs and again without LTO for static libs...



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]