[lld] r266610 - Fix handling of R_X86_64_GOT32.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 05:58:59 PDT 2016


Author: rafael
Date: Mon Apr 18 07:58:59 2016
New Revision: 266610

URL: http://llvm.org/viewvc/llvm-project?rev=266610&view=rev
Log:
Fix handling of R_X86_64_GOT32.

It computes the offset to the end of .got.

Modified:
    lld/trunk/ELF/Target.cpp
    lld/trunk/test/ELF/relocation.s

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=266610&r1=266609&r2=266610&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Mon Apr 18 07:58:59 2016
@@ -649,7 +649,7 @@ RelExpr X86_64TargetInfo::getRelExpr(uin
   case R_X86_64_PC32:
     return R_PC;
   case R_X86_64_GOT32:
-    return R_GOT;
+    return R_GOT_FROM_END;
   case R_X86_64_GOTPCREL:
   case R_X86_64_GOTTPOFF:
     return R_GOT_PC;
@@ -869,6 +869,7 @@ void X86_64TargetInfo::relocateOne(uint8
     break;
   case R_X86_64_32S:
   case R_X86_64_TPOFF32:
+  case R_X86_64_GOT32:
     checkInt<32>(Val, Type);
     write32le(Loc, Val);
     break;

Modified: lld/trunk/test/ELF/relocation.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation.s?rev=266610&r1=266609&r2=266610&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation.s (original)
+++ lld/trunk/test/ELF/relocation.s Mon Apr 18 07:58:59 2016
@@ -124,3 +124,11 @@ R_X86_64_GOTPCREL:
 // 7952 = 0x101f0000 in little endian
 // CHECK:      Contents of section .R_X86_64_GOTPCREL
 // CHECK-NEXT:   101d0 201f0000
+
+.section .R_X86_64_GOT32,"a", at progbits
+.global R_X86_64_GOT32
+R_X86_64_GOT32:
+        .long zed at got
+
+// CHECK: Contents of section .R_X86_64_GOT32:
+// CHECK-NEXT: f8ffffff




More information about the llvm-commits mailing list