|
| 1 | +# RUN: llvm-mc -triple=thumbv7-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t.o %s |
| 2 | +# RUN: llvm-objdump -r %t.o | FileCheck --check-prefix=CHECK-TYPE %s |
| 3 | +# RUN: llvm-objdump --disassemble %t.o | FileCheck --check-prefix=CHECK-INSTR %s |
| 4 | +# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \ |
| 5 | +# RUN: -slab-page-size 4096 -show-entry-es -check %s %t.o |
| 6 | + |
| 7 | +# This test requires the RuntimeDyldChecker fix from review D158280 |
| 8 | +# XFAIL: * |
| 9 | + |
| 10 | + .text |
| 11 | + .syntax unified |
| 12 | + |
| 13 | +# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_CALL call_target |
| 14 | +# CHECK-INSTR: 00000000 <call_site>: |
| 15 | +# CHECK-INSTR: 0: f7ff fffe bl 0x0 <call_site> |
| 16 | +# CHECK-INSTR: 00000004 <call_target>: |
| 17 | +# CHECK-INSTR: 4: 4770 bx lr |
| 18 | +# We decode the operand with index 2, because bl generates two leading implicit |
| 19 | +# predicate operands that we have to skip in order to decode the call_target operand |
| 20 | +# jitlink-check: decode_operand(call_site, 2) = call_target - next_pc(call_site) |
| 21 | + .globl call_site |
| 22 | + .type call_site,%function |
| 23 | + .p2align 1 |
| 24 | + .code 16 |
| 25 | + .thumb_func |
| 26 | +call_site: |
| 27 | + bl call_target |
| 28 | + .size call_site, .-call_site |
| 29 | + |
| 30 | + .globl call_target |
| 31 | + .type call_target,%function |
| 32 | + .p2align 1 |
| 33 | + .code 16 |
| 34 | + .thumb_func |
| 35 | +call_target: |
| 36 | + bx lr |
| 37 | + .size call_target, .-call_target |
| 38 | + |
| 39 | +# CHECK-TYPE: {{[0-9a-f]+}} R_ARM_THM_JUMP24 jump24_target |
| 40 | +# CHECK-INSTR: 00000006 <jump24_site>: |
| 41 | +# CHECK-INSTR: 6: f7ff bffe b.w 0x6 <jump24_site> |
| 42 | +# CHECK-INSTR: 0000000a <jump24_target>: |
| 43 | +# CHECK-INSTR: a: 4770 bx lr |
| 44 | +# b.w generates two implicit predicate operands as well, but they are trailing |
| 45 | +# operands, so there is no need to adjust the operand index. |
| 46 | +# jitlink-check: decode_operand(jump24_site, 0) = jump24_target - next_pc(jump24_site) |
| 47 | + .globl jump24_site |
| 48 | + .type jump24_site,%function |
| 49 | + .p2align 1 |
| 50 | + .code 16 |
| 51 | + .thumb_func |
| 52 | +jump24_site: |
| 53 | + b.w jump24_target |
| 54 | + .size jump24_site, .-jump24_site |
| 55 | + |
| 56 | + .globl jump24_target |
| 57 | + .type jump24_target,%function |
| 58 | + .p2align 1 |
| 59 | + .code 16 |
| 60 | + .thumb_func |
| 61 | +jump24_target: |
| 62 | + bx lr |
| 63 | + .size jump24_target, .-jump24_target |
| 64 | + |
| 65 | +# Empty main function for jitlink to be happy |
| 66 | + .globl main |
| 67 | + .type main,%function |
| 68 | + .p2align 1 |
| 69 | + .code 16 |
| 70 | + .thumb_func |
| 71 | +main: |
| 72 | + bx lr |
| 73 | + .size main, .-main |
0 commit comments