OSDN Git Service

ExecutionEngine: add R_AARCH64_ABS{16,32}
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 19 Sep 2017 18:00:50 +0000 (18:00 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 19 Sep 2017 18:00:50 +0000 (18:00 +0000)
Add support for the R_AARCH64_ABS{16,32} relocations in the execution
engine.  This is primarily used for DWARF debug information relocations
and needed by the LLVM JIT to support JITing for lldb.

Patch by Alex Langford!

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

lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s

index defe64e..a079d95 100644 (file)
@@ -354,6 +354,18 @@ void RuntimeDyldELF::resolveAArch64Relocation(const SectionEntry &Section,
   default:
     llvm_unreachable("Relocation type not implemented yet!");
     break;
+  case ELF::R_AARCH64_ABS16: {
+    uint64_t Result = Value + Addend;
+    assert(static_cast<int64_t>(Result) >= INT16_MIN && Result < UINT16_MAX);
+    write(isBE, TargetPtr, static_cast<uint16_t>(Result & 0xffffU));
+    break;
+  }
+  case ELF::R_AARCH64_ABS32: {
+    uint64_t Result = Value + Addend;
+    assert(static_cast<int64_t>(Result) >= INT32_MIN && Result < UINT32_MAX);
+    write(isBE, TargetPtr, static_cast<uint32_t>(Result & 0xffffffffU));
+    break;
+  }
   case ELF::R_AARCH64_ABS64:
     write(isBE, TargetPtr, Value + Addend);
     break;
index e0015a2..53535c7 100644 (file)
@@ -82,3 +82,16 @@ r:
 ## f & 0xFFF = 0xdef (bits 11:0 of f)
 ## 0xdef << 10 = 0x37bc00
 # rtdyld-check: *{4}(a) = 0x9137bc00
+
+       .data
+laser:
+       .asciz "laser"
+ABS16:
+       .short laser
+# rtdyld-check: (*{2}ABS16) = laser[15:0]
+ABS32:
+       .long laser
+# rtdyld-check: (*{4}ABS32) = laser[31:0]
+ABS64:
+       .xword laser
+# rtdyld-check: (*{8}ABS64) = laser