llvm.org GIT mirror llvm / 9be988a
RuntimeDyldELF: add missing test cases for AArch64 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291438 91177308-0d34-0410-b5e6-96231b3b80d8 Eugene Leviant 3 years ago
2 changed file(s) with 43 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
0 # RUN: llvm-mc -triple=aarch64_be-none-linux-gnu -filetype=obj -o %T/be-reloc.o %s
11 # RUN: llvm-rtdyld -triple=aarch64_be-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %T/be-reloc.o
2
3 .globl Q
4 .section .dummy, "ax"
5 Q:
6 nop
27
38 .text
49 .globl g
2227 .globl k
2328 .p2align 3
2429 k:
25 .xword f
30 .xword f
2631 .size k, 8
32 r:
33 # R_AARCH64_PREL32: use Q instead of f to fit in 32 bits.
34 .word Q - .
2735
2836 # LE instructions read as BE
2937 # rtdyld-check: *{4}(g) = 0x6024e0d2
3139 # rtdyld-check: *{4}(g + 8) = 0x6035b1f2
3240 # rtdyld-check: *{4}(g + 12) = 0xe0bd99f2
3341 # rtdyld-check: *{8}k = f
42 # rtdyld-check: *{4}r = (Q - r)[31:0]
0 # RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %T/reloc.o %s
11 # RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify -dummy-extern f=0x0123456789abcdef -check=%s %T/reloc.o
2
2
3 .globl Q
4 .section .dummy, "ax"
5 Q:
6 nop
7
38 .text
49 .globl g
510 .p2align 2
1318 movk x0, #:abs_g1_nc:f
1419 # R_AARCH64_MOVW_UABS_G0_NC
1520 movk x0, #:abs_g0_nc:f
21 l:
22 # R_AARCH64_LDST32_ABS_LO12_NC
23 ldr s4, [x5, :lo12:a]
24 # R_AARCH64_LDST64_ABS_LO12_NC
25 ldr x4, [x5, :lo12:a]
26 p:
27 # R_AARCH64_ADR_PREL_PG_HI21
28 # Test both low and high immediate values
29 adrp x4, a + 20480 # 16384 + 4096
30 # Align next label to 16 bytes, so that LDST immediate
31 # fields will be non-zero
32 .align 4
1633 a:
1734 # R_AARCH64_ADD_ABS_LO12_NC
1835 add x0, x0, :lo12:f
2643 .p2align 3
2744 k:
2845 .xword f
29 .size k, 8
46 .size k, 16
47 r:
48 # R_AARCH64_PREL32: use Q instead of f to fit in 32 bits.
49 .word Q - .
3050
3151 # rtdyld-check: *{4}(g) = 0xd2e02460
3252 # rtdyld-check: *{4}(g + 4) = 0xf2c8ace0
3353 # rtdyld-check: *{4}(g + 8) = 0xf2b13560
3454 # rtdyld-check: *{4}(g + 12) = 0xf299bde0
55
56 ## Check LDST32_ABS_LO12_NC and LDST64_ABS_LO12_NC
57 # rtdyld-check: (*{4}l)[21:10] = a[11:2]
58 # rtdyld-check: (*{4}(l+4))[21:10] = a[11:3]
59
60 ## Check ADR_PREL_PG_HI21. Low order bits of immediate value
61 ## go to bits 30:29. High order bits go to bits 23:5
62 # rtdyld-check: (*{4}p)[30:29] = (a - p + 20480)[13:12]
63 # rtdyld-check: (*{4}p)[23:5] = (a - p + 20480)[32:14]
64
3565 # rtdyld-check: *{8}k = f
66 # rtdyld-check: *{4}r = (Q - r)[31:0]
3667
3768 ## f & 0xFFF = 0xdef (bits 11:0 of f)
3869 ## 0xdef << 10 = 0x37bc00