[PATCH] D18301: [ELF] - Process R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX relocations.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 20 03:00:47 PDT 2016

grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

That should fix the Bug 26995 - [regression] unrecognized reloc 42 (https://llvm.org/bugs/show_bug.cgi?id=26995).

R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX relocations were added in latest ABI:

They should be generated instead of R_X86_64_GOTPCREL for cases when relaxation is possible.
Currently this patch just process them in the same way like R_X86_64_GOTPCREL. That should work for now
and we can implement relaxations later.

Patch implementing relaxations was posted before and on review now (http://reviews.llvm.org/D15779).

There is no testcases provided as I think there is no way to generate such relocations using llvm-mc atm.



Index: ELF/Target.cpp
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -736,7 +736,8 @@
 bool X86_64TargetInfo::refersToGotEntry(uint32_t Type) const {
-  return Type == R_X86_64_GOTPCREL;
+  return Type == R_X86_64_GOTPCREL || Type == R_X86_64_GOTPCRELX ||
+         Type == R_X86_64_REX_GOTPCRELX;
 bool X86_64TargetInfo::needsGot(uint32_t Type, SymbolBody &S) const {
@@ -934,6 +935,8 @@
     write32le(Loc, SA);
   case R_X86_64_GOTPCREL:
+  case R_X86_64_GOTPCRELX:
+  case R_X86_64_REX_GOTPCRELX:
   case R_X86_64_PC32:
   case R_X86_64_PLT32:
   case R_X86_64_TLSGD:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18301.51125.patch
Type: text/x-patch
Size: 656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160320/6d08560d/attachment.bin>

More information about the llvm-commits mailing list