summaryrefslogtreecommitdiff
path: root/test/MC/MachO/symbol-indirect.s
blob: 2412970322bffb8877bf273af42c1ed10772a7d8 (plain)
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
// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s

// FIXME: We are missing a lot of diagnostics on this kind of stuff which the
// assembler has.
        
        .lazy_symbol_pointer
        .indirect_symbol sym_lsp_B
        .long 0
        
        .globl sym_lsp_A
        .indirect_symbol sym_lsp_A
        .long 0
        
sym_lsp_C:      
        .indirect_symbol sym_lsp_C
        .long 0

// FIXME: Enable this test once missing llvm-mc support is in place.
.if 0
        .indirect_symbol sym_lsp_D
        .long sym_lsp_D
.endif

        .indirect_symbol sym_lsp_E
        .long 0xFA

// FIXME: Enable this test once missing llvm-mc support is in place.
.if 0
sym_lsp_F = 10
        .indirect_symbol sym_lsp_F
        .long 0
.endif

        .globl sym_lsp_G
sym_lsp_G:
        .indirect_symbol sym_lsp_G
        .long 0
        
        .non_lazy_symbol_pointer
        .indirect_symbol sym_nlp_B
        .long 0

        .globl sym_nlp_A
        .indirect_symbol sym_nlp_A
        .long 0

sym_nlp_C:      
        .indirect_symbol sym_nlp_C
        .long 0

// FIXME: Enable this test once missing llvm-mc support is in place.
.if 0
        .indirect_symbol sym_nlp_D
        .long sym_nlp_D
.endif

        .indirect_symbol sym_nlp_E
        .long 0xAF

// FIXME: Enable this test once missing llvm-mc support is in place.
.if 0
sym_nlp_F = 10
        .indirect_symbol sym_nlp_F
        .long 0
.endif

        .globl sym_nlp_G
sym_nlp_G:
        .indirect_symbol sym_nlp_G
        .long 0

// CHECK: ('cputype', 7)
// CHECK: ('cpusubtype', 3)
// CHECK: ('filetype', 1)
// CHECK: ('num_load_commands', 3)
// CHECK: ('load_commands_size', 364)
// CHECK: ('flag', 0)
// CHECK: ('load_commands', [
// CHECK:   # Load Command 0
// CHECK:  (('command', 1)
// CHECK:   ('size', 260)
// CHECK:   ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK:   ('vm_addr', 0)
// CHECK:   ('vm_size', 40)
// CHECK:   ('file_offset', 392)
// CHECK:   ('file_size', 40)
// CHECK:   ('maxprot', 7)
// CHECK:   ('initprot', 7)
// CHECK:   ('num_sections', 3)
// CHECK:   ('flags', 0)
// CHECK:   ('sections', [
// CHECK:     # Section 0
// CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK:     ('address', 0)
// CHECK:     ('size', 0)
// CHECK:     ('offset', 392)
// CHECK:     ('alignment', 0)
// CHECK:     ('reloc_offset', 0)
// CHECK:     ('num_reloc', 0)
// CHECK:     ('flags', 0x80000000)
// CHECK:     ('reserved1', 0)
// CHECK:     ('reserved2', 0)
// CHECK:    ),
// CHECK:     # Section 1
// CHECK:    (('section_name', '__la_symbol_ptr\x00')
// CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK:     ('address', 0)
// CHECK:     ('size', 20)
// CHECK:     ('offset', 392)
// CHECK:     ('alignment', 2)
// CHECK:     ('reloc_offset', 0)
// CHECK:     ('num_reloc', 0)
// CHECK:     ('flags', 0x7)
// CHECK:     ('reserved1', 0)
// CHECK:     ('reserved2', 0)
// CHECK:    ),
// CHECK:     # Section 2
// CHECK:    (('section_name', '__nl_symbol_ptr\x00')
// CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
// CHECK:     ('address', 20)
// CHECK:     ('size', 20)
// CHECK:     ('offset', 412)
// CHECK:     ('alignment', 2)
// CHECK:     ('reloc_offset', 0)
// CHECK:     ('num_reloc', 0)
// CHECK:     ('flags', 0x6)
        // FIXME: Enable this when fixed!
