1// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj --file-headers -S -r --symbols --macho-segment --macho-dysymtab --macho-indirect-symbols - | 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: File: <stdin>
21// CHECK: Format: Mach-O 64-bit x86-64
22// CHECK: Arch: x86_64
23// CHECK: AddressSize: 64bit
24// CHECK: MachHeader {
25// CHECK:   Magic: Magic64 (0xFEEDFACF)
26// CHECK:   CpuType: X86-64 (0x1000007)
27// CHECK:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
28// CHECK:   FileType: Relocatable (0x1)
29// CHECK:   NumOfLoadCommands: 4
30// CHECK:   SizeOfLoadCommands: 272
31// CHECK:   Flags [ (0x0)
32// CHECK:   ]
33// CHECK:   Reserved: 0x0
34// CHECK: }
35// CHECK: Sections [
36// CHECK:   Section {
37// CHECK:     Index: 0
38// CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
39// CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
40// CHECK:     Address: 0x0
41// CHECK:     Size: 0x2
42// CHECK:     Offset: 304
43// CHECK:     Alignment: 0
44// CHECK:     RelocationOffset: 0x0
45// CHECK:     RelocationCount: 0
46// CHECK:     Type: Regular (0x0)
47// CHECK:     Attributes [ (0x800004)
48// CHECK:       PureInstructions (0x800000)
49// CHECK:       SomeInstructions (0x4)
50// CHECK:     ]
51// CHECK:     Reserved1: 0x0
52// CHECK:     Reserved2: 0x0
53// CHECK:     Reserved3: 0x0
54// CHECK:   }
55// CHECK: ]
56// CHECK: Relocations [
57// CHECK: ]
58// CHECK: Symbols [
59// CHECK:   Symbol {
60// CHECK:     Name: _bar (12)
61// CHECK:     Type: Section (0xE)
62// CHECK:     Section: __text (0x1)
63// CHECK:     RefType: UndefinedNonLazy (0x0)
64// CHECK:     Flags [ (0x0)
65// CHECK:     ]
66// CHECK:     Value: 0x0
67// CHECK:   }
68// CHECK:   Symbol {
69// CHECK:     Name: _foo (17)
70// CHECK:     Type: Section (0xE)
71// CHECK:     Section: __text (0x1)
72// CHECK:     RefType: UndefinedNonLazy (0x0)
73// CHECK:     Flags [ (0x0)
74// CHECK:     ]
75// CHECK:     Value: 0x1
76// CHECK:   }
77// CHECK:   Symbol {
78// CHECK:     Name: foo_set1 (75)
79// CHECK:     Type: Section (0xE)
80// CHECK:     Section: __text (0x1)
81// CHECK:     RefType: UndefinedNonLazy (0x0)
82// CHECK:     Flags [ (0x220)
83// CHECK:       AltEntry (0x200)
84// CHECK:       NoDeadStrip (0x20)
85// CHECK:     ]
86// CHECK:     Value: 0xFFFF0001
87// CHECK:   }
88// CHECK:   Symbol {
89// CHECK:     Name: foo_set2 (54)
90// CHECK:     Type: Abs (0x2)
91// CHECK:     Section:  (0x0)
92// CHECK:     RefType: UndefinedNonLazy (0x0)
93// CHECK:     Flags [ (0x20)
94// CHECK:       NoDeadStrip (0x20)
95// CHECK:     ]
96// CHECK:     Value: 0xFFFF0001
97// CHECK:   }
98// CHECK:   Symbol {
99// CHECK:     Name: foo_equals (1)
100// CHECK:     Type: Section (0xE)
101// CHECK:     Section: __text (0x1)
102// CHECK:     RefType: UndefinedNonLazy (0x0)
103// CHECK:     Flags [ (0x200)
104// CHECK:       AltEntry (0x200)
105// CHECK:     ]
106// CHECK:     Value: 0xFFFF0001
107// CHECK:   }
108// CHECK:   Symbol {
109// CHECK:     Name: foo_equals2 (63)
110// CHECK:     Type: Abs (0x2)
111// CHECK:     Section:  (0x0)
112// CHECK:     RefType: UndefinedNonLazy (0x0)
113// CHECK:     Flags [ (0x0)
114// CHECK:     ]
115// CHECK:     Value: 0xFFFF0001
116// CHECK:   }
117// CHECK:   Symbol {
118// CHECK:     Name: foo_set1_global (38)
119// CHECK:     Extern
120// CHECK:     Type: Section (0xE)
121// CHECK:     Section: __text (0x1)
122// CHECK:     RefType: UndefinedNonLazy (0x0)
123// CHECK:     Flags [ (0x220)
124// CHECK:	AltEntry (0x200)
125// CHECK:       NoDeadStrip (0x20)
126// CHECK:     ]
127// CHECK:     Value: 0xFFFF0001
128// CHECK:   }
129// CHECK:   Symbol {
130// CHECK:     Name: foo_set2_global (22)
131// CHECK:     Extern
132// CHECK:     Type: Abs (0x2)
133// CHECK:     Section:  (0x0)
134// CHECK:     RefType: UndefinedNonLazy (0x0)
135// CHECK:     Flags [ (0x20)
136// CHECK:       NoDeadStrip (0x20)
137// CHECK:     ]
138// CHECK:     Value: 0xFFFF0001
139// CHECK:   }
140// CHECK: ]
141// CHECK: Indirect Symbols {
142// CHECK:   Number: 0
143// CHECK:   Symbols [
144// CHECK:   ]
145// CHECK: }
146// CHECK: Segment {
147// CHECK:   Cmd: LC_SEGMENT_64
148// CHECK:   Name:
149// CHECK:   Size: 152
150// CHECK:   vmaddr: 0x0
151// CHECK:   vmsize: 0x2
152// CHECK:   fileoff: 304
153// CHECK:   filesize: 2
154// CHECK:   maxprot: rwx
155// CHECK:   initprot: rwx
156// CHECK:   nsects: 1
157// CHECK:   flags: 0x0
158// CHECK: }
159// CHECK: Dysymtab {
160// CHECK:   ilocalsym: 0
161// CHECK:   nlocalsym: 6
162// CHECK:   iextdefsym: 6
163// CHECK:   nextdefsym: 2
164// CHECK:   iundefsym: 8
165// CHECK:   nundefsym: 0
166// CHECK:   tocoff: 0
167// CHECK:   ntoc: 0
168// CHECK:   modtaboff: 0
169// CHECK:   nmodtab: 0
170// CHECK:   extrefsymoff: 0
171// CHECK:   nextrefsyms: 0
172// CHECK:   indirectsymoff: 0
173// CHECK:   nindirectsyms: 0
174// CHECK:   extreloff: 0
175// CHECK:   nextrel: 0
176// CHECK:   locreloff: 0
177// CHECK:   nlocrel: 0
178// CHECK: }
179