[llvm] r313822 - Revert "Revert "ExecutionEngine: add R_AARCH64_ABS{16, 32}""
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 14:32:45 PDT 2017
Author: compnerd
Date: Wed Sep 20 14:32:44 2017
New Revision: 313822
URL: http://llvm.org/viewvc/llvm-project?rev=313822&view=rev
Log:
Revert "Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}""
This reverts commit SVN r313668. The original test case attempted to
write a pointer value into 16-bits, although the value may exceed the
range representable in 16-bits. Ensure that the symbol is located in
the address space such that its absolute address is representable in
16-bits. This should fix the assertion failure that was seen on the
Windows hosts.
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=313822&r1=313821&r2=313822&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Wed Sep 20 14:32:44 2017
@@ -354,6 +354,18 @@ void RuntimeDyldELF::resolveAArch64Reloc
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;
Modified: llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s?rev=313822&r1=313821&r2=313822&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s Wed Sep 20 14:32:44 2017
@@ -1,6 +1,6 @@
# RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %t %s
-# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %t
-
+# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -dummy-extern symbol=0xf00f -check=%s %t
+
.globl Q
.section .dummy, "ax"
Q:
@@ -82,3 +82,14 @@ r:
## f & 0xFFF = 0xdef (bits 11:0 of f)
## 0xdef << 10 = 0x37bc00
# rtdyld-check: *{4}(a) = 0x9137bc00
+
+ .data
+ABS16:
+ .short symbol
+# rtdyld-check: (*{2}ABS16) = symbol[15:0]
+ABS32:
+ .long symbol
+# rtdyld-check: (*{4}ABS32) = symbol[31:0]
+ABS64:
+ .xword symbol
+# rtdyld-check: (*{8}ABS64) = symbol
More information about the llvm-commits
mailing list