> On Thu, 6 Mar 2014, Jan Hubicka wrote: > > > > On Tue, 4 Mar 2014, Jan Hubicka wrote: > > > > > > > > > > > > > The following patch addresses the common (?) issue of people > > > > > omitting -flto from the linker command-line which gets more > > > > > severe with GCC 4.9 where slim LTO objects are emitted by > > > > > default. The patch simply _always_ arranges for the linker > > > > > plugin to be used, so if there are any (slim) LTO objects > > > > > on the link LTO will be done on them. Similarly the > > > > > non-linker-plugin path in collect2 is adjusted. > > > > > > > > > > You can still disable this by specifying -fno-lto on the > > > > > linker command-line. > > > > > > > > > > One side-effect of enabling the linker-plugin by default > > > > > (for HAVE_LTO_PLUGIN == 2) is that collect2 will then > > > > > use the configured plugin ld rather than the default ld. > > > > > Not sure if that is desired. > > > > > > > > > > Comments? > > > > > > > > I like it; it was on my TODO list, but I was only worried about > > > > --with-plugin-ld and did not find time, yet, to look into the > > > > consequences. > > > > These days, I do not think we need to worry much aboud --with-plugin-ld. > > > > > > Yeah, I think we should eventually remove that capability. > > > > > > Now as of the two patches (compute a default link-time optimization > > > level and this patch, make considering LTO at link-time the default), > > > they only make sense together (at least the default opt level at > > > link-time doesn't improve real-world situations without also considering > > > all links to be possibly -flto). > > > > > > So the question remains if we want to have both patches at this > > > stage or if we want to wait with them for 4.10 (we do have the > > > user-visible change of slim-lto objects by default with 4.9 > > > already). > > > > I think it makes things easier, so I would like to see this in 4.9 > > Ok. I'll push this to trunk now and then prepare a documentation > update for LTO opts handling (as promised some time ago ...). > > If any issues show up with these two patches then we'll revert > and revisit this for 4.10.
Thanks, I definitely saw issues without these patches even on projects that are kind of LTO enabled, like libreoffice (whose --enable-lto does linking of couple 3rd party libraries without -flto) and firefox (that links everything with -flto but sometimes forget optimization flags). So for a while I am using wrapper script that adds -O3 -flto to gcc command line just to be sure setup is not completely insane. Having this done automatically by a wrapper is nice. Honza > > Thanks, > Richard.