58 lines · plain
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.rst5/// Addend A is always -8 to cancel out Arm state PC-bias of 8 bytes6 7// REQUIRES: arm8// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t9// RUN: echo "SECTIONS { \10// RUN: . = 0xb4; \11// RUN: .callee1 : { *(.callee_low) } \12// RUN: .caller : { *(.text) } \13// RUN: .callee2 : { *(.callee_high) } } " > %t.script14// RUN: ld.lld --defsym=far=0x201001c --script %t.script %t -o %t215// RUN: llvm-objdump -d --no-show-raw-insn --triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s16 17 .syntax unified18 .section .callee_low, "ax",%progbits19 .align 220 .type callee_low,%function21callee_low:22 bx lr23 24 .section .text, "ax",%progbits25 .globl _start26 .balign 0x1000027 .type _start,%function28_start:29 bl callee_low30 b callee_low31 beq callee_low32 bl callee_high33 b callee_high34 bne callee_high35 bl far36 b far37 bgt far38 bx lr39 40 .section .callee_high, "ax",%progbits41 .align 242 .type callee_high,%function43callee_high:44 bx lr45 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 = far54// CHECK-NEXT: 10018: bl 0x201001c55// CHECK-NEXT: 1001c: b 0x201001c56// CHECK-NEXT: 10020: bgt 0x201001c57// CHECK-NEXT: 10024: bx lr58