diff options
| author | Wolfgang Pieb <Wolfgang.Pieb@sony.com> | 2018-07-26 01:12:41 +0000 |
|---|---|---|
| committer | Wolfgang Pieb <Wolfgang.Pieb@sony.com> | 2018-07-26 01:12:41 +0000 |
| commit | 1d56b4ae40c6dc7bbf6ec6917c986ae5210d1b70 (patch) | |
| tree | cee3fe82adeacd90e5799bb7ff35ce7127ae59cb /llvm/lib/DebugInfo | |
| parent | 984a424c8a677651cd1ab685656fb7e2525b9dba (diff) | |
| download | bcm5719-llvm-1d56b4ae40c6dc7bbf6ec6917c986ae5210d1b70.tar.gz bcm5719-llvm-1d56b4ae40c6dc7bbf6ec6917c986ae5210d1b70.zip | |
[DWARF v5] Don't report an error when the .debug_rnglists section is empty or non-existent. Fixes PR38297.
Reviewer: JDevlieghere
Differential Revision: https://reviews.llvm.org/D49815
llvm-svn: 337993
Diffstat (limited to 'llvm/lib/DebugInfo')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 51d086597ef..3b408857d29 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -314,22 +314,24 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) { else setRangesSection(&Context.getDWARFObj().getRnglistsSection(), toSectionOffset(UnitDie.find(DW_AT_rnglists_base), 0)); - // Parse the range list table header. Individual range lists are - // extracted lazily. - DWARFDataExtractor RangesDA(Context.getDWARFObj(), *RangeSection, - isLittleEndian, 0); - if (auto TableOrError = - parseRngListTableHeader(RangesDA, RangeSectionBase)) - RngListTable = TableOrError.get(); - else - WithColor::error() << "parsing a range list table: " - << toString(TableOrError.takeError()) - << '\n'; - - // In a split dwarf unit, there is no DW_AT_rnglists_base attribute. - // Adjust RangeSectionBase to point past the table header. - if (isDWO && RngListTable) - RangeSectionBase = RngListTable->getHeaderSize(); + if (RangeSection->Data.size()) { + // Parse the range list table header. Individual range lists are + // extracted lazily. + DWARFDataExtractor RangesDA(Context.getDWARFObj(), *RangeSection, + isLittleEndian, 0); + if (auto TableOrError = + parseRngListTableHeader(RangesDA, RangeSectionBase)) + RngListTable = TableOrError.get(); + else + WithColor::error() << "parsing a range list table: " + << toString(TableOrError.takeError()) + << '\n'; + + // In a split dwarf unit, there is no DW_AT_rnglists_base attribute. + // Adjust RangeSectionBase to point past the table header. + if (isDWO && RngListTable) + RangeSectionBase = RngListTable->getHeaderSize(); + } } // Don't fall back to DW_AT_GNU_ranges_base: it should be ignored for |

