Taints the non-acquire RMW's store address with the load part
[oota-llvm.git] / test / ExecutionEngine / RuntimeDyld / AArch64 / MachO_ARM64_relocations.s
1 # RUN: llvm-mc -triple=arm64-apple-ios7.0.0 -code-model=small -relocation-model=pic -filetype=obj -o %T/foo.o %s
2 # RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -map-section foo.o,__text=0x10bc0 -verify -check=%s %/T/foo.o
3
4     .section  __TEXT,__text,regular,pure_instructions
5     .ios_version_min 7, 0
6     .globl  _foo
7     .align  2
8 _foo:
9     movz  w0, #0
10     ret
11
12     .globl  _test_branch_reloc
13     .align  2
14
15
16 # Test ARM64_RELOC_BRANCH26 relocation. The branch instruction only encodes 26
17 # bits of the 28-bit possible branch range. The lower two bits are always zero
18 # and therefore ignored.
19 # rtdyld-check:  decode_operand(br1, 0)[25:0] = (_foo - br1)[27:2]
20 _test_branch_reloc:
21 br1:
22     b _foo
23     ret
24
25
26 # Test ARM64_RELOC_PAGE21 and ARM64_RELOC_PAGEOFF12 relocation. adrp encodes
27 # the PC-relative page (4 KiB) difference between the adrp instruction and the
28 # variable ptr. ldr encodes the offset of the variable within the page. The ldr
29 # instruction perfroms an implicit shift on the encoded immediate (imm<<3).
30 # rtdyld-check:  decode_operand(adrp1, 1) = (_ptr[32:12] - adrp1[32:12])
31 # rtdyld-check:  decode_operand(ldr1, 2) = _ptr[11:3]
32     .globl  _test_adrp_ldr
33     .align  2
34 _test_adrp_ldr:
35 adrp1:
36     adrp x0, _ptr@PAGE
37 ldr1:
38     ldr  x0, [x0, _ptr@PAGEOFF]
39     ret
40
41 # Test ARM64_RELOC_GOT_LOAD_PAGE21 and ARM64_RELOC_GOT_LOAD_PAGEOFF12
42 # relocation. adrp encodes the PC-relative page (4 KiB) difference between the
43 # adrp instruction and the GOT entry for ptr. ldr encodes the offset of the GOT
44 # entry within the page. The ldr instruction perfroms an implicit shift on the
45 # encoded immediate (imm<<3).
46 # rtdyld-check:  *{8}(stub_addr(foo.o, __text, _ptr)) = _ptr
47 # rtdyld-check:  decode_operand(adrp2, 1) = (stub_addr(foo.o, __text, _ptr)[32:12] - adrp2[32:12])
48 # rtdyld-check:  decode_operand(ldr2, 2) = stub_addr(foo.o, __text, _ptr)[11:3]
49     .globl  _test_adrp_ldr
50     .align  2
51 _test_got_adrp_ldr:
52 adrp2:
53     adrp x0, _ptr@GOTPAGE
54 ldr2:
55     ldr  x0, [x0, _ptr@GOTPAGEOFF]
56     ret
57
58 # rtdyld-check: decode_operand(add1, 2) = (tgt+8)[11:2] << 2
59     .globl  _test_explicit_addend_reloc
60     .align  4
61 _test_explicit_addend_reloc:
62 add1:
63     add x0, x0, tgt@PAGEOFF+8
64
65     .align  3
66 tgt:
67     .long 0
68     .long 0
69     .long 7
70
71 # Test ARM64_RELOC_UNSIGNED relocation. The absolute 64-bit address of the
72 # function should be stored at the 8-byte memory location.
73 # rtdyld-check: *{8}_ptr = _foo
74     .section  __DATA,__data
75     .globl  _ptr
76     .align  3
77     .fill 4096, 1, 0
78 _ptr:
79     .quad _foo