1// REQUIRES: arm 2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv5-none-linux-gnueabi %s -o %t 3// RUN: ld.lld %t -o %t2 4// RUN: llvm-objdump -d %t2 --triple=armv5-none-linux-gnueabi | FileCheck %s 5// RUN: ld.lld %t -o %t3 --shared 6// RUN: llvm-objdump -d %t3 --triple=armv5-none-linux-gnueabi | FileCheck --check-prefix=CHECK-PI %s 7 8// Test ARM Thumb Interworking on older Arm architectures using Thunks that do 9// not use MOVT/MOVW instructions. 10// For pure interworking (not considering range extension) there is only the 11// case of an Arm B to a Thumb Symbol to consider as in older Arm architectures 12// there is no Thumb B.w that we can intercept with a Thunk and we still assume 13// support for the blx instruction for Thumb BL and BLX to an Arm symbol. 14 .arm 15 .text 16 .syntax unified 17 .cpu arm10tdmi 18 19 .text 20 .globl _start 21 .type _start, %function 22 .balign 0x1000 23_start: 24 b thumb_func 25 bl thumb_func 26 blx thumb_func 27 bx lr 28 29// CHECK: <_start>: 30// CHECK-NEXT: 21000: 03 00 00 ea b 0x21014 <__ARMv5ABSLongThunk_thumb_func> 31// CHECK-NEXT: 21004: 01 00 00 fa blx 0x21010 <thumb_func> 32// CHECK-NEXT: 21008: 00 00 00 fa blx 0x21010 <thumb_func> 33// CHECK-NEXT: 2100c: 1e ff 2f e1 bx lr 34 35// CHECK: <thumb_func>: 36// CHECK-NEXT: 21010: 70 47 bx lr 37 38// CHECK: <__ARMv5ABSLongThunk_thumb_func>: 39// CHECK-NEXT: 21014: 04 f0 1f e5 ldr pc, [pc, #-4] 40// CHECK: <$d>: 41// CHECK-NEXT: 21018: 11 10 02 00 .word 0x00021011 42 43// CHECK-PI: <_start>: 44// CHECK-PI-NEXT: 11000: 03 00 00 ea b 0x11014 <__ARMV5PILongThunk_thumb_func> 45// CHECK-PI-NEXT: 11004: 01 00 00 fa blx 0x11010 <thumb_func> 46// CHECK-PI-NEXT: 11008: 00 00 00 fa blx 0x11010 <thumb_func> 47// CHECK-PI-NEXT: 1100c: 1e ff 2f e1 bx lr 48 49// CHECK-PI: <thumb_func>: 50// CHECK-PI-NEXT: 11010: 70 47 bx lr 51 52// CHECK-PI: <__ARMV5PILongThunk_thumb_func>: 53// CHECK-PI-NEXT: 11014: 04 c0 9f e5 ldr r12, [pc, #4] 54// CHECK-PI-NEXT: 11018: 0c c0 8f e0 add r12, pc, r12 55// CHECK-PI-NEXT: 1101c: 1c ff 2f e1 bx r12 56// CHECK-PI: <$d>: 57// CHECK-PI-NEXT: 11020: f1 ff ff ff .word 0xfffffff1 58 59 .section .text.1, "ax", %progbits 60 .thumb 61 .hidden thumb_func 62 .type thumb_func, %function 63thumb_func: 64 bx lr 65