[PATCH] D47507: [MC] [X86] Teach leaq _GLOBAL_OFFSET_TABLE(%rip), %r15 to use R_X86_64_GOTPC32 instead of R_X86_64_PC32

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 1 11:13:57 PDT 2018


MaskRay added a comment.

Added the test`leaq  _GLOBAL_OFFSET_TABLE_(%rip), %r15` along with `leaq  _GLOBAL_OFFSET_TABLE_(%rax), %r15`

The behavior of GNU as is weird (it is relative neither the current instruction nor the next, but the relocation position).
https://gmplib.org/repo/gmp/file/tip/mpn/x86/README#l361 notes that instructions like `leal  _GLOBAL_OFFSET_TABLE_(%edi), %ebx` can be assembled incorrectly.

I think the current llvm-mc behavior is fine and it is consistent with another test `test/MC/ELF/global-offset.s`.


Repository:
  rL LLVM

https://reviews.llvm.org/D47507





More information about the llvm-commits mailing list