arm-interworking-movw.yaml
12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# REQUIRES: arm
# RUN: ld64.lld -arch armv7 -r -print_atoms %s -o %t | FileCheck %s
# RUN: ld64.lld -arch armv7 -dylib -print_atoms %t -o %t2 \
# RUN: %p/Inputs/armv7/libSystem.yaml -sectalign __TEXT __text 0x1000 | FileCheck %s
# RUN: llvm-objdump -d -macho -no-symbolic-operands %t2 | FileCheck -check-prefix=CODE %s
#
# Test thumb and arm branches round trip through -r.
# Test movw/movt pairs have low bit set properly for thumb vs arm.
#
#
--- !mach-o
arch: armv7
file-type: MH_OBJECT
flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 2
address: 0x0000000000000000
content: [ 0x40, 0xF2, 0x25, 0x00, 0xC0, 0xF2, 0x00, 0x00,
0x40, 0xF2, 0x01, 0x01, 0xC0, 0xF2, 0x00, 0x01,
0x40, 0xF2, 0x4E, 0x02, 0xC0, 0xF2, 0x00, 0x02,
0x40, 0xF2, 0x2A, 0x03, 0xC0, 0xF2, 0x00, 0x03,
0x78, 0x44, 0x70, 0x47, 0x70, 0x47, 0x25, 0x00,
0x00, 0xE3, 0x00, 0x00, 0x40, 0xE3, 0xD7, 0x1F,
0x0F, 0xE3, 0xFF, 0x1F, 0x4F, 0xE3, 0x4E, 0x20,
0x00, 0xE3, 0x00, 0x20, 0x40, 0xE3, 0x00, 0x30,
0x00, 0xE3, 0x00, 0x30, 0x40, 0xE3, 0x0F, 0x00,
0x80, 0xE0, 0x1E, 0xFF, 0x2F, 0xE1, 0x1E, 0xFF,
0x2F, 0xE1 ]
relocations:
- offset: 0x00000042
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 1
pc-rel: false
value: 0x0000004E
- offset: 0x00000000
scattered: true
type: ARM_RELOC_PAIR
length: 1
pc-rel: false
value: 0x00000046
- offset: 0x0000003E
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 0
pc-rel: false
value: 0x0000004E
- offset: 0x00000000
scattered: true
type: ARM_RELOC_PAIR
length: 0
pc-rel: false
value: 0x00000046
- offset: 0x0000003A
type: ARM_RELOC_HALF
length: 1
pc-rel: false
extern: false
symbol: 1
- offset: 0x0000004E
type: ARM_RELOC_PAIR
length: 1
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x00000036
type: ARM_RELOC_HALF
length: 0
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000000
type: ARM_RELOC_PAIR
length: 0
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x00000032
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 1
pc-rel: false
value: 0x00000024
- offset: 0x0000FFD6
scattered: true
type: ARM_RELOC_PAIR
length: 1
pc-rel: false
value: 0x00000046
- offset: 0x0000002E
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 0
pc-rel: false
value: 0x00000024
- offset: 0x0000FFFF
scattered: true
type: ARM_RELOC_PAIR
length: 0
pc-rel: false
value: 0x00000046
- offset: 0x0000002A
type: ARM_RELOC_HALF
length: 1
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000025
type: ARM_RELOC_PAIR
length: 1
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x00000026
type: ARM_RELOC_HALF
length: 0
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000000
type: ARM_RELOC_PAIR
length: 0
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x0000001C
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 3
pc-rel: false
value: 0x0000004E
- offset: 0x0000002A
scattered: true
type: ARM_RELOC_PAIR
length: 3
pc-rel: false
value: 0x00000020
- offset: 0x00000018
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 2
pc-rel: false
value: 0x0000004E
- offset: 0x00000000
scattered: true
type: ARM_RELOC_PAIR
length: 2
pc-rel: false
value: 0x00000020
- offset: 0x00000014
type: ARM_RELOC_HALF
length: 3
pc-rel: false
extern: false
symbol: 1
- offset: 0x0000004E
type: ARM_RELOC_PAIR
length: 3
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x00000010
type: ARM_RELOC_HALF
length: 2
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000000
type: ARM_RELOC_PAIR
length: 2
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x0000000C
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 3
pc-rel: false
value: 0x00000024
- offset: 0x00000000
scattered: true
type: ARM_RELOC_PAIR
length: 3
pc-rel: false
value: 0x00000020
- offset: 0x00000008
scattered: true
type: ARM_RELOC_HALF_SECTDIFF
length: 2
pc-rel: false
value: 0x00000024
- offset: 0x00000000
scattered: true
type: ARM_RELOC_PAIR
length: 2
pc-rel: false
value: 0x00000020
- offset: 0x00000004
type: ARM_RELOC_HALF
length: 3
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000025
type: ARM_RELOC_PAIR
length: 3
pc-rel: false
extern: false
symbol: 16777215
- offset: 0x00000000
type: ARM_RELOC_HALF
length: 2
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000000
type: ARM_RELOC_PAIR
length: 2
pc-rel: false
extern: false
symbol: 16777215
local-symbols:
- name: _t1
type: N_SECT
sect: 1
desc: [ N_ARM_THUMB_DEF ]
value: 0x0000000000000000
- name: _t2
type: N_SECT
sect: 1
desc: [ N_ARM_THUMB_DEF ]
value: 0x0000000000000024
- name: _a2
type: N_SECT
sect: 1
value: 0x000000000000004E
- name: _a1
type: N_SECT
sect: 1
value: 0x0000000000000026
...
# CHECK: defined-atoms:
# CHECK: - name: _t1
# CHECK: references:
# CHECK: - kind: modeThumbCode
# CHECK: offset: 0
# CHECK: target: _t1
# CHECK: - kind: thumb_movw
# CHECK: offset: 0
# CHECK: target: _t2
# CHECK-NOT: addend:
# CHECK: - kind: thumb_movt
# CHECK: offset: 4
# CHECK: target: _t2
# CHECK-NOT: addend:
# CHECK: - kind: thumb_movw_funcRel
# CHECK: offset: 8
# CHECK: target: _t2
# CHECK: addend: -36
# CHECK: - kind: thumb_movt_funcRel
# CHECK: offset: 12
# CHECK: target: _t2
# CHECK: addend: -36
# CHECK: - kind: thumb_movw
# CHECK: offset: 16
# CHECK: target: _a2
# CHECK-NOT: addend:
# CHECK: - kind: thumb_movt
# CHECK: offset: 20
# CHECK: target: _a2
# CHECK-NOT: addend:
# CHECK: - kind: thumb_movw_funcRel
# CHECK: offset: 24
# CHECK: target: _a2
# CHECK: addend: -36
# CHECK: - kind: thumb_movt_funcRel
# CHECK: offset: 28
# CHECK: target: _a2
# CHECK: addend: -36
# CHECK: - name: _t2
# CHECK: references:
# CHECK: - kind: modeThumbCode
# CHECK: offset: 0
# CHECK: target: _t2
# CHECK: - name: _a1
# CHECK: references:
# CHECK: - kind: arm_movw
# CHECK: offset: 0
# CHECK: target: _t2
# CHECK-NOT: addend:
# CHECK: - kind: arm_movt
# CHECK: offset: 4
# CHECK: target: _t2
# CHECK-NOT: addend:
# CHECK: - kind: arm_movw_funcRel
# CHECK: offset: 8
# CHECK: target: _t2
# CHECK: addend: -40
# CHECK: - kind: arm_movt_funcRel
# CHECK: offset: 12
# CHECK: target: _t2
# CHECK: addend: -40
# CHECK: - kind: arm_movw
# CHECK: offset: 16
# CHECK: target: _a2
# CHECK-NOT: addend:
# CHECK: - kind: arm_movt
# CHECK: offset: 20
# CHECK: target: _a2
# CHECK-NOT: addend:
# CHECK: - kind: arm_movw_funcRel
# CHECK: offset: 24
# CHECK: target: _a2
# CHECK: addend: -40
# CHECK: - kind: arm_movt_funcRel
# CHECK: offset: 28
# CHECK: target: _a2
# CHECK: addend: -40
# CHECK: - name: _a2
# CODE: _t1:
# CODE-NEXT: movw r0, #4133
# CODE-NEXT: movt r0, #0
# CODE-NEXT: movw r1, #1
# CODE-NEXT: movt r1, #0
# CODE-NEXT: movw r2, #4174
# CODE-NEXT: movt r2, #0
# CODE-NEXT: movw r3, #42
# CODE-NEXT: movt r3, #0
# CODE: _a1:
# CODE-NEXT: movw r0, #4133
# CODE-NEXT: movt r0, #0
# CODE-NEXT: movw r1, #65495
# CODE-NEXT: movt r1, #65535
# CODE-NEXT: movw r2, #4174
# CODE-NEXT: movt r2, #0
# CODE-NEXT: movw r3, #0
# CODE-NEXT: movt r3, #0
# .syntax unified
# .align 2
#
# .code 16
# .thumb_func _t1
#_t1:
# movw r0, :lower16:(_t2)
# movt r0, :upper16:(_t2)
# movw r1, :lower16:(_t2-(L0+4))
# movt r1, :upper16:(_t2-(L0+4))
# movw r2, :lower16:(_a2)
# movt r2, :upper16:(_a2)
# movw r3, :lower16:(_a2-(L0+4))
# movt r3, :upper16:(_a2-(L0+4))
#L0:
# add r0, pc
# bx lr
#
#
# .code 16
# .thumb_func _t2
#_t2:
# bx lr
#
#
#
# .code 32
#_a1:
# movw r0, :lower16:(_t2)
# movt r0, :upper16:(_t2)
# movw r1, :lower16:(_t2-(L1+8))
# movt r1, :upper16:(_t2-(L1+8))
# movw r2, :lower16:(_a2)
# movt r2, :upper16:(_a2)
# movw r3, :lower16:(_a2-(L1+8))
# movt r3, :upper16:(_a2-(L1+8))
#L1:
# add r0, pc
# bx lr
#
#_a2:
# bx lr