arm-shims.yaml
3.23 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
# RUN: ld64.lld -arch armv7 %s %p/Inputs/arm-shims.yaml \
# RUN: -dylib %p/Inputs/armv7/libSystem.yaml -o %t
# RUN: llvm-readobj -S --section-data %t | FileCheck %s
#
# Test b from arm to thumb or vice versa has shims added.s
#
#
--- !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: [ 0x00, 0xBF, 0xFF, 0xF7, 0xFE, 0xEF, 0xFF, 0xF7,
0xFB, 0xBF, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3,
0xFA, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF, 0xEA ]
relocations:
- offset: 0x00000014
type: ARM_RELOC_BR24
length: 2
pc-rel: true
extern: true
symbol: 3
- offset: 0x00000010
type: ARM_RELOC_BR24
length: 2
pc-rel: true
extern: true
symbol: 3
- offset: 0x00000006
type: ARM_THUMB_RELOC_BR22
length: 2
pc-rel: true
extern: true
symbol: 2
- offset: 0x00000002
type: ARM_THUMB_RELOC_BR22
length: 2
pc-rel: true
extern: true
symbol: 2
global-symbols:
- name: _a1
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x000000000000000C
- name: _t1
type: N_SECT
scope: [ N_EXT ]
sect: 1
desc: [ N_ARM_THUMB_DEF ]
value: 0x0000000000000000
undefined-symbols:
- name: _a2
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
- name: _t2
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
...
# CHECK: Section {
# CHECK: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
# CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
# CHECK: SectionData (
# CHECK: 0000: 00BF00F0 10E800F0 19B80000 00F020E3
# CHECK: 0010: 000000FA 0F0000EA 00BFFFF7 F8EF00F0
# CHECK: 0020: 07B80000 00F020E3 F4FFFFFA 050000EA
# CHECK: 0030: DFF804C0 FF446047 D4FFFFFF DFF804C0
# CHECK: 0040: FF446047 E0FFFFFF 04C09FE5 0CC08FE0
# CHECK: 0050: 1CFF2FE1 ADFFFFFF 04C09FE5 0CC08FE0
# CHECK: 0060: 1CFF2FE1 B5FFFFFF
# CHECK: )
# When we get a good mach-o disassembler the above __text section content check can be change to be symbolic.
# Input file one:
#
# .align 2
# .code 16
# .globl _t1
# .thumb_func _t1
#_t1:
# nop
# blx _a2
# b _a2
#
# .code 32
# .align 2
# .globl _a1
#_a1:
# nop
# blx _t2
# b _t2
# Input file two:
#
# .align 2
# .code 16
# .globl _t2
# .thumb_func _t2
#_t2:
# nop
# blx _a1
# b _a1
#
# .code 32
# .align 2
# .globl _a2
#_a2:
# nop
# blx _t1
# b _t1