diff options
author | Juergen Ributzka <juergen@apple.com> | 2014-07-23 22:23:17 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2014-07-23 22:23:17 +0000 |
commit | fa154f03d1e2f356f862e2f6960f4dca3ea4bf87 (patch) | |
tree | 782cf6def83aea78a3eebe22fb8cec79e636cf40 /llvm/test/ExecutionEngine | |
parent | 9d9167950e038bb2b7aa7f958f647b6e232583cc (diff) | |
download | bcm5719-llvm-fa154f03d1e2f356f862e2f6960f4dca3ea4bf87.tar.gz bcm5719-llvm-fa154f03d1e2f356f862e2f6960f4dca3ea4bf87.zip |
[RuntimeDyld][AArch64] Update relocation tests and also add a simple GOT test.
llvm-svn: 213807
Diffstat (limited to 'llvm/test/ExecutionEngine')
-rw-r--r-- | llvm/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/llvm/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s b/llvm/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s index f76cf0cca32..fd4fd9acf35 100644 --- a/llvm/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s +++ b/llvm/test/ExecutionEngine/RuntimeDyld/AArch64/MachO_ARM64_relocations.s @@ -1,15 +1,13 @@ -# RUN: llvm-mc -triple=arm64-apple-ios7.0.0 -code-model=small -relocation-model=pic -filetype=obj -o %t.o %s -# RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -verify -check=%s %t.o -# RUN: rm %t.o +# RUN: llvm-mc -triple=arm64-apple-ios7.0.0 -code-model=small -relocation-model=pic -filetype=obj -o %T/foo.o %s +# RUN: sed "s,<filename>,%/T/foo.o,g" %s > %T/foo.s +# RUN: llvm-rtdyld -triple=arm64-apple-ios7.0.0 -verify -check=%T/foo.s %/T/foo.o # XFAIL: mips -# FIXME: Add GOT relocation tests once GOT testing is supported. - .section __TEXT,__text,regular,pure_instructions .ios_version_min 7, 0 - .globl foo + .globl _foo .align 2 -foo: +_foo: movz w0, #0 ret @@ -20,36 +18,53 @@ foo: # Test ARM64_RELOC_BRANCH26 relocation. The branch instruction only encodes 26 # bits of the 28-bit possible branch range. The lower two bits are always zero # and therefore ignored. -# rtdyld-check: decode_operand(br1, 0)[25:0] = (foo-br1)[27:2] +# rtdyld-check: decode_operand(br1, 0)[25:0] = (_foo - br1)[27:2] _test_branch_reloc: br1: - b foo + b _foo ret -# Test ARM64_RELOC_UNSIGNED relocation. The absolute 64-bit address of the -# function should be stored at the 8-byte memory location. -# rtdyld-check: *{8}ptr = foo - .section __DATA,__data - .globl ptr - .align 3 - .fill 8192, 1, 0 -ptr: - .quad foo - - # Test ARM64_RELOC_PAGE21 and ARM64_RELOC_PAGEOFF12 relocation. adrp encodes # the PC-relative page (4 KiB) difference between the adrp instruction and the # variable ptr. ldr encodes the offset of the variable within the page. The ldr # instruction perfroms an implicit shift on the encoded immediate (imm<<3). -# rtdyld-check: decode_operand(adrp1, 1) = (ptr[32:12]-adrp1[32:12]) -# rtdyld-check: decode_operand(ldr1, 2) = (ptr[11:3]) +# rtdyld-check: decode_operand(adrp1, 1) = (_ptr[32:12] - adrp1[32:12]) +# rtdyld-check: decode_operand(ldr1, 2) = (_ptr[11:3]) .globl _test_adrp_ldr .align 2 _test_adrp_ldr: adrp1: - adrp x0, ptr@PAGE + adrp x0, _ptr@PAGE ldr1: - ldr x0, [x0, ptr@PAGEOFF] + ldr x0, [x0, _ptr@PAGEOFF] + ret + + +# Test ARM64_RELOC_GOT_LOAD_PAGE21 and ARM64_RELOC_GOT_LOAD_PAGEOFF12 +# relocation. adrp encodes the PC-relative page (4 KiB) difference between the +# adrp instruction and the GOT entry for ptr. ldr encodes the offset of the GOT +# entry within the page. The ldr instruction perfroms an implicit shift on the +# encoded immediate (imm<<3). +# rtdyld-check: *{8}(stub_addr(<filename>, __text, _ptr)) = _ptr +# rtdyld-check: decode_operand(adrp2, 1) = (stub_addr(<filename>, __text, _ptr)[32:12] - adrp2[32:12]) +# rtdyld-check: decode_operand(ldr2, 2) = (stub_addr(<filename>, __text, _ptr)[11:3]) + .globl _test_adrp_ldr + .align 2 +_test_got_adrp_ldr: +adrp2: + adrp x0, _ptr@GOTPAGE +ldr2: + ldr x0, [x0, _ptr@GOTPAGEOFF] ret - .fill 8192, 1, 0 + + +# Test ARM64_RELOC_UNSIGNED relocation. The absolute 64-bit address of the +# function should be stored at the 8-byte memory location. +# rtdyld-check: *{8}_ptr = _foo + .section __DATA,__data + .globl _ptr + .align 3 + .fill 4096, 1, 0 +_ptr: + .quad _foo |