Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / yaml2obj / ELF / DWARF / debug-addr.yaml
blob6a8dc84d98aa784a900984b54199d0aff8061a87
1 ## Test that yaml2obj emits .debug_addr section.
3 ## a) Generate and verify a little endian DWARF32 .debug_addr section in a 64-bit object file.
5 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB %s -o %t1.dwarf32.le.o
6 # RUN: llvm-readobj --sections --section-data %t1.dwarf32.le.o | \
7 # RUN:   FileCheck %s -DSIZE=264 -DADDRALIGN=1 --check-prefixes=SHDR,DWARF32-LE
9 #            SHDR: Index: 1
10 #       SHDR-NEXT: Name: .debug_addr (1)
11 #       SHDR-NEXT: Type: SHT_PROGBITS (0x1)
12 #       SHDR-NEXT: Flags [ (0x0)
13 #       SHDR-NEXT: ]
14 #       SHDR-NEXT: Address: 0x0
15 #       SHDR-NEXT: Offset: 0x40
16 #       SHDR-NEXT: Size: [[SIZE]]
17 #       SHDR-NEXT: Link: 0
18 #       SHDR-NEXT: Info: 0
19 #       SHDR-NEXT: AddressAlignment: [[ADDRALIGN]]
20 #       SHDR-NEXT: EntrySize: 0
21 # DWARF32-LE-NEXT: SectionData (
22 # DWARF32-LE-NEXT:   0000: 0C000000 05000400 34120000 78560000
23 ##                         |        |   | |  |        |
24 ##                         |        |   | |  |        +------- address (4-byte)
25 ##                         |        |   | |  +------- address (4-byte)
26 ##                         |        |   | +- segment_selector_size (1-byte)
27 ##                         |        |   +- address_size (1-byte)
28 ##                         |        +--- version (2-byte)
29 ##                         +------- 1) unit_length (4-byte)
31 # DWARF32-LE-NEXT:   0010: 14000000 05000800 21430000 00000000
32 ##                         |        |   | |  |
33 ##                         |        |   | |  +---------------- address (8-byte)
34 ##                         |        |   | +- segment_selector_size (1-byte)
35 ##                         |        |   +- address_size (1-byte)
36 ##                         |        +--- version (2-byte)
37 ##                         +------- 2) unit_length (4-byte)
39 # DWARF32-LE-NEXT:   0020: 65870000 00000000 0C000000 05000004
40 ##                         |                 |        |   | |
41 ##                         |                 |        |   | +- segment_selector_size (1-byte)
42 ##                         |                 |        |   +- address_size (1-byte)
43 ##                         |                 |        +--- version (2-byte)
44 ##                         |                 +------- 3) unit_length (4-byte)
45 ##                         +---------------- address (8-byte)
47 # DWARF32-LE-NEXT:   0030: 34120000 78560000 14000000 05000008
48 ##                         |        |        |        |   | |
49 ##                         |        |        |        |   | +- segment_selector_size (1-byte)
50 ##                         |        |        |        |   +- address_size (1-byte)
51 ##                         |        |        |        +--- version (2-byte)
52 ##                         |        |        +------- 4) unit_length (4-byte)
53 ##                         |        +------- segment (4-byte)
54 ##                         +------- segment (4-byte)
56 # DWARF32-LE-NEXT:   0040: 21430000 00000000 65870000 00000000
57 ##                         |                 |
58 ##                         |                 +---------------- segment (8-byte)
59 ##                         +---------------- segment (8-byte)
61 # DWARF32-LE-NEXT:   0050: 1C000000 05000404 34120000 78560000
62 ##                         |        |   | |  |        |
63 ##                         |        |   | |  |        +------- address (4-byte)
64 ##                         |        |   | |  +------- segment (4-byte)
65 ##                         |        |   | +- segment_selector_size (4-byte)
66 ##                         |        |   +- address_size (4-byte)
67 ##                         |        +--- version (2-byte)
68 ##                         +------- 5) unit_length (4-byte)
70 # DWARF32-LE-NEXT:   0060: 21430000 00000000 00000000 21430000
71 ##                         |        |        |        |
72 ##                         |        |        |        +------- address (4-byte)
73 ##                         |        |        +------- segment (4-byte)
74 ##                         |        +------- address (4-byte)
75 ##                         +------- segment (4-byte)
77 # DWARF32-LE-NEXT:   0070: 34000000 05000808 34120000 00000000
78 ##                         |        |   | |  |
79 ##                         |        |   | |  +---------------- segment (8-byte)
80 ##                         |        |   | +- segment_size (1-byte)
81 ##                         |        |   +- address_size (1-byte)
82 ##                         |        +--- version (2-byte)
83 ##                         +------- 6) unit_length (4-byte)
85 # DWARF32-LE-NEXT:   0080: 78560000 00000000 21430000 00000000
86 ##                         |                 |
87 ##                         |                 +---------------- segment (8-byte)
88 ##                         +---------------- address (8-byte)
90 # DWARF32-LE-NEXT:   0090: 00000000 00000000 00000000 00000000
91 ##                         |                 +---------------- segment (8-byte)
92 ##                         +---------------- address (8-byte)
94 # DWARF32-LE-NEXT:   00A0: 21430000 00000000 28000000 05000408
95 ##                         |                 |        |   | |
96 ##                         |                 |        |   | +- segment_size (1-byte)
97 ##                         |                 |        |   +- address_size (1-byte)
98 ##                         |                 |        +--- version (2-byte)
99 ##                         |                 +------- 7) unit_length (4-byte)
100 ##                         +---------------- address (8-byte)
102 # DWARF32-LE-NEXT:   00B0: 34120000 00000000 78560000 21430000
103 ##                         |                 |        |
104 ##                         |                 |        +------- segment (8-byte)
105 ##                         |                 +------- address (4-byte)
106 ##                         +---------------- segment (8-byte)
108 # DWARF32-LE-NEXT:   00C0: 00000000 00000000 00000000 00000000
109 ##                         |        |        +---------------- segment (8-byte)
110 ##                         |        +------- address (4-btye)
111 ##                         +------- higher 4-byte of segment
113 # DWARF32-LE-NEXT:   00D0: 21430000 28000000 05000804 34120000
114 ##                         |        |        |   | |  +------- segment (4-byte)
115 ##                         |        |        |   | +- segment_size (1-byte)
116 ##                         |        |        |   +- address_size (1-byte)
117 ##                         |        |        +--- version (2-byte)
118 ##                         |        +------- 8) unit_length (4-byte)
119 ##                         +------- address (4-byte)
121 # DWARF32-LE-NEXT:   00E0: 78560000 00000000 21430000 00000000
122 ##                         |                 |        |
123 ##                         |                 |        +------- address (8-byte)
124 ##                         |                 +------- segment (4-byte)
125 ##                         +---------------- address (8-byte)
127 # DWARF32-LE-NEXT:   00F0: 00000000 00000000 21430000 00000000
128 ##                         |        |        |
129 ##                         |        |        +---------------- address (8-byte)
130 ##                         |        +------- segment (4-byte)
131 ##                         +------- higher 4-byte of address
133 # DWARF32-LE-NEXT:   0100: 34120000 02000400
134 ##                         |        |   | |
135 ##                         |        |   | +- segment_size (1-byte)
136 ##                         |        |   +- address_size (1-byte)
137 ##                         |        +--- version (2-byte)
138 ##                         +------- 9) unit_length (4-byte)
139 # DWARF32-LE-NEXT: )
141 --- !ELF
142 FileHeader:
143   Class: ELFCLASS64
144   Data:  [[ENDIAN]]
145   Type:  ET_EXEC
146 DWARF:
147   debug_addr:
148     ## 1) Only address (4-byte) exists.
149     - Version:     5
150       AddressSize: 0x04
151       Entries:
152         - Address: 0x1234
153         - Address: 0x5678
154     ## 2) Only address (8-byte) exists (AddressSize is derived from FileHeader).
155     - Version: 5
156       Entries:
157         - Address: 0x4321
158         - Address: 0x8765
159     ## 3) Only segment (4-byte) exists.
160     - Version:             5
161       AddressSize:         0x00
162       SegmentSelectorSize: 0x04
163       Entries:
164         - Segment: 0x1234
165         - Segment: 0x5678
166     ## 4) Only segment (8-byte) exists.
167     - Version:             5
168       AddressSize:         0x00
169       SegmentSelectorSize: 0x08
170       Entries:
171         - Segment: 0x4321
172         - Segment: 0x8765
173     ## 5) Both address (4-byte) and segment (4-byte) exist.
174     - Version:             5
175       AddressSize:         0x04
176       SegmentSelectorSize: 0x04
177       Entries:
178         - Segment: 0x1234
179           Address: 0x5678
180         - Segment: 0x4321
181           ## Segment exists, while address takes the default value 0x00.
182         - Address: 0x4321
183           ## Address exists, while segment takes the default value 0x00.
184     ## 6) Both address (8-byte) and segment (8-byte) exist (AddressSize is derived from FileHeader).
185     - Version:             5
186       SegmentSelectorSize: 0x08
187       Entries:
188         - Segment: 0x1234
189           Address: 0x5678
190         - Segment: 0x4321
191           ## Segment exists, while address takes the default value 0x00.
192         - Address: 0x4321
193           ## Address exists, while segment takes the default value 0x00.
194     ## 7) Both address (4-byte) and segment (8-byte) exist.
195     - Version:             5
196       AddressSize:         0x04
197       SegmentSelectorSize: 0x08
198       Entries:
199         - Segment: 0x1234
200           Address: 0x5678
201         - Segment: 0x4321
202           ## Segment exists, while address takes the default value 0x00.
203         - Address: 0x4321
204           ## Address exists, while segment takes the default value 0x00.
205     ## 8) Both address (8-byte) and segment (4-byte) exist (AddressSize is derived from FileHeader).
206     - Version:             5
207       SegmentSelectorSize: 0x04
208       Entries:
209         - Segment: 0x1234
210           Address: 0x5678
211         - Segment: 0x4321
212           ## Segment exists, while address takes the default value 0x00.
213         - Address: 0x4321
214           ## Address exists, while segment takes the default value 0x00.
215     ## 9) Explicitly assign a value to 'Length'.
216     - Length:              0x1234
217       Version:             0x02
218       AddressSize:         0x04
219       SegmentSelectorSize: 0x00
220       Entries:             []
222 ## b) Generate and verify a big endian DWARF32 .debug_addr section.
224 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.dwarf32.be.o
225 # RUN: llvm-readobj --sections --section-data %t1.dwarf32.be.o | \
226 # RUN:   FileCheck %s -DSIZE=264 -DADDRALIGN=1 --check-prefixes=SHDR,DWARF32-BE
228 # DWARF32-BE-NEXT: SectionData (
229 # DWARF32-BE-NEXT:   0000: 0000000C 00050400 00001234 00005678
230 ##                         |        |   | |  |        |
231 ##                         |        |   | |  |        +------- address (4-byte)
232 ##                         |        |   | |  +------- address (4-byte)
233 ##                         |        |   | +- segment_selector_size (1-byte)
234 ##                         |        |   +- address_size (1-byte)
235 ##                         |        +--- version (2-byte)
236 ##                         +------- 1) unit_length (4-byte)
238 # DWARF32-BE-NEXT:   0010: 00000014 00050800 00000000 00004321
239 ##                         |        |   | |  |
240 ##                         |        |   | |  +---------------- address (8-byte)
241 ##                         |        |   | +- segment_selector_size (1-byte)
242 ##                         |        |   +- address_size (1-byte)
243 ##                         |        +--- version (2-byte)
244 ##                         +------- 2) unit_length (4-byte)
246 # DWARF32-BE-NEXT:   0020: 00000000 00008765 0000000C 00050004
247 ##                         |                 |        |   | |
248 ##                         |                 |        |   | +- segment_selector_size (1-byte)
249 ##                         |                 |        |   +- address_size (1-byte)
250 ##                         |                 |        +--- version (2-byte)
251 ##                         |                 +------- 3) unit_length (4-byte)
252 ##                         +---------------- address (8-byte)
254 # DWARF32-BE-NEXT:   0030: 00001234 00005678 00000014 00050008
255 ##                         |        |        |        |   | |
256 ##                         |        |        |        |   | +- segment_selector_size (1-byte)
257 ##                         |        |        |        |   +- address_size (1-byte)
258 ##                         |        |        |        +--- version (2-byte)
259 ##                         |        |        +------- 4) unit_length (4-byte)
260 ##                         |        +------- segment (4-byte)
261 ##                         +------- segment (4-byte)
263 # DWARF32-BE-NEXT:   0040: 00000000 00004321 00000000 00008765
264 ##                         |                 |
265 ##                         |                 +---------------- segment (8-byte)
266 ##                         +---------------- segment (8-byte)
268 # DWARF32-BE-NEXT:   0050: 0000001C 00050404 00001234 00005678
269 ##                         |        |   | |  |        |
270 ##                         |        |   | |  |        +------- address (4-byte)
271 ##                         |        |   | |  +------- segment (4-byte)
272 ##                         |        |   | +- segment_selector_size (4-byte)
273 ##                         |        |   +- address_size (4-byte)
274 ##                         |        +--- version (2-byte)
275 ##                         +------- 5) unit_length (4-byte)
277 # DWARF32-BE-NEXT:   0060: 00004321 00000000 00000000 00004321
278 ##                         |        |        |        |
279 ##                         |        |        |        +------- address (4-byte)
280 ##                         |        |        +------- segment (4-byte)
281 ##                         |        +------- address (4-byte)
282 ##                         +------- segment (4-byte)
284 # DWARF32-BE-NEXT:   0070: 00000034 00050808 00000000 00001234
285 ##                         |        |   | |  |
286 ##                         |        |   | |  +---------------- segment (8-byte)
287 ##                         |        |   | +- segment_size (1-byte)
288 ##                         |        |   +- address_size (1-byte)
289 ##                         |        +--- version (2-byte)
290 ##                         +------- 6) unit_length (4-byte)
292 # DWARF32-BE-NEXT:   0080: 00000000 00005678 00000000 00004321
293 ##                         |                 |
294 ##                         |                 +---------------- segment (8-byte)
295 ##                         +---------------- address (8-byte)
297 # DWARF32-BE-NEXT:   0090: 00000000 00000000 00000000 00000000
298 ##                         |                 |
299 ##                         |                 +---------------- segment (8-byte)
300 ##                         +---------------- address (8-byte)
302 # DWARF32-BE-NEXT:   00A0: 00000000 00004321 00000028 00050408
303 ##                         |                 |        |   | |
304 ##                         |                 |        |   | +- segment_size (1-byte)
305 ##                         |                 |        |   +- address_size (1-byte)
306 ##                         |                 |        +--- version (2-byte)
307 ##                         |                 +------- 7) unit_length (4-byte)
308 ##                         +---------------- address (8-byte)
310 # DWARF32-BE-NEXT:   00B0: 00000000 00001234 00005678 00000000
311 ##                         |                 |        |
312 ##                         |                 |        +------- segment (8-byte)
313 ##                         |                 +------- address (4-byte)
314 ##                         +---------------- segment (8-byte)
316 # DWARF32-BE-NEXT:   00C0: 00004321 00000000 00000000 00000000
317 ##                         |        |        |
318 ##                         |        |        +---------------- segment (8-byte)
319 ##                         |        +------- address (4-btye)
320 ##                         +------- lower 4-byte of segment
322 # DWARF32-BE-NEXT:   00D0: 00004321 00000028 00050804 00001234
323 ##                         |        |        |   | |  |
324 ##                         |        |        |   | |  +------- segment (4-byte)
325 ##                         |        |        |   | +- segment_size (1-byte)
326 ##                         |        |        |   +- address_size (1-byte)
327 ##                         |        |        +--- version (2-byte)
328 ##                         |        +------- 8) unit_length (4-byte)
329 ##                         +------- address (4-byte)
331 # DWARF32-BE-NEXT:   00E0: 00000000 00005678 00004321 00000000
332 ##                         |                 |        |
333 ##                         |                 |        +------- address (8-byte)
334 ##                         |                 +------- segment (4-byte)
335 ##                         +---------------- address (8-byte)
337 # DWARF32-BE-NEXT:   00F0: 00000000 00000000 00000000 00004321
338 ##                         |        |        |
339 ##                         |        |        +---------------- address (8-byte)
340 ##                         |        +------- segment (4-byte)
341 ##                         +------- lower 4-byte of address
343 # DWARF32-BE-NEXT:   0100: 00001234 00020400
344 ##                         |        |   | |
345 ##                         |        |   | +- segment_size (1-byte)
346 ##                         |        |   +- address_size (1-byte)
347 ##                         |        +--- version (2-byte)
348 ##                         +------- 9) unit_length (4-byte)
349 # DWARF32-BE-NEXT: )
351 ## c) Generate and verify a little endian DWARF64 .debug_addr section.
353 # RUN: yaml2obj --docnum=2 -DENDIAN=ELFDATA2LSB %s -o %t2.dwarf64.le.o
354 # RUN: llvm-readobj --sections --section-data %t2.dwarf64.le.o | \
355 # RUN:   FileCheck %s -DSIZE=56 -DADDRALIGN=1 --check-prefixes=SHDR,DWARF64-LE
357 # DWARF64-LE-NEXT: SectionData (
358 # DWARF64-LE-NEXT:   0000: FFFFFFFF 0C000000 00000000 05000400
359 ##                         |                          |   | |
360 ##                         |                          |   | +- segment_selector_size (1-byte)
361 ##                         |                          |   +- address_size (1-byte)
362 ##                         |                          +--- version (2-byte)
363 ##                         +------------------------- unit_length (12-byte)
365 # DWARF64-LE-NEXT:   0010: 34120000 78560000 FFFFFFFF 14000000
366 ##                         |        |        |
367 ##                         |        |        +---------------- unit_length (12-byte)
368 ##                         |        +------- address (4-byte)
369 ##                         +------- address (4-byte)
371 # DWARF64-LE-NEXT:   0020: 00000000 05000800 21430000 00000000
372 ##                         |        |   | |  |
373 ##                         |        |   | |  +---------------- address (8-byte)
374 ##                         |        |   | +- segment_selector_size (1-byte)
375 ##                         |        |   +- address_size (1-byte)
376 ##                         |        +--- version (2-byte)
377 ##                         +------- last 4-byte of unit_length
379 # DWARF64-LE-NEXT:   0030: 65870000 00000000
380 ##                         |
381 ##                         +---------------- address (8-byte)
382 # DWARF64-LE-NEXT: )
384 --- !ELF
385 FileHeader:
386   Class: ELFCLASS64
387   Data:  [[ENDIAN]]
388   Type:  ET_EXEC
389 DWARF:
390   debug_addr:
391     - Format:      DWARF64
392       Version:     5
393       AddressSize: 0x04
394       Entries:
395         - Address: 0x1234
396         - Address: 0x5678
397     - Format:   DWARF64
398       Version:  5
399       Entries:
400         - Address: 0x4321
401         - Address: 0x8765
403 ## d) Generate and verify a big endian DWARF64 .debug_addr section.
405 # RUN: yaml2obj --docnum=2 -DENDIAN=ELFDATA2MSB %s -o %t2.dwarf64.be.o
406 # RUN: llvm-readobj --sections --section-data %t2.dwarf64.be.o | \
407 # RUN:   FileCheck %s -DSIZE=56 -DADDRALIGN=1 --check-prefixes=SHDR,DWARF64-BE
409 # DWARF64-BE-NEXT: SectionData (
410 # DWARF64-BE-NEXT:   0000: FFFFFFFF 00000000 0000000C 00050400
411 ##                         |                          |   | |
412 ##                         |                          |   | +- segment_selector_size (1-byte)
413 ##                         |                          |   +- address_size (1-byte)
414 ##                         |                          +--- version (2-byte)
415 ##                         +------------------------- unit_length (12-byte)
417 # DWARF64-BE-NEXT:   0010: 00001234 00005678 FFFFFFFF 00000000
418 ##                         |        |        |
419 ##                         |        |        +---------------- unit_length (12-byte)
420 ##                         |        +------- address (4-byte)
421 ##                         +------- address (4-byte)
423 # DWARF64-BE-NEXT:   0020: 00000014 00050800 00000000 00004321
424 ##                         |        |   | |  |
425 ##                         |        |   | |  +---------------- address (8-byte)
426 ##                         |        |   | +- segment_selector_size (1-byte)
427 ##                         |        |   +- address_size (1-byte)
428 ##                         |        +--- version (2-byte)
429 ##                         +------- last 4-byte of unit_length
431 # DWARF64-BE-NEXT:   0030: 00000000 00008765
432 ##                         |
433 ##                         +---------------- address (8-byte)
434 # DWARF64-BE-NEXT: )
436 ## e) Test that yaml2obj emits an error message if the 'Version' fields is missing.
438 # RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=MISSING-VERSION
440 # MISSING-VERSION: error: missing required key 'Version'
442 --- !ELF
443 FileHeader:
444   Class: ELFCLASS64
445   Data:  ELFDATA2LSB
446   Type:  ET_EXEC
447 DWARF:
448   debug_addr:
449     - Entries: []
451 ## f) Generate the .debug_addr section from raw section content.
453 # RUN: yaml2obj --docnum=4 %s -o %t4.o
454 # RUN: llvm-readobj --sections --section-data %t4.o | \
455 # RUN:   FileCheck %s -DADDRALIGN=0 -DSIZE=3 --check-prefixes=SHDR,ARBITRARY-CONTENT
457 #      ARBITRARY-CONTENT: SectionData (
458 # ARBITRARY-CONTENT-NEXT:   0000: 112233
459 # ARBITRARY-CONTENT-NEXT: )
461 --- !ELF
462 FileHeader:
463   Class: ELFCLASS64
464   Data:  ELFDATA2LSB
465   Type:  ET_EXEC
466 Sections:
467   - Name:    .debug_addr
468     Type:    SHT_PROGBITS
469     Content: "112233"
471 ## g) Generate the .debug_addr section when the "Size" is specified.
473 # RUN: yaml2obj --docnum=5 %s -o %t5.o
474 # RUN: llvm-readelf --hex-dump=.debug_addr %t5.o | FileCheck %s --check-prefix=SIZE
476 #       SIZE: Hex dump of section '.debug_addr':
477 #  SIZE-NEXT: 0x00000000 00000000 00000000 00000000 00000000 ................
478 # SIZE-EMPTY:
480 --- !ELF
481 FileHeader:
482   Class: ELFCLASS64
483   Data:  ELFDATA2LSB
484   Type:  ET_EXEC
485 Sections:
486   - Name: .debug_addr
487     Type: SHT_PROGBITS
488     Size: 0x10
490 ## h) Test that yaml2obj emits an error message when both the "Size" and the
491 ## "debug_addr" entry are specified at the same time.
493 # RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=ERROR
495 # ERROR: yaml2obj: error: cannot specify section '.debug_addr' contents in the 'DWARF' entry and the 'Content' or 'Size' in the 'Sections' entry at the same time
497 --- !ELF
498 FileHeader:
499   Class: ELFCLASS64
500   Data:  ELFDATA2LSB
501   Type:  ET_EXEC
502 Sections:
503   - Name: .debug_addr
504     Type: SHT_PROGBITS
505     Size: 0x10
506 DWARF:
507   debug_addr:
508     - Version: 5
509       Entries: []
511 ## i) Test that yaml2obj emits an error message when both the "Content" and the
512 ## "debug_addr" entry are specified at the same time.
514 # RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=ERROR
516 --- !ELF
517 FileHeader:
518   Class: ELFCLASS64
519   Data:  ELFDATA2LSB
520   Type:  ET_EXEC
521 Sections:
522   - Name:    .debug_addr
523     Type:    SHT_PROGBITS
524     Content: "00"
525 DWARF:
526   debug_addr:
527     - Version: 5
528       Entries: []
530 ## j) Test that all the properties can be overridden by the section header when
531 ## the "debug_addr" entry doesn't exist.
533 # RUN: yaml2obj --docnum=8 %s -o %t8.o
534 # RUN: llvm-readelf --sections %t8.o | FileCheck %s --check-prefix=OVERRIDDEN
536 #      OVERRIDDEN: [Nr] Name        Type   Address          Off    Size   ES Flg Lk Inf Al
537 #      OVERRIDDEN: [ 1] .debug_addr STRTAB 0000000000002020 000050 000008 01   A  2   1  2
538 # OVERRIDDEN-NEXT: [ 2] .sec        STRTAB 0000000000000000 000058 000000 00      0   0  0
540 --- !ELF
541 FileHeader:
542   Class: ELFCLASS64
543   Data:  ELFDATA2LSB
544   Type:  ET_EXEC
545 Sections:
546   - Name:         .debug_addr
547     Type:         SHT_STRTAB  ## SHT_PROGBITS by default.
548     Flags:        [SHF_ALLOC] ## 0 by default.
549     Link:         .sec        ## 0 by default.
550     EntSize:      1           ## 0 by default.
551     Info:         1           ## 0 by default.
552     AddressAlign: 2           ## 0 by default.
553     Address:      0x2020      ## 0x00 by default.
554     Offset:       0x50        ## 0x40 for the first section.
555     Size:         0x08        ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
556   - Name:         .sec        ## Linked by .debug_addr.
557     Type:         SHT_STRTAB
559 ## k) Test that all the properties can be overridden by the section header when
560 ## the "debug_addr" entry exists.
562 # RUN: yaml2obj --docnum=9 %s -o %t9.o
563 # RUN: llvm-readelf --sections %t9.o | FileCheck %s --check-prefix=OVERRIDDEN
565 --- !ELF
566 FileHeader:
567   Class: ELFCLASS64
568   Data:  ELFDATA2LSB
569   Type:  ET_EXEC
570 Sections:
571   - Name:         .debug_addr
572     Type:         SHT_STRTAB  ## SHT_PROGBITS by default.
573     Flags:        [SHF_ALLOC] ## 0 by default.
574     Link:         .sec        ## 0 by default.
575     EntSize:      1           ## 0 by default.
576     Info:         1           ## 0 by default.
577     AddressAlign: 2           ## 1 by default.
578     Address:      0x2020      ## 0x00 by default.
579     Offset:       0x50        ## 0x40 for the first section.
580   - Name:         .sec        ## Linked by .debug_addr.
581     Type:         SHT_STRTAB
582 DWARF:
583   debug_addr:
584     - Version: 5
585       Entries: []
587 ## l) Test that yaml2obj still generates a .debug_addr section if we assign an invalid value
588 ## to 'AddressSize' or 'SegmentSelectorSize' when the 'Entries' list is empty.
590 # RUN: yaml2obj --docnum=10 -DSIZENAME=AddressSize %s -o %t10.addr.o
591 # RUN: llvm-readelf --hex-dump=.debug_addr %t10.addr.o | \
592 # RUN:   FileCheck -DADDRSIZE=03 -DSEGSIZE=00 %s --check-prefix=ADDR-SEG-SIZE
594 # RUN: yaml2obj --docnum=10 -DSIZENAME=SegmentSelectorSize %s -o %t10.seg.o
595 # RUN: llvm-readelf --hex-dump=.debug_addr %t10.seg.o | \
596 # RUN:   FileCheck -DADDRSIZE=08 -DSEGSIZE=03 %s --check-prefix=ADDR-SEG-SIZE
598 #      ADDR-SEG-SIZE: Hex dump of section '.debug_addr':
599 # ADDR-SEG-SIZE-NEXT: 0x00000000 04000000 0500[[ADDRSIZE]][[SEGSIZE]]
601 --- !ELF
602 FileHeader:
603   Class: ELFCLASS64
604   Data:  ELFDATA2LSB
605   Type:  ET_EXEC
606 DWARF:
607   debug_addr:
608     - Version:      5
609       [[SIZENAME]]: 3
610       Entries:      []
612 ## m) Test that yaml2obj emits an error message if we try to assign an invalid value to
613 ## 'AddressSize' or 'SegmentSelectorSize' when the 'Entries' list isn't empty.
615 # RUN: not yaml2obj --docnum=11 -DSIZENAME=AddressSize %s 2>&1 | \
616 # RUN:   FileCheck -DFIELD=address %s --check-prefix=INVALID-SIZE
618 # RUN: not yaml2obj --docnum=11 -DSIZENAME=SegmentSelectorSize %s 2>&1 | \
619 # RUN:   FileCheck -DFIELD=segment %s --check-prefix=INVALID-SIZE
621 # INVALID-SIZE: yaml2obj: error: unable to write debug_addr [[FIELD]]: invalid integer write size: 3
623 --- !ELF
624 FileHeader:
625   Class: ELFCLASS64
626   Data:  ELFDATA2LSB
627   Type:  ET_EXEC
628 DWARF:
629   debug_addr:
630     - Version:      5
631       [[SIZENAME]]: 3
632       Entries:
633         - Address: 0x1234
635 ## n) Test that the .debug_addr section header is emitted if the "debug_addr"
636 ## entry is empty.
638 # RUN: yaml2obj --docnum=12 %s -o %t12.o
639 # RUN: llvm-readobj --sections %t12.o | \
640 # RUN:   FileCheck %s -DSIZE=0 -DADDRALIGN=1 --check-prefix=SHDR
642 --- !ELF
643 FileHeader:
644   Class: ELFCLASS64
645   Data:  ELFDATA2LSB
646   Type:  ET_EXEC
647 DWARF:
648   debug_addr: []