diff options
| author | David Blaikie <dblaikie@gmail.com> | 2019-11-12 14:15:37 -0800 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2019-11-15 18:51:13 -0800 |
| commit | 77cfcd75092b57693d40123a013e59295634a945 (patch) | |
| tree | 1199d6a4ddee2a0351d11eacd99f2ec373a8f156 /llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | |
| parent | 97c742e6b74e731afdef74dd5f8366ce883e0520 (diff) | |
| download | bcm5719-llvm-77cfcd75092b57693d40123a013e59295634a945.tar.gz bcm5719-llvm-77cfcd75092b57693d40123a013e59295634a945.zip | |
DebugInfo: Use loclistx for DWARFv5 location lists to reduce the number of relocations
This only implements the non-dwo part, but loclistx is necessary to use
location lists in DWARFv5, so it's a precursor to that work - and
generally reduces relocations (only using one reloc, then
indexes/relative offsets for all location list references) in non-split
DWARF.
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index e5cba5e50b3..2eb7d2f945a 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -352,6 +352,7 @@ void DWARFUnit::clear() { Abbrevs = nullptr; BaseAddr.reset(); RangeSectionBase = 0; + LocSectionBase = 0; AddrOffsetSectionBase = 0; clearDIEs(false); DWO.reset(); @@ -442,11 +443,13 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { if (!IsDWO) { assert(AddrOffsetSectionBase == 0); assert(RangeSectionBase == 0); + assert(LocSectionBase == 0); AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_addr_base), 0); if (!AddrOffsetSectionBase) AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_GNU_addr_base), 0); RangeSectionBase = toSectionOffset(UnitDie.find(DW_AT_rnglists_base), 0); + LocSectionBase = toSectionOffset(UnitDie.find(DW_AT_loclists_base), 0); } // In general, in DWARF v5 and beyond we derive the start of the unit's @@ -498,6 +501,28 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { if (IsDWO && RngListTable) RangeSectionBase = RngListTable->getHeaderSize(); } + + // FIXME: add loclists.dwo support + setLocSection(&Context.getDWARFObj().getLoclistsSection(), + toSectionOffset(UnitDie.find(DW_AT_loclists_base), 0)); + + if (LocSection->Data.size()) { + LoclistTableHeader.emplace(".debug_loclists", "locations"); + uint64_t Offset = LocSectionBase; + uint64_t HeaderSize = DWARFListTableHeader::getHeaderSize(Header.getFormat()); + DWARFDataExtractor Data(Context.getDWARFObj(), *LocSection, + isLittleEndian, getAddressByteSize()); + if (Offset < HeaderSize) + return createStringError(errc::invalid_argument, + "did not detect a valid" + " list table with base = 0x%" PRIx64 "\n", + Offset); + Offset -= HeaderSize; + if (Error E = LoclistTableHeader->extract(Data, &Offset)) + return createStringError(errc::invalid_argument, + "parsing a loclist table: " + + toString(std::move(E))); + } } // Don't fall back to DW_AT_GNU_ranges_base: it should be ignored for |

