[PATCH] X86: Work around a bfd ld quirk wrt GOTTPOFF relocation processing
H.J. Lu
hjl.tools at gmail.com
Mon Jan 5 08:48:49 PST 2015
On Mon, Jan 5, 2015 at 7:14 AM, Rafael EspĂndola
<rafael.espindola at gmail.com> wrote:
>> It is due to the requirement of the REX prefix for IE->LE optimization:
>
> Not sure I follow.
>
> Given
>
>
> main:
> movl %fs:0, %eax
> addl external_ie at GOTTPOFF(%rip), %eax
> retq
>
> gold produces
>
> 0000000000400590 <main>:
> 400590: 64 8b 04 25 00 00 00 mov %fs:0x0,%eax
> 400597: 00
> 400598: 8d 80 fc ff ff ff lea -0x4(%rax),%eax
> 40059e: c3 retq
>
> What is wrong with this transformation? Why can't bfd ld do the same?
See:
https://sourceware.org/bugzilla/show_bug.cgi?id=17795
>
> 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?
>
> In any case. This is at least a bfd ld limitation and we should work
> around it. This patch LGTM.
>
--
H.J.
More information about the llvm-commits
mailing list