1 RUN: dsymutil -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK32
2 RUN: dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK64
4 This test checks that the dSYM companion binaries generated in 32 and 64 bits
5 are correct. The check are pretty strict (we check even the offsets and sizes
6 of the sections) in order to test the VM address layout algorithm. As the
7 debug sections are generated, this is a bit risky, but I don't expect
8 dsymutil's output to change much for these tiny C programs so this should
10 The 32bits version doesn't have object files, thus it has basically no debug
13 CHECK32: Format: Mach-O 32-bit i386
15 CHECK32: AddressSize: 32bit
16 CHECK64: Format: Mach-O 64-bit x86-64
18 CHECK64: AddressSize: 64bit
20 CHECK32: Magic: Magic (0xFEEDFACE)
21 CHECK32: CpuType: X86 (0x7)
22 CHECK32: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
23 CHECK64: Magic: Magic64 (0xFEEDFACF)
24 CHECK64: CpuType: X86-64 (0x1000007)
25 CHECK64: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
26 CHECK: FileType: DWARFSymbol (0xA)
27 CHECK: NumOfLoadCommands: 7
33 CHECK: Segment: __TEXT
34 CHECK32: Address: 0x1E90
36 CHECK64: Address: 0x100000EA0
40 CHECK: RelocationOffset: 0x0
41 CHECK: RelocationCount: 0
42 CHECK: Type: Regular (0x0)
43 CHECK: Attributes [ (0x800004)
44 CHECK: PureInstructions (0x800000)
45 CHECK: SomeInstructions (0x4)
51 CHECK: Name: __unwind_info
52 CHECK: Segment: __TEXT
53 CHECK32: Address: 0x1FAC
54 CHECK64: Address: 0x100000FAC
58 CHECK: RelocationOffset: 0x0
59 CHECK: RelocationCount: 0
60 CHECK: Type: Regular (0x0)
61 CHECK: Attributes [ (0x0)
67 CHECK32: Name: __nl_symbol_ptr
68 CHECK32: Segment: __DATA
69 CHECK32: Address: 0x2000
73 CHECK32: RelocationOffset: 0x0
74 CHECK32: RelocationCount: 0
75 CHECK32: Type: NonLazySymbolPointers (0x6)
76 CHECK32: Attributes [ (0x0)
78 CHECK32: Reserved1: 0x0
79 CHECK32: Reserved2: 0x0
83 CHECK: Segment: __DATA
84 CHECK32: Address: 0x2004
85 CHECK64: Address: 0x100001000
89 CHECK: RelocationOffset: 0x0
90 CHECK: RelocationCount: 0
91 CHECK: Type: Regular (0x0)
92 CHECK: Attributes [ (0x0)
99 CHECK: Segment: __DATA
100 CHECK32: Address: 0x2008
101 CHECK64: Address: 0x100001004
105 CHECK: RelocationOffset: 0x0
106 CHECK: RelocationCount: 0
107 CHECK: Type: ZeroFill (0x1)
108 CHECK: Attributes [ (0x0)
110 CHECK: Reserved1: 0x0
111 CHECK: Reserved2: 0x0
115 CHECK: Segment: __DATA
116 CHECK32: Address: 0x200C
117 CHECK64: Address: 0x100001008
121 CHECK: RelocationOffset: 0x0
122 CHECK: RelocationCount: 0
123 CHECK: Type: ZeroFill (0x1)
124 CHECK: Attributes [ (0x0)
126 CHECK: Reserved1: 0x0
127 CHECK: Reserved2: 0x0
130 CHECK64: Name: __debug_line
131 CHECK64: Segment: __DWARF
132 CHECK64: Address: 0x100003000
134 CHECK64: Offset: 8192
135 CHECK64: Alignment: 0
136 CHECK64: RelocationOffset: 0x0
137 CHECK64: RelocationCount: 0
138 CHECK64: Type: Regular (0x0)
139 CHECK64: Attributes [ (0x0)
141 CHECK64: Reserved1: 0x0
142 CHECK64: Reserved2: 0x0
145 CHECK64: Name: __debug_pubnames
146 CHECK64: Segment: __DWARF
147 CHECK64: Address: 0x1000030EA
149 CHECK64: Offset: 8426
150 CHECK64: Alignment: 0
151 CHECK64: RelocationOffset: 0x0
152 CHECK64: RelocationCount: 0
153 CHECK64: Type: Regular (0x0)
154 CHECK64: Attributes [ (0x0)
156 CHECK64: Reserved1: 0x0
157 CHECK64: Reserved2: 0x0
160 CHECK64: Name: __debug_pubtypes
161 CHECK64: Segment: __DWARF
162 CHECK64: Address: 0x100003169
164 CHECK64: Offset: 8553
165 CHECK64: Alignment: 0
166 CHECK64: RelocationOffset: 0x0
167 CHECK64: RelocationCount: 0
168 CHECK64: Type: Regular (0x0)
169 CHECK64: Attributes [ (0x0)
171 CHECK64: Reserved1: 0x0
172 CHECK64: Reserved2: 0x0
175 CHECK64: Name: __debug_aranges
176 CHECK64: Segment: __DWARF
177 CHECK64: Address: 0x1000031C0
179 CHECK64: Offset: 8640
180 CHECK64: Alignment: 0
181 CHECK64: RelocationOffset: 0x0
182 CHECK64: RelocationCount: 0
183 CHECK64: Type: Regular (0x0)
184 CHECK64: Attributes [ (0x0)
186 CHECK64: Reserved1: 0x0
187 CHECK64: Reserved2: 0x0
190 CHECK64: Name: __debug_info
191 CHECK64: Segment: __DWARF
192 CHECK64: Address: 0x100003270
194 CHECK64: Offset: 8816
195 CHECK64: Alignment: 0
196 CHECK64: RelocationOffset: 0x0
197 CHECK64: RelocationCount: 0
198 CHECK64: Type: Regular (0x0)
199 CHECK64: Attributes [ (0x0)
201 CHECK64: Reserved1: 0x0
202 CHECK64: Reserved2: 0x0
205 CHECK: Name: __debug_abbrev
206 CHECK: Segment: __DWARF
207 CHECK32: Address: 0x4000
209 CHECK32: Offset: 8192
210 CHECK64: Address: 0x10000342C
212 CHECK64: Offset: 9260
214 CHECK: RelocationOffset: 0x0
215 CHECK: RelocationCount: 0
216 CHECK: Type: Regular (0x0)
217 CHECK: Attributes [ (0x0)
219 CHECK: Reserved1: 0x0
220 CHECK: Reserved2: 0x0
223 CHECK: Name: __debug_str
224 CHECK: Segment: __DWARF
225 CHECK32: Address: 0x4001
227 CHECK32: Offset: 8193
228 CHECK64: Address: 0x1000034BB
230 CHECK64: Offset: 9403
232 CHECK: RelocationOffset: 0x0
233 CHECK: RelocationCount: 0
234 CHECK: Type: Regular (0x0)
235 CHECK: Attributes [ (0x0)
237 CHECK: Reserved1: 0x0
238 CHECK: Reserved2: 0x0
243 CHECK: Name: _inc (2)
244 CHECK: Type: Section (0xE)
245 CHECK: Section: __text
246 CHECK: RefType: UndefinedNonLazy (0x0)
249 CHECK32: Value: 0x1F20
250 CHECK64: Value: 0x100000F20
253 CHECK: Name: _inc (2)
254 CHECK: Type: Section (0xE)
255 CHECK: Section: __text
256 CHECK: RefType: UndefinedNonLazy (0x0)
259 CHECK32: Value: 0x1F90
260 CHECK64: Value: 0x100000F90
263 CHECK: Name: _baz (7)
264 CHECK: Type: Section (0xE)
265 CHECK: Section: __data
266 CHECK: RefType: UndefinedNonLazy (0x0)
269 CHECK32: Value: 0x2004
270 CHECK64: Value: 0x100001000
273 CHECK: Name: _private_int (12)
274 CHECK: Type: Section (0xE)
275 CHECK: Section: __bss
276 CHECK: RefType: UndefinedNonLazy (0x0)
279 CHECK32: Value: 0x200C
280 CHECK64: Value: 0x100001008
283 CHECK: Name: __mh_execute_header (25)
285 CHECK: Type: Section (0xE)
286 CHECK: Section: __text
287 CHECK: RefType: UndefinedNonLazy (0x0)
288 CHECK: Flags [ (0x10)
289 CHECK: ReferencedDynamically (0x10)
291 CHECK32: Value: 0x1000
292 CHECK64: Value: 0x100000000
295 CHECK: Name: _bar (45)
297 CHECK: Type: Section (0xE)
298 CHECK: Section: __text
299 CHECK: RefType: UndefinedNonLazy (0x0)
302 CHECK32: Value: 0x1F40
303 CHECK64: Value: 0x100000F40
306 CHECK: Name: _foo (50)
308 CHECK: Type: Section (0xE)
309 CHECK: Section: __text
310 CHECK: RefType: UndefinedNonLazy (0x0)
313 CHECK32: Value: 0x1EC0
314 CHECK64: Value: 0x100000ED0
317 CHECK: Name: _main (55)
319 CHECK: Type: Section (0xE)
320 CHECK: Section: __text
321 CHECK: RefType: UndefinedNonLazy (0x0)
324 CHECK32: Value: 0x1E90
325 CHECK64: Value: 0x100000EA0
328 CHECK: Name: _val (61)
330 CHECK: Type: Section (0xE)
331 CHECK: Section: __common
332 CHECK: RefType: UndefinedNonLazy (0x0)
335 CHECK32: Value: 0x2008
336 CHECK64: Value: 0x100001004