diff options
author | Paul Robinson <paul.robinson@sony.com> | 2017-06-29 16:52:08 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2017-06-29 16:52:08 +0000 |
commit | 17536b935ae8a4ef2679ae5ccd541eddc60dceed (patch) | |
tree | 73d94728c989ff925143beb251bec0d2048b93a9 /llvm/tools | |
parent | 0ce4999002659c659510a1b5bd8478da31c2a5ee (diff) | |
download | bcm5719-llvm-17536b935ae8a4ef2679ae5ccd541eddc60dceed.tar.gz bcm5719-llvm-17536b935ae8a4ef2679ae5ccd541eddc60dceed.zip |
[DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.
Requires callers to directly associate relocations with a DataExtractor
used to read data from a DWARF section, which helps a callee not make
assumptions about which section it is reading.
This is the next step in reducing DWARFFormValue's dependence on DWARFUnit.
Differential Revision: https://reviews.llvm.org/D34704
llvm-svn: 306699
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/dsymutil/DwarfLinker.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index ba5c63846b5..86621e3260f 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -2212,7 +2212,7 @@ void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr, // Then we need to mark all the DIEs referenced by this DIE's // attributes as kept. - DataExtractor Data = Unit.getDebugInfoExtractor(); + DWARFDataExtractor Data = Unit.getDebugInfoExtractor(); const auto *Abbrev = Die.getAbbreviationDeclarationPtr(); uint32_t Offset = Die.getOffset() + getULEB128Size(Abbrev->getCode()); @@ -2729,7 +2729,7 @@ DIE *DwarfLinker::DIECloner::cloneDIE( } // Extract and clone every attribute. - DataExtractor Data = U.getDebugInfoExtractor(); + DWARFDataExtractor Data = U.getDebugInfoExtractor(); // Point to the next DIE (generally there is always at least a NULL // entry after the current one). If this is a lone // DW_TAG_compile_unit without any children, point to the next unit. @@ -2743,7 +2743,8 @@ DIE *DwarfLinker::DIECloner::cloneDIE( // it. After testing, it seems there is no performance downside to // doing the copy unconditionally, and it makes the code simpler. SmallString<40> DIECopy(Data.getData().substr(Offset, NextOffset - Offset)); - Data = DataExtractor(DIECopy, Data.isLittleEndian(), Data.getAddressSize()); + Data = + DWARFDataExtractor(DIECopy, Data.isLittleEndian(), Data.getAddressSize()); // Modify the copy with relocated addresses. if (RelocMgr.applyValidRelocs(DIECopy, Offset, Data.isLittleEndian())) { // If we applied relocations, we store the value of high_pc that was @@ -2872,8 +2873,8 @@ void DwarfLinker::patchRangesForUnit(const CompileUnit &Unit, DWARFDebugRangeList RangeList; const auto &FunctionRanges = Unit.getFunctionRanges(); unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize(); - DataExtractor RangeExtractor(OrigDwarf.getRangeSection().Data, - OrigDwarf.isLittleEndian(), AddressSize); + DWARFDataExtractor RangeExtractor(OrigDwarf.getRangeSection(), + OrigDwarf.isLittleEndian(), AddressSize); auto InvalidRange = FunctionRanges.end(), CurrRange = InvalidRange; DWARFUnit &OrigUnit = Unit.getOrigUnit(); auto OrigUnitDie = OrigUnit.getUnitDIE(false); @@ -2887,7 +2888,7 @@ void DwarfLinker::patchRangesForUnit(const CompileUnit &Unit, for (const auto &RangeAttribute : Unit.getRangesAttributes()) { uint32_t Offset = RangeAttribute.get(); RangeAttribute.set(Streamer->getRangesSectionSize()); - RangeList.extract(RangeExtractor, &Offset, OrigDwarf.getRangeSection().Relocs); + RangeList.extract(RangeExtractor, &Offset); const auto &Entries = RangeList.getEntries(); if (!Entries.empty()) { const DWARFDebugRangeList::RangeListEntry &First = Entries.front(); @@ -2983,11 +2984,10 @@ void DwarfLinker::patchLineTableForUnit(CompileUnit &Unit, // Parse the original line info for the unit. DWARFDebugLine::LineTable LineTable; uint32_t StmtOffset = *StmtList; - StringRef LineData = OrigDwarf.getLineSection().Data; - DataExtractor LineExtractor(LineData, OrigDwarf.isLittleEndian(), - Unit.getOrigUnit().getAddressByteSize()); - LineTable.parse(LineExtractor, &OrigDwarf.getLineSection().Relocs, - &StmtOffset); + DWARFDataExtractor LineExtractor(OrigDwarf.getLineSection(), + OrigDwarf.isLittleEndian(), + Unit.getOrigUnit().getAddressByteSize()); + LineTable.parse(LineExtractor, &StmtOffset); // This vector is the output line table. std::vector<DWARFDebugLine::Row> NewRows; @@ -3086,6 +3086,7 @@ void DwarfLinker::patchLineTableForUnit(CompileUnit &Unit, LineTable.Prologue.OpcodeBase > 13) reportWarning("line table parameters mismatch. Cannot emit."); else { + StringRef LineData = OrigDwarf.getLineSection().Data; MCDwarfLineTableParams Params; Params.DWARF2LineOpcodeBase = LineTable.Prologue.OpcodeBase; Params.DWARF2LineBase = LineTable.Prologue.LineBase; |