1## Test that yaml2obj emits .debug_info section.
2
3## a) Generate the .debug_info section from the "DWARF" entry.
4
5## Generate and verify a DWARF32 little endian .debug_info (DWARFv5) section.
6
7# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB %s -o %t1.le.o
8# RUN: llvm-readobj --sections --section-data %t1.le.o | \
9# RUN:   FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9B -DSIZE=179 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE-CONTENT
10
11#                    SHDR: Index: [[INDEX]]
12#               SHDR-NEXT: Name: .debug_info ([[NAME]])
13#               SHDR-NEXT: Type: SHT_PROGBITS (0x1)
14#               SHDR-NEXT: Flags [ (0x0)
15#               SHDR-NEXT: ]
16#               SHDR-NEXT: Address: 0x0
17#               SHDR-NEXT: Offset: [[OFFSET]]
18#               SHDR-NEXT: Size: [[SIZE]]
19#               SHDR-NEXT: Link: 0
20#               SHDR-NEXT: Info: 0
21#               SHDR-NEXT: AddressAlignment: [[ADDRALIGN]]
22#               SHDR-NEXT: EntrySize: 0
23# DWARF32-LE-CONTENT-NEXT: SectionData (
24# DWARF32-LE-CONTENT-NEXT:   0000: 34120000 05000204 34120000 01785634
25##                                 ^-------                            unit_length (4-byte)
26##                                          ^---                       version (2-byte)
27##                                              ^-                     unit_type (1-byte) DW_UT_type
28##                                                ^-                   address_size (1-byte)
29##                                                   ^-------          debug_abbrev_offset (4-byte)
30##                                                            ^-       abbreviation code (LEB128) 0x01
31##                                                              ^----- Form: DW_FORM_addr (4-byte)
32# DWARF32-LE-CONTENT-NEXT:   0010: 12020012 34020000 00123434 12785634
33##                                 --
34##                                   ^---                              Form: DW_FORM_block2 size (2-byte)
35##                                       ^- ^-                         Form: DW_FORM_block2 body (2-byte)
36##                                            ^--------                Form: DW_FORM_block4 size (4-byte)
37##                                                     ^-^-            Form: DW_FORM_block4 body (2-byte)
38##                                                         ^----       Form: DW_FORM_data2 (2-byte)
39##                                                              ^----- Form: DW_FORM_data4 (4-byte)
40# DWARF32-LE-CONTENT-NEXT:   0020: 12F0DEBC 9A785634 12616263 64000212
41##                                 --
42##                                   ^-----------------                Form: DW_FORM_data8 (8-byte)
43##                                                     ^----------     Form: DW_FORM_string "abcd\0"
44##                                                                ^-   Form: DW_FORM_block size (ULEB128)
45##                                                                  ^- Form: DW_FORM_block body (2-byte)
46# DWARF32-LE-CONTENT-NEXT:   0030: 34021234 1201B424 78563412 B4247856
47##                                 ^-                                  Form: DW_FORM_block body
48##                                   ^-                                Form: DW_FORM_block1 size (1-byte)
49##                                     ^-^-                            Form: DW_FORM_block1 body (2-byte)
50##                                          ^-                         Form: DW_FORM_data1 (1-byte)
51##                                            ^-                       Form: DW_FORM_flag (1-byte)
52##                                              ^---                   Form: DW_FORM_sdata (SLEB128) 0x1234
53##                                                   ^-------          Form: DW_FORM_strp (4-byte)
54##                                                            ^---     Form: DW_FORM_udata (ULEB128) 0x1234
55##                                                                ^--- Form: DW_FORM_ref_addr (4-byte)
56# DWARF32-LE-CONTENT-NEXT:   0040: 34121234 12785634 12F0DEBC 9A785634
57##                                 ----
58##                                     ^-                              Form: DW_FORM_ref1 (1-byte)
59##                                       ^----                         Form: DW_FORM_ref2 (2-byte)
60##                                            ^--------                Form: DW_FORM_ref4 (4-byte)
61##                                                     ^-------------- Form: DW_FORM_ref8 (8-byte)
62# DWARF32-LE-CONTENT-NEXT:   0050: 12B42408 65666768 00341200 00021234
63##                                 --
64##                                   ^---                              Form: DW_FORM_ref_udata (ULEB128) 0x1234
65##                                       ^-                            Form: DW_FORM_indirect (ULEB128) DW_FORM_string
66##                                          ^----------                "efgh\0"
67##                                                     ^--------       Form: DW_FORM_sec_offset (4-byte)
68##                                                              ^-     Form: DW_FORM_exprloc size (ULEB128) 0x02
69##                                                                ^-^- Form: DW_FORM_exprloc body (2-byte)
70# DWARF32-LE-CONTENT-NEXT:   0060: B424B424 78563412 78563412 78563412
71##                                 ^---                                Form: DW_FORM_strx (ULEB128)
72##                                     ^---                            Form: DW_FORM_addrx (ULEB128)
73##                                          ^-------                   Form: DW_FORM_ref_sup4 (4-byte)
74##                                                   ^-------          Form: DW_FORM_strp_sup (4-byte)
75##                                                            ^------- Form: DW_FORM_line_strp (4-byte)
76# DWARF32-LE-CONTENT-NEXT:   0070: F0DEBC9A 78563412 B424B424 F0DEBC9A
77##                                 ^----------------                   Form: DW_FORM_ref_sig8 (8-byte)
78##                                                   ^---              Form: DW_FORM_loclistx (ULEB128)
79##                                                       ^---          Form: DW_FORM_rnglistx (ULEB128)
80##                                                            ^------- Form: DW_FORM_ref_sup8 (8-byte)
81# DWARF32-LE-CONTENT-NEXT:   0080: 78563412 12341278 56341212 34127856
82##                                 --------
83##                                          ^-                         Form: DW_FORM_strx1 (1-byte)
84##                                            ^---                     Form: DW_FORM_strx2 (2-byte)
85##                                                ^--------            Form: DW_FORM_strx4 (4-byte)
86##                                                         ^-          Form: DW_FORM_addrx1 (1-byte)
87##                                                            ^---     Form: DW_FORM_addrx2 (1-byte)
88##                                                                ^--- Form: DW_FORM_addrx4 (4-byte)
89# DWARF32-LE-CONTENT-NEXT:   0090: 34123412 00000500 01043412 00000078
90##                                 ----
91##                                     ^--------                       unit_length (4-byte)
92##                                              ^---                   version (2-byte)
93##                                                   ^-                unit_type (1-byte)
94##                                                     ^-              address_size (1-byte)
95##                                                       ^--------     debug_abbrev_offset (4-byte)
96##                                                                ^-   abbrev code (ULEB128) 0x00
97##                                                                  ^- unit_length (4-byte)
98# DWARF32-LE-CONTENT-NEXT:   00A0: 56000004 00785600 00040178 56341202
99##                                 ------
100##                                       ^----                         version (2-byte)
101##                                            ^--------                debug_abbrev_offset (4-byte)
102##                                                     ^-              address_size (1-byte)
103##                                                       ^-            abbrev code (ULEB128) 0x01
104##                                                         ^--------   Form: DW_FORM_addr
105##                                                                  ^- Form: DW_FORM_block2 size (2-byte)
106# DWARF32-LE-CONTENT-NEXT:   00B0: 001234
107##                                 --
108##                                   ^-^-                              Form: DW_FORM_block2 body (2-byte)
109# DWARF32-LE-CONTENT-NEXT: )
110
111--- !ELF
112FileHeader:
113  Class: ELFCLASS64
114  Data:  [[ENDIAN]]
115  Type:  ET_EXEC
116DWARF:
117  debug_abbrev:
118    - Table:
119        - Code:     1
120          Tag:      DW_TAG_compile_unit
121          Children: DW_CHILDREN_no
122          Attributes:
123            - Attribute: 0x01
124              Form:      DW_FORM_addr           ## 0x01
125            - Attribute: 0x01
126              Form:      DW_FORM_block2         ## 0x03
127            - Attribute: 0x01
128              Form:      DW_FORM_block4         ## 0x04
129            - Attribute: 0x01
130              Form:      DW_FORM_data2          ## 0x05
131            - Attribute: 0x01
132              Form:      DW_FORM_data4          ## 0x06
133            - Attribute: 0x01
134              Form:      DW_FORM_data8          ## 0x07
135            - Attribute: 0x01
136              Form:      DW_FORM_string         ## 0x08
137            - Attribute: 0x01
138              Form:      DW_FORM_block          ## 0x09
139            - Attribute: 0x01
140              Form:      DW_FORM_block1         ## 0x0a
141            - Attribute: 0x01
142              Form:      DW_FORM_data1          ## 0x0b
143            - Attribute: 0x01
144              Form:      DW_FORM_flag           ## 0x0c
145            - Attribute: 0x01
146              Form:      DW_FORM_sdata          ## 0x0d
147            - Attribute: 0x01
148              Form:      DW_FORM_strp           ## 0x0e
149            - Attribute: 0x01
150              Form:      DW_FORM_udata          ## 0x0f
151            - Attribute: 0x01
152              Form:      DW_FORM_ref_addr       ## 0x10
153            - Attribute: 0x01
154              Form:      DW_FORM_ref1           ## 0x11
155            - Attribute: 0x01
156              Form:      DW_FORM_ref2           ## 0x12
157            - Attribute: 0x01
158              Form:      DW_FORM_ref4           ## 0x13
159            - Attribute: 0x01
160              Form:      DW_FORM_ref8           ## 0x14
161            - Attribute: 0x01
162              Form:      DW_FORM_ref_udata      ## 0x15
163            - Attribute: 0x01
164              Form:      DW_FORM_indirect       ## 0x16
165            - Attribute: 0x01
166              Form:      DW_FORM_sec_offset     ## 0x17
167            - Attribute: 0x01
168              Form:      DW_FORM_exprloc        ## 0x18
169            - Attribute: 0x01
170              Form:      DW_FORM_strx           ## 0x1a
171            - Attribute: 0x01
172              Form:      DW_FORM_addrx          ## 0x1b
173            - Attribute: 0x01
174              Form:      DW_FORM_ref_sup4       ## 0x1c
175            - Attribute: 0x01
176              Form:      DW_FORM_strp_sup       ## 0x1d
177            - Attribute: 0x01
178              Form:      DW_FORM_data16         ## 0x1e
179            - Attribute: 0x01
180              Form:      DW_FORM_line_strp      ## 0x1f
181            - Attribute: 0x01
182              Form:      DW_FORM_ref_sig8       ## 0x20
183            - Attribute: 0x01
184              Form:      DW_FORM_implicit_const ## 0x21
185              Value:     0x01
186            - Attribute: 0x01
187              Form:      DW_FORM_loclistx       ## 0x22
188            - Attribute: 0x01
189              Form:      DW_FORM_rnglistx       ## 0x23
190            - Attribute: 0x01
191              Form:      DW_FORM_ref_sup8       ## 0x24
192            - Attribute: 0x01
193              Form:      DW_FORM_strx1          ## 0x25
194            - Attribute: 0x01
195              Form:      DW_FORM_strx2          ## 0x26
196            - Attribute: 0x01
197              Form:      DW_FORM_strx3          ## 0x27
198            - Attribute: 0x01
199              Form:      DW_FORM_strx4          ## 0x28
200            - Attribute: 0x01
201              Form:      DW_FORM_addrx1         ## 0x29
202            - Attribute: 0x01
203              Form:      DW_FORM_addrx2         ## 0x2a
204            - Attribute: 0x01
205              Form:      DW_FORM_addrx3         ## 0x2b
206            - Attribute: 0x01
207              Form:      DW_FORM_addrx4         ## 0x2c
208  debug_info:
209    - Length:     0x1234
210      Version:    5
211      UnitType:   DW_UT_type
212      AbbrOffset: 0x1234
213      AddrSize:   4
214      Entries:
215        - AbbrCode: 1
216          Values:
217            - Value: 0x12345678         ## DW_FORM_addr
218            - BlockData:                ## DW_FORM_block2
219                - 0x12
220                - 0x34
221            - BlockData:                ## DW_FORM_block4
222                - 0x12
223                - 0x34
224            - Value: 0x1234             ## DW_FORM_data2
225            - Value: 0x12345678         ## DW_FORM_data4
226            - Value: 0x123456789abcdef0 ## DW_FORM_data8
227            - CStr:  abcd               ## DW_FORM_string
228            - BlockData:                ## DW_FORM_block
229                - 0x12
230                - 0x34
231            - BlockData:                ## DW_FORM_block1
232                - 0x12
233                - 0x34
234            - Value: 0x12               ## DW_FORM_data1
235            - Value: 0x01               ## DW_FORM_flag
236            - Value: 0x1234             ## DW_FORM_sdata
237            - Value: 0x12345678         ## DW_FORM_strp
238            - Value: 0x1234             ## DW_FORM_udata
239            - Value: 0x12345678         ## DW_FORM_ref_addr
240            - Value: 0x12               ## DW_FORM_ref1
241            - Value: 0x1234             ## DW_FORM_ref2
242            - Value: 0x12345678         ## DW_FORM_ref4
243            - Value: 0x123456789abcdef0 ## DW_FORM_ref8
244            - Value: 0x1234             ## DW_FORM_ref_udata
245            - Value: 0x08               ## DW_FORM_indirect. The following value's form is 0x08, which is DW_FORM_string.
246            - CStr:  efgh
247            - Value: 0x1234             ## DW_FORM_sec_offset
248            - BlockData:                ## DW_FORM_exprloc
249                - 0x12
250                - 0x34
251            - Value: 0x1234             ## DW_FORM_strx
252            - Value: 0x1234             ## DW_FORM_addrx
253            - Value: 0x12345678         ## DW_FORM_ref_sup4
254            - Value: 0x12345678         ## DW_FORM_strp_sup
255            - Value: 0x1234             ## DW_FORM_data16 (unimplemented)
256            - Value: 0x12345678         ## DW_FORM_line_strp
257            - Value: 0x123456789abcdef0 ## DW_FORM_ref_sig8
258            - Value: 0x1234             ## DW_FORM_implicit_const (unimplemented)
259            - Value: 0x1234             ## DW_FORM_loclistx
260            - Value: 0x1234             ## DW_FORM_rnglistx
261            - Value: 0x123456789abcdef0 ## DW_FORM_ref_sup8
262            - Value: 0x12               ## DW_FORM_strx1
263            - Value: 0x1234             ## DW_FORM_strx2
264            - Value: 0x123456           ## DW_FORM_strx3 (unimplemented)
265            - Value: 0x12345678         ## DW_FORM_strx4
266            - Value: 0x12               ## DW_FORM_addrx1
267            - Value: 0x1234             ## DW_FORM_addrx2
268            - Value: 0x123456           ## DW_FORM_addrx3 (unimplemented)
269            - Value: 0x12345678         ## DW_FORM_addrx4
270    - Length:        0x1234
271      Version:       5
272      ## Test another unit type.
273      UnitType:      DW_UT_compile
274      AbbrOffset:    0x1234
275      AddrSize:      4
276      Entries:
277        - AbbrCode: 0
278          Values:   []
279    - Length:        0x5678
280      ## Test DWARFv4
281      Version:       4
282      AbbrevTableID: 0
283      AbbrOffset:    0x5678
284      AddrSize:      4
285      Entries:
286        - AbbrCode: 1
287          Values:
288            - Value: 0x12345678 ## DW_FORM_addr
289            - BlockData:        ## DW_FORM_block2
290                - 0x12
291                - 0x34
292
293## Generate and verify a DWARF32 big endian .debug_info (DWARFv4) section.
294
295# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.be.o
296# RUN: llvm-readobj --sections --section-data %t1.be.o | \
297# RUN:   FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9B -DSIZE=179 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE-CONTENT
298
299# DWARF32-BE-CONTENT-NEXT: SectionData (
300# DWARF32-BE-CONTENT-NEXT:   0000: 00001234 00050204 00001234 01123456
301##                                 ^-------                            unit_length (4-byte)
302##                                          ^---                       version (2-byte)
303##                                              ^-                     unit_type (1-byte) DW_UT_type
304##                                                ^-                   address_size (1-byte)
305##                                                   ^-------          debug_abbrev_offset (4-byte)
306##                                                            ^-       abbreviation code (LEB128) 0x01
307##                                                              ^----- Form: DW_FORM_addr (4-byte)
308# DWARF32-BE-CONTENT-NEXT:   0010: 78000212 34000000 02123412 34123456
309##                                 --
310##                                   ^---                              Form: DW_FORM_block2 size (2-byte)
311##                                       ^- ^-                         Form: DW_FORM_block2 body (2-byte)
312##                                            ^--------                Form: DW_FORM_block4 size (4-byte)
313##                                                     ^-^-            Form: DW_FORM_block4 body (2-byte)
314##                                                         ^----       Form: DW_FORM_data2 (2-byte)
315##                                                              ^----- Form: DW_FORM_data4 (4-byte)
316# DWARF32-BE-CONTENT-NEXT:   0020: 78123456 789ABCDE F0616263 64000212
317##                                 --
318##                                   ^-----------------                Form: DW_FORM_data8 (8-byte)
319##                                                     ^----------     Form: DW_FORM_string "abcd\0"
320##                                                                ^-   Form: DW_FORM_block size (ULEB128)
321##                                                                  ^- Form: DW_FORM_block body (2-byte)
322# DWARF32-BE-CONTENT-NEXT:   0030: 34021234 1201B424 12345678 B4241234
323##                                 ^-                                  Form: DW_FORM_block body
324##                                   ^-                                Form: DW_FORM_block1 size (1-byte)
325##                                     ^-^-                            Form: DW_FORM_block1 body (2-byte)
326##                                          ^-                         Form: DW_FORM_data1 (1-byte)
327##                                            ^-                       Form: DW_FORM_flag (1-byte)
328##                                              ^---                   Form: DW_FORM_sdata (SLEB128) 0x1234
329##                                                   ^-------          Form: DW_FORM_strp (4-byte)
330##                                                            ^---     Form: DW_FORM_udata (ULEB128) 0x1234
331##                                                                ^--- Form: DW_FORM_ref_addr (4-byte)
332# DWARF32-BE-CONTENT-NEXT:   0040: 56781212 34123456 78123456 789ABCDE
333##                                 ----
334##                                     ^-                              Form: DW_FORM_ref1 (1-byte)
335##                                       ^----                         Form: DW_FORM_ref2 (2-byte)
336##                                            ^--------                Form: DW_FORM_ref4 (4-byte)
337##                                                     ^-------------- Form: DW_FORM_ref8 (8-byte)
338# DWARF32-BE-CONTENT-NEXT:   0050: F0B42408 65666768 00000012 34021234
339##                                 --
340##                                   ^---                              Form: DW_FORM_ref_udata (ULEB128) 0x1234
341##                                       ^-                            Form: DW_FORM_indirect (ULEB128) DW_FORM_string
342##                                          ^----------                "efgh\0"
343##                                                     ^--------       Form: DW_FORM_sec_offset (4-byte)
344##                                                              ^-     Form: DW_FORM_exprloc size (ULEB128) 0x02
345##                                                                ^-^- Form: DW_FORM_exprloc body (2-byte)
346# DWARF32-BE-CONTENT-NEXT:   0060: B424B424 12345678 12345678 12345678
347##                                 ^---                                Form: DW_FORM_strx (ULEB128)
348##                                     ^---                            Form: DW_FORM_addrx (ULEB128)
349##                                          ^-------                   Form: DW_FORM_ref_sup4 (4-byte)
350##                                                   ^-------          Form: DW_FORM_strp_sup (4-byte)
351##                                                            ^------- Form: DW_FORM_line_strp (4-byte)
352# DWARF32-BE-CONTENT-NEXT:   0070: 12345678 9ABCDEF0 B424B424 12345678
353##                                 ^----------------                   Form: DW_FORM_ref_sig8 (8-byte)
354##                                                   ^---              Form: DW_FORM_loclistx (ULEB128)
355##                                                       ^---          Form: DW_FORM_rnglistx (ULEB128)
356##                                                            ^------- Form: DW_FORM_ref_sup8 (8-byte)
357# DWARF32-BE-CONTENT-NEXT:   0080: 9ABCDEF0 12123412 34567812 12341234
358##                                 --------
359##                                          ^-                         Form: DW_FORM_strx1 (1-byte)
360##                                            ^---                     Form: DW_FORM_strx2 (2-byte)
361##                                                ^--------            Form: DW_FORM_strx4 (4-byte)
362##                                                         ^-          Form: DW_FORM_addrx1 (1-byte)
363##                                                            ^---     Form: DW_FORM_addrx2 (1-byte)
364##                                                                ^--- Form: DW_FORM_addrx4 (4-byte)
365# DWARF32-BE-CONTENT-NEXT:   0090: 56780000 12340005 01040000 12340000
366##                                 ----
367##                                     ^--------                       unit_length (4-byte)
368##                                              ^---                   version (2-byte)
369##                                                   ^-                unit_type (1-byte)
370##                                                     ^-              address_size (1-byte)
371##                                                       ^--------     debug_abbrev_offset (4-byte)
372##                                                                ^-   abbrev code (ULEB128) 0x00
373##                                                                  ^- unit_length (4-byte)
374# DWARF32-BE-CONTENT-NEXT:   00A0: 00567800 04000056 78040112 34567800
375##                                 ------
376##                                       ^----                         version (2-byte)
377##                                            ^--------                debug_abbrev_offset (4-byte)
378##                                                     ^-              address_size (1-byte)
379##                                                       ^-            abbrev code (ULEB128) 0x01
380##                                                         ^--------   Form: DW_FORM_addr
381##                                                                  ^- Form: DW_FORM_block2 size (2-byte)
382# DWARF32-BE-CONTENT-NEXT:   00B0: 021234
383##                                 --
384##                                   ^-^-                              Form: DW_FORM_block2 body (2-byte)
385# DWARF32-BE-CONTENT-NEXT: )
386
387## b) Generate the .debug_info section from raw section content.
388
389# RUN: yaml2obj --docnum=2 %s -o %t2.o
390# RUN: llvm-readobj --sections --section-data %t2.o | \
391# RUN:   FileCheck -DINDEX=1 -DNAME=1 -DOFFSET=0x40 -DSIZE=3 -DADDRALIGN=0 %s --check-prefixes=SHDR,ARBITRARY-CONTENT
392
393# ARBITRARY-CONTENT-NEXT: SectionData (
394# ARBITRARY-CONTENT-NEXT:   0000: 112233
395# ARBITRARY-CONTENT-NEXT: )
396
397--- !ELF
398FileHeader:
399  Class: ELFCLASS64
400  Data:  ELFDATA2LSB
401  Type:  ET_EXEC
402Sections:
403  - Name:    .debug_info
404    Type:    SHT_PROGBITS
405    Content: "112233"
406
407## c) Generate the .debug_info section when the "Size" is specified.
408
409# RUN: yaml2obj --docnum=3 %s -o %t3.o
410# RUN: llvm-readobj --sections --section-data %t3.o | \
411# RUN:   FileCheck -DINDEX=1 -DNAME=1 -DOFFSET=0x40 -DSIZE=16 -DADDRALIGN=0 %s --check-prefixes=SHDR,SIZE
412
413# SIZE-NEXT: SectionData (
414# SIZE-NEXT:   0000: 00000000 00000000 00000000 00000000
415# SIZE-NEXT: )
416
417--- !ELF
418FileHeader:
419  Class: ELFCLASS64
420  Data:  ELFDATA2LSB
421  Type:  ET_EXEC
422Sections:
423  - Name: .debug_info
424    Type: SHT_PROGBITS
425    Size: 0x10
426
427## d) Test that yaml2obj emits an error message when both the "Size" and the
428## "debug_info" entry are specified at the same time.
429
430# RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=AMBIGUOUS-CONTENT
431
432# AMBIGUOUS-CONTENT: yaml2obj: error: cannot specify section '.debug_info' contents in the 'DWARF' entry and the 'Content' or 'Size' in the 'Sections' entry at the same time
433
434--- !ELF
435FileHeader:
436  Class: ELFCLASS64
437  Data:  ELFDATA2LSB
438  Type:  ET_EXEC
439Sections:
440  - Name: .debug_info
441    Type: SHT_PROGBITS
442    Size: 0x10
443DWARF:
444  debug_abbrev:
445    - Table:
446        - Code:       1
447          Tag:        DW_TAG_compile_unit
448          Children:   DW_CHILDREN_no
449  debug_info:
450    - Length:     0x1234
451      Version:    5
452      UnitType:   DW_UT_type
453      AbbrOffset: 0x1234
454      Entries:    []
455
456## e) Test that yaml2obj emits an error message when both the "Content" and the
457## "debug_info" entry are specified at the same time.
458
459# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=AMBIGUOUS-CONTENT
460
461--- !ELF
462FileHeader:
463  Class: ELFCLASS64
464  Data:  ELFDATA2LSB
465  Type:  ET_EXEC
466Sections:
467  - Name: .debug_info
468    Type: SHT_PROGBITS
469    Content: "00"
470DWARF:
471  debug_abbrev:
472    - Table:
473        - Code:       1
474          Tag:        DW_TAG_compile_unit
475          Children:   DW_CHILDREN_no
476  debug_info:
477    - Length:     0x1234
478      Version:    5
479      UnitType:   DW_UT_type
480      AbbrOffset: 0x1234
481      Entries:    []
482
483## f) Test that all the properties can be overridden by the section header when
484## the "debug_info" entry doesn't exist.
485
486# RUN: yaml2obj --docnum=6 %s -o %t6.o
487# RUN: llvm-readelf --sections %t6.o | FileCheck %s --check-prefix=OVERRIDDEN
488
489#      OVERRIDDEN: [Nr] Name        Type   Address          Off    Size   ES Flg Lk Inf Al
490#      OVERRIDDEN: [ 1] .debug_info STRTAB 0000000000002020 000050 00000d 01   A  2   1  2
491# OVERRIDDEN-NEXT: [ 2] .sec        STRTAB 0000000000000000 00005d 000000 00      0   0  0
492
493--- !ELF
494FileHeader:
495  Class: ELFCLASS64
496  Data:  ELFDATA2LSB
497  Type:  ET_EXEC
498Sections:
499  - Name:         .debug_info
500    Type:         SHT_STRTAB  ## SHT_PROGBITS by default.
501    Flags:        [SHF_ALLOC] ## 0 by default.
502    Link:         .sec        ## 0 by default.
503    EntSize:      1           ## 0 by default.
504    Info:         1           ## 0 by default.
505    AddressAlign: 2           ## 0 by default.
506    Address:      0x2020      ## 0x00 by default.
507    Offset:       0x50        ## 0x40 for the first section.
508    Size:         0x0d        ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
509  - Name:         .sec        ## Linked by .debug_info.
510    Type:         SHT_STRTAB
511
512## g) Test that all the properties can be overridden by the section header when
513## the "debug_info" entry exists.
514
515# RUN: yaml2obj --docnum=7 %s -o %t7.o
516# RUN: llvm-readelf --sections %t7.o | FileCheck %s --check-prefix=OVERRIDDEN
517
518--- !ELF
519FileHeader:
520  Class: ELFCLASS64
521  Data:  ELFDATA2LSB
522  Type:  ET_EXEC
523Sections:
524  - Name:         .debug_info
525    Type:         SHT_STRTAB  ## SHT_PROGBITS by default.
526    Flags:        [SHF_ALLOC] ## 0 by default.
527    Link:         .sec        ## 0 by default.
528    EntSize:      1           ## 0 by default.
529    Info:         1           ## 0 by default.
530    AddressAlign: 2           ## 0 by default.
531    Address:      0x2020      ## 0x00 by default.
532    Offset:       0x50        ## 0x40 for the first section.
533  - Name:         .sec        ## Linked by .debug_info.
534    Type:         SHT_STRTAB
535DWARF:
536  debug_abbrev:
537    - Table:
538        - Code:       1
539          Tag:        DW_TAG_compile_unit
540          Children:   DW_CHILDREN_no
541  debug_info:
542    - Length:     0x1234
543      Version:    5
544      UnitType:   DW_UT_type
545      AbbrOffset: 0x1234
546      Entries:
547        - AbbrCode: 0
548          Values:   []
549
550## h) Test that yaml2obj doesn't crash when the 'Entries' of a compilation unit is empty.
551
552# RUN: yaml2obj --docnum=8 %s -o %t8.o
553# RUN: llvm-readelf --hex-dump=.debug_info %t8.o | \
554# RUN:   FileCheck %s --check-prefix=EMPTY-ENTRIES --match-full-lines
555
556#       EMPTY-ENTRIES: Hex dump of section '.debug_info':
557#  EMPTY-ENTRIES-NEXT: 0x00000000 34120000 05000204 34120000 4.......4...
558# EMPTY-ENTRIES-EMPTY:
559##                                ^- 'Entries' is empty
560
561--- !ELF
562FileHeader:
563  Class: ELFCLASS32
564  Data:  ELFDATA2LSB
565  Type:  ET_EXEC
566DWARF:
567  debug_info:
568    - Length:     0x1234
569      Version:    5
570      UnitType:   DW_UT_type
571      AbbrOffset: 0x1234
572      Entries:    []
573
574## h) Test that yaml2obj emits values in the DIE according to the abbreviation whose
575## index is equal to the value in 'AbbrevCode'.
576
577# RUN: yaml2obj --docnum=9 %s -o %t9.o
578# RUN: llvm-readelf --hex-dump=.debug_info %t9.o | \
579# RUN:   FileCheck %s --check-prefix=FORM --match-full-lines
580
581#       FORM: Hex dump of section '.debug_info':
582#  FORM-NEXT: 0x00000000 34120000 05000204 34120000 02341221 4.......4....4.!
583##                       ^-------                            unit_length (4-byte)
584##                                                  ^-       abbreviation code (ULEB128)
585##                                                    ^---   Form: DW_FORM_data2 (2-byte)
586##                                                        ^- Form: DW_FORM_data4 (4-byte)
587#  FORM-NEXT: 0x00000010 43658701 21436587 341200            Ce..!Ce.4..
588##                       ------
589##                             ^-                            abbreviation code (ULEB128)
590##                                ^-------                   Form: DW_FORM_data4 (4-byte)
591##                                         ^---              Form: DW_FORM_data2 (2-byte)
592##                                             ^-            abbreviation code (ULEB128)
593# FORM-EMPTY:
594
595--- !ELF
596FileHeader:
597  Class: ELFCLASS32
598  Data:  ELFDATA2LSB
599  Type:  ET_EXEC
600DWARF:
601  debug_abbrev:
602    - Table:
603        - Tag:        DW_TAG_compile_unit
604          Children:   DW_CHILDREN_yes
605          Attributes:
606            - Attribute: DW_AT_low_pc
607              Form:      DW_FORM_data4
608            - Attribute: DW_AT_high_pc
609              Form:      DW_FORM_data2
610        - Tag:        DW_TAG_subprogram
611          Children:   DW_CHILDREN_no
612          Attributes:
613            - Attribute: DW_AT_low_pc
614              Form:      DW_FORM_data2
615            - Attribute: DW_AT_high_pc
616              Form:      DW_FORM_data4
617  debug_info:
618    - Length:     0x1234
619      Version:    5
620      UnitType:   DW_UT_type
621      AbbrOffset: 0x1234
622      Entries:
623        ## Test that yaml2obj emits values when the abbrev code is specified.
624        - AbbrCode: 2
625          Values:
626            - Value: 0x1234
627            - Value: 0x87654321
628        ## Test that yaml2obj emits values when the abbrev code is specified to
629        ## be lower than the first abbrev.
630        - AbbrCode: 1
631          Values:
632            - Value: 0x87654321
633            - Value: 0x1234
634        ## Test that yaml2obj ignores the contents of entries with abbrev code 0.
635        - AbbrCode: 0
636          Values:
637            - Value: 0x1234
638
639## i) Test that yaml2obj reports an error when 'debug_info' has values in its
640## entries but 'debug_abbrev' doesn't have enough attributes for them.
641
642# RUN: not yaml2obj --docnum=10 %s -o %t10.o 2>&1 | \
643# RUN:   FileCheck %s --check-prefixes=ERROR
644
645# ERROR: yaml2obj: error: abbrev code must be less than or equal to the number of entries in abbreviation table
646
647--- !ELF
648FileHeader:
649  Class: ELFCLASS64
650  Data:  ELFDATA2LSB
651  Type:  ET_EXEC
652DWARF:
653  debug_abbrev:
654    - Table: []
655  debug_info:
656    - Length:     0x1234
657      Version:    5
658      UnitType:   DW_UT_type
659      AbbrOffset: 0x1234
660      Entries:
661        - AbbrCode: 1
662          Values:
663            - Value: 0x1234
664
665## j) Test that yaml2obj emits the correct DWARF64 unit headers.
666
667## DWARFv5 unit header.
668
669# RUN: yaml2obj --docnum=11 %s -o %t11.o
670# RUN: llvm-readelf --hex-dump=.debug_info %t11.o | \
671# RUN:   FileCheck %s --check-prefix=DWARFV5-HEADER
672
673#      DWARFV5-HEADER: Hex dump of section '.debug_info':
674# DWARFV5-HEADER-NEXT: 0x00000000 ffffffff 0c000000 00000000 05000208 ................
675##                                ^-------------------------          unit_length (12-byte)
676##                                                           ^---     version (2-byte)
677##                                                               ^-   unit_type (1-byte)
678##                                                                 ^- address_size (1-byte)
679# DWARFV5-HEADER-NEXT: 0x00000010 34120000 00000000                   4.......
680##                                ^----------------                   debug_abbrev_offset (8-byte)
681
682--- !ELF
683FileHeader:
684  Class: ELFCLASS64
685  Data:  ELFDATA2LSB
686  Type:  ET_EXEC
687DWARF:
688  debug_info:
689    - Format:     DWARF64
690      Length:     0x0c
691      Version:    5
692      UnitType:   DW_UT_type
693      AbbrOffset: 0x1234
694      Entries:    []
695
696## DWARFv4 unit header.
697
698# RUN: yaml2obj --docnum=12 %s -o %t12.o
699# RUN: llvm-readelf --hex-dump=.debug_info %t12.o | \
700# RUN:   FileCheck %s --check-prefix=DWARFV4-HEADER
701
702#      DWARFV4-HEADER: Hex dump of section '.debug_info':
703# DWARFV4-HEADER-NEXT: 0x00000000 ffffffff 0c000000 00000000 04003412 ..............4.
704##                                ^-------------------------          unit_length (12-byte)
705##                                                           ^---     version (2-byte)
706##                                                               ^--- debug_abbrev_offset (8-byte)
707# DWARFV4-HEADER-NEXT: 0x00000010 00000000 000008                     .......
708##                                -------------
709##                                             ^-                     address_size (1-byte)
710
711--- !ELF
712FileHeader:
713  Class: ELFCLASS64
714  Data:  ELFDATA2LSB
715  Type:  ET_EXEC
716DWARF:
717  debug_info:
718    - Format:     DWARF64
719      Length:     0x0c
720      Version:    4
721      AbbrOffset: 0x1234
722      Entries:    []
723
724## k) Test that yaml2obj is able to emit a correct length for compilation units.
725
726# RUN: yaml2obj --docnum=13 %s -o %t13.o
727# RUN: llvm-readelf --hex-dump=.debug_info %t13.o | \
728# RUN:   FileCheck %s --check-prefix=INFER-LENGTH
729
730#      INFER-LENGTH: Hex dump of section '.debug_info':
731# INFER-LENGTH-NEXT: 0x00000000 37000000 04000000 00000801 00000000 7...............
732##                              ^-------                            unit_length (0x37)
733##                                       ^---                       version (2-byte)
734##                                           ^--------              debug_abbrev_offset (4-byte)
735##                                                    ^-            address_size (1-byte)
736##                                                      ^-          abbrev code (ULEB128) 0x01
737##                                                         ^------- Form: DW_FORM_strp (4-byte)
738# INFER-LENGTH-NEXT: 0x00000010 0c001600 00000000 00001e00 00002011 .............. .
739##                              ^---                                Form: DW_FORM_data2 (2-byte)
740##                                  ^--------                       Form: DW_FORM_strp (4-byte)
741##                                           ^--------              Form: DW_FORM_sec_offset (4-byte)
742##                                                    ^--------     Form: DW_FORM_strp (4-byte)
743##                                                             ^--- Form: DW_FORM_addr (8-byte)
744# INFER-LENGTH-NEXT: 0x00000020 00000000 00003300 00000220 11000000 ......3.... ....
745##                              -------------
746##                                           ^--------              Form: DW_FORM_data4 (4-byte)
747##                                                    ^-            abbrev code (ULEB128) 0x02
748##                                                      ^---------- Form: DW_FORM_addr (8-byte)
749# INFER-LENGTH-NEXT: 0x00000030 00000006 00000038 000000            .......8...
750##                              ------
751##                                    ^--------                     Form: DW_FORM_data4 (4-byte)
752##                                             ^--------            Form: DW_FORM_strp (4-byte)
753
754## The handwritten DIEs should look like:
755
756## 0x0000000b: DW_TAG_compile_unit [1] *
757##               DW_AT_producer [DW_FORM_strp]        ( .debug_str[0x00000000] = "clang version 10.0.0 ")
758##               DW_AT_language [DW_FORM_data2]       (DW_LANG_C99)
759##               DW_AT_name [DW_FORM_strp]            ( .debug_str[0x00000016] = "hello.c")
760##               DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
761##               DW_AT_comp_dir [DW_FORM_strp]        ( .debug_str[0x0000001e] = "/home/v/x/llvm/playground")
762##               DW_AT_low_pc [DW_FORM_addr]          (0x0000000000001120)
763##               DW_AT_high_pc [DW_FORM_data4]        (0x00000033)
764##
765## 0x0000002a:   DW_TAG_subprogram [2]
766##                 DW_AT_low_pc [DW_FORM_addr]        (0x0000000000001120)
767##                 DW_AT_high_pc [DW_FORM_data4]      (0x00000006)
768##                 DW_AT_name [DW_FORM_strp]          ( .debug_str[0x00000038] = "main")
769
770--- !ELF
771FileHeader:
772  Class: ELFCLASS64
773  Data:  ELFDATA2LSB
774  Type:  ET_EXEC
775DWARF:
776  debug_str:
777    - "clang version 10.0.0 "
778    - "hello.c"
779    - "/home/v/x/llvm/playground"
780    - "main"
781  debug_abbrev:
782    - Table:
783        - Code:     1
784          Tag:      DW_TAG_compile_unit
785          Children: DW_CHILDREN_yes
786          Attributes:
787            - Attribute: DW_AT_producer
788              Form:      DW_FORM_strp
789            - Attribute: DW_AT_language
790              Form:      DW_FORM_data2
791            - Attribute: DW_AT_name
792              Form:      DW_FORM_strp
793            - Attribute: DW_AT_stmt_list
794              Form:      DW_FORM_sec_offset
795            - Attribute: DW_AT_comp_dir
796              Form:      DW_FORM_strp
797            - Attribute: DW_AT_low_pc
798              Form:      DW_FORM_addr
799            - Attribute: DW_AT_high_pc
800              Form:      DW_FORM_data4
801        - Code: 2
802          Tag:  DW_TAG_subprogram
803          Children: DW_CHILDREN_no
804          Attributes:
805            - Attribute: DW_AT_low_pc
806              Form:      DW_FORM_addr
807            - Attribute: DW_AT_high_pc
808              Form:      DW_FORM_data4
809            - Attribute: DW_AT_name
810              Form:      DW_FORM_strp
811  debug_info:
812    - Version:    4
813      AbbrOffset: 0x00
814      Entries:
815        - AbbrCode: 1
816          Values:
817            - Value: 0x00   ## DW_AT_producer [DW_FORM_strp]
818            - Value: 0x0c   ## DW_LANG_C99, DW_AT_language [DW_FORM_data2]
819            - Value: 0x16   ## DW_AT_name [DW_FORM_strp]
820            - Value: 0x00   ## DW_AT_stmt_list [DW_FORM_sec_offset]
821            - Value: 0x1e   ## DW_AT_comp_dir [DW_FORM_strp]
822            - Value: 0x1120 ## DW_AT_low_pc [DW_FORM_addr]
823            - Value: 0x33   ## DW_AT_high_pc [DW_FORM_data4]
824        - AbbrCode: 2
825          Values:
826            - Value: 0x1120 ## DW_AT_low_pc [DW_FORM_addr]
827            - Value: 0x06   ## DW_AT_high_pc [DW_FORM_data4]
828            - Value: 0x38   ## DW_AT_name [DW_FORM_strp]
829
830## l) Test that if we don't specify the 'Values' key for an entry, yaml2obj will only emit the abbrev_code.
831
832# RUN: yaml2obj --docnum=14 %s -o %t14.o
833# RUN: llvm-readelf --hex-dump=.debug_info %t14.o | \
834# RUN:   FileCheck %s --check-prefix=NO-VALUES
835
836#      NO-VALUES: Hex dump of section '.debug_info':
837# NO-VALUES-NEXT: 0x00000000 0a000000 04000000 00000801 0002     ..............
838##                           ^-------                            unit_length (4-byte)
839##                                    ^---                       version (2-byte)
840##                                        ^--------              debug_abbrev_offset (4-byte)
841##                                                 ^-            address_size (1-byte)
842##                                                   ^-          abbrev_code (ULEB128) 0x01
843##                                                      ^-       abbrev_code (ULEB128) 0x00
844##                                                        ^-     abbrev_code (ULEB128) 0x02
845
846--- !ELF
847FileHeader:
848  Class: ELFCLASS64
849  Data:  ELFDATA2LSB
850  Type:  ET_EXEC
851DWARF:
852  debug_info:
853    - Version:    4
854      AbbrOffset: 0x00
855      Entries:
856        - AbbrCode: 1
857        - AbbrCode: 0
858        - AbbrCode: 2
859
860## m) Test that yaml2obj is able to infer the address size from the object file.
861
862# RUN: yaml2obj --docnum=15 -DBITS=64 %s -o %t15.64-bit.o
863# RUN: llvm-readelf --hex-dump=.debug_info %t15.64-bit.o | \
864# RUN:   FileCheck %s --check-prefix=ADDRSIZE -DADDRSIZE=08
865
866#      ADDRSIZE: Hex dump of section '.debug_info':
867# ADDRSIZE-NEXT: 0x00000000 07000000 04000000 0000[[ADDRSIZE]]            ...........
868
869# RUN: yaml2obj --docnum=15 -DBITS=32 %s -o %t15.32-bit.o
870# RUN: llvm-readelf --hex-dump=.debug_info %t15.32-bit.o | \
871# RUN:   FileCheck %s --check-prefix=ADDRSIZE -DADDRSIZE=04
872
873--- !ELF
874FileHeader:
875  Class: ELFCLASS[[BITS]]
876  Data:  ELFDATA2LSB
877  Type:  ET_EXEC
878DWARF:
879  debug_info:
880    - Version:    4
881      AbbrOffset: 0x00
882
883## n) Test that yaml2obj emits an error message when a compilation unit has values but there is no associated abbrev table.
884
885## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
886
887# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
888
889--- !ELF
890FileHeader:
891  Class:   ELFCLASS64
892  Data:    ELFDATA2LSB
893  Type:    ET_EXEC
894  Machine: EM_X86_64
895DWARF:
896  debug_info:
897    - Version:    4
898      AbbrOffset: 0x00
899      Entries:
900        - AbbrCode: 1
901          Values:
902            - Value: 0x1234
903
904## o) Test that yaml2obj is able to generate compilation units according to the
905## associated abbrev table that is referenced by the 'AbbrevTableID' and infer
906## the value of the debug_abbrev_offset field.
907
908# RUN: yaml2obj --docnum=17 %s -o %t17.o
909# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
910
911#      MULTI-TABLES: Hex dump of section '.debug_info':
912# MULTI-TABLES-NEXT: 0x00000000 0c000000 04000800 00000801 34120000 ............4...
913##                              ^-------                            unit_length (4-byte)
914##                                       ^---                       version (2-byte)
915##                                           ^--------              debug_abbrev_offset (4-byte)
916##                                                    ^-            address_size (1-byte)
917##                                                      ^-          abbrev_code (ULEB128) 0x01
918##                                                         ^------- Form: DW_FORM_data4 (4-byte) 0x1234
919# MULTI-TABLES-NEXT: 0x00000010 0c000000 04000800 00000801 21430000 ............!C..
920##                              ^-------                            unit_length (4-byte)
921##                                       ^---                       version (2-byte)
922##                                           ^--------              debug_abbrev_offset (4-byte)
923##                                                    ^-            address_size (1-byte)
924##                                                      ^-          abbrev_code (ULEB128) 0x01
925##                                                         ^------- Form: DW_FORM_data4 (4-byte) 0x4321
926# MULTI-TABLES-NEXT: 0x00000020 10000000 04000000 00000801 78560000 ............xV..
927##                              ^-------                            unit_length (4-byte)
928##                                       ^---                       version (2-byte)
929##                                           ^--------              debug_abbrev_offset (4-byte)
930##                                                    ^-            address_size (1-byte)
931##                                                      ^-          abbrev_code (ULEB128) 0x01
932##                                                         ^------- Form: DW_FORM_addr (8-byte) 0x5678
933# MULTI-TABLES-NEXT: 0x00000030 00000000 0b000000 04001000 00000801 ................
934##                              --------
935##                                       ^-------                   unit_length (4-byte)
936##                                                ^---              version (2-byte)
937##                                                    ^--------     debug_abbrev_offset (4-byte)
938##                                                             ^-   address_size (1-byte)
939##                                                               ^- abbrev_code (ULEB128) 0x01
940# MULTI-TABLES-NEXT: 0x00000040 e58e02                              ...
941##                              ^-----                              Form: DW_FORM_udata (ULEB128) 0x8765
942
943--- !ELF
944FileHeader:
945  Class:   ELFCLASS64
946  Data:    ELFDATA2LSB
947  Type:    ET_EXEC
948DWARF:
949  debug_abbrev:
950    - Table:
951        - Code:     1
952          Tag:      DW_TAG_compile_unit
953          Children: DW_CHILDREN_no
954          Attributes:
955            - Attribute: DW_AT_low_pc
956              Form:      DW_FORM_addr
957    - ID: 2
958      Table:
959        - Code:     1
960          Tag:      DW_TAG_compile_unit
961          Children: DW_CHILDREN_no
962          Attributes:
963            - Attribute: DW_AT_low_pc
964              Form:      DW_FORM_data4
965    - ID: 1
966      Table:
967        - Code:     1
968          Tag:      DW_TAG_compile_unit
969          Children: DW_CHILDREN_no
970          Attributes:
971            - Attribute: DW_AT_low_pc
972              Form:      DW_FORM_udata
973  debug_info:
974    - Version:       4
975      AbbrevTableID: 2
976      Entries:
977        - AbbrCode: 1
978          Values:
979            - Value: 0x1234
980    - Version:       4
981      AbbrevTableID: 2
982      Entries:
983        - AbbrCode: 1
984          Values:
985            - Value: 0x4321
986    - Version:       4
987      AbbrevTableID: 0
988      Entries:
989        - AbbrCode: 1
990          Values:
991            - Value: 0x5678
992    - Version:       4
993      AbbrevTableID: 1
994      Entries:
995        - AbbrCode: 1
996          Values:
997            - Value: 0x8765
998
999## p) Test that when the debug_abbrev_offset field isn't specified and there is no associated
1000## abbrev table, yaml2obj will assign 0 to the debug_abbrev_offset field.
1001
1002# RUN: yaml2obj --docnum=18 %s -o %t18.o
1003# RUN: llvm-readelf --hex-dump=.debug_info %t18.o | FileCheck %s --check-prefix=ZERO-OFFSET
1004
1005#      ZERO-OFFSET: Hex dump of section '.debug_info':
1006# ZERO-OFFSET-NEXT: 0x00000000 07000000 04000000 000008            ...........
1007##                             ^-------                            unit_length (4-byte)
1008##                                      ^---                       version (2-byte)
1009##                                          ^--------              debug_abbrev_offset (4-byte)
1010##                                                   ^-            address_size (1-byte)
1011
1012--- !ELF
1013FileHeader:
1014  Class:   ELFCLASS64
1015  Data:    ELFDATA2LSB
1016  Type:    ET_EXEC
1017DWARF:
1018  debug_info:
1019    - Version:       4
1020      AbbrevTableID: [[ABBREVID=<none>]]
1021
1022## q) Test that when we assign an invalid 'AbbrevTableID' that doesn't point to an abbrev table,
1023## yaml2obj will assign 0 to the debug_abbrev_offset field.
1024
1025# RUN: yaml2obj --docnum=18 -DABBREVID=2 %s -o %t18.o
1026# RUN: llvm-readelf --hex-dump=.debug_info %t18.o | FileCheck %s --check-prefix=ZERO-OFFSET
1027