[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / arm-bl-v4t.s
blob7e4a4f0857311f57f14210c1c10293c8f10a05d7
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
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
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
23 /// On Armv4T there is no blx instruction so long branch/exchange looks slightly
24 /// different.
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 .thumb
41 .globl thumb_start
42 .type thumb_start,%function
43 .p2align 2
44 thumb_start:
45 bl thumb_target
46 bx lr
48 // FAR-LABEL: <_start>:
49 // FAR-NEXT: 1000000: bl 0x1000010 <__ARMv5LongLdrPcThunk_target> @ imm = #8
50 // FAR-NEXT: bx lr
51 // FAR-EMPTY:
52 // FAR-LABEL: <thumb_start>:
53 // FAR-NEXT: 1000008: bl 0x1000018 <__Thumbv4ABSLongThunk_thumb_target> @ imm = #12
54 // FAR-NEXT: bx lr
55 // FAR-NEXT: bmi 0xffffba @ imm = #-88
56 // FAR-EMPTY:
57 // FAR-NEXT: <__ARMv5LongLdrPcThunk_target>:
58 // FAR-NEXT: 1000010: ldr pc, [pc, #-4] @ 0x1000014 <__ARMv5LongLdrPcThunk_target+0x4>
59 // FAR-NEXT: 1000014: 00 00 00 06 .word 0x06000000
60 // FAR-EMPTY:
61 // FAR-NEXT: <__Thumbv4ABSLongThunk_thumb_target>:
62 // FAR-NEXT: 1000018: bx pc
63 // FAR-NEXT: b 0x1000018 <__Thumbv4ABSLongThunk_thumb_target> @ imm = #-6
64 // FAR-NEXT: 100001c: ldr r12, [pc] @ 0x1000024 <__Thumbv4ABSLongThunk_thumb_target+0xc>
65 // FAR-NEXT: bx r12
66 // FAR-NEXT: 1000024: 05 00 00 06 .word 0x06000005
68 // FAR-EB-LABEL: <_start>:
69 // FAR-EB-NEXT: 1000000: bl 0x1000010 <__ARMv5LongLdrPcThunk_target> @ imm = #8
70 // FAR-EB-NEXT: bx lr
71 // FAR-EB-EMPTY:
72 // FAR-EB-LABEL: <thumb_start>:
73 // FAR-EB-NEXT: 1000008: bl 0x1000018 <__Thumbv4ABSLongThunk_thumb_target> @ imm = #12
74 // FAR-EB-NEXT: bx lr
75 // FAR-EB-NEXT: bmi 0xffffba @ imm = #-88
76 // FAR-EB-EMPTY:
77 // FAR-EB-NEXT: <__ARMv5LongLdrPcThunk_target>:
78 // FAR-EB-NEXT: 1000010: ldr pc, [pc, #-4] @ 0x1000014 <__ARMv5LongLdrPcThunk_target+0x4>
79 // FAR-EB-NEXT: 1000014: 06 00 00 00 .word 0x06000000
80 // FAR-EB-EMPTY:
81 // FAR-EB-NEXT: <__Thumbv4ABSLongThunk_thumb_target>:
82 // FAR-EB-NEXT: 1000018: bx pc
83 // FAR-EB-NEXT: b 0x1000018 <__Thumbv4ABSLongThunk_thumb_target> @ imm = #-6
84 // FAR-EB-NEXT: 100001c: ldr r12, [pc] @ 0x1000024 <__Thumbv4ABSLongThunk_thumb_target+0xc>
85 // FAR-EB-NEXT: bx r12
86 // FAR-EB-NEXT: 1000024: 06 00 00 05 .word 0x06000005
88 // FAR-PIE-LABEL: <_start>:
89 // FAR-PIE-NEXT: 1000000: bl 0x1000010 <__ARMv4PILongThunk_target> @ imm = #8
90 // FAR-PIE-NEXT: bx lr
91 // FAR-PIE-EMPTY:
92 // FAR-PIE-NEXT: <thumb_start>:
93 // FAR-PIE-NEXT: 1000008: bl 0x100001c <__Thumbv4PILongThunk_thumb_target> @ imm = #16
94 // FAR-PIE-NEXT: bx lr
95 // FAR-PIE-NEXT: bmi 0xffffba @ imm = #-88
96 // FAR-PIE-EMPTY:
97 // FAR-PIE-NEXT: <__ARMv4PILongThunk_target>:
98 // FAR-PIE-NEXT: 1000010: ldr r12, [pc] @ 0x1000018 <__ARMv4PILongThunk_target+0x8>
99 // FAR-PIE-NEXT: add pc, pc, r12
100 // FAR-PIE-NEXT: 1000018: e4 ff ff 04 .word 0x04ffffe4
101 // FAR-PIE-EMPTY:
102 // FAR-PIE-NEXT: <__Thumbv4PILongThunk_thumb_target>:
103 // FAR-PIE-NEXT: 100001c: bx pc
104 // FAR-PIE-NEXT: b 0x100001c <__Thumbv4PILongThunk_thumb_target> @ imm = #-6
105 // FAR-PIE-NEXT: 1000020: ldr r12, [pc, #4] @ 0x100002c <__Thumbv4PILongThunk_thumb_target+0x10>
106 // FAR-PIE-NEXT: add r12, pc, r12
107 // FAR-PIE-NEXT: bx r12
108 // FAR-PIE-NEXT: 100002c: d9 ff ff 04 .word 0x04ffffd9
110 // FAR-EB-PIE-LABEL: <_start>:
111 // FAR-EB-PIE-NEXT: 1000000: bl 0x1000010 <__ARMv4PILongThunk_target> @ imm = #8
112 // FAR-EB-PIE-NEXT: bx lr
113 // FAR-EB-PIE-EMPTY:
114 // FAR-EB-PIE-NEXT: <thumb_start>:
115 // FAR-EB-PIE-NEXT: 1000008: bl 0x100001c <__Thumbv4PILongThunk_thumb_target> @ imm = #16
116 // FAR-EB-PIE-NEXT: bx lr
117 // FAR-EB-PIE-NEXT: bmi 0xffffba @ imm = #-88
118 // FAR-EB-PIE-EMPTY:
119 // FAR-EB-PIE-NEXT: <__ARMv4PILongThunk_target>:
120 // FAR-EB-PIE-NEXT: 1000010: ldr r12, [pc] @ 0x1000018 <__ARMv4PILongThunk_target+0x8>
121 // FAR-EB-PIE-NEXT: add pc, pc, r12
122 // FAR-EB-PIE-NEXT: 1000018: 04 ff ff e4 .word 0x04ffffe4
123 // FAR-EB-PIE-EMPTY:
124 // FAR-EB-PIE-NEXT: <__Thumbv4PILongThunk_thumb_target>:
125 // FAR-EB-PIE-NEXT: 100001c: bx pc
126 // FAR-EB-PIE-NEXT: b 0x100001c <__Thumbv4PILongThunk_thumb_target> @ imm = #-6
127 // FAR-EB-PIE-NEXT: 1000020: ldr r12, [pc, #4] @ 0x100002c <__Thumbv4PILongThunk_thumb_target+0x10>
128 // FAR-EB-PIE-NEXT: add r12, pc, r12
129 // FAR-EB-PIE-NEXT: bx r12
130 // FAR-EB-PIE-NEXT: 100002c: 04 ff ff d9 .word 0x04ffffd9
132 // NEAR-LABEL: <_start>:
133 // NEAR-NEXT: 1000000: bl 0x1000010 <target> @ imm = #8
134 // NEAR-NEXT: bx lr
135 // NEAR-EMPTY:
136 // NEAR-LABEL: <thumb_start>:
137 // NEAR-NEXT: 1000008: bl 0x1000014 <thumb_target> @ imm = #8
138 // NEAR-NEXT: bx lr
140 .section .high, "ax", %progbits
141 .arm
142 .globl target
143 .type target,%function
144 target:
145 bx lr
147 .thumb
148 .globl thumb_target
149 .type thumb_target,%function
150 thumb_target:
151 bx lr
153 // FAR-LABEL: <target>:
154 // FAR-NEXT: 6000000: bx lr
155 // FAR-EMPTY:
156 // FAR-LABEL: <thumb_target>:
157 // FAR-NEXT: 6000004: bx lr
159 // FAR-PIE-LABEL: <target>:
160 // FAR-PIE-NEXT: 6000000: bx lr
161 // FAR-PIE-EMPTY:
162 // FAR-PIE-LABEL: <thumb_target>:
163 // FAR-PIE-NEXT: 6000004: bx lr
165 // NEAR-LABEL: <target>:
166 // NEAR-LABEL: 1000010: bx lr
167 // NEAR-EMPTY:
168 // NEAR-NEXT: <thumb_target>:
169 // NEAR-NEXT: 1000014: bx lr
172 #--- far.lds
173 SECTIONS {
174 . = SIZEOF_HEADERS;
175 .low 0x01000000 : { *(.low) }
176 .high 0x06000000 : { *(.high) }
179 #--- near.lds
180 SECTIONS {
181 . = SIZEOF_HEADERS;
182 .all 0x01000000 : { *(.low) *(.high) }