diff options
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 9 | ||||
-rw-r--r-- | test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index a977dce06bb..fea932078c4 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -453,6 +453,15 @@ void RuntimeDyldELF::resolveAArch64Relocation(const SectionEntry &Section, support::ulittle32_t::ref{TargetPtr} = TargetValue; break; } + case ELF::R_AARCH64_ADD_ABS_LO12_NC: { + // Operation: S + A + uint64_t Result = Value + Addend; + + // Immediate goes in bits 21:10 of LD/ST instruction, taken + // from bits 11:0 of X + *TargetPtr |= ((Result & 0xfff) << 10); + break; + } case ELF::R_AARCH64_LDST32_ABS_LO12_NC: { // Operation: S + A uint64_t Result = Value + Addend; diff --git a/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s b/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s index f83f6bf8793..c57234a906e 100644 --- a/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s +++ b/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s @@ -14,6 +14,9 @@ g: movk x0, #:abs_g1_nc:f # R_AARCH64_MOVW_UABS_G0_NC movk x0, #:abs_g0_nc:f +a: +# R_AARCH64_ADD_ABS_LO12_NC + add x0, x0, :lo12:f ret .Lfunc_end0: .size g, .Lfunc_end0-g @@ -31,3 +34,7 @@ k: # rtdyld-check: *{4}(g + 8) = 0xf2b13560 # rtdyld-check: *{4}(g + 12) = 0xf299bde0 # rtdyld-check: *{8}k = f + +## f & 0xFFF = 0xdef (bits 11:0 of f) +## 0xdef << 10 = 0x37bc00 +# rtdyld-check: *{4}(a) = 0x9137bc00 |