diff options
author | Alon Zakai <azakai@google.com> | 2020-01-28 10:45:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-28 10:45:48 -0800 |
commit | 9384ff68eea8090578354bab35fce2e621a588c4 (patch) | |
tree | 3ba04c14502f6fdbe552ba283cfa0287728f77cb /third_party/llvm-project/DWARFEmitter.cpp | |
parent | b00f7f9b97631b214eff177b92639df6307db286 (diff) | |
download | binaryen-9384ff68eea8090578354bab35fce2e621a588c4.tar.gz binaryen-9384ff68eea8090578354bab35fce2e621a588c4.tar.bz2 binaryen-9384ff68eea8090578354bab35fce2e621a588c4.zip |
DWARF: Fix debug_abbrev section (#2630)
Each compilation unit's abbreviations must be terminated by
a zero, so that we use the right abbreviations. This adds that
support to the YAML layer, both adding the zeros and parsing
them to look in the right abbreviation section at the right time.
Also add two large testcases, zlib and cubescript, which
crash without this and the last PR.
Diffstat (limited to 'third_party/llvm-project/DWARFEmitter.cpp')
-rw-r--r-- | third_party/llvm-project/DWARFEmitter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/third_party/llvm-project/DWARFEmitter.cpp b/third_party/llvm-project/DWARFEmitter.cpp index 92efcdfa0..6e4ee6119 100644 --- a/third_party/llvm-project/DWARFEmitter.cpp +++ b/third_party/llvm-project/DWARFEmitter.cpp @@ -78,6 +78,10 @@ void DWARFYAML::EmitDebugStr(raw_ostream &OS, const DWARFYAML::Data &DI) { void DWARFYAML::EmitDebugAbbrev(raw_ostream &OS, const DWARFYAML::Data &DI) { for (auto AbbrevDecl : DI.AbbrevDecls) { encodeULEB128(AbbrevDecl.Code, OS); + // XXX BINARYEN This is a terminator. + if (!AbbrevDecl.Code) { + continue; + } encodeULEB128(AbbrevDecl.Tag, OS); OS.write(AbbrevDecl.Children); for (auto Attr : AbbrevDecl.Attributes) { @@ -89,10 +93,6 @@ void DWARFYAML::EmitDebugAbbrev(raw_ostream &OS, const DWARFYAML::Data &DI) { encodeULEB128(0, OS); encodeULEB128(0, OS); } - // XXX BINARYEN: end the list with a zero. LLVM works with or without this, - // but other decoders may error. See - // https://bugs.llvm.org/show_bug.cgi?id=44511 - writeInteger((uint8_t)0, OS, true /* isLittleEndian */); } void DWARFYAML::EmitDebugAranges(raw_ostream &OS, const DWARFYAML::Data &DI) { |