[PATCH] X86: Work around a bfd ld quirk wrt GOTTPOFF relocation processing

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jan 5 09:24:35 PST 2015


>> What is wrong with this transformation? Why can't bfd ld do the same?
>
> See:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=17795

Awesome. Thank you so much!

>>
>> Adding a dummy rex also doesn't help. BFD errors on
>>
>>
>> main:
>>         movq    %fs:0, %rax
>>         rex addl        external_ie at GOTTPOFF(%rip), %eax
>>         retq
>
> This is supported only for x32 since x32 is limited to 32-bit
> address space.   How do you know R_X86_64_GOTTPOFF
> won't overflow 32-bit register in 64-bit address space?

We don't, but this will only show up if the user code is explicitly
requesting only the low 32 bits.

In any case, not doing the transformation (i.e., this patch) looks
like the right thing.

>>
>> In any case. This is at least a bfd ld limitation and we should work
>> around it. This patch LGTM.

Please just update the comment to point out it is not a bug :-)

Thanks,
Rafael



More information about the llvm-commits mailing list