1// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -file-headers -s -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols | 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
14sym_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
29sym_lsp_F = 10
30        .indirect_symbol sym_lsp_F
31        .long 0
32.endif
33
34        .globl sym_lsp_G
35sym_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
47sym_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
62sym_nlp_F = 10
63        .indirect_symbol sym_nlp_F
64        .long 0
65.endif
66
67        .globl sym_nlp_G
68sym_nlp_G:
69        .indirect_symbol sym_nlp_G
70        .long 0
71
72// CHECK: File: <stdin>
73// CHECK: Format: Mach-O 32-bit i386
74// CHECK: Arch: i386
75// CHECK: AddressSize: 32bit
76// CHECK: MachHeader {
77// CHECK:   Magic: Magic (0xFEEDFACE)
78// CHECK:   CpuType: X86 (0x7)
79// CHECK:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
80// CHECK:   FileType: Relocatable (0x1)
81// CHECK:   NumOfLoadCommands: 4
82// CHECK:   SizeOfLoadCommands: 380
83// CHECK:   Flags [ (0x0)
84// CHECK:   ]
85// CHECK: }
86// CHECK: Sections [
87// CHECK:   Section {
88// CHECK:     Index: 0
89// CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
90// CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
91// CHECK:     Address: 0x0
92// CHECK:     Size: 0x0
93// CHECK:     Offset: 408
94// CHECK:     Alignment: 0
95// CHECK:     RelocationOffset: 0x0
96// CHECK:     RelocationCount: 0
97// CHECK:     Type: 0x0
98// CHECK:     Attributes [ (0x800000)
99// CHECK:       PureInstructions (0x800000)
100// CHECK:     ]
101// CHECK:     Reserved1: 0x0
102// CHECK:     Reserved2: 0x0
103// CHECK:   }
104// CHECK:   Section {
105// CHECK:     Index: 1
106// CHECK:     Name: __la_symbol_ptr (5F 5F 6C 61 5F 73 79 6D 62 6F 6C 5F 70 74 72 00)
107// CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
108// CHECK:     Address: 0x0
109// CHECK:     Size: 0x14
110// CHECK:     Offset: 408
111// CHECK:     Alignment: 2
112// CHECK:     RelocationOffset: 0x0
113// CHECK:     RelocationCount: 0
114// CHECK:     Type: 0x7
115// CHECK:     Attributes [ (0x0)
116// CHECK:     ]
117// CHECK:     Reserved1: 0x0
118// CHECK:     Reserved2: 0x0
119// CHECK:   }
120// CHECK:   Section {
121// CHECK:     Index: 2
122// CHECK:     Name: __nl_symbol_ptr (5F 5F 6E 6C 5F 73 79 6D 62 6F 6C 5F 70 74 72 00)
123// CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
124// CHECK:     Address: 0x14
125// CHECK:     Size: 0x14
126// CHECK:     Offset: 428
127// CHECK:     Alignment: 2
128// CHECK:     RelocationOffset: 0x0
129// CHECK:     RelocationCount: 0
130// CHECK:     Type: 0x6
131// CHECK:     Attributes [ (0x0)
132// CHECK:     ]
133// CHECK:     Reserved1: 0x5
134// CHECK:     Reserved2: 0x0
135// CHECK:   }
136// CHECK: ]
137// CHECK: Relocations [
138// CHECK: ]
139// CHECK: Symbols [
140// CHECK:   Symbol {
141// CHECK:     Name: sym_lsp_C (41)
142// CHECK:     Type: Section (0xE)
143// CHECK:     Section: __la_symbol_ptr (0x2)
144// CHECK:     RefType: UndefinedNonLazy (0x0)
145// CHECK:     Flags [ (0x0)
146// CHECK:     ]
147// CHECK:     Value: 0x8
148// CHECK:   }
149// CHECK:   Symbol {
150// CHECK:     Name: sym_nlp_C (51)
151// CHECK:     Type: Section (0xE)
152// CHECK:     Section: __nl_symbol_ptr (0x3)
153// CHECK:     RefType: UndefinedNonLazy (0x0)
154// CHECK:     Flags [ (0x0)
155// CHECK:     ]
156// CHECK:     Value: 0x1C
157// CHECK:   }
158// CHECK:   Symbol {
159// CHECK:     Name: sym_lsp_G (1)
160// CHECK:     Extern
161// CHECK:     Type: Section (0xE)
162// CHECK:     Section: __la_symbol_ptr (0x2)
163// CHECK:     RefType: UndefinedNonLazy (0x0)
164// CHECK:     Flags [ (0x0)
165// CHECK:     ]
166// CHECK:     Value: 0x10
167// CHECK:   }
168// CHECK:   Symbol {
169// CHECK:     Name: sym_nlp_G (11)
170// CHECK:     Extern
171// CHECK:     Type: Section (0xE)
172// CHECK:     Section: __nl_symbol_ptr (0x3)
173// CHECK:     RefType: UndefinedNonLazy (0x0)
174// CHECK:     Flags [ (0x0)
175// CHECK:     ]
176// CHECK:     Value: 0x24
177// CHECK:   }
178// CHECK:   Symbol {
179// CHECK:     Name: sym_lsp_A (81)
180// CHECK:     Extern
181// CHECK:     Type: Undef (0x0)
182// CHECK:     Section:  (0x0)
183// CHECK:     RefType: UndefinedNonLazy (0x0)
184// CHECK:     Flags [ (0x0)
185// CHECK:     ]
186// CHECK:     Value: 0x0
187// CHECK:   }
188// CHECK:   Symbol {
189// CHECK:     Name: sym_lsp_B (61)
190// CHECK:     Extern
191// CHECK:     Type: Undef (0x0)
192// CHECK:     Section:  (0x0)
193// CHECK:     RefType: ReferenceFlagUndefinedLazy (0x1)
194// CHECK:     Flags [ (0x0)
195// CHECK:     ]
196// CHECK:     Value: 0x0
197// CHECK:   }
198// CHECK:   Symbol {
199// CHECK:     Name: sym_lsp_E (21)
200// CHECK:     Extern
201// CHECK:     Type: Undef (0x0)
202// CHECK:     Section:  (0x0)
203// CHECK:     RefType: ReferenceFlagUndefinedLazy (0x1)
204// CHECK:     Flags [ (0x0)
205// CHECK:     ]
206// CHECK:     Value: 0x0
207// CHECK:   }
208// CHECK:   Symbol {
209// CHECK:     Name: sym_nlp_A (91)
210// CHECK:     Extern
211// CHECK:     Type: Undef (0x0)
212// CHECK:     Section:  (0x0)
213// CHECK:     RefType: UndefinedNonLazy (0x0)
214// CHECK:     Flags [ (0x0)
215// CHECK:     ]
216// CHECK:     Value: 0x0
217// CHECK:   }
218// CHECK:   Symbol {
219// CHECK:     Name: sym_nlp_B (71)
220// CHECK:     Extern
221// CHECK:     Type: Undef (0x0)
222// CHECK:     Section:  (0x0)
223// CHECK:     RefType: UndefinedNonLazy (0x0)
224// CHECK:     Flags [ (0x0)
225// CHECK:     ]
226// CHECK:     Value: 0x0
227// CHECK:   }
228// CHECK:   Symbol {
229// CHECK:     Name: sym_nlp_E (31)
230// CHECK:     Extern
231// CHECK:     Type: Undef (0x0)
232// CHECK:     Section:  (0x0)
233// CHECK:     RefType: UndefinedNonLazy (0x0)
234// CHECK:     Flags [ (0x0)
235// CHECK:     ]
236// CHECK:     Value: 0x0
237// CHECK:   }
238// CHECK: ]
239// CHECK: Indirect Symbols {
240// CHECK:   Number: 10
241// CHECK:   Symbols [
242// CHECK:     Entry {
243// CHECK:       Entry Index: 0
244// CHECK:       Symbol Index: 0x5
245// CHECK:     }
246// CHECK:     Entry {
247// CHECK:       Entry Index: 1
248// CHECK:       Symbol Index: 0x4
249// CHECK:     }
250// CHECK:     Entry {
251// CHECK:       Entry Index: 2
252// CHECK:       Symbol Index: 0x0
253// CHECK:     }
254// CHECK:     Entry {
255// CHECK:       Entry Index: 3
256// CHECK:       Symbol Index: 0x6
257// CHECK:     }
258// CHECK:     Entry {
259// CHECK:       Entry Index: 4
260// CHECK:       Symbol Index: 0x2
261// CHECK:     }
262// CHECK:     Entry {
263// CHECK:       Entry Index: 5
264// CHECK:       Symbol Index: 0x8
265// CHECK:     }
266// CHECK:     Entry {
267// CHECK:       Entry Index: 6
268// CHECK:       Symbol Index: 0x7
269// CHECK:     }
270// CHECK:     Entry {
271// CHECK:       Entry Index: 7
272// CHECK:       Symbol Index: 0x80000000
273// CHECK:     }
274// CHECK:     Entry {
275// CHECK:       Entry Index: 8
276// CHECK:       Symbol Index: 0x9
277// CHECK:     }
278// CHECK:     Entry {
279// CHECK:       Entry Index: 9
280// CHECK:       Symbol Index: 0x3
281// CHECK:     }
282// CHECK:   ]
283// CHECK: }
284// CHECK: Segment {
285// CHECK:   Cmd: LC_SEGMENT
286// CHECK:   Name:
287// CHECK:   Size: 260
288// CHECK:   vmaddr: 0x0
289// CHECK:   vmsize: 0x28
290// CHECK:   fileoff: 408
291// CHECK:   filesize: 40
292// CHECK:   maxprot: rwx
293// CHECK:   initprot: rwx
294// CHECK:   nsects: 3
295// CHECK:   flags: 0x0
296// CHECK: }
297// CHECK: Dysymtab {
298// CHECK:   ilocalsym: 0
299// CHECK:   nlocalsym: 2
300// CHECK:   iextdefsym: 2
301// CHECK:   nextdefsym: 2
302// CHECK:   iundefsym: 4
303// CHECK:   nundefsym: 6
304// CHECK:   tocoff: 0
305// CHECK:   ntoc: 0
306// CHECK:   modtaboff: 0
307// CHECK:   nmodtab: 0
308// CHECK:   extrefsymoff: 0
309// CHECK:   nextrefsyms: 0
310// CHECK:   indirectsymoff: 448
311// CHECK:   nindirectsyms: 10
312// CHECK:   extreloff: 0
313// CHECK:   nextrel: 0
314// CHECK:   locreloff: 0
315// CHECK:   nlocrel: 0
316// CHECK: }
317