[patch] LTO support for Mach-O (apple-darwin)

Steven Bosscher stevenb.gcc@gmail.com
Wed May 5 06:09:00 GMT 2010


On Wed, May 5, 2010 at 5:26 AM, IainS <idsandoe@googlemail.com> wrote:
>
> On 2 May 2010, at 03:53, Steven Bosscher wrote:
>>
>> This patch adds support for LTO on Mach-O targets, i.e. darwin.
>
> Bravo!
>
>> There are a couple of funny things this patch does to make LTO work on
>> Mach-O. The most noticeable is that I had to capture assembler output
>> in the LTO generate phase and redirect it to a temporary file. The
>> reason is that you can only define relocations in a relocatable Mach-O
>> object for the first 255 sections, although there doesn't seem to be a
>> limit to the number of sections you can add. So I want all non-LTO
>> sections output before the LTO sections.
>
> I want to understand this better -- I don't think we name anything like 255
> distinct sections (even with OBJC2 ones in place).

You have way more than 255 distinct named sections with LTO. All LTO
function bodies and meta data are written to separate sections.

The problem is with the relocations, and possibly other data
structures, in Mach-O. Apparently you can only define relocations in
the first 255 sections, and after that the section counter in one of
the relocation data structs wraps around. At least, that's what a
cctools guy said in the radar issue we opened for this problem.

Ciao!
Steven



More information about the Gcc-patches mailing list