* Török Edwin wrote on Fri, Mar 26, 2010 at 12:33:14PM CET:
> In fact -O* flags need to be passed to the linker too for LTO to do any
> optimizations at all.

Yup.

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

> Also -fuser-linker-plugin needs to be passed on by libtool.

Yes, I gues libtool should support -fuse-linker-plugin too.

> In fact for LTO I think it'd make sense to pass all of CFLAGS/CXXFLAGS
> to the linker, since they affect code generation at link time now.
> Or document the fact that you need to export LDFLAGS="$CFLAGS" if you
> want LTO to work.

When you use Automake to create your makefiles, then $(CFLAGS) is passed
on the C linker command line already.  Using LDFLAGS=$CFLAGS will not
buy you anything.  This issue is purely about which flags libtool passes
through to the compiler driver.

If you mix several languages in your package, you may need to add -flto
to all per-language flags.

Cheers,
Ralf



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to