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