diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index defe64e4445..a079d95a50f 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -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(Result) >= INT16_MIN && Result < UINT16_MAX); + write(isBE, TargetPtr, static_cast(Result & 0xffffU)); + break; + } + case ELF::R_AARCH64_ABS32: { + uint64_t Result = Value + Addend; + assert(static_cast(Result) >= INT32_MIN && Result < UINT32_MAX); + write(isBE, TargetPtr, static_cast(Result & 0xffffffffU)); + break; + } case ELF::R_AARCH64_ABS64: write(isBE, TargetPtr, Value + Addend); break; diff --git a/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s b/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s index e0015a2b23f..53535c7fe4a 100644 --- a/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s +++ b/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s @@ -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