2 // RUN
: llvm-mc
-filetype
=obj
-triple
=armv7a-unknown-linux-gnueabi
%s
-o
%t
3 // RUN
: ld.lld
%t -o
%t2
4 // RUN
: llvm-objdump
--no-print-imm-hex
-d
%t2
--triple
=armv7a-unknown-linux-gnueabi
--no-show-raw-insn | FileCheck
%s
5 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7a-unknown-linux-gnueabi
%s
-o
%t3
6 // RUN
: ld.lld
%t3
-o
%t4
7 // RUN
: llvm-objdump
--no-print-imm-hex
-d
%t4
--triple
=thumbv7a-unknown-linux-gnueabi
--no-show-raw-insn | FileCheck
%s
9 // RUN
: llvm-mc
-filetype
=obj
-triple
=armv7aeb-unknown-linux-gnueabi
-mcpu
=cortex-a8
%s
-o
%t
10 // RUN
: ld.lld
%t -o
%t2
11 // RUN
: llvm-objdump
--no-print-imm-hex
-d
%t2
--triple
=armv7aeb-unknown-linux-gnueabi
--no-show-raw-insn | FileCheck
%s
12 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7aeb-unknown-linux-gnueabi
-mcpu
=cortex-a8
%s
-o
%t3
13 // RUN
: ld.lld
%t3
-o
%t4
14 // RUN
: llvm-objdump
--no-print-imm-hex
-d
%t4
--triple
=thumbv7aeb-unknown-linux-gnueabi
--no-show-raw-insn | FileCheck
%s
16 // RUN
: ld.lld
--be8
%t -o
%t2
17 // RUN
: llvm-objdump
--no-print-imm-hex
-d
%t2
--triple
=armv7aeb-unknown-linux-gnueabi
--no-show-raw-insn | FileCheck
%s
18 // RUN
: ld.lld
--be8
%t3
-o
%t4
19 // RUN
: llvm-objdump
--no-print-imm-hex
-d
%t4
--triple
=thumbv7aeb-unknown-linux-gnueabi
--no-show-raw-insn | FileCheck
%s
21 /// Test the following relocation pairs
:
22 /// * R_ARM_MOVW_ABS_NC
and R_ARM_MOVT_ABS
23 /// * R_ARM_MOVW_PREL_NC
and R_ARM_MOVT_PREL
24 /// * R_ARM_MOVW_BREL_NC
and R_ARM_MOVT_BREL
26 /// * R_ARM_THM_MOVW_ABS_NC
and R_ARM_THM_MOVT_ABS
27 /// * R_ARM_THM_MOVW_PREL_NC
and R_ARM_THM_MOVT_PREL
28 /// * R_ARM_THM_MOVW_BREL_NC
and R_ARM_THM_MOVT_BREL
34 .section .R_ARM_MOVW_ABS_NC, "ax",%progbits
36 movw
r0, :lower16
:label
37 movw
r1, :lower16
:label1
38 movw
r2, :lower16
:label2
+ 4
39 movw
r3, :lower16
:label3
40 movw
r4, :lower16
:label3
+ 4
41 // CHECK-LABEL
: Disassembly of section
.R_ARM_MOVW_ABS_NC
43 // CHECK
: 21000: movw
r0, #0
45 // CHECK
: movw
r2, #12
46 // CHECK
: movw
r3, #65532
47 /// :lower16
:label3
+ 4 = :lower16
:0x30000 = 0
50 .section .R_ARM_MOVT_ABS, "ax",%progbits
52 movt
r0, :upper16
:label
53 movt
r1, :upper16
:label1
54 movt
r2, :upper16
:label2
+ 4
55 movt
r3, :upper16
:label3
56 movt
r4, :upper16
:label3
+ 4
57 // CHECK-LABEL
: Disassembly of section
.R_ARM_MOVT_ABS
59 // CHECK
: 21100: movt
r0, #4
63 /// :upper16
:label3
+ 4 = :upper16
:0x30000 = 3
66 .section .R_ARM_MOVW_PREL_NC, "ax",%progbits
68 movw
r0, :lower16
:label
- .
69 movw
r1, :lower16
:label1
- .
70 movw
r2, :lower16
:label2
+ 4 - .
71 movw
r3, :lower16
:label3
- .
72 movw
r4, :lower16
:label3
+ 0x2214 - .
73 // CHECK-LABEL
: Disassembly of section
.R_ARM_MOVW_PREL_NC
75 /// :lower16
:label
- . = 56832
76 // CHECK
: 21200: movw
r0, #60928
77 /// :lower16
:label1
- . = 56832
78 // CHECK
: movw
r1, #60928
79 /// :lower16
:label2
- . + 4 = 60932
80 // CHECK
: movw
r2, #60932
81 /// :lower16
:label3
- . = 60912
82 // CHECK
: movw
r3, #60912
83 /// :lower16
:label3
- . + 0x2214 = :lower16:0x20000 = 4096
84 // CHECK
: movw
r4, #4096
86 .section .R_ARM_MOVT_PREL, "ax",%progbits
88 movt
r0, :upper16
:label
- .
89 movt
r1, :upper16
:label1
- .
90 movt
r2, :upper16
:label2
+ 0x4 - .
91 movt
r3, :upper16
:label3
- .
92 movt
r4, :upper16
:label3
+ 0x2314 - .
93 // CHECK-LABEL
: Disassembly of section
.R_ARM_MOVT_PREL
95 /// :upper16
:label
- . = :upper16:0xdd00 = 1
96 // CHECK
: 21300: movt
r0, #1
97 /// :upper16
:label1
- . = :upper16:0xdd00 = 1
99 /// :upper16
:label2
- . + 4 = :upper16:0xdd04 = 1
100 // CHECK
: movt
r2, #1
101 /// :upper16
:label3
- . = :upper16:0x1dcf0 = 2
102 // CHECK
: movt
r3, #2
103 /// :upper16
:label3
- . + 0x2314 = :upper16:0x20000 = 3
104 // CHECK
: movt
r4, #3
106 .section .R_ARM_MOVW_BREL_NC, "ax",%progbits
108 movw
r0, :lower16
:label
(sbrel
)
109 movw
r1, :lower16
:label1
(sbrel
)
110 movw
r2, :lower16
:label2
(sbrel
)
111 movw
r3, :lower16
:label3
(sbrel
)
112 movw
r4, :lower16
:label3.4
(sbrel
)
113 // CHECK-LABEL
: Disassembly of section
.R_ARM_MOVW_BREL_NC
116 /// :lower16
:label
- SB
= 0
117 // CHECK
: 21400: movw
r0, #0
118 /// :lower16
:label1
- SB
= 4
119 // CHECK
: movw
r1, #4
120 /// :lower16
:label2
- SB
= 8
121 // CHECK
: movw
r2, #8
122 /// :lower16
:label3
- SB
= 0xfffc
123 // CHECK
: movw
r3, #65532
124 /// :lower16
:label3.4
- SB
= :lower16
:0x10000 = 0
125 // CHECK
: movw
r4, #0
127 .section .R_ARM_MOVT_BREL, "ax",%progbits
129 movt
r0, :upper16
:label
(sbrel
)
130 movt
r1, :upper16
:label1
(sbrel
)
131 movt
r2, :upper16
:label2
(sbrel
)
132 movt
r3, :upper16
:label3
(sbrel
)
133 movt
r4, :upper16
:label3.4
(sbrel
)
134 // CHECK-LABEL
: Disassembly of section
.R_ARM_MOVT_BREL
137 /// :upper16
:label
- SB
= 0
138 // CHECK
: 21500: movt
r0, #0
139 /// :upper16
:label1
- SB
= 0
140 // CHECK
: movt
r1, #0
141 /// :upper16
:label2
- SB
= 0
142 // CHECK
: movt
r2, #0
143 /// :upper16
:label3
- SB
= 0
144 // CHECK
: movt
r3, #0
145 /// :upper16
:label3.4
- SB
= :upper16
:0x10000 = 1
146 // CHECK
: movt
r4, #1
148 .section .R_ARM_THM_MOVW_ABS_NC, "ax",%progbits
150 movw
r0, :lower16
:label
151 movw
r1, :lower16
:label1
152 movw
r2, :lower16
:label2
+ 4
153 movw
r3, :lower16
:label3
154 movw
r4, :lower16
:label3
+ 4
155 // CHECK-LABEL
: Disassembly of section
.R_ARM_THM_MOVW_ABS_NC
157 // CHECK
: 21600: movw
r0, #0
158 // CHECK
: movw
r1, #4
159 // CHECK
: movw
r2, #12
160 // CHECK
: movw
r3, #65532
161 // CHECK
: movw
r4, #0
163 .section .R_ARM_THM_MOVT_ABS, "ax",%progbits
165 movt
r0, :upper16
:label
166 movt
r1, :upper16
:label1
167 movt
r2, :upper16
:label2
+ 4
168 movt
r3, :upper16
:label3
169 movt
r4, :upper16
:label3
+ 4
170 // CHECK-LABEL
: Disassembly of section
.R_ARM_THM_MOVT_ABS
172 // CHECK
: 21700: movt
r0, #4
173 // CHECK
: movt
r1, #4
174 // CHECK
: movt
r2, #4
175 // CHECK
: movt
r3, #4
176 // CHECK
: movt
r4, #5
178 .section .R_ARM_THM_MOVW_PREL_NC, "ax",%progbits
180 movw
r0, :lower16
:label
- .
181 movw
r1, :lower16
:label1
- .
182 movw
r2, :lower16
:label2
+ 4 - .
183 movw
r3, :lower16
:label3
- .
184 movw
r4, :lower16
:label3
+ 0x2814 - .
185 // CHECK-LABEL
: Disassembly of section
.R_ARM_THM_MOVW_PREL_NC
187 /// :lower16
:label
- . = 59392
188 // CHECK
: 21800: movw
r0, #59392
189 /// :lower16
:label1
- . = 59392
190 // CHECK
: movw
r1, #59392
191 /// :lower16
:label2
- . + 4 = 59396
192 // CHECK
: movw
r2, #59396
193 /// :lower16
:label3
- . = 59376
194 // CHECK
: movw
r3, #59376
195 /// :lower16
:label3
- . + 0x2814 = 0x20000
196 // CHECK
: movw
r4, #4096
198 .section .R_ARM_THM_MOVT_PREL, "ax",%progbits
200 movt
r0, :upper16
:label
- .
201 movt
r1, :upper16
:label1
- .
202 movt
r2, :upper16
:label2
+ 0x4 - .
203 movt
r3, :upper16
:label3
- .
204 movt
r4, :upper16
:label3
+ 0x2914 - .
205 // CHECK-LABEL
: Disassembly of section
.R_ARM_THM_MOVT_PREL
207 /// :upper16
:label
- . = :upper16:0xd700 = 1
208 // CHECK
: 21900: movt
r0, #1
209 /// :upper16
:label1
- . = :upper16:0xd700 = 1
210 // CHECK
: movt
r1, #1
211 /// :upper16
:label2
- . + 4 = :upper16:0xd704 = 1
212 // CHECK
: movt
r2, #1
213 /// :upper16
:label3
- . = :upper16:0x1d6f0 = 2
214 // CHECK
: movt
r3, #2
215 /// :upper16
:label3
- . + 0x2914 = :upper16:0x20000 = 3
216 // CHECK
: movt
r4, #3
218 .section .R_ARM_THM_MOVW_BREL_NC, "ax",%progbits
220 movw
r0, :lower16
:label
(sbrel
)
221 movw
r1, :lower16
:label1
(sbrel
)
222 movw
r2, :lower16
:label2
(sbrel
)
223 movw
r3, :lower16
:label3
(sbrel
)
224 movw
r4, :lower16
:label3.4
(sbrel
)
225 // CHECK-LABEL
: Disassembly of section
.R_ARM_THM_MOVW_BREL_NC
228 /// :lower16
:label
- SB
= 0
229 // CHECK
: 21a00
: movw
r0, #0
230 /// :lower16
:label1
- SB
= 4
231 // CHECK
: movw
r1, #4
232 /// :lower16
:label2
- SB
= 8
233 // CHECK
: movw
r2, #8
234 /// :lower16
:label3
- SB
= 0xfffc
235 // CHECK
: movw
r3, #65532
236 /// :lower16
:label3.4
- SB
= :lower16
:0x10000 = 0
237 // CHECK
: movw
r4, #0
239 .section .R_ARM_THM_MOVT_BREL, "ax",%progbits
241 movt
r0, :upper16
:label
(sbrel
)
242 movt
r1, :upper16
:label1
(sbrel
)
243 movt
r2, :upper16
:label2
(sbrel
)
244 movt
r3, :upper16
:label3
(sbrel
)
245 movt
r4, :upper16
:label3.4
(sbrel
)
246 // CHECK-LABEL
: Disassembly of section
.R_ARM_THM_MOVT_BREL
248 /// SB
= .destination
249 /// :upper16
:label
- SB
= 0
250 // CHECK
: 21b00
: movt
r0, #0
251 /// :upper16
:label1
- SB
= 0
252 // CHECK
: movt
r1, #0
253 /// :upper16
:label2
- SB
= 0
254 // CHECK
: movt
r2, #0
255 /// :upper16
:label3
- SB
= 0
256 // CHECK
: movt
r3, #0
257 /// :upper16
:label3.4
- SB
= :upper16
:0x10000 = 1
258 // CHECK
: movt
r4, #1
260 .section .destination, "aw",%progbits
271 /// Test label3 is immediately below
2^
16 alignment boundary
276 /// label3
+ 4 is on
a 2^
16 alignment boundary