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: sed "s,<filename>,%/T/foo.o,g" %s > %T/foo.s
3 # RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -verify -check=%T/foo.s %/T/foo.o
6 .section __TEXT,__text,regular,pure_instructions
14 .globl _test_branch_reloc
18 # Test ARM64_RELOC_BRANCH26 relocation. The branch instruction only encodes 26
19 # bits of the 28-bit possible branch range. The lower two bits are always zero
20 # and therefore ignored.
21 # rtdyld-check: decode_operand(br1, 0)[25:0] = (_foo - br1)[27:2]
28 # Test ARM64_RELOC_PAGE21 and ARM64_RELOC_PAGEOFF12 relocation. adrp encodes
29 # the PC-relative page (4 KiB) difference between the adrp instruction and the
30 # variable ptr. ldr encodes the offset of the variable within the page. The ldr
31 # instruction perfroms an implicit shift on the encoded immediate (imm<<3).
32 # rtdyld-check: decode_operand(adrp1, 1) = (_ptr[32:12] - adrp1[32:12])
33 # rtdyld-check: decode_operand(ldr1, 2) = (_ptr[11:3])
40 ldr x0, [x0, _ptr@PAGEOFF]
44 # Test ARM64_RELOC_GOT_LOAD_PAGE21 and ARM64_RELOC_GOT_LOAD_PAGEOFF12
45 # relocation. adrp encodes the PC-relative page (4 KiB) difference between the
46 # adrp instruction and the GOT entry for ptr. ldr encodes the offset of the GOT
47 # entry within the page. The ldr instruction perfroms an implicit shift on the
48 # encoded immediate (imm<<3).
49 # rtdyld-check: *{8}(stub_addr(<filename>, __text, _ptr)) = _ptr
50 # rtdyld-check: decode_operand(adrp2, 1) = (stub_addr(<filename>, __text, _ptr)[32:12] - adrp2[32:12])
51 # rtdyld-check: decode_operand(ldr2, 2) = (stub_addr(<filename>, __text, _ptr)[11:3])
58 ldr x0, [x0, _ptr@GOTPAGEOFF]
62 # Test ARM64_RELOC_UNSIGNED relocation. The absolute 64-bit address of the
63 # function should be stored at the 8-byte memory location.
64 # rtdyld-check: *{8}_ptr = _foo
65 .section __DATA,__data