[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / arm-branch.s
blob411d6dc9fbee9655ceadd6ec7846063b5c29d70e
1 /// Test the Arm state R_ARM_CALL and R_ARM_JUMP24 relocation to Arm state destinations.
2 /// R_ARM_CALL is used for branch and link (BL)
3 /// R_ARM_JUMP24 is used for unconditional and conditional branches (B and B<cc>)
4 /// Relocations defined in https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst
5 /// Addend A is always -8 to cancel out Arm state PC-bias of 8 bytes
7 // REQUIRES: arm
8 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
9 // RUN: echo "SECTIONS { \
10 // RUN: . = 0xb4; \
11 // RUN: .callee1 : { *(.callee_low) } \
12 // RUN: .caller : { *(.text) } \
13 // RUN: .callee2 : { *(.callee_high) } } " > %t.script
14 // RUN: ld.lld --defsym=far=0x201001c --script %t.script %t -o %t2
15 // RUN: llvm-objdump -d --no-show-raw-insn --triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s
17 .syntax unified
18 .section .callee_low, "ax",%progbits
19 .align 2
20 .type callee_low,%function
21 callee_low:
22 bx lr
24 .section .text, "ax",%progbits
25 .globl _start
26 .balign 0x10000
27 .type _start,%function
28 _start:
29 bl callee_low
30 b callee_low
31 beq callee_low
32 bl callee_high
33 b callee_high
34 bne callee_high
35 bl far
36 b far
37 bgt far
38 bx lr
40 .section .callee_high, "ax",%progbits
41 .align 2
42 .type callee_high,%function
43 callee_high:
44 bx lr
46 // CHECK: 00010000 <_start>:
47 // CHECK-NEXT: 10000: bl 0xb4 <callee_low>
48 // CHECK-NEXT: 10004: b 0xb4 <callee_low>
49 // CHECK-NEXT: 10008: beq 0xb4 <callee_low>
50 // CHECK-NEXT: 1000c: bl 0x10028 <callee_high>
51 // CHECK-NEXT: 10010: b 0x10028 <callee_high>
52 // CHECK-NEXT: 10014: bne 0x10028 <callee_high>
53 /// 0x201001c = far
54 // CHECK-NEXT: 10018: bl 0x201001c
55 // CHECK-NEXT: 1001c: b 0x201001c
56 // CHECK-NEXT: 10020: bgt 0x201001c
57 // CHECK-NEXT: 10024: bx lr