[llvm] r290598 - RuntimeDyldELF: add R_AARCH64_ADD_ABS_LO12_NC reloc
Eugene Leviant via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 27 01:51:39 PST 2016
Author: evgeny777
Date: Tue Dec 27 03:51:38 2016
New Revision: 290598
URL: http://llvm.org/viewvc/llvm-project?rev=290598&view=rev
Log:
RuntimeDyldELF: add R_AARCH64_ADD_ABS_LO12_NC reloc
Differential revision: https://reviews.llvm.org/D28115
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=290598&r1=290597&r2=290598&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Tue Dec 27 03:51:38 2016
@@ -453,6 +453,15 @@ void RuntimeDyldELF::resolveAArch64Reloc
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;
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=290598&r1=290597&r2=290598&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s Tue Dec 27 03:51:38 2016
@@ -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
More information about the llvm-commits
mailing list