diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp --- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp +++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp @@ -111,6 +111,10 @@ encodeULEB128(0, OS); } + // The abbreviations for a given compilation unit end with an entry consisting + // of a 0 byte for the abbreviation code. + OS.write_zeros(1); + return Error::success(); } diff --git a/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml b/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml --- a/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml +++ b/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml @@ -204,7 +204,7 @@ - sectname: __debug_abbrev segname: __DWARF addr: 0x000000010000312C - size: 84 + size: 86 offset: 0x00002167 align: 0 reloff: 0x00000000 @@ -217,7 +217,7 @@ segname: __DWARF addr: 0x0000000100003178 size: 83 - offset: 0x000021BB + offset: 0x000021BC align: 0 reloff: 0x00000000 nreloc: 0 diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml --- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml @@ -4,7 +4,7 @@ # RUN: yaml2obj --docnum=1 %s -o %t1.o # RUN: llvm-readobj --sections --section-data %t1.o | \ -# RUN: FileCheck -DSIZE=38 -DADDRALIGN=1 %s --check-prefixes=SHDR,CONTENT +# RUN: FileCheck -DSIZE=39 -DADDRALIGN=1 %s --check-prefixes=SHDR,CONTENT # SHDR: Index: 1 # SHDR-NEXT: Name: .debug_abbrev (1) @@ -42,8 +42,9 @@ ## ^--- Form: invalid ULEB128 (0x81) ^--- Attribute: reserved ULEB128 (0x2020) ## ^- Attribute: reserved ULEB128 ^- DW_FORM_implicit_const ULEB128 ## -# CONTENT-NEXT: 0020: CEC2F105 0000 |......| -## ^------- Value SLEB128 (12345678) ^--- terminating entry +# CONTENT-NEXT: 0020: CEC2F105 000000 |.......| +## ^------- Value SLEB128 (12345678) ^--- terminating entry for attributes. +## ^- terminating entry for abbreviations. # CONTENT-NEXT: ) --- !ELF @@ -186,8 +187,8 @@ # RUN: llvm-readelf --sections %t6.o | FileCheck %s --check-prefix=OVERRIDDEN # OVERRIDDEN: [Nr] Name Type Address Off Size ES Flg Lk Inf Al -# OVERRIDDEN: [ 1] .debug_abbrev STRTAB 0000000000002020 000050 000005 01 A 2 1 2 -# OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 000055 000000 00 0 0 0 +# OVERRIDDEN: [ 1] .debug_abbrev STRTAB 0000000000002020 000050 000006 01 A 2 1 2 +# OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 000056 000000 00 0 0 0 --- !ELF FileHeader: @@ -205,7 +206,7 @@ AddressAlign: 2 ## 0 by default. Address: 0x2020 ## 0x00 by default. Offset: 0x50 ## 0x40 for the first section. - Size: 0x05 ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN". + Size: 0x06 ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN". - Name: .sec ## Linked by .debug_abbrev. Type: SHT_STRTAB diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml --- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml +++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml @@ -6,7 +6,7 @@ # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB %s -o %t1.le.o # RUN: llvm-readobj --sections --section-data %t1.le.o | \ -# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9A -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE-CONTENT +# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9B -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE-CONTENT # SHDR: Index: [[INDEX]] # SHDR-NEXT: Name: .debug_info ([[NAME]]) @@ -287,7 +287,7 @@ # RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.be.o # RUN: llvm-readobj --sections --section-data %t1.be.o | \ -# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9A -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE-CONTENT +# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9B -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE-CONTENT # DWARF32-BE-CONTENT-NEXT: SectionData ( # DWARF32-BE-CONTENT-NEXT: 0000: 00001234 00050204 00001234 01123456