aboutsummaryrefslogtreecommitdiff
path: root/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s')
-rw-r--r--test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s35
1 files changed, 33 insertions, 2 deletions
diff --git a/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s b/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
index c57234a906e3..f9a03ab40667 100644
--- a/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
+++ b/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
@@ -1,6 +1,11 @@
# RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %T/reloc.o %s
# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %T/reloc.o
-
+
+ .globl Q
+ .section .dummy, "ax"
+Q:
+ nop
+
.text
.globl g
.p2align 2
@@ -14,6 +19,18 @@ g:
movk x0, #:abs_g1_nc:f
# R_AARCH64_MOVW_UABS_G0_NC
movk x0, #:abs_g0_nc:f
+l:
+# R_AARCH64_LDST32_ABS_LO12_NC
+ ldr s4, [x5, :lo12:a]
+# R_AARCH64_LDST64_ABS_LO12_NC
+ ldr x4, [x5, :lo12:a]
+p:
+# R_AARCH64_ADR_PREL_PG_HI21
+# Test both low and high immediate values
+ adrp x4, a + 20480 # 16384 + 4096
+# Align next label to 16 bytes, so that LDST immediate
+# fields will be non-zero
+ .align 4
a:
# R_AARCH64_ADD_ABS_LO12_NC
add x0, x0, :lo12:f
@@ -27,13 +44,27 @@ a:
.p2align 3
k:
.xword f
- .size k, 8
+ .size k, 16
+r:
+# R_AARCH64_PREL32: use Q instead of f to fit in 32 bits.
+ .word Q - .
# rtdyld-check: *{4}(g) = 0xd2e02460
# rtdyld-check: *{4}(g + 4) = 0xf2c8ace0
# rtdyld-check: *{4}(g + 8) = 0xf2b13560
# rtdyld-check: *{4}(g + 12) = 0xf299bde0
+
+## Check LDST32_ABS_LO12_NC and LDST64_ABS_LO12_NC
+# rtdyld-check: (*{4}l)[21:10] = a[11:2]
+# rtdyld-check: (*{4}(l+4))[21:10] = a[11:3]
+
+## Check ADR_PREL_PG_HI21. Low order bits of immediate value
+## go to bits 30:29. High order bits go to bits 23:5
+# rtdyld-check: (*{4}p)[30:29] = (a - p + 20480)[13:12]
+# rtdyld-check: (*{4}p)[23:5] = (a - p + 20480)[32:14]
+
# rtdyld-check: *{8}k = f
+# rtdyld-check: *{4}r = (Q - r)[31:0]
## f & 0xFFF = 0xdef (bits 11:0 of f)
## 0xdef << 10 = 0x37bc00