diff options
| author | David Blaikie <dblaikie@gmail.com> | 2019-12-18 16:19:17 -0800 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2019-12-18 16:28:19 -0800 |
| commit | eed0242330926815d19dd0d54f393576bcffc762 (patch) | |
| tree | cdde7a82acdf9a16e90727bf8ef76b3f4d337490 /llvm/lib | |
| parent | 64fa76ef553c15b556fbd06383c1d28baf0bc142 (diff) | |
| download | bcm5719-llvm-eed0242330926815d19dd0d54f393576bcffc762.tar.gz bcm5719-llvm-eed0242330926815d19dd0d54f393576bcffc762.zip | |
DebugInfo: Don't use implicit zero addr_base
(found when LLVM fails to emit addr_base for gmlt+DWARFv5)
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp index 820f530a3e3..e97ae81345b 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -412,7 +412,7 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { if (A) dumpSectionedAddress(AddrOS, DumpOpts, *A); else - OS << "<no .debug_addr section>"; + OS << "<unresolved>"; break; } case DW_FORM_flag_present: diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 02f915bc6f7..9586d5aca1a 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -228,7 +228,9 @@ DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const { if (I != R.end() && std::next(I) == R.end()) return (*I)->getAddrOffsetSectionItem(Index); } - uint64_t Offset = AddrOffsetSectionBase + Index * getAddressByteSize(); + if (!AddrOffsetSectionBase) + return None; + uint64_t Offset = *AddrOffsetSectionBase + Index * getAddressByteSize(); if (AddrOffsetSection->Data.size() < Offset + getAddressByteSize()) return None; DWARFDataExtractor DA(Context.getDWARFObj(), *AddrOffsetSection, @@ -360,7 +362,7 @@ void DWARFUnit::clear() { BaseAddr.reset(); RangeSectionBase = 0; LocSectionBase = 0; - AddrOffsetSectionBase = 0; + AddrOffsetSectionBase = None; clearDIEs(false); DWO.reset(); } @@ -448,13 +450,13 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { if (Optional<uint64_t> DWOId = toUnsigned(UnitDie.find(DW_AT_GNU_dwo_id))) Header.setDWOId(*DWOId); if (!IsDWO) { - assert(AddrOffsetSectionBase == 0); + assert(AddrOffsetSectionBase == None); assert(RangeSectionBase == 0); assert(LocSectionBase == 0); - AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_addr_base), 0); + AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_addr_base)); if (!AddrOffsetSectionBase) AddrOffsetSectionBase = - toSectionOffset(UnitDie.find(DW_AT_GNU_addr_base), 0); + toSectionOffset(UnitDie.find(DW_AT_GNU_addr_base)); RangeSectionBase = toSectionOffset(UnitDie.find(DW_AT_rnglists_base), 0); LocSectionBase = toSectionOffset(UnitDie.find(DW_AT_loclists_base), 0); } @@ -578,7 +580,8 @@ bool DWARFUnit::parseDWO() { return false; DWO = std::shared_ptr<DWARFCompileUnit>(std::move(DWOContext), DWOCU); // Share .debug_addr and .debug_ranges section with compile unit in .dwo - DWO->setAddrOffsetSection(AddrOffsetSection, AddrOffsetSectionBase); + if (AddrOffsetSectionBase) + DWO->setAddrOffsetSection(AddrOffsetSection, *AddrOffsetSectionBase); if (getVersion() >= 5) { DWO->setRangesSection(&Context.getDWARFObj().getRnglistsDWOSection(), 0); DWARFDataExtractor RangesDA(Context.getDWARFObj(), *RangeSection, |

