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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jan 5 07:14:37 PST 2015


> 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?


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


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


Cheers,
Rafael



More information about the llvm-commits mailing list