1// RUN: llvm-mc -triple x86_64-apple-darwin %s -filetype=obj -o - | llvm-readobj -file-headers -s -sd -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols | FileCheck %s
2
3        .section        __TEXT,__text,regular,pure_instructions
4        .section        __DATA,__thread_data,thread_local_regular
5        .globl  _c$tlv$init
6        .align  2
7_c$tlv$init:
8        .long   4
9
10        .section        __DATA,__thread_vars,thread_local_variables
11        .globl  _c
12_c:
13        .quad   ___tlv_bootstrap
14        .quad   0
15        .quad   _c$tlv$init
16
17        .section        __DATA,__thread_data,thread_local_regular
18        .globl  _d$tlv$init
19        .align  2
20_d$tlv$init:
21        .long   5
22
23        .section        __DATA,__thread_vars,thread_local_variables
24        .globl  _d
25_d:
26        .quad   ___tlv_bootstrap
27        .quad   0
28        .quad   _d$tlv$init
29
30.tbss _a$tlv$init, 4, 2
31
32        .globl  _a
33_a:
34        .quad   ___tlv_bootstrap
35        .quad   0
36        .quad   _a$tlv$init
37
38.tbss _b$tlv$init, 4, 2
39
40        .globl  _b
41_b:
42        .quad   ___tlv_bootstrap
43        .quad   0
44        .quad   _b$tlv$init
45
46.subsections_via_symbols
47
48// CHECK: File: <stdin>
49// CHECK: Format: Mach-O 64-bit x86-64
50// CHECK: Arch: x86_64
51// CHECK: AddressSize: 64bit
52// CHECK: MachHeader {
53// CHECK:   Magic: Magic64 (0xFEEDFACF)
54// CHECK:   CpuType: X86-64 (0x1000007)
55// CHECK:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
56// CHECK:   FileType: Relocatable (0x1)
57// CHECK:   NumOfLoadCommands: 3
58// CHECK:   SizeOfLoadCommands: 496
59// CHECK:   Flags [ (0x2000)
60// CHECK:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
61// CHECK:   ]
62// CHECK:   Reserved: 0x0
63// CHECK: }
64// CHECK: Sections [
65// CHECK:   Section {
66// CHECK:     Index: 0
67// CHECK:     Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
68// CHECK:     Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
69// CHECK:     Address: 0x0
70// CHECK:     Size: 0x0
71// CHECK:     Offset: 528
72// CHECK:     Alignment: 0
73// CHECK:     RelocationOffset: 0x0
74// CHECK:     RelocationCount: 0
75// CHECK:     Type: 0x0
76// CHECK:     Attributes [ (0x800000)
77// CHECK:       PureInstructions (0x800000)
78// CHECK:     ]
79// CHECK:     Reserved1: 0x0
80// CHECK:     Reserved2: 0x0
81// CHECK:     Reserved3: 0x0
82// CHECK:     SectionData (
83// CHECK:     )
84// CHECK:   }
85// CHECK:   Section {
86// CHECK:     Index: 1
87// CHECK:     Name: __thread_data (5F 5F 74 68 72 65 61 64 5F 64 61 74 61 00 00 00)
88// CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
89// CHECK:     Address: 0x0
90// CHECK:     Size: 0x8
91// CHECK:     Offset: 528
92// CHECK:     Alignment: 2
93// CHECK:     RelocationOffset: 0x0
94// CHECK:     RelocationCount: 0
95// CHECK:     Type: 0x11
96// CHECK:     Attributes [ (0x0)
97// CHECK:     ]
98// CHECK:     Reserved1: 0x0
99// CHECK:     Reserved2: 0x0
100// CHECK:     Reserved3: 0x0
101// CHECK:     SectionData (
102// CHECK:       0000: 04000000 05000000                    |........|
103// CHECK:     )
104// CHECK:   }
105// CHECK:   Section {
106// CHECK:     Index: 2
107// CHECK:     Name: __thread_vars (5F 5F 74 68 72 65 61 64 5F 76 61 72 73 00 00 00)
108// CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
109// CHECK:     Address: 0x8
110// CHECK:     Size: 0x60
111// CHECK:     Offset: 536
112// CHECK:     Alignment: 0
113// CHECK:     RelocationOffset: 0x278
114// CHECK:     RelocationCount: 8
115// CHECK:     Type: 0x13
116// CHECK:     Attributes [ (0x0)
117// CHECK:     ]
118// CHECK:     Reserved1: 0x0
119// CHECK:     Reserved2: 0x0
120// CHECK:     Reserved3: 0x0
121// CHECK:     SectionData (
122// CHECK:       0000: 00000000 00000000 00000000 00000000  |................|
123// CHECK:       0010: 00000000 00000000 00000000 00000000  |................|
124// CHECK:       0020: 00000000 00000000 00000000 00000000  |................|
125// CHECK:       0030: 00000000 00000000 00000000 00000000  |................|
126// CHECK:       0040: 00000000 00000000 00000000 00000000  |................|
127// CHECK:       0050: 00000000 00000000 00000000 00000000  |................|
128// CHECK:     )
129// CHECK:   }
130// CHECK:   Section {
131// CHECK:     Index: 3
132// CHECK:     Name: __thread_bss (5F 5F 74 68 72 65 61 64 5F 62 73 73 00 00 00 00)
133// CHECK:     Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
134// CHECK:     Address: 0x68
135// CHECK:     Size: 0x8
136// CHECK:     Offset: 0
137// CHECK:     Alignment: 2
138// CHECK:     RelocationOffset: 0x0
139// CHECK:     RelocationCount: 0
140// CHECK:     Type: 0x12
141// CHECK:     Attributes [ (0x0)
142// CHECK:     ]
143// CHECK:     Reserved1: 0x0
144// CHECK:     Reserved2: 0x0
145// CHECK:     Reserved3: 0x0
146// CHECK:     SectionData (
147// CHECK:       0000: CFFAEDFE 07000001                    |........|
148// CHECK:     )
149// CHECK:   }
150// CHECK: ]
151// CHECK: Relocations [
152// CHECK:   Section __thread_vars {
153// CHECK:     0x58 0 3 1 X86_64_RELOC_UNSIGNED 0 _b$tlv$init
154// CHECK:     0x48 0 3 1 X86_64_RELOC_UNSIGNED 0 ___tlv_bootstrap
155// CHECK:     0x40 0 3 1 X86_64_RELOC_UNSIGNED 0 _a$tlv$init
156// CHECK:     0x30 0 3 1 X86_64_RELOC_UNSIGNED 0 ___tlv_bootstrap
157// CHECK:     0x28 0 3 1 X86_64_RELOC_UNSIGNED 0 _d$tlv$init
158// CHECK:     0x18 0 3 1 X86_64_RELOC_UNSIGNED 0 ___tlv_bootstrap
159// CHECK:     0x10 0 3 1 X86_64_RELOC_UNSIGNED 0 _c$tlv$init
160// CHECK:     0x0 0 3 1 X86_64_RELOC_UNSIGNED 0 ___tlv_bootstrap
161// CHECK:   }
162// CHECK: ]
163// CHECK: Symbols [
164// CHECK:   Symbol {
165// CHECK:     Name: _a$tlv$init (37)
166// CHECK:     Type: Section (0xE)
167// CHECK:     Section: __thread_bss (0x4)
168// CHECK:     RefType: UndefinedNonLazy (0x0)
169// CHECK:     Flags [ (0x0)
170// CHECK:     ]
171// CHECK:     Value: 0x68
172// CHECK:   }
173// CHECK:   Symbol {
174// CHECK:     Name: _b$tlv$init (25)
175// CHECK:     Type: Section (0xE)
176// CHECK:     Section: __thread_bss (0x4)
177// CHECK:     RefType: UndefinedNonLazy (0x0)
178// CHECK:     Flags [ (0x0)
179// CHECK:     ]
180// CHECK:     Value: 0x6C
181// CHECK:   }
182// CHECK:   Symbol {
183// CHECK:     Name: _a (75)
184// CHECK:     Extern
185// CHECK:     Type: Section (0xE)
186// CHECK:     Section: __thread_vars (0x3)
187// CHECK:     RefType: UndefinedNonLazy (0x0)
188// CHECK:     Flags [ (0x0)
189// CHECK:     ]
190// CHECK:     Value: 0x38
191// CHECK:   }
192// CHECK:   Symbol {
193// CHECK:     Name: _b (72)
194// CHECK:     Extern
195// CHECK:     Type: Section (0xE)
196// CHECK:     Section: __thread_vars (0x3)
197// CHECK:     RefType: UndefinedNonLazy (0x0)
198// CHECK:     Flags [ (0x0)
199// CHECK:     ]
200// CHECK:     Value: 0x50
201// CHECK:   }
202// CHECK:   Symbol {
203// CHECK:     Name: _c (69)
204// CHECK:     Extern
205// CHECK:     Type: Section (0xE)
206// CHECK:     Section: __thread_vars (0x3)
207// CHECK:     RefType: UndefinedNonLazy (0x0)
208// CHECK:     Flags [ (0x0)
209// CHECK:     ]
210// CHECK:     Value: 0x8
211// CHECK:   }
212// CHECK:   Symbol {
213// CHECK:     Name: _c$tlv$init (13)
214// CHECK:     Extern
215// CHECK:     Type: Section (0xE)
216// CHECK:     Section: __thread_data (0x2)
217// CHECK:     RefType: UndefinedNonLazy (0x0)
218// CHECK:     Flags [ (0x0)
219// CHECK:     ]
220// CHECK:     Value: 0x0
221// CHECK:   }
222// CHECK:   Symbol {
223// CHECK:     Name: _d (66)
224// CHECK:     Extern
225// CHECK:     Type: Section (0xE)
226// CHECK:     Section: __thread_vars (0x3)
227// CHECK:     RefType: UndefinedNonLazy (0x0)
228// CHECK:     Flags [ (0x0)
229// CHECK:     ]
230// CHECK:     Value: 0x20
231// CHECK:   }
232// CHECK:   Symbol {
233// CHECK:     Name: _d$tlv$init (1)
234// CHECK:     Extern
235// CHECK:     Type: Section (0xE)
236// CHECK:     Section: __thread_data (0x2)
237// CHECK:     RefType: UndefinedNonLazy (0x0)
238// CHECK:     Flags [ (0x0)
239// CHECK:     ]
240// CHECK:     Value: 0x4
241// CHECK:   }
242// CHECK:   Symbol {
243// CHECK:     Name: ___tlv_bootstrap (49)
244// CHECK:     Extern
245// CHECK:     Type: Undef (0x0)
246// CHECK:     Section:  (0x0)
247// CHECK:     RefType: UndefinedNonLazy (0x0)
248// CHECK:     Flags [ (0x0)
249// CHECK:     ]
250// CHECK:     Value: 0x0
251// CHECK:   }
252// CHECK: ]
253// CHECK: Indirect Symbols {
254// CHECK:   Number: 0
255// CHECK:   Symbols [
256// CHECK:   ]
257// CHECK: }
258// CHECK: Segment {
259// CHECK:   Cmd: LC_SEGMENT_64
260// CHECK:   Name:
261// CHECK:   Size: 392
262// CHECK:   vmaddr: 0x0
263// CHECK:   vmsize: 0x70
264// CHECK:   fileoff: 528
265// CHECK:   filesize: 104
266// CHECK:   maxprot: rwx
267// CHECK:   initprot: rwx
268// CHECK:   nsects: 4
269// CHECK:   flags: 0x0
270// CHECK: }
271// CHECK: Dysymtab {
272// CHECK:   ilocalsym: 0
273// CHECK:   nlocalsym: 2
274// CHECK:   iextdefsym: 2
275// CHECK:   nextdefsym: 6
276// CHECK:   iundefsym: 8
277// CHECK:   nundefsym: 1
278// CHECK:   tocoff: 0
279// CHECK:   ntoc: 0
280// CHECK:   modtaboff: 0
281// CHECK:   nmodtab: 0
282// CHECK:   extrefsymoff: 0
283// CHECK:   nextrefsyms: 0
284// CHECK:   indirectsymoff: 0
285// CHECK:   nindirectsyms: 0
286// CHECK:   extreloff: 0
287// CHECK:   nextrel: 0
288// CHECK:   locreloff: 0
289// CHECK:   nlocrel: 0
290// CHECK: }
291