[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / arm-bx-v4t.s
blob6e772be1bedb7c38596ec380eee0fe22922c77f1
1 // REQUIRES: arm
2 // RUN: rm -rf %t && split-file %s %t
3 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv4t-none-linux-gnueabi %t/a.s -o %t/a.o
4 // RUN: ld.lld %t/a.o --script %t/far.lds -o %t/a-far
5 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4t-none-linux-gnueabi %t/a-far | FileCheck %s --check-prefixes=FAR
6 // RUN: ld.lld %t/a.o --script %t/near.lds -o %t/a-near
7 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4t-none-linux-gnueabi %t/a-near | FileCheck %s --check-prefixes=NEAR
8 // RUN: ld.lld %t/a.o -pie --script %t/far.lds -o %t/a-far-pie
9 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4t-none-linux-gnueabi %t/a-far-pie | FileCheck %s --check-prefixes=FAR-PIE
10 // RUN: ld.lld %t/a.o -pie --script %t/near.lds -o %t/a-near-pie
11 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4t-none-linux-gnueabi %t/a-near-pie | FileCheck %s --check-prefixes=NEAR-PIE
13 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv4teb-none-linux-gnueabi %t/a.s -o %t/a.o
14 // RUN: ld.lld %t/a.o --script %t/far.lds -o %t/a-far
15 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4teb-none-linux-gnueabi %t/a-far | FileCheck %s --check-prefixes=FAR-EB
16 // RUN: ld.lld %t/a.o --script %t/near.lds -o %t/a-near
17 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4teb-none-linux-gnueabi %t/a-near | FileCheck %s --check-prefixes=NEAR-EB
18 // RUN: ld.lld %t/a.o -pie --script %t/far.lds -o %t/a-far-pie
19 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4teb-none-linux-gnueabi %t/a-far-pie | FileCheck %s --check-prefixes=FAR-EB-PIE
20 // RUN: ld.lld %t/a.o -pie --script %t/near.lds -o %t/a-near-pie
21 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn --triple=armv4teb-none-linux-gnueabi %t/a-near-pie | FileCheck %s --check-prefixes=NEAR-EB-PIE
23 /// On Arm v4t there is no blx instruction so all interworking must go via
24 /// a thunk.
26 #--- a.s
27 .text
28 .syntax unified
29 .cpu arm7tdmi
31 .section .low, "ax", %progbits
32 .arm
33 .globl _start
34 .type _start,%function
35 .p2align 2
36 _start:
37 bl target
38 bx lr
40 // FAR-LABEL: <_start>:
41 // FAR-NEXT: 1000000: bl 0x1000008 <__ARMv4ABSLongBXThunk_target> @ imm = #0
42 // FAR-NEXT: bx lr
43 // FAR-EMPTY:
44 // FAR-NEXT: <__ARMv4ABSLongBXThunk_target>:
45 // FAR-NEXT: 1000008: ldr r12, [pc] @ 0x1000010 <__ARMv4ABSLongBXThunk_target+0x8>
46 // FAR-NEXT: bx r12
47 // FAR-NEXT: 1000010: 01 00 00 06 .word 0x06000001
49 // FAR-EB-LABEL: <_start>:
50 // FAR-EB-NEXT: 1000000: bl 0x1000008 <__ARMv4ABSLongBXThunk_target> @ imm = #0
51 // FAR-EB-NEXT: bx lr
52 // FAR-EB-EMPTY:
53 // FAR-EB-NEXT: <__ARMv4ABSLongBXThunk_target>:
54 // FAR-EB-NEXT: 1000008: ldr r12, [pc] @ 0x1000010 <__ARMv4ABSLongBXThunk_target+0x8>
55 // FAR-EB-NEXT: bx r12
56 // FAR-EB-NEXT: 1000010: 06 00 00 01 .word 0x06000001
58 // NEAR-LABEL: <_start>:
59 // NEAR-NEXT: 1000000: bl 0x1000008 <__ARMv4ABSLongBXThunk_target> @ imm = #0
60 // NEAR-NEXT: bx lr
61 // NEAR-EMPTY:
62 // NEAR-NEXT: <__ARMv4ABSLongBXThunk_target>:
63 // NEAR-NEXT: 1000008: ldr r12, [pc] @ 0x1000010 <__ARMv4ABSLongBXThunk_target+0x8>
64 // NEAR-NEXT: bx r12
65 // NEAR-NEXT: 1000010: 15 00 00 01 .word 0x01000015
67 // NEAR-EB-LABEL: <_start>:
68 // NEAR-EB-NEXT: 1000000: bl 0x1000008 <__ARMv4ABSLongBXThunk_target> @ imm = #0
69 // NEAR-EB-NEXT: bx lr
70 // NEAR-EB-EMPTY:
71 // NEAR-EB-NEXT: <__ARMv4ABSLongBXThunk_target>:
72 // NEAR-EB-NEXT: 1000008: ldr r12, [pc] @ 0x1000010 <__ARMv4ABSLongBXThunk_target+0x8>
73 // NEAR-EB-NEXT: bx r12
74 // NEAR-EB-NEXT: 1000010: 01 00 00 15 .word 0x01000015
76 // FAR-PIE-LABEL: <_start>:
77 // FAR-PIE-NEXT: 1000000: bl 0x1000008 <__ARMv4PILongBXThunk_target> @ imm = #0
78 // FAR-PIE-NEXT: bx lr
79 // FAR-PIE-EMPTY:
80 // FAR-PIE-NEXT: <__ARMv4PILongBXThunk_target>:
81 // FAR-PIE-NEXT: 1000008: ldr r12, [pc, #4] @ 0x1000014 <__ARMv4PILongBXThunk_target+0xc>
82 // FAR-PIE-NEXT: add r12, pc, r12
83 // FAR-PIE-NEXT: bx r12
84 // FAR-PIE-NEXT: 1000014: ed ff ff 04 .word 0x04ffffed
86 // FAR-EB-PIE-LABEL: <_start>:
87 // FAR-EB-PIE-NEXT: 1000000: bl 0x1000008 <__ARMv4PILongBXThunk_target> @ imm = #0
88 // FAR-EB-PIE-NEXT: bx lr
89 // FAR-EB-PIE-EMPTY:
90 // FAR-EB-PIE-NEXT: <__ARMv4PILongBXThunk_target>:
91 // FAR-EB-PIE-NEXT: 1000008: ldr r12, [pc, #4] @ 0x1000014 <__ARMv4PILongBXThunk_target+0xc>
92 // FAR-EB-PIE-NEXT: add r12, pc, r12
93 // FAR-EB-PIE-NEXT: bx r12
94 // FAR-EB-PIE-NEXT: 1000014: 04 ff ff ed .word 0x04ffffed
96 // NEAR-PIE-LABEL: <_start>:
97 // NEAR-PIE-NEXT: 1000000: bl 0x1000008 <__ARMv4PILongBXThunk_target> @ imm = #0
98 // NEAR-PIE-NEXT: bx lr
99 // NEAR-PIE-EMPTY:
100 // NEAR-PIE-NEXT: <__ARMv4PILongBXThunk_target>:
101 // NEAR-PIE-NEXT: 1000008: ldr r12, [pc, #4] @ 0x1000014 <__ARMv4PILongBXThunk_target+0xc>
102 // NEAR-PIE-NEXT: add r12, pc, r12
103 // NEAR-PIE-NEXT: bx r12
104 // NEAR-PIE-NEXT: 1000014: 05 00 00 00 .word 0x00000005
106 // NEAR-EB-PIE-LABEL: <_start>:
107 // NEAR-EB-PIE-NEXT: 1000000: bl 0x1000008 <__ARMv4PILongBXThunk_target> @ imm = #0
108 // NEAR-EB-PIE-NEXT: bx lr
109 // NEAR-EB-PIE-EMPTY:
110 // NEAR-EB-PIE-NEXT: <__ARMv4PILongBXThunk_target>:
111 // NEAR-EB-PIE-NEXT: 1000008: ldr r12, [pc, #4] @ 0x1000014 <__ARMv4PILongBXThunk_target+0xc>
112 // NEAR-EB-PIE-NEXT: add r12, pc, r12
113 // NEAR-EB-PIE-NEXT: bx r12
114 // NEAR-EB-PIE-NEXT: 1000014: 00 00 00 05 .word 0x00000005
116 .section .high, "ax", %progbits
117 .thumb
118 .globl target
119 .type target,%function
120 target:
121 bl _start
122 bx lr
124 // FAR-LABEL: <target>:
125 // FAR-NEXT: 6000000: bl 0x6000008 <__Thumbv4ABSLongBXThunk__start> @ imm = #4
126 // FAR-NEXT: bx lr
127 // FAR-NEXT: bmi 0x5ffffb2 <__ARMv4ABSLongBXThunk_target+0x4ffffaa> @ imm = #-88
128 // FAR-EMPTY:
129 // FAR-NEXT: <__Thumbv4ABSLongBXThunk__start>:
130 // FAR-NEXT: 6000008: bx pc
131 // FAR-NEXT: b 0x6000008 <__Thumbv4ABSLongBXThunk__start> @ imm = #-6
132 // FAR-NEXT: 600000c: ldr pc, [pc, #-4] @ 0x6000010 <__Thumbv4ABSLongBXThunk__start+0x8>
133 // FAR-NEXT: 6000010: 00 00 00 01 .word 0x01000000
135 // FAR-EB-LABEL: <target>:
136 // FAR-EB-NEXT: 6000000: bl 0x6000008 <__Thumbv4ABSLongBXThunk__start> @ imm = #4
137 // FAR-EB-NEXT: bx lr
138 // FAR-EB-NEXT: bmi 0x5ffffb2 <__ARMv4ABSLongBXThunk_target+0x4ffffaa> @ imm = #-88
139 // FAR-EB-EMPTY:
140 // FAR-EB-NEXT: <__Thumbv4ABSLongBXThunk__start>:
141 // FAR-EB-NEXT: 6000008: bx pc
142 // FAR-EB-NEXT: b 0x6000008 <__Thumbv4ABSLongBXThunk__start> @ imm = #-6
143 // FAR-EB-NEXT: 600000c: ldr pc, [pc, #-4] @ 0x6000010 <__Thumbv4ABSLongBXThunk__start+0x8>
144 // FAR-EB-NEXT: 6000010: 01 00 00 00 .word 0x01000000
146 // NEAR-LABEL: <target>:
147 // NEAR-NEXT: 1000014: bl 0x100001c <__Thumbv4ABSLongBXThunk__start> @ imm = #4
148 // NEAR-NEXT: bx lr
149 // NEAR-NEXT: bmi 0xffffc6 @ imm = #-88
150 // NEAR-EMPTY:
151 // NEAR-NEXT: <__Thumbv4ABSLongBXThunk__start>:
152 // NEAR-NEXT: 100001c: bx pc
153 // NEAR-NEXT: b 0x100001c <__Thumbv4ABSLongBXThunk__start> @ imm = #-6
154 // NEAR-NEXT: 1000020: ldr pc, [pc, #-4] @ 0x1000024 <__Thumbv4ABSLongBXThunk__start+0x8>
155 // NEAR-NEXT: 1000024: 00 00 00 01 .word 0x01000000
157 // NEAR-EB-LABEL: <target>:
158 // NEAR-EB-NEXT: 1000014: bl 0x100001c <__Thumbv4ABSLongBXThunk__start> @ imm = #4
159 // NEAR-EB-NEXT: bx lr
160 // NEAR-EB-NEXT: bmi 0xffffc6 @ imm = #-88
161 // NEAR-EB-EMPTY:
162 // NEAR-EB-NEXT: <__Thumbv4ABSLongBXThunk__start>:
163 // NEAR-EB-NEXT: 100001c: bx pc
164 // NEAR-EB-NEXT: b 0x100001c <__Thumbv4ABSLongBXThunk__start> @ imm = #-6
165 // NEAR-EB-NEXT: 1000020: ldr pc, [pc, #-4] @ 0x1000024 <__Thumbv4ABSLongBXThunk__start+0x8>
166 // NEAR-EB-NEXT: 1000024: 01 00 00 00 .word 0x01000000
168 // FAR-PIE-LABEL: <target>:
169 // FAR-PIE-NEXT: 6000000: bl 0x6000008 <__Thumbv4PILongBXThunk__start> @ imm = #4
170 // FAR-PIE-NEXT: bx lr
171 // FAR-PIE-NEXT: bmi 0x5ffffb2 <__ARMv4PILongBXThunk_target+0x4ffffaa> @ imm = #-88
172 // FAR-PIE-EMPTY:
173 // FAR-PIE-NEXT: <__Thumbv4PILongBXThunk__start>:
174 // FAR-PIE-NEXT: 6000008: bx pc
175 // FAR-PIE-NEXT: b 0x6000008 <__Thumbv4PILongBXThunk__start> @ imm = #-6
176 // FAR-PIE-NEXT: 600000c: ldr r12, [pc] @ 0x6000014 <__Thumbv4PILongBXThunk__start+0xc>
177 // FAR-PIE-NEXT: add pc, r12, pc
178 // FAR-PIE-NEXT: 6000014: e8 ff ff fa .word 0xfaffffe8
180 // FAR-EB-PIE-LABEL: <target>:
181 // FAR-EB-PIE-NEXT: 6000000: bl 0x6000008 <__Thumbv4PILongBXThunk__start> @ imm = #4
182 // FAR-EB-PIE-NEXT: bx lr
183 // FAR-EB-PIE-NEXT: bmi 0x5ffffb2 <__ARMv4PILongBXThunk_target+0x4ffffaa> @ imm = #-88
184 // FAR-EB-PIE-EMPTY:
185 // FAR-EB-PIE-NEXT: <__Thumbv4PILongBXThunk__start>:
186 // FAR-EB-PIE-NEXT: 6000008: bx pc
187 // FAR-EB-PIE-NEXT: b 0x6000008 <__Thumbv4PILongBXThunk__start> @ imm = #-6
188 // FAR-EB-PIE-NEXT: 600000c: ldr r12, [pc] @ 0x6000014 <__Thumbv4PILongBXThunk__start+0xc>
189 // FAR-EB-PIE-NEXT: add pc, r12, pc
190 // FAR-EB-PIE-NEXT: 6000014: fa ff ff e8 .word 0xfaffffe8
192 // NEAR-PIE-LABEL: <target>:
193 // NEAR-PIE-NEXT: 1000018: bl 0x1000020 <__Thumbv4PILongBXThunk__start> @ imm = #4
194 // NEAR-PIE-NEXT: bx lr
195 // NEAR-PIE-NEXT: bmi 0xffffca @ imm = #-88
196 // NEAR-PIE-EMPTY:
197 // NEAR-PIE-NEXT: <__Thumbv4PILongBXThunk__start>:
198 // NEAR-PIE-NEXT: 1000020: bx pc
199 // NEAR-PIE-NEXT: b 0x1000020 <__Thumbv4PILongBXThunk__start> @ imm = #-6
200 // NEAR-PIE-NEXT: 1000024: ldr r12, [pc] @ 0x100002c <__Thumbv4PILongBXThunk__start+0xc>
201 // NEAR-PIE-NEXT: add pc, r12, pc
202 // NEAR-PIE-NEXT: 100002c: d0 ff ff ff .word 0xffffffd0
204 // NEAR-EB-PIE-LABEL: <target>:
205 // NEAR-EB-PIE-NEXT: 1000018: bl 0x1000020 <__Thumbv4PILongBXThunk__start> @ imm = #4
206 // NEAR-EB-PIE-NEXT: bx lr
207 // NEAR-EB-PIE-NEXT: bmi 0xffffca @ imm = #-88
208 // NEAR-EB-PIE-EMPTY:
209 // NEAR-EB-PIE-NEXT: <__Thumbv4PILongBXThunk__start>:
210 // NEAR-EB-PIE-NEXT: 1000020: bx pc
211 // NEAR-EB-PIE-NEXT: b 0x1000020 <__Thumbv4PILongBXThunk__start> @ imm = #-6
212 // NEAR-EB-PIE-NEXT: 1000024: ldr r12, [pc] @ 0x100002c <__Thumbv4PILongBXThunk__start+0xc>
213 // NEAR-EB-PIE-NEXT: add pc, r12, pc
214 // NEAR-EB-PIE-NEXT: 100002c: ff ff ff d0 .word 0xffffffd0
216 #--- far.lds
217 SECTIONS {
218 . = SIZEOF_HEADERS;
219 .low 0x01000000 : { *(.low) }
220 .high 0x06000000 : { *(.high) }
223 #--- near.lds
224 SECTIONS {
225 . = SIZEOF_HEADERS;
226 .all 0x01000000 : { *(.low) *(.high) }