Update test to use llvm-readobj. NFC.
[oota-llvm.git] / test / MC / MachO / symbol-indirect.s
1 // RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s
2
3 // FIXME: We are missing a lot of diagnostics on this kind of stuff which the
4 // assembler has.
5         
6         .lazy_symbol_pointer
7         .indirect_symbol sym_lsp_B
8         .long 0
9         
10         .globl sym_lsp_A
11         .indirect_symbol sym_lsp_A
12         .long 0
13         
14 sym_lsp_C:      
15         .indirect_symbol sym_lsp_C
16         .long 0
17
18 // FIXME: Enable this test once missing llvm-mc support is in place.
19 .if 0
20         .indirect_symbol sym_lsp_D
21         .long sym_lsp_D
22 .endif
23
24         .indirect_symbol sym_lsp_E
25         .long 0xFA
26
27 // FIXME: Enable this test once missing llvm-mc support is in place.
28 .if 0
29 sym_lsp_F = 10
30         .indirect_symbol sym_lsp_F
31         .long 0
32 .endif
33
34         .globl sym_lsp_G
35 sym_lsp_G:
36         .indirect_symbol sym_lsp_G
37         .long 0
38         
39         .non_lazy_symbol_pointer
40         .indirect_symbol sym_nlp_B
41         .long 0
42
43         .globl sym_nlp_A
44         .indirect_symbol sym_nlp_A
45         .long 0
46
47 sym_nlp_C:      
48         .indirect_symbol sym_nlp_C
49         .long 0
50
51 // FIXME: Enable this test once missing llvm-mc support is in place.
52 .if 0
53         .indirect_symbol sym_nlp_D
54         .long sym_nlp_D
55 .endif
56
57         .indirect_symbol sym_nlp_E
58         .long 0xAF
59
60 // FIXME: Enable this test once missing llvm-mc support is in place.
61 .if 0
62 sym_nlp_F = 10
63         .indirect_symbol sym_nlp_F
64         .long 0
65 .endif
66
67         .globl sym_nlp_G
68 sym_nlp_G:
69         .indirect_symbol sym_nlp_G
70         .long 0
71
72 // CHECK: ('cputype', 7)
73 // CHECK: ('cpusubtype', 3)
74 // CHECK: ('filetype', 1)
75 // CHECK: ('num_load_commands', 3)
76 // CHECK: ('load_commands_size', 364)
77 // CHECK: ('flag', 0)
78 // CHECK: ('load_commands', [
79 // CHECK:   # Load Command 0
80 // CHECK:  (('command', 1)
81 // CHECK:   ('size', 260)
82 // CHECK:   ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
83 // CHECK:   ('vm_addr', 0)
84 // CHECK:   ('vm_size', 40)
85 // CHECK:   ('file_offset', 392)
86 // CHECK:   ('file_size', 40)
87 // CHECK:   ('maxprot', 7)
88 // CHECK:   ('initprot', 7)
89 // CHECK:   ('num_sections', 3)
90 // CHECK:   ('flags', 0)
91 // CHECK:   ('sections', [
92 // CHECK:     # Section 0
93 // CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
94 // CHECK:     ('address', 0)
95 // CHECK:     ('size', 0)
96 // CHECK:     ('offset', 392)
97 // CHECK:     ('alignment', 0)
98 // CHECK:     ('reloc_offset', 0)
99 // CHECK:     ('num_reloc', 0)
100 // CHECK:     ('flags', 0x80000000)
101 // CHECK:     ('reserved1', 0)
102 // CHECK:     ('reserved2', 0)
103 // CHECK:    ),
104 // CHECK:     # Section 1
105 // CHECK:    (('section_name', '__la_symbol_ptr\x00')
106 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
107 // CHECK:     ('address', 0)
108 // CHECK:     ('size', 20)
109 // CHECK:     ('offset', 392)
110 // CHECK:     ('alignment', 2)
111 // CHECK:     ('reloc_offset', 0)
112 // CHECK:     ('num_reloc', 0)
113 // CHECK:     ('flags', 0x7)
114 // CHECK:     ('reserved1', 0)
115 // CHECK:     ('reserved2', 0)
116 // CHECK:    ),
117 // CHECK:     # Section 2
118 // CHECK:    (('section_name', '__nl_symbol_ptr\x00')
119 // CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
120 // CHECK:     ('address', 20)
121 // CHECK:     ('size', 20)
122 // CHECK:     ('offset', 412)
123 // CHECK:     ('alignment', 2)
124 // CHECK:     ('reloc_offset', 0)
125 // CHECK:     ('num_reloc', 0)
126 // CHECK:     ('flags', 0x6)
127         // FIXME: Enable this when fixed!
128 // CHECX:     ('reserved1', 5)
129 // CHECK:     ('reserved2', 0)
130 // CHECK:    ),
131 // CHECK:   ])
132 // CHECK:  ),
133 // CHECK:   # Load Command 1
134 // CHECK:  (('command', 2)
135 // CHECK:   ('size', 24)
136 // CHECK:   ('symoff', 472)
137 // CHECK:   ('nsyms', 10)
138 // CHECK:   ('stroff', 592)
139 // CHECK:   ('strsize', 104)
140 // CHECK:   ('_string_data', '\x00sym_lsp_G\x00sym_nlp_G\x00sym_lsp_E\x00sym_nlp_E\x00sym_lsp_C\x00sym_nlp_C\x00sym_lsp_B\x00sym_nlp_B\x00sym_lsp_A\x00sym_nlp_A\x00\x00\x00\x00')
141 // CHECK:   ('_symbols', [
142 // CHECK:     # Symbol 0
143 // CHECK:    (('n_strx', 41)
144 // CHECK:     ('n_type', 0xe)
145 // CHECK:     ('n_sect', 2)
146 // CHECK:     ('n_desc', 0)
147 // CHECK:     ('n_value', 8)
148 // CHECK:     ('_string', 'sym_lsp_C')
149 // CHECK:    ),
150 // CHECK:     # Symbol 1
151 // CHECK:    (('n_strx', 51)
152 // CHECK:     ('n_type', 0xe)
153 // CHECK:     ('n_sect', 3)
154 // CHECK:     ('n_desc', 0)
155 // CHECK:     ('n_value', 28)
156 // CHECK:     ('_string', 'sym_nlp_C')
157 // CHECK:    ),
158 // CHECK:     # Symbol 2
159 // CHECK:    (('n_strx', 1)
160 // CHECK:     ('n_type', 0xf)
161 // CHECK:     ('n_sect', 2)
162 // CHECK:     ('n_desc', 0)
163 // CHECK:     ('n_value', 16)
164 // CHECK:     ('_string', 'sym_lsp_G')
165 // CHECK:    ),
166 // CHECK:     # Symbol 3
167 // CHECK:    (('n_strx', 11)
168 // CHECK:     ('n_type', 0xf)
169 // CHECK:     ('n_sect', 3)
170 // CHECK:     ('n_desc', 0)
171 // CHECK:     ('n_value', 36)
172 // CHECK:     ('_string', 'sym_nlp_G')
173 // CHECK:    ),
174 // CHECK:     # Symbol 4
175 // CHECK:    (('n_strx', 81)
176 // CHECK:     ('n_type', 0x1)
177 // CHECK:     ('n_sect', 0)
178 // CHECK:     ('n_desc', 0)
179 // CHECK:     ('n_value', 0)
180 // CHECK:     ('_string', 'sym_lsp_A')
181 // CHECK:    ),
182 // CHECK:     # Symbol 5
183 // CHECK:    (('n_strx', 61)
184 // CHECK:     ('n_type', 0x1)
185 // CHECK:     ('n_sect', 0)
186 // CHECK:     ('n_desc', 1)
187 // CHECK:     ('n_value', 0)
188 // CHECK:     ('_string', 'sym_lsp_B')
189 // CHECK:    ),
190 // CHECK:     # Symbol 6
191 // CHECK:    (('n_strx', 21)
192 // CHECK:     ('n_type', 0x1)
193 // CHECK:     ('n_sect', 0)
194 // CHECK:     ('n_desc', 1)
195 // CHECK:     ('n_value', 0)
196 // CHECK:     ('_string', 'sym_lsp_E')
197 // CHECK:    ),
198 // CHECK:     # Symbol 7
199 // CHECK:    (('n_strx', 91)
200 // CHECK:     ('n_type', 0x1)
201 // CHECK:     ('n_sect', 0)
202 // CHECK:     ('n_desc', 0)
203 // CHECK:     ('n_value', 0)
204 // CHECK:     ('_string', 'sym_nlp_A')
205 // CHECK:    ),
206 // CHECK:     # Symbol 8
207 // CHECK:    (('n_strx', 71)
208 // CHECK:     ('n_type', 0x1)
209 // CHECK:     ('n_sect', 0)
210 // CHECK:     ('n_desc', 0)
211 // CHECK:     ('n_value', 0)
212 // CHECK:     ('_string', 'sym_nlp_B')
213 // CHECK:    ),
214 // CHECK:     # Symbol 9
215 // CHECK:    (('n_strx', 31)
216 // CHECK:     ('n_type', 0x1)
217 // CHECK:     ('n_sect', 0)
218 // CHECK:     ('n_desc', 0)
219 // CHECK:     ('n_value', 0)
220 // CHECK:     ('_string', 'sym_nlp_E')
221 // CHECK:    ),
222 // CHECK:   ])
223 // CHECK:  ),
224 // CHECK:   # Load Command 2
225 // CHECK:  (('command', 11)
226 // CHECK:   ('size', 80)
227 // CHECK:   ('ilocalsym', 0)
228 // CHECK:   ('nlocalsym', 2)
229 // CHECK:   ('iextdefsym', 2)
230 // CHECK:   ('nextdefsym', 2)
231 // CHECK:   ('iundefsym', 4)
232 // CHECK:   ('nundefsym', 6)
233 // CHECK:   ('tocoff', 0)
234 // CHECK:   ('ntoc', 0)
235 // CHECK:   ('modtaboff', 0)
236 // CHECK:   ('nmodtab', 0)
237 // CHECK:   ('extrefsymoff', 0)
238 // CHECK:   ('nextrefsyms', 0)
239 // CHECK:   ('indirectsymoff', 432)
240 // CHECK:   ('nindirectsyms', 10)
241 // CHECK:   ('extreloff', 0)
242 // CHECK:   ('nextrel', 0)
243 // CHECK:   ('locreloff', 0)
244 // CHECK:   ('nlocrel', 0)
245 // CHECK:   ('_indirect_symbols', [
246 // CHECK:     # Indirect Symbol 0
247 // CHECK:     (('symbol_index', 0x5),),
248 // CHECK:     # Indirect Symbol 1
249 // CHECK:     (('symbol_index', 0x4),),
250 // CHECK:     # Indirect Symbol 2
251 // CHECK:     (('symbol_index', 0x0),),
252 // CHECK:     # Indirect Symbol 3
253 // CHECK:     (('symbol_index', 0x6),),
254 // CHECK:     # Indirect Symbol 4
255 // CHECK:     (('symbol_index', 0x2),),
256 // CHECK:     # Indirect Symbol 5
257 // CHECK:     (('symbol_index', 0x8),),
258 // CHECK:     # Indirect Symbol 6
259 // CHECK:     (('symbol_index', 0x7),),
260 // CHECK:     # Indirect Symbol 7
261 // CHECK:     (('symbol_index', 0x80000000),),
262 // CHECK:     # Indirect Symbol 8
263 // CHECK:     (('symbol_index', 0x9),),
264 // CHECK:     # Indirect Symbol 9
265 // CHECK:     (('symbol_index', 0x3),),
266 // CHECK:   ])
267 // CHECK:  ),
268 // CHECK: ])