1// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj --file-headers -S --sd -r --symbols --macho-segment --macho-dysymtab --macho-indirect-symbols - | FileCheck %s
2
3_b:
4        _c = 0
5_e:
6        _f = 0
7
8	.section	__IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5
9.indirect_symbol _a
10	.ascii	 "\364\364\364\364\364"
11.indirect_symbol _b
12	.ascii	 "\364\364\364\364\364"
13.indirect_symbol _c
14	.ascii	 "\364\364\364\364\364"
15	.section	__IMPORT,__pointers,non_lazy_symbol_pointers
16.indirect_symbol _d
17	.long	0
18.indirect_symbol _e
19	.long	0
20.indirect_symbol _f
21	.long	0
22
23// CHECK: File: <stdin>
24// CHECK: Format: Mach-O 32-bit i386
25// CHECK: Arch: i386
26// CHECK: AddressSize: 32bit
27// CHECK: MachHeader {
28// CHECK:   Magic: Magic (0xFEEDFACE)
29// CHECK:   CpuType: X86 (0x7)
30// CHECK:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
31// CHECK:   FileType: Relocatable (0x1)
32// CHECK:   NumOfLoadCommands: 4
33// CHECK:   SizeOfLoadCommands: 380
34// CHECK:   Flags [ (0x0)
35// CHECK:   ]
36// CHECK: }
37// CHECK: Sections [
38// CHECK:   Section {
39// CHECK:     Index: 0
40// CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
41// CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
42// CHECK:     Address: 0x0
43// CHECK:     Size: 0x0
44// CHECK:     Offset: 408
45// CHECK:     Alignment: 0
46// CHECK:     RelocationOffset: 0x0
47// CHECK:     RelocationCount: 0
48// CHECK:     Type: Regular (0x0)
49// CHECK:     Attributes [ (0x800000)
50// CHECK:       PureInstructions (0x800000)
51// CHECK:     ]
52// CHECK:     Reserved1: 0x0
53// CHECK:     Reserved2: 0x0
54// CHECK:     SectionData (
55// CHECK:     )
56// CHECK:   }
57// CHECK:   Section {
58// CHECK:     Index: 1
59// CHECK:     Name: __jump_table (5F 5F 6A 75 6D 70 5F 74 61 62 6C 65 00 00 00 00)
60// CHECK:     Segment: __IMPORT (5F 5F 49 4D 50 4F 52 54 00 00 00 00 00 00 00 00)
61// CHECK:     Address: 0x0
62// CHECK:     Size: 0xF
63// CHECK:     Offset: 408
64// CHECK:     Alignment: 0
65// CHECK:     RelocationOffset: 0x0
66// CHECK:     RelocationCount: 0
67// CHECK:     Type: SymbolStubs (0x8)
68// CHECK:     Attributes [ (0x840000)
69// CHECK:       PureInstructions (0x800000)
70// CHECK:       SelfModifyingCode (0x40000)
71// CHECK:     ]
72// CHECK:     Reserved1: 0x0
73// CHECK:     Reserved2: 0x5
74// CHECK:     SectionData (
75// CHECK:       0000: F4F4F4F4 F4F4F4F4 F4F4F4F4 F4F4F4    |...............|
76// CHECK:     )
77// CHECK:   }
78// CHECK:   Section {
79// CHECK:     Index: 2
80// CHECK:     Name: __pointers (5F 5F 70 6F 69 6E 74 65 72 73 00 00 00 00 00 00)
81// CHECK:     Segment: __IMPORT (5F 5F 49 4D 50 4F 52 54 00 00 00 00 00 00 00 00)
82// CHECK:     Address: 0xF
83// CHECK:     Size: 0xC
84// CHECK:     Offset: 423
85// CHECK:     Alignment: 0
86// CHECK:     RelocationOffset: 0x0
87// CHECK:     RelocationCount: 0
88// CHECK:     Type: NonLazySymbolPointers (0x6)
89// CHECK:     Attributes [ (0x0)
90// CHECK:     ]
91// CHECK:     Reserved1: 0x3
92// CHECK:     Reserved2: 0x0
93// CHECK:     SectionData (
94// CHECK:       0000: 00000000 00000000 00000000           |............|
95// CHECK:     )
96// CHECK:   }
97// CHECK: ]
98// CHECK: Relocations [
99// CHECK: ]
100// CHECK: Symbols [
101// CHECK:   Symbol {
102// CHECK:     Name: _b (13)
103// CHECK:     Type: Section (0xE)
104// CHECK:     Section: __text (0x1)
105// CHECK:     RefType: UndefinedNonLazy (0x0)
106// CHECK:     Flags [ (0x0)
107// CHECK:     ]
108// CHECK:     Value: 0x0
109// CHECK:   }
110// CHECK:   Symbol {
111// CHECK:     Name: _c (10)
112// CHECK:     Type: Abs (0x2)
113// CHECK:     Section:  (0x0)
114// CHECK:     RefType: UndefinedNonLazy (0x0)
115// CHECK:     Flags [ (0x0)
116// CHECK:     ]
117// CHECK:     Value: 0x0
118// CHECK:   }
119// CHECK:   Symbol {
120// CHECK:     Name: _e (4)
121// CHECK:     Type: Section (0xE)
122// CHECK:     Section: __text (0x1)
123// CHECK:     RefType: UndefinedNonLazy (0x0)
124// CHECK:     Flags [ (0x0)
125// CHECK:     ]
126// CHECK:     Value: 0x0
127// CHECK:   }
128// CHECK:   Symbol {
129// CHECK:     Name: _f (1)
130// CHECK:     Type: Abs (0x2)
131// CHECK:     Section:  (0x0)
132// CHECK:     RefType: UndefinedNonLazy (0x0)
133// CHECK:     Flags [ (0x0)
134// CHECK:     ]
135// CHECK:     Value: 0x0
136// CHECK:   }
137// CHECK:   Symbol {
138// CHECK:     Name: _a (16)
139// CHECK:     Extern
140// CHECK:     Type: Undef (0x0)
141// CHECK:     Section:  (0x0)
142// CHECK:     RefType: ReferenceFlagUndefinedLazy (0x1)
143// CHECK:     Flags [ (0x0)
144// CHECK:     ]
145// CHECK:     Value: 0x0
146// CHECK:   }
147// CHECK:   Symbol {
148// CHECK:     Name: _d (7)
149// CHECK:     Extern
150// CHECK:     Type: Undef (0x0)
151// CHECK:     Section:  (0x0)
152// CHECK:     RefType: UndefinedNonLazy (0x0)
153// CHECK:     Flags [ (0x0)
154// CHECK:     ]
155// CHECK:     Value: 0x0
156// CHECK:   }
157// CHECK: ]
158// CHECK: Indirect Symbols {
159// CHECK:   Number: 6
160// CHECK:   Symbols [
161// CHECK:     Entry {
162// CHECK:       Entry Index: 0
163// CHECK:       Symbol Index: 0x4
164// CHECK:     }
165// CHECK:     Entry {
166// CHECK:       Entry Index: 1
167// CHECK:       Symbol Index: 0x0
168// CHECK:     }
169// CHECK:     Entry {
170// CHECK:       Entry Index: 2
171// CHECK:       Symbol Index: 0x1
172// CHECK:     }
173// CHECK:     Entry {
174// CHECK:       Entry Index: 3
175// CHECK:       Symbol Index: 0x5
176// CHECK:     }
177// CHECK:     Entry {
178// CHECK:       Entry Index: 4
179// CHECK:       Symbol Index: 0x80000000
180// CHECK:     }
181// CHECK:     Entry {
182// CHECK:       Entry Index: 5
183// CHECK:       Symbol Index: 0xC0000000
184// CHECK:     }
185// CHECK:   ]
186// CHECK: }
187// CHECK: Segment {
188// CHECK:   Cmd: LC_SEGMENT
189// CHECK:   Name:
190// CHECK:   Size: 260
191// CHECK:   vmaddr: 0x0
192// CHECK:   vmsize: 0x1B
193// CHECK:   fileoff: 408
194// CHECK:   filesize: 27
195// CHECK:   maxprot: rwx
196// CHECK:   initprot: rwx
197// CHECK:   nsects: 3
198// CHECK:   flags: 0x0
199// CHECK: }
200// CHECK: Dysymtab {
201// CHECK:   ilocalsym: 0
202// CHECK:   nlocalsym: 4
203// CHECK:   iextdefsym: 4
204// CHECK:   nextdefsym: 0
205// CHECK:   iundefsym: 4
206// CHECK:   nundefsym: 2
207// CHECK:   tocoff: 0
208// CHECK:   ntoc: 0
209// CHECK:   modtaboff: 0
210// CHECK:   nmodtab: 0
211// CHECK:   extrefsymoff: 0
212// CHECK:   nextrefsyms: 0
213// CHECK:   indirectsymoff: 436
214// CHECK:   nindirectsyms: 6
215// CHECK:   extreloff: 0
216// CHECK:   nextrel: 0
217// CHECK:   locreloff: 0
218// CHECK:   nlocrel: 0
219// CHECK: }
220