]> granicus.if.org Git - llvm/commitdiff
RuntimeDyldELF: implement R_AARCH64_PREL64 reloc
authorEugene Leviant <eleviant@accesssoftek.com>
Tue, 10 Jan 2017 11:05:30 +0000 (11:05 +0000)
committerEugene Leviant <eleviant@accesssoftek.com>
Tue, 10 Jan 2017 11:05:30 +0000 (11:05 +0000)
Differential revision: https://reviews.llvm.org/D28122

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291558 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 8f6b1849169a9de19b90ca1c0ade1b3084892e77..05615d3cc6cf909818be59df958e6adb3e31061f 100644 (file)
@@ -374,6 +374,9 @@ void RuntimeDyldELF::resolveAArch64Relocation(const SectionEntry &Section,
     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
index a9ec009395043848b3fff4b68182da8e40d453ea..7ef07d72200d3811d095281ea505f05dc64b7f67 100644 (file)
@@ -33,6 +33,9 @@ k:
 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
@@ -41,3 +44,4 @@ r:
 # 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 f9a03ab40667c2b173a751bd2f8f37592f51e491..069170bdf36bdf8fd817ade76737afa0d10dac26 100644 (file)
@@ -47,7 +47,10 @@ k:
         .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 @@ r:
 
 # 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