parse-data-in-code-armv7.yaml
4.12 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
# RUN: ld64.lld -arch armv7 -r -print_atoms %s -o %t | FileCheck %s
# RUN: ld64.lld -arch armv7 -r -print_atoms %t -o %t2 | FileCheck %s
# RUN: ld64.lld -arch armv7 -dylib %s -o %t3.dylib %p/Inputs/armv7/libSystem.yaml \
# RUN: && llvm-objdump -macho -private-headers %t3.dylib | FileCheck --check-prefix=CHECK2 %s
#
# Test parsing LC_DATA_IN_CODE
#
#
--- !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, 0x00, 0xBF, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0xBF,
0x00, 0xF0, 0x20, 0xE3, 0x0A, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3 ]
local-symbols:
- name: _foo_thumb
type: N_SECT
sect: 1
desc: [ N_ARM_THUMB_DEF ]
value: 0x0000000000000000
- name: _foo_arm
type: N_SECT
sect: 1
value: 0x0000000000000018
dataInCode:
- offset: 0x00000004
length: 0x0004
kind: DICE_KIND_DATA
- offset: 0x00000008
length: 0x0004
kind: DICE_KIND_JUMP_TABLE32
- offset: 0x0000000C
length: 0x0004
kind: DICE_KIND_JUMP_TABLE16
- offset: 0x00000010
length: 0x0004
kind: DICE_KIND_JUMP_TABLE8
- offset: 0x0000001C
length: 0x0004
kind: DICE_KIND_DATA
- offset: 0x00000020
length: 0x0004
kind: DICE_KIND_JUMP_TABLE32
- offset: 0x00000024
length: 0x0004
kind: DICE_KIND_JUMP_TABLE16
- offset: 0x00000028
length: 0x0004
kind: DICE_KIND_JUMP_TABLE8
...
# CHECK: defined-atoms:
# CHECK: - name: _foo_thumb
# CHECK: references:
# CHECK: - kind: modeThumbCode
# CHECK: offset: 0
# CHECK: - kind: modeData
# CHECK: offset: 4
# CHECK: addend: 1
# CHECK: - kind: modeData
# CHECK: offset: 8
# CHECK: addend: 4
# CHECK: - kind: modeData
# CHECK: offset: 12
# CHECK: addend: 3
# CHECK: - kind: modeData
# CHECK: offset: 16
# CHECK: addend: 2
# CHECK: - kind: modeThumbCode
# CHECK: offset: 20
# CHECK: - name: _foo_arm
# CHECK: references:
# CHECK: - kind: modeData
# CHECK: offset: 4
# CHECK: addend: 1
# CHECK: - kind: modeData
# CHECK: offset: 8
# CHECK: addend: 4
# CHECK: - kind: modeData
# CHECK: offset: 12
# CHECK: addend: 3
# CHECK: - kind: modeData
# CHECK: offset: 16
# CHECK: addend: 2
# CHECK: - kind: modeArmCode
# CHECK: offset: 20
# CHECK2: cmd LC_DATA_IN_CODE
# CHECK2: cmdsize 16
# CHECK2: datasize 64
# .code 16
# .thumb_func _foo_thumb
#_foo_thumb:
# nop
# nop
#
# .data_region
# .long 0
# .end_data_region
#
# .data_region jt32
# .long 1
# .end_data_region
#
# .data_region jt16
# .long 2
# .end_data_region
#
# .data_region jt8
# .long 3
# .end_data_region
#
# nop
# nop
#
#
#
# .code 32
# .align 2
#_foo_arm:
# nop
#
# .data_region
# .long 10
# .end_data_region
#
# .data_region jt32
# .long 11
# .end_data_region
#
# .data_region jt16
# .long 12
# .end_data_region
#
# .data_region jt8
# .long 13
# .end_data_region
#
# nop
#