[lld] r264043 - [ELF] - Process R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX relocations.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 05:15:27 PDT 2016


Author: grimar
Date: Tue Mar 22 07:15:26 2016
New Revision: 264043

URL: http://llvm.org/viewvc/llvm-project?rev=264043&view=rev
Log:
[ELF] - Process R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX relocations.

R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX relocations were added in latest ABI:
https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-r249.pdf

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.

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

Differential revision: http://reviews.llvm.org/D18301

Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=264043&r1=264042&r2=264043&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Mar 22 07:15:26 2016
@@ -736,7 +736,8 @@ bool X86_64TargetInfo::needsCopyRelImpl(
 }
 
 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 @@ void X86_64TargetInfo::relocateOne(uint8
     write32le(Loc, SA);
     break;
   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:




More information about the llvm-commits mailing list