[PATCH] D47098: [ELF] Make R_GOTONLY_PC_FROM_END R_GOTREL_FROM_END relative to _GLOBAL_OFFSET_TABLE_ instead of end of .got

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 08:39:37 PDT 2018


grimar added a comment.

x86_64 ABI uses GOTPC32/GOTPC64 relocations for _GLOBAL_OFFSET_TABLE_:
(p40 https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf)

So I think llvm-mc need fix and the solution to support R_X86_64_GOTPC{32,64} is:

1. Make llvm-mc to emit R_X86_64_GOTPC32 instead of R_X86_64_PC32 when _GLOBAL_OFFSET_TABLE_ is involved.
2. Teach LLD about type (R_GOTONLY_PC_FROM_END) of new relocations R_X86_64_GOTPC32/R_X86_64_GOTPC64 (X86_64.cpp part of this patch). Do not change the logic in ELF/InputSection.cpp or anything else, resolve these relocations as we already do, against the end of .got.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47098





More information about the llvm-commits mailing list