• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1RUN: dsymutil -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj -file-headers -program-headers -sections -symbols - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK32
2RUN: dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj -file-headers -program-headers -sections -symbols - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK64
3
4This test checks that the dSYM companion binaries generated in 32 and 64 bits
5are correct. The check are pretty strict (we check even the offsets and sizes
6of the sections) in order to test the VM address layout algorithm. As the
7debug sections are generated, this is a bit risky, but I don't expect
8dsymutil's output to change much for these tiny C programs so this should
9be OK.
10The 32bits version doesn't have object files, thus it has basically no debug
11sections.
12
13CHECK32: Format: Mach-O 32-bit i386
14CHECK32: Arch: i386
15CHECK32: AddressSize: 32bit
16CHECK64: Format: Mach-O 64-bit x86-64
17CHECK64: Arch: x86_64
18CHECK64: AddressSize: 64bit
19CHECK:   MachHeader {
20CHECK32:   Magic: Magic (0xFEEDFACE)
21CHECK32:   CpuType: X86 (0x7)
22CHECK32:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
23CHECK64:   Magic: Magic64 (0xFEEDFACF)
24CHECK64:   CpuType: X86-64 (0x1000007)
25CHECK64:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
26CHECK:     FileType: DWARFSymbol (0xA)
27CHECK:     NumOfLoadCommands: 7
28CHECK:     Flags [ (0x0)
29CHECK:   }
30CHECK:   Sections [
31CHECK:     Section {
32CHECK:       Name: __text
33CHECK:       Segment: __TEXT
34CHECK32:     Address: 0x1E90
35CHECK32:     Size: 0x11A
36CHECK64:     Address: 0x100000EA0
37CHECK64:     Size: 0x109
38CHECK:       Offset: 0
39CHECK:       Alignment: 4
40CHECK:       RelocationOffset: 0x0
41CHECK:       RelocationCount: 0
42CHECK:       Type: 0x0
43CHECK:       Attributes [ (0x800004)
44CHECK:         PureInstructions (0x800000)
45CHECK:         SomeInstructions (0x4)
46CHECK:       ]
47CHECK:       Reserved1: 0x0
48CHECK:       Reserved2: 0x0
49CHECK:     }
50CHECK:     Section {
51CHECK:       Name: __unwind_info
52CHECK:       Segment: __TEXT
53CHECK32:     Address: 0x1FAC
54CHECK64:     Address: 0x100000FAC
55CHECK:       Size: 0x48
56CHECK:       Offset: 0
57CHECK:       Alignment: 2
58CHECK:       RelocationOffset: 0x0
59CHECK:       RelocationCount: 0
60CHECK:       Type: 0x0
61CHECK:       Attributes [ (0x0)
62CHECK:       ]
63CHECK:       Reserved1: 0x0
64CHECK:       Reserved2: 0x0
65CHECK:     }
66CHECK32:  Section {
67CHECK32:    Name: __nl_symbol_ptr
68CHECK32:    Segment: __DATA
69CHECK32:    Address: 0x2000
70CHECK32:    Size: 0x4
71CHECK32:    Offset: 0
72CHECK32:    Alignment: 2
73CHECK32:    RelocationOffset: 0x0
74CHECK32:    RelocationCount: 0
75CHECK32:    Type: 0x6
76CHECK32:    Attributes [ (0x0)
77CHECK32:    ]
78CHECK32:    Reserved1: 0x0
79CHECK32:    Reserved2: 0x0
80CHECK32:  }
81CHECK:     Section {
82CHECK:       Name: __data
83CHECK:       Segment: __DATA
84CHECK32:     Address: 0x2004
85CHECK64:     Address: 0x100001000
86CHECK:       Size: 0x4
87CHECK:       Offset: 0
88CHECK:       Alignment: 2
89CHECK:       RelocationOffset: 0x0
90CHECK:       RelocationCount: 0
91CHECK:       Type: 0x0
92CHECK:       Attributes [ (0x0)
93CHECK:       ]
94CHECK:       Reserved1: 0x0
95CHECK:       Reserved2: 0x0
96CHECK:     }
97CHECK:     Section {
98CHECK:       Name: __common
99CHECK:       Segment: __DATA
100CHECK32:     Address: 0x2008
101CHECK64:     Address: 0x100001004
102CHECK:       Size: 0x4
103CHECK:       Offset: 0
104CHECK:       Alignment: 2
105CHECK:       RelocationOffset: 0x0
106CHECK:       RelocationCount: 0
107CHECK:       Type: LocReloc (0x1)
108CHECK:       Attributes [ (0x0)
109CHECK:       ]
110CHECK:       Reserved1: 0x0
111CHECK:       Reserved2: 0x0
112CHECK:     }
113CHECK:     Section {
114CHECK:       Name: __bss
115CHECK:       Segment: __DATA
116CHECK32:     Address: 0x200C
117CHECK64:     Address: 0x100001008
118CHECK:       Size: 0x4
119CHECK:       Offset: 0
120CHECK:       Alignment: 2
121CHECK:       RelocationOffset: 0x0
122CHECK:       RelocationCount: 0
123CHECK:       Type: LocReloc (0x1)
124CHECK:       Attributes [ (0x0)
125CHECK:       ]
126CHECK:       Reserved1: 0x0
127CHECK:       Reserved2: 0x0
128CHECK:     }
129CHECK64:   Section {
130CHECK64:     Name: __debug_line
131CHECK64:     Segment: __DWARF
132CHECK64:     Address: 0x100003000
133CHECK64:     Size: 0xEA
134CHECK64:     Offset: 8192
135CHECK64:     Alignment: 0
136CHECK64:     RelocationOffset: 0x0
137CHECK64:     RelocationCount: 0
138CHECK64:     Type: 0x0
139CHECK64:     Attributes [ (0x0)
140CHECK64:     ]
141CHECK64:     Reserved1: 0x0
142CHECK64:     Reserved2: 0x0
143CHECK64:   }
144CHECK64:   Section {
145CHECK64:     Name: __debug_pubnames
146CHECK64:     Segment: __DWARF
147CHECK64:     Address: 0x1000030EA
148CHECK64:     Size: 0x7F
149CHECK64:     Offset: 8426
150CHECK64:     Alignment: 0
151CHECK64:     RelocationOffset: 0x0
152CHECK64:     RelocationCount: 0
153CHECK64:     Type: 0x0
154CHECK64:     Attributes [ (0x0)
155CHECK64:     ]
156CHECK64:     Reserved1: 0x0
157CHECK64:     Reserved2: 0x0
158CHECK64:   }
159CHECK64:   Section {
160CHECK64:     Name: __debug_pubtypes
161CHECK64:     Segment: __DWARF
162CHECK64:     Address: 0x100003169
163CHECK64:     Size: 0x57
164CHECK64:     Offset: 8553
165CHECK64:     Alignment: 0
166CHECK64:     RelocationOffset: 0x0
167CHECK64:     RelocationCount: 0
168CHECK64:     Type: 0x0
169CHECK64:     Attributes [ (0x0)
170CHECK64:     ]
171CHECK64:     Reserved1: 0x0
172CHECK64:     Reserved2: 0x0
173CHECK64:   }
174CHECK64:   Section {
175CHECK64:     Name: __debug_aranges
176CHECK64:     Segment: __DWARF
177CHECK64:     Address: 0x1000031C0
178CHECK64:     Size: 0xB0
179CHECK64:     Offset: 8640
180CHECK64:     Alignment: 0
181CHECK64:     RelocationOffset: 0x0
182CHECK64:     RelocationCount: 0
183CHECK64:     Type: 0x0
184CHECK64:     Attributes [ (0x0)
185CHECK64:     ]
186CHECK64:     Reserved1: 0x0
187CHECK64:     Reserved2: 0x0
188CHECK64:   }
189CHECK64:   Section {
190CHECK64:     Name: __debug_info
191CHECK64:     Segment: __DWARF
192CHECK64:     Address: 0x100003270
193CHECK64:     Size: 0x1BC
194CHECK64:     Offset: 8816
195CHECK64:     Alignment: 0
196CHECK64:     RelocationOffset: 0x0
197CHECK64:     RelocationCount: 0
198CHECK64:     Type: 0x0
199CHECK64:     Attributes [ (0x0)
200CHECK64:     ]
201CHECK64:     Reserved1: 0x0
202CHECK64:     Reserved2: 0x0
203CHECK64:   }
204CHECK:     Section {
205CHECK:       Name: __debug_abbrev
206CHECK:       Segment: __DWARF
207CHECK32:     Address: 0x4000
208CHECK32:     Size: 0x1
209CHECK32:     Offset: 8192
210CHECK64:     Address: 0x10000342C
211CHECK64:     Size: 0x8F
212CHECK64:     Offset: 9260
213CHECK:       Alignment: 0
214CHECK:       RelocationOffset: 0x0
215CHECK:       RelocationCount: 0
216CHECK:       Type: 0x0
217CHECK:       Attributes [ (0x0)
218CHECK:       ]
219CHECK:       Reserved1: 0x0
220CHECK:       Reserved2: 0x0
221CHECK:     }
222CHECK:     Section {
223CHECK:       Name: __debug_str
224CHECK:       Segment: __DWARF
225CHECK32:     Address: 0x4001
226CHECK32:     Size: 0x1
227CHECK32:     Offset: 8193
228CHECK64:     Address: 0x1000034BB
229CHECK64:     Size: 0x9F
230CHECK64:     Offset: 9403
231CHECK:       Alignment: 0
232CHECK:       RelocationOffset: 0x0
233CHECK:       RelocationCount: 0
234CHECK:       Type: 0x0
235CHECK:       Attributes [ (0x0)
236CHECK:       ]
237CHECK:       Reserved1: 0x0
238CHECK:       Reserved2: 0x0
239CHECK:     }
240CHECK:   ]
241CHECK:   Symbols [
242CHECK:     Symbol {
243CHECK:       Name: _inc (2)
244CHECK:       Type: Section (0xE)
245CHECK:       Section: __text
246CHECK:       RefType: UndefinedNonLazy (0x0)
247CHECK:       Flags [ (0x0)
248CHECK:       ]
249CHECK32:     Value: 0x1F20
250CHECK64:     Value: 0x100000F20
251CHECK:     }
252CHECK:     Symbol {
253CHECK:       Name: _inc (2)
254CHECK:       Type: Section (0xE)
255CHECK:       Section: __text
256CHECK:       RefType: UndefinedNonLazy (0x0)
257CHECK:       Flags [ (0x0)
258CHECK:       ]
259CHECK32:     Value: 0x1F90
260CHECK64:     Value: 0x100000F90
261CHECK:     }
262CHECK:     Symbol {
263CHECK:       Name: _baz (7)
264CHECK:       Type: Section (0xE)
265CHECK:       Section: __data
266CHECK:       RefType: UndefinedNonLazy (0x0)
267CHECK:       Flags [ (0x0)
268CHECK:       ]
269CHECK32:     Value: 0x2004
270CHECK64:     Value: 0x100001000
271CHECK:     }
272CHECK:     Symbol {
273CHECK:       Name: _private_int (12)
274CHECK:       Type: Section (0xE)
275CHECK:       Section: __bss
276CHECK:       RefType: UndefinedNonLazy (0x0)
277CHECK:       Flags [ (0x0)
278CHECK:       ]
279CHECK32:     Value: 0x200C
280CHECK64:     Value: 0x100001008
281CHECK:     }
282CHECK:     Symbol {
283CHECK:       Name: __mh_execute_header (25)
284CHECK:       Extern
285CHECK:       Type: Section (0xE)
286CHECK:       Section: __text
287CHECK:       RefType: UndefinedNonLazy (0x0)
288CHECK:       Flags [ (0x10)
289CHECK:         ReferencedDynamically (0x10)
290CHECK:       ]
291CHECK32:     Value: 0x1000
292CHECK64:     Value: 0x100000000
293CHECK:     }
294CHECK:     Symbol {
295CHECK:       Name: _bar (45)
296CHECK:       Extern
297CHECK:       Type: Section (0xE)
298CHECK:       Section: __text
299CHECK:       RefType: UndefinedNonLazy (0x0)
300CHECK:       Flags [ (0x0)
301CHECK:       ]
302CHECK32:     Value: 0x1F40
303CHECK64:     Value: 0x100000F40
304CHECK:     }
305CHECK:     Symbol {
306CHECK:       Name: _foo (50)
307CHECK:       Extern
308CHECK:       Type: Section (0xE)
309CHECK:       Section: __text
310CHECK:       RefType: UndefinedNonLazy (0x0)
311CHECK:       Flags [ (0x0)
312CHECK:       ]
313CHECK32:     Value: 0x1EC0
314CHECK64:     Value: 0x100000ED0
315CHECK:     }
316CHECK:     Symbol {
317CHECK:       Name: _main (55)
318CHECK:       Extern
319CHECK:       Type: Section (0xE)
320CHECK:       Section: __text
321CHECK:       RefType: UndefinedNonLazy (0x0)
322CHECK:       Flags [ (0x0)
323CHECK:       ]
324CHECK32:     Value: 0x1E90
325CHECK64:     Value: 0x100000EA0
326CHECK:     }
327CHECK:     Symbol {
328CHECK:       Name: _val (61)
329CHECK:       Extern
330CHECK:       Type: Section (0xE)
331CHECK:       Section: __common
332CHECK:       RefType: UndefinedNonLazy (0x0)
333CHECK:       Flags [ (0x0)
334CHECK:       ]
335CHECK32:     Value: 0x2008
336CHECK64:     Value: 0x100001004
337CHECK:     }
338CHECK:   ]
339
340