1 ## Test that yaml2obj emits .debug_pubnames section.
3 ## a) Generate the '.debug_pubnames' section from the 'DWARF' entry.
5 ## Generate and verify a 32-bit little endian .debug_pubnames section.
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 -DSIZE=30 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE
12 # SHDR-NEXT: Name: .debug_pubnames (1)
13 # SHDR-NEXT: Type: SHT_PROGBITS (0x1)
14 # SHDR-NEXT: Flags [ (0x0)
16 # SHDR-NEXT: Address: 0x0
17 # SHDR-NEXT: Offset: 0x40
18 # SHDR-NEXT: Size: [[SIZE]]
21 # SHDR-NEXT: AddressAlignment: [[ADDRALIGN]]
22 # SHDR-NEXT: EntrySize: 0
23 # DWARF32-LE-NEXT: SectionData (
24 # DWARF32-LE-NEXT: 0000: 34120000 02003412 00002143 00007856 |4.....4...!C..xV|
25 ## ^------- unit_length (4-byte)
26 ## ^--- version (2-byte)
27 ## ^-------- debug_info_offset (4-byte)
28 ## ^-------- debug_info_length (4-byte)
29 ## ^--- offset (4-byte)
31 # DWARF32-LE-NEXT: 0010: 34126162 63002143 65876465 6600 |4.abc.!Ce.def.|
33 ## ^-------- name "abc\0"
34 ## ^-------- offset (4-byte)
35 ## ^-------- name "def\0"
50 - DieOffset: 0x12345678
52 - DieOffset: 0x87654321
55 ## Generate and verify a 32-bit big endian .debug_pubnames section.
57 # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.be.o
58 # RUN: llvm-readobj --sections --section-data %t1.be.o | \
59 # RUN: FileCheck -DSIZE=30 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE
61 # DWARF32-BE-NEXT: SectionData (
62 # DWARF32-BE-NEXT: 0000: 00001234 00020000 12340000 43211234 |...4.....4..C!.4|
63 ## ^------- unit_length (4-byte)
64 ## ^--- version (2-byte)
65 ## ^-------- debug_info_offset (4-byte)
66 ## ^-------- debug_info_length (4-byte)
67 ## ^--- offset (4-byte)
69 # DWARF32-BE-NEXT: 0010: 56786162 63008765 43216465 6600 |Vxabc..eC!def.|
71 ## ^-------- name "abc\0"
72 ## ^-------- offset (4-byte)
73 ## ^-------- name "def\0"
76 ## b) Generate the .debug_pubnames section from raw section content.
78 # RUN: yaml2obj --docnum=2 %s -o %t2.o
79 # RUN: llvm-readobj --sections --section-data %t2.o | \
80 # RUN: FileCheck %s -DADDRALIGN=0 -DSIZE=3 --check-prefixes=SHDR,ARBITRARY-CONTENT
82 # ARBITRARY-CONTENT: SectionData (
83 # ARBITRARY-CONTENT-NEXT: 0000: 112233
84 # ARBITRARY-CONTENT-NEXT: )
92 - Name: .debug_pubnames
96 ## c) Generate the .debug_pubnames section when the "Size" is specified.
98 # RUN: yaml2obj --docnum=3 %s -o %t3.o
99 # RUN: llvm-readobj --sections --section-data %t3.o | \
100 # RUN: FileCheck -DSIZE=16 -DADDRALIGN=0 %s --check-prefixes=SHDR,SIZE
102 # SIZE: SectionData (
103 # SIZE-NEXT: 0000: 00000000 00000000 00000000 00000000 |................|
112 - Name: .debug_pubnames
116 ## d) Test that yaml2obj emits an error message when both the "Size" and the
117 ## "debug_pubnames" entry are specified at the same time.
119 # RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=ERROR
121 # ERROR: yaml2obj: error: cannot specify section '.debug_pubnames' contents in the 'DWARF' entry and the 'Content' or 'Size' in the 'Sections' entry at the same time
129 - Name: .debug_pubnames
140 ## e) Test that yaml2obj emits an error message when both the "Content" and the
141 ## "debug_pubnames" entry are specified at the same time.
143 # RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=ERROR
151 - Name: .debug_pubnames
162 ## f) Test that all the properties can be overridden by the section header when
163 ## the "debug_pubnames" entry doesn't exist.
165 # RUN: yaml2obj --docnum=6 %s -o %t6.o
166 # RUN: llvm-readelf --sections %t6.o | FileCheck %s --check-prefix=OVERRIDDEN
168 # OVERRIDDEN: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
169 # OVERRIDDEN: [ 1] .debug_pubnames STRTAB 0000000000002020 000050 00000e 01 A 2 1 2
170 # OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 00005e 000000 00 0 0 0
178 - Name: .debug_pubnames
179 Type: SHT_STRTAB ## SHT_PROGBITS by default.
180 Flags: [SHF_ALLOC] ## 0 by default.
181 Link: .sec ## 0 by default.
182 EntSize: 1 ## 0 by default.
183 Info: 1 ## 0 by default.
184 AddressAlign: 2 ## 0 by default.
185 Address: 0x2020 ## 0x00 by default.
186 Offset: 0x50 ## 0x40 for the first section.
187 Size: 0x0e ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
188 - Name: .sec ## Linked by .debug_pubnames.
191 ## g) Test that all the properties can be overridden by the section header when
192 ## the "debug_pubnames" entry exists.
194 # RUN: yaml2obj --docnum=7 %s -o %t7.o
195 # RUN: llvm-readelf --sections %t7.o | FileCheck %s --check-prefix=OVERRIDDEN
203 - Name: .debug_pubnames
204 Type: SHT_STRTAB ## SHT_PROGBITS by default.
205 Flags: [SHF_ALLOC] ## 0 by default.
206 Link: .sec ## 0 by default.
207 EntSize: 1 ## 0 by default.
208 Info: 1 ## 0 by default.
209 AddressAlign: 2 ## 1 by default.
210 Address: 0x2020 ## 0x00 by default.
211 Offset: 0x50 ## 0x40 for the first section.
212 - Name: .sec ## Linked by .debug_pubnames.