[llvm] r226503 - Add r224985 back with fixes.

Steven Wu stevenwu at apple.com
Thu Feb 12 14:09:24 PST 2015


Hi Rafael

I don’t have time to dig very deep but your second patch seems to work and you first patch doesn’t.
Thanks for the fix.

Steven

> On Feb 12, 2015, at 10:13 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
>> The section contains just pointers (to classes) (like a GOT). The linker coalesces duplicate pointers across translation units.  The linker knows to break up the section into pointer sized atoms, regardless of labels.
>> 
>> The problem is that the assembler is adding a ltmpNNN label at the start of the section, then using extern relocations to reference any pointer.  For instance an ADRP to the third pointer in the section looks to the linker like:
>>     ADRP x8, ltmp123 + 16
>> 
>> The symbol ltmp123 gets associated with the first pointer, after coalescing  ltmp123 + 16 can wind up pointing to the wrong pointer.
>> 
>> It might work to have zero labels in that section (although that has not been tested), or to have labels on each pointer (for use by the ADRP references).
> 
> Makes sense. Would using internal relocations work?
> 
> The attached patch goes the way of using the original symbol.
> 
> Cheers,
> Rafael
> <t.patch>





More information about the llvm-commits mailing list