[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 10:50:59 PDT 2018


MaskRay added a comment.

The offsets do not change before/after the patch.

In https://reviews.llvm.org/D47507#1118648, @peter.smith wrote:

> Apologies I don't know x86 well enough to be authoritative here. It looks like at least the test case needs to use %rip to see a meaningful difference in the output of mc.


Yes, r_addend is different in GNU as (RIP is relative to the next instruction) and llvm-mc (before or after the patch: relative to the currect instruction):

  leaq  _GLOBAL_OFFSET_TABLE_(%rax), %r15

But the following is correct (relative to the RIP of the next instruction):

  leaq  _GLOBAL_OFFSET_TABLE_(%rip), %r15


Repository:
  rL LLVM

https://reviews.llvm.org/D47507





More information about the llvm-commits mailing list