// CHECX:     ('reserved1', 5)
// CHECK:     ('reserved2', 0)
// CHECK:    ),
// CHECK:   ])
// CHECK:  ),
// CHECK:   # Load Command 1
// CHECK:  (('command', 2)
// CHECK:   ('size', 24)
// CHECK:   ('symoff', 472)
// CHECK:   ('nsyms', 10)
// CHECK:   ('stroff', 592)
// CHECK:   ('strsize', 104)
// CHECK:   ('_string_data', '\x00sym_lsp_A\x00sym_lsp_G\x00sym_nlp_A\x00sym_nlp_G\x00sym_nlp_B\x00sym_nlp_E\x00sym_lsp_B\x00sym_lsp_E\x00sym_lsp_C\x00sym_nlp_C\x00\x00\x00\x00')
// CHECK:   ('_symbols', [
// CHECK:     # Symbol 0
// CHECK:    (('n_strx', 81)
// CHECK:     ('n_type', 0xe)
// CHECK:     ('n_sect', 2)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 8)
// CHECK:     ('_string', 'sym_lsp_C')
// CHECK:    ),
// CHECK:     # Symbol 1
// CHECK:    (('n_strx', 91)
// CHECK:     ('n_type', 0xe)
// CHECK:     ('n_sect', 3)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 28)
// CHECK:     ('_string', 'sym_nlp_C')
// CHECK:    ),
// CHECK:     # Symbol 2
// CHECK:    (('n_strx', 11)
// CHECK:     ('n_type', 0xf)
// CHECK:     ('n_sect', 2)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 16)
// CHECK:     ('_string', 'sym_lsp_G')
// CHECK:    ),
// CHECK:     # Symbol 3
// CHECK:    (('n_strx', 31)
// CHECK:     ('n_type', 0xf)
// CHECK:     ('n_sect', 3)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 36)
// CHECK:     ('_string', 'sym_nlp_G')
// CHECK:    ),
// CHECK:     # Symbol 4
// CHECK:    (('n_strx', 1)
// CHECK:     ('n_type', 0x1)
// CHECK:     ('n_sect', 0)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 0)
// CHECK:     ('_string', 'sym_lsp_A')
// CHECK:    ),
// CHECK:     # Symbol 5
// CHECK:    (('n_strx', 61)
// CHECK:     ('n_type', 0x1)
// CHECK:     ('n_sect', 0)
// CHECK:     ('n_desc', 1)
// CHECK:     ('n_value', 0)
// CHECK:     ('_string', 'sym_lsp_B')
// CHECK:    ),
// CHECK:     # Symbol 6
// CHECK:    (('n_strx', 71)
// CHECK:     ('n_type', 0x1)
// CHECK:     ('n_sect', 0)
// CHECK:     ('n_desc', 1)
// CHECK:     ('n_value', 0)
// CHECK:     ('_string', 'sym_lsp_E')
// CHECK:    ),
// CHECK:     # Symbol 7
// CHECK:    (('n_strx', 21)
// CHECK:     ('n_type', 0x1)
// CHECK:     ('n_sect', 0)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 0)
// CHECK:     ('_string', 'sym_nlp_A')
// CHECK:    ),
// CHECK:     # Symbol 8
// CHECK:    (('n_strx', 41)
// CHECK:     ('n_type', 0x1)
// CHECK:     ('n_sect', 0)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 0)
// CHECK:     ('_string', 'sym_nlp_B')
// CHECK:    ),
// CHECK:     # Symbol 9
// CHECK:    (('n_strx', 51)
// CHECK:     ('n_type', 0x1)
// CHECK:     ('n_sect', 0)
// CHECK:     ('n_desc', 0)
// CHECK:     ('n_value', 0)
// CHECK:     ('_string', 'sym_nlp_E')
// CHECK:    ),
// CHECK:   ])
// CHECK:  ),
// CHECK:   # Load Command 2
// CHECK:  (('command', 11)
// CHECK:   ('size', 80)
// CHECK:   ('ilocalsym', 0)
// CHECK:   ('nlocalsym', 2)
// CHECK:   ('iextdefsym', 2)
// CHECK:   ('nextdefsym', 2)
// CHECK:   ('iundefsym', 4)
// CHECK:   ('nundefsym', 6)
// CHECK:   ('tocoff', 0)
// CHECK:   ('ntoc', 0)
// CHECK:   ('modtaboff', 0)
// CHECK:   ('nmodtab', 0)
// CHECK:   ('extrefsymoff', 0)
// CHECK:   ('nextrefsyms', 0)
// CHECK:   ('indirectsymoff', 432)
// CHECK:   ('nindirectsyms', 10)
// CHECK:   ('extreloff', 0)
// CHECK:   ('nextrel', 0)
// CHECK:   ('locreloff', 0)
// CHECK:   ('nlocrel', 0)
// CHECK:   ('_indirect_symbols', [
// CHECK:     # Indirect Symbol 0
// CHECK:     (('symbol_index', 0x5),),
// CHECK:     # Indirect Symbol 1
// CHECK:     (('symbol_index', 0x4),),
// CHECK:     # Indirect Symbol 2
// CHECK:     (('symbol_index', 0x0),),
// CHECK:     # Indirect Symbol 3
// CHECK:     (('symbol_index', 0x6),),
// CHECK:     # Indirect Symbol 4
// CHECK:     (('symbol_index', 0x2),),
// CHECK:     # Indirect Symbol 5
// CHECK:     (('symbol_index', 0x8),),
// CHECK:     # Indirect Symbol 6
// CHECK:     (('symbol_index', 0x7),),
// CHECK:     # Indirect Symbol 7
// CHECK:     (('symbol_index', 0x80000000),),
// CHECK:     # Indirect Symbol 8
// CHECK:     (('symbol_index', 0x9),),
// CHECK:     # Indirect Symbol 9
// CHECK:     (('symbol_index', 0x3),),
// CHECK:   ])
// CHECK:  ),
// CHECK: ])