* Török Edwin wrote on Fri, Mar 26, 2010 at 08:45:44PM CET:
> There's also a caveat (or rather compiler bug): using one -O level when
> compiling, and another when linking doesn't really work:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42402

Yes.

> >> So if I call gcc -O2 -flto x.o y.o, libtool will need to pass both -O2
> >> and -flto. And of course any -f* -m* flags that affect code generation.
> > 
> > -m* is passed through by libtool.
> 
> Ok, but I think -f* should be passed too, they affect code generation as
> well, especially -fPIC.

Well, we simply cannot pass all of -f* through.  -fPIC should be added
by libtool itself.

> Apparently even if you compile ALL the individual files with -fPIC,
> you need to pass -fPIC on the link command-line too, otherwise you get a
> failure when building shared libs (that relocation error message that
> tells you to use -fPIC).
> I consider this rather a gcc bug (it should know that -shared needs
> -fPIC for -flto), see here #575451.
> 
> Or do you think libtool should handle this?

Yes.

> >> Also -fuser-linker-plugin needs to be passed on by libtool.
> > 
> > Yes, I gues libtool should support -fuse-linker-plugin too.
> 
> Ok.

> BTW I'm using a simple hack for now, I set
> new_inherited_linker_flags="-flto -O2", and that allows me to test LTO.

You should be able to use ./configure CC='gcc -flto -O2' too.

Cheers,
Ralf



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to