[PATCH] D28122: RuntimeDyldELF: implement R_AARCH64_PREL64 reloc

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 04:47:34 PST 2017


evgeny777 updated this revision to Diff 83612.
evgeny777 added a comment.

Diff updated to reflect latest changes


https://reviews.llvm.org/D28122

Files:
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_BE-relocations.s
  test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s


Index: test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
===================================================================
--- test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
+++ test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
@@ -47,7 +47,10 @@
         .size   k, 16
 r:
 # R_AARCH64_PREL32: use Q instead of f to fit in 32 bits.
-        .word  Q - .
+        .word  Q - .        
+# R_AARCH64_PREL64
+        .p2align        3
+        .xword f - .
 
 # rtdyld-check: *{4}(g) = 0xd2e02460
 # rtdyld-check: *{4}(g + 4) = 0xf2c8ace0
@@ -65,6 +68,7 @@
 
 # rtdyld-check: *{8}k = f
 # rtdyld-check: *{4}r = (Q - r)[31:0]
+# rtdyld-check: *{8}(r + 8) = f - r - 8
 
 ## f & 0xFFF = 0xdef (bits 11:0 of f)
 ## 0xdef << 10 = 0x37bc00
Index: test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_BE-relocations.s
===================================================================
--- test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_BE-relocations.s
+++ test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_BE-relocations.s
@@ -33,11 +33,15 @@
 r:
 # R_AARCH64_PREL32: use Q instead of f to fit in 32 bits.
         .word  Q - .
+# R_AARCH64_PREL64
+        .p2align        3
+        .xword f - .
 
 # LE instructions read as BE
 # rtdyld-check: *{4}(g) = 0x6024e0d2
 # rtdyld-check: *{4}(g + 4) = 0xe0acc8f2
 # rtdyld-check: *{4}(g + 8) = 0x6035b1f2
 # rtdyld-check: *{4}(g + 12) = 0xe0bd99f2
 # rtdyld-check: *{8}k = f
 # rtdyld-check: *{4}r = (Q - r)[31:0]
+# rtdyld-check: *{8}(r + 8) = f - r - 8
Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -374,6 +374,9 @@
     write(isBE, TargetPtr, static_cast<uint32_t>(Result & 0xffffffffU));
     break;
   }
+  case ELF::R_AARCH64_PREL64:
+    write(isBE, TargetPtr, Value + Addend - FinalAddress);
+    break;
   case ELF::R_AARCH64_CALL26: // fallthrough
   case ELF::R_AARCH64_JUMP26: {
     // Operation: S+A-P. Set Call or B immediate value to bits fff_fffc of the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28122.83612.patch
Type: text/x-patch
Size: 2155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170109/f766c1b1/attachment.bin>


More information about the llvm-commits mailing list