2 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
-triple
=armv7a-none-linux-gnueabi
%s
-o
%t
3 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
-triple
=armv7a-none-linux-gnueabi
%S
/Inputs
/far-arm-thumb-
abs.s
-o
%tfar
4 // RUN
: echo
"SECTIONS { \
6 // RUN: .callee1 : { *(.callee_low) } \
7 // RUN: .callee2 : { *(.callee_arm_low) } \
8 // RUN: .caller : { *(.text) } \
9 // RUN: .callee3 : { *(.callee_high) } \
10 // RUN: .callee4 : { *(.callee_arm_high) } } " > %t.script
11 // RUN
: ld.lld
--script
%t.script
%t %tfar
-o
%t2
12 // RUN
: llvm-objdump
-d
--triple
=armv7a-none-linux-gnueabi
%t2 | FileCheck
%s
14 /// Test BLX instruction is chosen for ARM
BL/BLX instruction
and Thumb callee
15 /// Using two callees to ensure at least one has
2-byte alignment.
18 .section .callee_low, "ax",%progbits
20 .type callee_low,%function
23 .type callee_low2, %function
27 .section .callee_arm_low, "ax",%progbits
30 .type callee_arm_low,%function
35 .section .text, "ax",%progbits
39 .type _start,%function
51 /// blx to ARM instruction should
be written as
a BL
58 .section .callee_high, "ax",%progbits
61 .type callee_high,%function
64 .type callee_high2,%function
68 .section .callee_arm_high, "ax",%progbits
71 .type callee_arm_high,%function
75 // CHECK
: Disassembly of section
.callee1:
77 // CHECK-NEXT
: <callee_low
>:
78 // CHECK-NEXT
: b4
: 4770 bx
lr
79 // CHECK
: <callee_low2
>:
80 // CHECK-NEXT
: b6
: 4770 bx
lr
82 // CHECK
: Disassembly of section
.callee2:
84 // CHECK-NEXT
: <callee_arm_low
>:
85 // CHECK-NEXT
: 100: e12fff1e bx
lr
87 // CHECK
: Disassembly of section
.caller:
89 // CHECK-NEXT
: <_start
>:
90 // CHECK-NEXT
: 10000: faffc02b blx
0xb4 <callee_low
>
91 // CHECK-NEXT
: 10004: faffc02a blx
0xb4 <callee_low
>
92 // CHECK-NEXT
: 10008: fbffc029 blx
0xb6 <callee_low2
>
93 // CHECK-NEXT
: 1000c
: fbffc028 blx
0xb6 <callee_low2
>
94 // CHECK-NEXT
: 10010: fa00003a blx
0x10100 <callee_high
>
95 // CHECK-NEXT
: 10014: fa000039 blx
0x10100 <callee_high
>
96 // CHECK-NEXT
: 10018: fb000038 blx
0x10102 <callee_high2
>
97 // CHECK-NEXT
: 1001c
: fb000037 blx
0x10102 <callee_high2
>
98 /// 0x2010024 = blx_far
99 // CHECK-NEXT
: 10020: fa7fffff blx
0x2010024
100 /// 0x2010028 = blx_far2
101 // CHECK-NEXT
: 10024: fa7fffff blx
0x2010028
102 // CHECK-NEXT
: 10028: ebffc034
bl 0x100 <callee_arm_low
>
103 // CHECK-NEXT
: 1002c
: ebffc033
bl 0x100 <callee_arm_low
>
104 // CHECK-NEXT
: 10030: eb000072
bl 0x10200 <callee_arm_high
>
105 // CHECK-NEXT
: 10034: eb000071
bl 0x10200 <callee_arm_high
>
106 // CHECK-NEXT
: 10038: e12fff1e bx
lr
108 // CHECK
: Disassembly of section
.callee3:
110 // CHECK
: <callee_high
>:
111 // CHECK-NEXT
: 10100: 4770 bx
lr
112 // CHECK
: <callee_high2
>:
113 // CHECK-NEXT
: 10102: 4770 bx
lr
115 // CHECK
: Disassembly of section
.callee4:
117 // CHECK-NEXT
: <callee_arm_high
>:
118 // CHECK-NEXT
: 10200: e12fff1e bx
lr