[Frontend] Remove unused includes (NFC) (#116927)
[llvm-project.git] / llvm / test / ObjectYAML / MachO / DWARF-debug_aranges.yaml
blobf362b44c7e3187568b81890acfbc7ceb1543a01a
1 ## a) Test that yaml2macho is able to emit the .debug_aranges section and obj2yaml
2 ## is able to convert it back.
4 # RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s
6 --- !mach-o
7 FileHeader:      
8   magic:           0xFEEDFACF
9   cputype:         0x01000007
10   cpusubtype:      0x00000003
11   filetype:        0x0000000A
12   ncmds:           7
13   sizeofcmds:      1848
14   flags:           0x00000000
15   reserved:        0x00000000
16 LoadCommands:    
17   - cmd:             LC_UUID
18     cmdsize:         24
19     uuid:            B4D48511-37F4-3ED4-AFA7-1683DCE69AC4
20   - cmd:             LC_SYMTAB
21     cmdsize:         24
22     symoff:          4096
23     nsyms:           2
24     stroff:          4128
25     strsize:         28
26   - cmd:             LC_SEGMENT_64
27     cmdsize:         72
28     segname:         __PAGEZERO
29     vmaddr:          0
30     vmsize:          4294967296
31     fileoff:         0
32     filesize:        0
33     maxprot:         0
34     initprot:        0
35     nsects:          0
36     flags:           0
37   - cmd:             LC_SEGMENT_64
38     cmdsize:         472
39     segname:         __TEXT
40     vmaddr:          4294967296
41     vmsize:          4096
42     fileoff:         0
43     filesize:        0
44     maxprot:         7
45     initprot:        5
46     nsects:          5
47     flags:           0
48     Sections:        
49       - sectname:        __text
50         segname:         __TEXT
51         addr:            0x0000000100000F50
52         size:            52
53         offset:          0x00000000
54         align:           4
55         reloff:          0x00000000
56         nreloc:          0
57         flags:           0x80000400
58         reserved1:       0x00000000
59         reserved2:       0x00000000
60         reserved3:       0x00000000
61       - sectname:        __stubs
62         segname:         __TEXT
63         addr:            0x0000000100000F84
64         size:            6
65         offset:          0x00000000
66         align:           1
67         reloff:          0x00000000
68         nreloc:          0
69         flags:           0x80000408
70         reserved1:       0x00000000
71         reserved2:       0x00000006
72         reserved3:       0x00000000
73       - sectname:        __stub_helper
74         segname:         __TEXT
75         addr:            0x0000000100000F8C
76         size:            26
77         offset:          0x00000000
78         align:           2
79         reloff:          0x00000000
80         nreloc:          0
81         flags:           0x80000400
82         reserved1:       0x00000000
83         reserved2:       0x00000000
84         reserved3:       0x00000000
85       - sectname:        __cstring
86         segname:         __TEXT
87         addr:            0x0000000100000FA6
88         size:            14
89         offset:          0x00000000
90         align:           0
91         reloff:          0x00000000
92         nreloc:          0
93         flags:           0x00000002
94         reserved1:       0x00000000
95         reserved2:       0x00000000
96         reserved3:       0x00000000
97       - sectname:        __unwind_info
98         segname:         __TEXT
99         addr:            0x0000000100000FB4
100         size:            72
101         offset:          0x00000000
102         align:           2
103         reloff:          0x00000000
104         nreloc:          0
105         flags:           0x00000000
106         reserved1:       0x00000000
107         reserved2:       0x00000000
108         reserved3:       0x00000000
109   - cmd:             LC_SEGMENT_64
110     cmdsize:         232
111     segname:         __DATA
112     vmaddr:          4294971392
113     vmsize:          4096
114     fileoff:         0
115     filesize:        0
116     maxprot:         7
117     initprot:        3
118     nsects:          2
119     flags:           0
120     Sections:        
121       - sectname:        __nl_symbol_ptr
122         segname:         __DATA
123         addr:            0x0000000100001000
124         size:            16
125         offset:          0x00000000
126         align:           3
127         reloff:          0x00000000
128         nreloc:          0
129         flags:           0x00000006
130         reserved1:       0x00000001
131         reserved2:       0x00000000
132         reserved3:       0x00000000
133       - sectname:        __la_symbol_ptr
134         segname:         __DATA
135         addr:            0x0000000100001010
136         size:            8
137         offset:          0x00000000
138         align:           3
139         reloff:          0x00000000
140         nreloc:          0
141         flags:           0x00000007
142         reserved1:       0x00000003
143         reserved2:       0x00000000
144         reserved3:       0x00000000
145   - cmd:             LC_SEGMENT_64
146     cmdsize:         72
147     segname:         __LINKEDIT
148     vmaddr:          4294975488
149     vmsize:          4096
150     fileoff:         4096
151     filesize:        60
152     maxprot:         7
153     initprot:        1
154     nsects:          0
155     flags:           0
156   - cmd:             LC_SEGMENT_64
157     cmdsize:         952
158     segname:         __DWARF
159     vmaddr:          4294979584
160     vmsize:          4096
161     fileoff:         8192
162     filesize:        764
163     maxprot:         7
164     initprot:        3
165     nsects:          11
166     flags:           0
167     Sections:        
168       - sectname:        __debug_line
169         segname:         __DWARF
170         addr:            0x0000000100003000
171         size:            69
172         offset:          0x00002000
173         align:           0
174         reloff:          0x00000000
175         nreloc:          0
176         flags:           0x00000000
177         reserved1:       0x00000000
178         reserved2:       0x00000000
179         reserved3:       0x00000000
180       - sectname:        __debug_pubnames
181         segname:         __DWARF
182         addr:            0x0000000100003045
183         size:            27
184         offset:          0x00002045
185         align:           0
186         reloff:          0x00000000
187         nreloc:          0
188         flags:           0x00000000
189         reserved1:       0x00000000
190         reserved2:       0x00000000
191         reserved3:       0x00000000
192       - sectname:        __debug_pubtypes
193         segname:         __DWARF
194         addr:            0x0000000100003060
195         size:            35
196         offset:          0x00002060
197         align:           0
198         reloff:          0x00000000
199         nreloc:          0
200         flags:           0x00000000
201         reserved1:       0x00000000
202         reserved2:       0x00000000
203         reserved3:       0x00000000
204       - sectname:        __debug_aranges
205         segname:         __DWARF
206         addr:            0x0000000100003083
207         size:            48
208         offset:          0x00002083
209         align:           0
210         reloff:          0x00000000
211         nreloc:          0
212         flags:           0x00000000
213         reserved1:       0x00000000
214         reserved2:       0x00000000
215         reserved3:       0x00000000
216       - sectname:        __debug_info
217         segname:         __DWARF
218         addr:            0x00000001000030B3
219         size:            121
220         offset:          0x000020B3
221         align:           0
222         reloff:          0x00000000
223         nreloc:          0
224         flags:           0x00000000
225         reserved1:       0x00000000
226         reserved2:       0x00000000
227         reserved3:       0x00000000
228       - sectname:        __debug_abbrev
229         segname:         __DWARF
230         addr:            0x000000010000312C
231         size:            76
232         offset:          0x0000212C
233         align:           0
234         reloff:          0x00000000
235         nreloc:          0
236         flags:           0x00000000
237         reserved1:       0x00000000
238         reserved2:       0x00000000
239         reserved3:       0x00000000
240       - sectname:        __debug_str
241         segname:         __DWARF
242         addr:            0x0000000100003178
243         size:            142
244         offset:          0x00002178
245         align:           0
246         reloff:          0x00000000
247         nreloc:          0
248         flags:           0x00000000
249         reserved1:       0x00000000
250         reserved2:       0x00000000
251         reserved3:       0x00000000
252       - sectname:        __apple_names
253         segname:         __DWARF
254         addr:            0x0000000100003206
255         size:            60
256         offset:          0x00002206
257         align:           0
258         reloff:          0x00000000
259         nreloc:          0
260         flags:           0x00000000
261         reserved1:       0x00000000
262         reserved2:       0x00000000
263         reserved3:       0x00000000
264       - sectname:        __apple_namespac
265         segname:         __DWARF
266         addr:            0x0000000100003242
267         size:            36
268         offset:          0x00002242
269         align:           0
270         reloff:          0x00000000
271         nreloc:          0
272         flags:           0x00000000
273         reserved1:       0x00000000
274         reserved2:       0x00000000
275         reserved3:       0x00000000
276       - sectname:        __apple_types
277         segname:         __DWARF
278         addr:            0x0000000100003266
279         size:            114
280         offset:          0x00002266
281         align:           0
282         reloff:          0x00000000
283         nreloc:          0
284         flags:           0x00000000
285         reserved1:       0x00000000
286         reserved2:       0x00000000
287         reserved3:       0x00000000
288       - sectname:        __apple_objc
289         segname:         __DWARF
290         addr:            0x00000001000032D8
291         size:            36
292         offset:          0x000022D8
293         align:           0
294         reloff:          0x00000000
295         nreloc:          0
296         flags:           0x00000000
297         reserved1:       0x00000000
298         reserved2:       0x00000000
299         reserved3:       0x00000000
300 LinkEditData:    
301   NameList:        
302     - n_strx:          2
303       n_type:          0x0F
304       n_sect:          1
305       n_desc:          16
306       n_value:         4294967296
307     - n_strx:          22
308       n_type:          0x0F
309       n_sect:          1
310       n_desc:          0
311       n_value:         4294971216
312   StringTable:     
313     - ''
314     - ''
315     - __mh_execute_header
316     - _main
317 DWARF:           
318   debug_aranges:   
319     - Length:              44
320       Version:             2
321       CuOffset:            0
322       AddressSize:         8
323       SegmentSelectorSize: 0
324       Descriptors:     
325         - Address:         0x0000000100000F50
326           Length:          52
329 #      CHECK:   debug_aranges:
330 # CHECK-NEXT:     - Length:              0x2C
331 # CHECK-NEXT:       Version:             2
332 # CHECK-NEXT:       CuOffset:            0x0
333 # CHECK-NEXT:       AddressSize:         0x8
334 # CHECK-NEXT:       Descriptors:
335 # CHECK-NEXT:         - Address: 0x100000F50
336 # CHECK-NEXT:           Length:  0x34
338 ## b) Test that if the "debug_aranges" entry is empty, yaml2macho will only emit the
339 ## section header.
341 # RUN: yaml2obj --docnum=2 %s -o %t2.o
342 # RUN: llvm-readobj --sections --section-data %t2.o | FileCheck %s --check-prefix=EMPTY-SECTION
344 #      EMPTY-SECTION: Index: 0
345 # EMPTY-SECTION-NEXT: Name: __debug_aranges (5F 5F 64 65 62 75 67 5F 61 72 61 6E 67 65 73 00)
346 # EMPTY-SECTION-NEXT: Segment: __DWARF (5F 5F 44 57 41 52 46 00 00 00 00 00 00 00 00 00)
347 # EMPTY-SECTION-NEXT: Address: 0x0
348 # EMPTY-SECTION-NEXT: Size: 0xC
349 # EMPTY-SECTION-NEXT: Offset: 528
350 # EMPTY-SECTION-NEXT: Alignment: 0
351 # EMPTY-SECTION-NEXT: RelocationOffset: 0x0
352 # EMPTY-SECTION-NEXT: RelocationCount: 0
353 # EMPTY-SECTION-NEXT: Type: Regular (0x0)
354 # EMPTY-SECTION-NEXT: Attributes [ (0x0)
355 # EMPTY-SECTION-NEXT: ]
356 # EMPTY-SECTION-NEXT: Reserved1: 0x0
357 # EMPTY-SECTION-NEXT: Reserved2: 0x0
358 # EMPTY-SECTION-NEXT: Reserved3: 0x0
359 # EMPTY-SECTION-NEXT: SectionData (
360 # EMPTY-SECTION-NEXT: )
362 --- !mach-o
363 FileHeader:
364   magic:      0xFEEDFACF
365   cputype:    0x01000007
366   cpusubtype: 0x00000003
367   filetype:   0x0000000A
368   ncmds:      1
369   sizeofcmds: 232
370   flags:      0x00000000
371   reserved:   0x00000000
372 LoadCommands:
373   - cmd:      LC_SEGMENT_64
374     cmdsize:  152
375     segname:  __DWARF
376     vmaddr:   0x00
377     vmsize:   0x00
378     fileoff:  0x00
379     filesize: 0x00
380     maxprot:  0
381     initprot: 0
382     nsects:   1
383     flags:    0
384     Sections:
385       - sectname:  __debug_aranges
386         segname:   __DWARF
387         addr:      0x00
388         size:      12
389         offset:    528
390         align:     0
391         reloff:    0x00000000
392         nreloc:    0
393         flags:     0x00000000
394         reserved1: 0x00000000
395         reserved2: 0x00000000
396         reserved3: 0x00000000
397 DWARF:
398   debug_aranges: []