[PATCH] D48058: Handle R_X86_64_GOTOFF64.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 12 13:31:36 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL334534: Handle R_X86_64_GOTOFF64. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48058?vs=150868&id=151013#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48058

Files:
  lld/trunk/ELF/Arch/X86_64.cpp
  lld/trunk/test/ELF/x86-64-reloc-gotoff64.s


Index: lld/trunk/test/ELF/x86-64-reloc-gotoff64.s
===================================================================
--- lld/trunk/test/ELF/x86-64-reloc-gotoff64.s
+++ lld/trunk/test/ELF/x86-64-reloc-gotoff64.s
@@ -0,0 +1,17 @@
+// REQUIRES: x86
+
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: ld.lld -shared -o %t.so %t.o
+// RUN: llvm-readelf -sections %t.so | FileCheck %s
+// RUN: llvm-objdump -d %t.so | FileCheck -check-prefix=DISASM %s
+
+// CHECK: .dynamic DYNAMIC  0000000000002000 002000
+// CHECK: .got     PROGBITS 0000000000002070 002070
+
+// DISASM: 1000: 48 ba 90 ff ff ff ff ff ff ff   movabsq $-112, %rdx
+
+.global _start
+.weak _DYNAMIC
+.hidden _DYNAMIC
+_start:
+  movabsq $_DYNAMIC at GOTOFF, %rdx
Index: lld/trunk/ELF/Arch/X86_64.cpp
===================================================================
--- lld/trunk/ELF/Arch/X86_64.cpp
+++ lld/trunk/ELF/Arch/X86_64.cpp
@@ -105,6 +105,8 @@
   case R_X86_64_REX_GOTPCRELX:
   case R_X86_64_GOTTPOFF:
     return R_GOT_PC;
+  case R_X86_64_GOTOFF64:
+    return R_GOTREL;
   case R_X86_64_GOTPC32:
   case R_X86_64_GOTPC64:
     return R_GOTONLY_PC_FROM_END;
@@ -323,6 +325,7 @@
   case R_X86_64_PC64:
   case R_X86_64_SIZE64:
   case R_X86_64_GOT64:
+  case R_X86_64_GOTOFF64:
   case R_X86_64_GOTPC64:
     write64le(Loc, Val);
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48058.151013.patch
Type: text/x-patch
Size: 1341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180612/1a350a9d/attachment.bin>


More information about the llvm-commits mailing list