1// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | macho-dump | FileCheck %s
2
3_bar:
4  nop
5_foo:
6  nop
7
8  .set foo_set1, (_foo + 0xffff0000)
9  .set foo_set2, (_foo - _bar + 0xffff0000)
10
11foo_equals = (_foo + 0xffff0000)
12foo_equals2 = (_foo - _bar + 0xffff0000)
13
14  .globl foo_set1_global;
15  .set foo_set1_global, (_foo + 0xffff0000)
16
17  .globl foo_set2_global;
18  .set foo_set2_global, (_foo - _bar + 0xffff0000)
19
20// CHECK: ('cputype', 16777223)
21// CHECK: ('cpusubtype', 3)
22// CHECK: ('filetype', 1)
23// CHECK: ('num_load_commands', 3)
24// CHECK: ('load_commands_size', 256)
25// CHECK: ('flag', 0)
26// CHECK: ('reserved', 0)
27// CHECK: ('load_commands', [
28// CHECK:   # Load Command 0
29// CHECK:  (('command', 25)
30// CHECK:   ('size', 152)
31// CHECK:   ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
32// CHECK:   ('vm_addr', 0)
33// CHECK:   ('vm_size', 2)
34// CHECK:   ('file_offset', 288)
35// CHECK:   ('file_size', 2)
36// CHECK:   ('maxprot', 7)
37// CHECK:   ('initprot', 7)
38// CHECK:   ('num_sections', 1)
39// CHECK:   ('flags', 0)
40// CHECK:   ('sections', [
41// CHECK:     # Section 0
42// CHECK:    (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
43// CHECK:     ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
44// CHECK:     ('address', 0)
45// CHECK:     ('size', 2)
46// CHECK:     ('offset', 288)
47// CHECK:     ('alignment', 0)
48// CHECK:     ('reloc_offset', 0)
49// CHECK:     ('num_reloc', 0)
50// CHECK:     ('flags', 0x80000400)
51// CHECK:     ('reserved1', 0)
52// CHECK:     ('reserved2', 0)
53// CHECK:     ('reserved3', 0)
54// CHECK:    ),
55// CHECK:   ('_relocations', [
56// CHECK:   ])
57// CHECK:   ])
58// CHECK:  ),
59// CHECK:   # Load Command 1
60// CHECK:  (('command', 2)
61// CHECK:   ('size', 24)
62// CHECK:   ('symoff', 292)
63// CHECK:   ('nsyms', 8)
64// CHECK:   ('stroff', 420)
65// CHECK:   ('strsize', 84)
66// CHECK:   ('_string_data', '\x00foo_set1_global\x00foo_set2_global\x00_bar\x00_foo\x00foo_set1\x00foo_set2\x00foo_equals\x00foo_equals2\x00')
67// CHECK:   ('_symbols', [
68// CHECK:     # Symbol 0
69// CHECK:    (('n_strx', 33)
70// CHECK:     ('n_type', 0xe)
71// CHECK:     ('n_sect', 1)
72// CHECK:     ('n_desc', 0)
73// CHECK:     ('n_value', 0)
74// CHECK:     ('_string', '_bar')
75// CHECK:    ),
76// CHECK:     # Symbol 1
77// CHECK:    (('n_strx', 38)
78// CHECK:     ('n_type', 0xe)
79// CHECK:     ('n_sect', 1)
80// CHECK:     ('n_desc', 0)
81// CHECK:     ('n_value', 1)
82// CHECK:     ('_string', '_foo')
83// CHECK:    ),
84// CHECK:     # Symbol 2
85// CHECK:    (('n_strx', 43)
86// CHECK:     ('n_type', 0xe)
87// CHECK:     ('n_sect', 1)
88// CHECK:     ('n_desc', 32)
89// CHECK:     ('n_value', 4294901761)
90// CHECK:     ('_string', 'foo_set1')
91// CHECK:    ),
92// CHECK:     # Symbol 3
93// CHECK:    (('n_strx', 52)
94// CHECK:     ('n_type', 0x2)
95// CHECK:     ('n_sect', 0)
96// CHECK:     ('n_desc', 32)
97// CHECK:     ('n_value', 4294901761)
98// CHECK:     ('_string', 'foo_set2')
99// CHECK:    ),
100// CHECK:     # Symbol 4
101// CHECK:    (('n_strx', 61)
102// CHECK:     ('n_type', 0xe)
103// CHECK:     ('n_sect', 1)
104// CHECK:     ('n_desc', 0)
105// CHECK:     ('n_value', 4294901761)
106// CHECK:     ('_string', 'foo_equals')
107// CHECK:    ),
108// CHECK:     # Symbol 5
109// CHECK:    (('n_strx', 72)
110// CHECK:     ('n_type', 0x2)
111// CHECK:     ('n_sect', 0)
112// CHECK:     ('n_desc', 0)
113// CHECK:     ('n_value', 4294901761)
114// CHECK:     ('_string', 'foo_equals2')
115// CHECK:    ),
116// CHECK:     # Symbol 6
117// CHECK:    (('n_strx', 1)
118// CHECK:     ('n_type', 0xf)
119// CHECK:     ('n_sect', 1)
120// CHECK:     ('n_desc', 32)
121// CHECK:     ('n_value', 4294901761)
122// CHECK:     ('_string', 'foo_set1_global')
123// CHECK:    ),
124// CHECK:     # Symbol 7
125// CHECK:    (('n_strx', 17)
126// CHECK:     ('n_type', 0x3)
127// CHECK:     ('n_sect', 0)
128// CHECK:     ('n_desc', 32)
129// CHECK:     ('n_value', 4294901761)
130// CHECK:     ('_string', 'foo_set2_global')
131// CHECK:    ),
132// CHECK:   ])
133// CHECK:  ),
134// CHECK:   # Load Command 2
135// CHECK:  (('command', 11)
136// CHECK:   ('size', 80)
137// CHECK:   ('ilocalsym', 0)
138// CHECK:   ('nlocalsym', 6)
139// CHECK:   ('iextdefsym', 6)
140// CHECK:   ('nextdefsym', 2)
141// CHECK:   ('iundefsym', 8)
142// CHECK:   ('nundefsym', 0)
143// CHECK:   ('tocoff', 0)
144// CHECK:   ('ntoc', 0)
145// CHECK:   ('modtaboff', 0)
146// CHECK:   ('nmodtab', 0)
147// CHECK:   ('extrefsymoff', 0)
148// CHECK:   ('nextrefsyms', 0)
149// CHECK:   ('indirectsymoff', 0)
150// CHECK:   ('nindirectsyms', 0)
151// CHECK:   ('extreloff', 0)
152// CHECK:   ('nextrel', 0)
153// CHECK:   ('locreloff', 0)
154// CHECK:   ('nlocrel', 0)
155// CHECK:   ('_indirect_symbols', [
156// CHECK:   ])
157// CHECK:  ),
158// CHECK: ])
159