1// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s
2
3        .data
4        .long undef
5        .long (undef + 4)
6
7        .globl local_a_ext
8local_a_ext:
9        .long local_a_ext
10
11local_a:
12        .long 0
13local_a_elt:
14        .long 0
15local_b:
16        .long local_b - local_c + 245
17        .long 0
18local_c:
19        .long 0
20
21
22        .long local_a_elt + 1
23        .long local_a_elt + 10
24        .short local_a_elt + 20
25        .byte local_a_elt + 89
26
27        .const
28
29        .long
30bar:
31        .long local_a_elt - bar + 33
32
33L0:
34        .long L0
35        .long L1
36
37        .text
38_f0:
39L1:
40        jmp	0xbabecafe
41        jmp L0
42        jmp L1
43        ret
44
45        .objc_class_name_A=0
46	.globl .objc_class_name_A
47
48        .text
49        .globl _f1
50        .weak_definition _f1
51_f1:
52        .data
53        .long _f1
54        .long _f1 + 4
55
56// CHECK: ('cputype', 7)
57// CHECK: ('cpusubtype', 3)
58// CHECK: ('filetype', 1)
59// CHECK: ('num_load_commands', 3)
60// CHECK: ('load_commands_size', 364)
61// CHECK: ('flag', 0)
62// CHECK: ('load_commands', [
63// CHECK:   # Load Command 0
64// CHECK:  (('command', 1)
65// CHECK:   ('size', 260)
66// CHECK:   ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
67// CHECK:   ('vm_addr', 0)
68// CHECK:   ('vm_size', 76)
69// CHECK:   ('file_offset', 392)
70// CHECK:   ('file_size', 76)
71// CHECK:   ('maxprot', 7)
72// CHECK:   ('initprot', 7)
73// CHECK:   ('num_sections', 3)
74// CHECK:   ('flags', 0)
75// CHECK:   ('sections', [
76// CHECK:     # Section 0
77// CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
78// CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
79// CHECK:     ('address', 0)
80// CHECK:     ('size', 13)
81// CHECK:     ('offset', 392)
82// CHECK:     ('alignment', 0)
83// CHECK:     ('reloc_offset', 468)
84// CHECK:     ('num_reloc', 2)
85// CHECK:     ('flags', 0x80000400)
86// CHECK:     ('reserved1', 0)
87// CHECK:     ('reserved2', 0)
88// CHECK:    ),
89// CHECK:   ('_relocations', [
90// CHECK:     # Relocation 0
91// CHECK:     (('word-0', 0x6),
92// CHECK:      ('word-1', 0x5000003)),
93// CHECK:     # Relocation 1
94// CHECK:     (('word-0', 0x1),
95// CHECK:      ('word-1', 0x5000000)),
96// CHECK:   ])
97// CHECK:   ('_section_data', 'e9f9cabe bae93a00 0000ebf4 c3')
98// CHECK:     # Section 1
99// CHECK:    (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
100// CHECK:     ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
101// CHECK:     ('address', 13)
102// CHECK:     ('size', 51)
103// CHECK:     ('offset', 405)
104// CHECK:     ('alignment', 0)
105// CHECK:     ('reloc_offset', 484)
106// CHECK:     ('num_reloc', 11)
107// CHECK:     ('flags', 0x0)
108// CHECK:     ('reserved1', 0)
109// CHECK:     ('reserved2', 0)
110// CHECK:    ),
111// CHECK:   ('_relocations', [
112// CHECK:     # Relocation 0
113// CHECK:     (('word-0', 0x2f),
114// CHECK:      ('word-1', 0xc000007)),
115// CHECK:     # Relocation 1
116// CHECK:     (('word-0', 0x2b),
117// CHECK:      ('word-1', 0xc000007)),
118// CHECK:     # Relocation 2
119// CHECK:     (('word-0', 0x8000002a),
120// CHECK:      ('word-1', 0x1d)),
121// CHECK:     # Relocation 3
122// CHECK:     (('word-0', 0x90000028),
123// CHECK:      ('word-1', 0x1d)),
124// CHECK:     # Relocation 4
125// CHECK:     (('word-0', 0xa0000024),
126// CHECK:      ('word-1', 0x1d)),
127// CHECK:     # Relocation 5
128// CHECK:     (('word-0', 0xa0000020),
129// CHECK:      ('word-1', 0x1d)),
130// CHECK:     # Relocation 6
131// CHECK:     (('word-0', 0xa4000014),
132// CHECK:      ('word-1', 0x21)),
133// CHECK:     # Relocation 7
134// CHECK:     (('word-0', 0xa1000000),
135// CHECK:      ('word-1', 0x29)),
136// CHECK:     # Relocation 8
137// CHECK:     (('word-0', 0x8),
138// CHECK:      ('word-1', 0x4000002)),
139// CHECK:     # Relocation 9
140// CHECK:     (('word-0', 0x4),
141// CHECK:      ('word-1', 0xc000009)),
142// CHECK:     # Relocation 10
143// CHECK:     (('word-0', 0x0),
144// CHECK:      ('word-1', 0xc000009)),
145// CHECK:   ])
146// CHECK:   ('_section_data', '00000000 04000000 15000000 00000000 00000000 ed000000 00000000 00000000 1e000000 27000000 31007600 00000004 000000')
147// CHECK:     # Section 2
148// CHECK:    (('section_name', '__const\x00\x00\x00\x00\x00\x00\x00\x00\x00')
149// CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
150// CHECK:     ('address', 64)
151// CHECK:     ('size', 12)
152// CHECK:     ('offset', 456)
153// CHECK:     ('alignment', 0)
154// CHECK:     ('reloc_offset', 572)
155// CHECK:     ('num_reloc', 4)
156// CHECK:     ('flags', 0x0)
157// CHECK:     ('reserved1', 0)
158// CHECK:     ('reserved2', 0)
159// CHECK:    ),
160// CHECK:   ('_relocations', [
161// CHECK:     # Relocation 0
162// CHECK:     (('word-0', 0x8),
163// CHECK:      ('word-1', 0x4000001)),
164// CHECK:     # Relocation 1
165// CHECK:     (('word-0', 0x4),
166// CHECK:      ('word-1', 0x4000003)),
167// CHECK:     # Relocation 2
168// CHECK:     (('word-0', 0xa4000000),
169// CHECK:      ('word-1', 0x1d)),
170// CHECK:     # Relocation 3
171// CHECK:     (('word-0', 0xa1000000),
172// CHECK:      ('word-1', 0x40)),
173// CHECK:   ])
174// CHECK:   ('_section_data', 'feffffff 44000000 00000000')
175// CHECK:   ])
176// CHECK:  ),
177// CHECK:   # Load Command 1
178// CHECK:  (('command', 2)
179// CHECK:   ('size', 24)
180// CHECK:   ('symoff', 604)
181// CHECK:   ('nsyms', 10)
182// CHECK:   ('stroff', 724)
183// CHECK:   ('strsize', 88)
184// CHECK:   ('_string_data', '\x00undef\x00local_a_ext\x00.objc_class_name_A\x00_f1\x00local_a\x00local_a_elt\x00local_b\x00local_c\x00bar\x00_f0\x00\x00\x00')
185// CHECK:   ('_symbols', [
186// CHECK:     # Symbol 0
187// CHECK:    (('n_strx', 42)
188// CHECK:     ('n_type', 0xe)
189// CHECK:     ('n_sect', 2)
190// CHECK:     ('n_desc', 0)
191// CHECK:     ('n_value', 25)
192// CHECK:     ('_string', 'local_a')
193// CHECK:    ),
194// CHECK:     # Symbol 1
195// CHECK:    (('n_strx', 50)
196// CHECK:     ('n_type', 0xe)
197// CHECK:     ('n_sect', 2)
198// CHECK:     ('n_desc', 0)
199// CHECK:     ('n_value', 29)
200// CHECK:     ('_string', 'local_a_elt')
201// CHECK:    ),
202// CHECK:     # Symbol 2
203// CHECK:    (('n_strx', 62)
204// CHECK:     ('n_type', 0xe)
205// CHECK:     ('n_sect', 2)
206// CHECK:     ('n_desc', 0)
207// CHECK:     ('n_value', 33)
208// CHECK:     ('_string', 'local_b')
209// CHECK:    ),
210// CHECK:     # Symbol 3
211// CHECK:    (('n_strx', 70)
212// CHECK:     ('n_type', 0xe)
213// CHECK:     ('n_sect', 2)
214// CHECK:     ('n_desc', 0)
215// CHECK:     ('n_value', 41)
216// CHECK:     ('_string', 'local_c')
217// CHECK:    ),
218// CHECK:     # Symbol 4
219// CHECK:    (('n_strx', 78)
220// CHECK:     ('n_type', 0xe)
221// CHECK:     ('n_sect', 3)
222// CHECK:     ('n_desc', 0)
223// CHECK:     ('n_value', 64)
224// CHECK:     ('_string', 'bar')
225// CHECK:    ),
226// CHECK:     # Symbol 5
227// CHECK:    (('n_strx', 82)
228// CHECK:     ('n_type', 0xe)
229// CHECK:     ('n_sect', 1)
230// CHECK:     ('n_desc', 0)
231// CHECK:     ('n_value', 0)
232// CHECK:     ('_string', '_f0')
233// CHECK:    ),
234// CHECK:     # Symbol 6
235// CHECK:    (('n_strx', 19)
236// CHECK:     ('n_type', 0x3)
237// CHECK:     ('n_sect', 0)
238// CHECK:     ('n_desc', 0)
239// CHECK:     ('n_value', 0)
240// CHECK:     ('_string', '.objc_class_name_A')
241// CHECK:    ),
242// CHECK:     # Symbol 7
243// CHECK:    (('n_strx', 38)
244// CHECK:     ('n_type', 0xf)
245// CHECK:     ('n_sect', 1)
246// CHECK:     ('n_desc', 128)
247// CHECK:     ('n_value', 13)
248// CHECK:     ('_string', '_f1')
249// CHECK:    ),
250// CHECK:     # Symbol 8
251// CHECK:    (('n_strx', 7)
252// CHECK:     ('n_type', 0xf)
253// CHECK:     ('n_sect', 2)
254// CHECK:     ('n_desc', 0)
255// CHECK:     ('n_value', 21)
256// CHECK:     ('_string', 'local_a_ext')
257// CHECK:    ),
258// CHECK:     # Symbol 9
259// CHECK:    (('n_strx', 1)
260// CHECK:     ('n_type', 0x1)
261// CHECK:     ('n_sect', 0)
262// CHECK:     ('n_desc', 0)
263// CHECK:     ('n_value', 0)
264// CHECK:     ('_string', 'undef')
265// CHECK:    ),
266// CHECK:   ])
267// CHECK:  ),
268// CHECK:   # Load Command 2
269// CHECK:  (('command', 11)
270// CHECK:   ('size', 80)
271// CHECK:   ('ilocalsym', 0)
272// CHECK:   ('nlocalsym', 6)
273// CHECK:   ('iextdefsym', 6)
274// CHECK:   ('nextdefsym', 3)
275// CHECK:   ('iundefsym', 9)
276// CHECK:   ('nundefsym', 1)
277// CHECK:   ('tocoff', 0)
278// CHECK:   ('ntoc', 0)
279// CHECK:   ('modtaboff', 0)
280// CHECK:   ('nmodtab', 0)
281// CHECK:   ('extrefsymoff', 0)
282// CHECK:   ('nextrefsyms', 0)
283// CHECK:   ('indirectsymoff', 0)
284// CHECK:   ('nindirectsyms', 0)
285// CHECK:   ('extreloff', 0)
286// CHECK:   ('nextrel', 0)
287// CHECK:   ('locreloff', 0)
288// CHECK:   ('nlocrel', 0)
289// CHECK:   ('_indirect_symbols', [
290// CHECK:   ])
291// CHECK:  ),
292// CHECK: ])
293