state of lto in gcc 4.6.0

Jack Howarth howarth at bromo.med.uc.edu
Tue Mar 22 10:10:23 PDT 2011


   Just a heads up for the MacPorts gcc46 developers. Unfortunately we had to
disable LTO for darwin10 just before the gcc 4.6.0 release. The new Xcode 3.2.6
and 4.0 has an assmebler 'fix' which effectively broke LTO. We were relying on
the fact that the mach-o specification only dictated less than 256 sections 
when they contained relocations. To avoid problems with the limitation, all of
the GNU LTO sections (which contain no symbols but just lto GIMPLE code) were
placed at the end of the object file. Apple decided in Xcode 3.2.6/4.0 to
enforce a hard limit of 255 sections (regardless of section content) which
breaks the design of LTO since it requires an unlimited number of GNU LTO
sections. 
    This issue won't be fixed for gcc 4.6.0 but a work in progress patch
is available that solves the problem without regression. This should be
present in gcc 4.6.1 and LTO will be enabled on darwin10 again at that point.
          Jack
ps The fix was to containerize the GNU LTO sections using a set of three
mach-o sections for that purpose.


More information about the macports-dev mailing list