diff options
author | Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com> | 2019-11-23 19:44:42 +0530 |
---|---|---|
committer | Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com> | 2019-11-23 19:46:07 +0530 |
commit | 02cb4b2fd699564c68d30c1dd22cb74d671fe14b (patch) | |
tree | 8a164701cb4570ef8108a194172efcf0f9b4e43f /llvm/lib | |
parent | ed33cb5b147402c06a3e0a9082b0f991a9d91a1b (diff) | |
download | bcm5719-llvm-02cb4b2fd699564c68d30c1dd22cb74d671fe14b.tar.gz bcm5719-llvm-02cb4b2fd699564c68d30c1dd22cb74d671fe14b.zip |
Revert "[DWARF] Support for loclist.dwo section in llvm and llvm-dwarfdump."
This reverts commit 81b0a3284af1dcef26e56b0de9fd74002083c471.
Will Re-apply, with updated Differtial Revision, for automatic closure of
Phabricator review.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 55 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFContext.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 32 | ||||
-rw-r--r-- | llvm/lib/MC/MCObjectFileInfo.cpp | 3 |
4 files changed, 26 insertions, 77 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 551e8a2751b..84444ca5174 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1158,12 +1158,11 @@ void DwarfDebug::finalizeModuleInfo() { if (U.hasRangeLists()) U.addRnglistsBase(); - if (!DebugLocs.getLists().empty()) { + if (!DebugLocs.getLists().empty() && !useSplitDwarf()) { DebugLocs.setSym(Asm->createTempSymbol("loclists_table_base")); - if (!useSplitDwarf()) - U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_loclists_base, - DebugLocs.getSym(), - TLOF.getDwarfLoclistsSection()->getBeginSymbol()); + U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_loclists_base, + DebugLocs.getSym(), + TLOF.getDwarfLoclistsSection()->getBeginSymbol()); } } @@ -1208,10 +1207,9 @@ void DwarfDebug::endModule() { emitDebugStr(); if (useSplitDwarf()) - // Handles debug_loc.dwo / debug_loclists.dwo section emission emitDebugLocDWO(); else - // Handles debug_loc / debug_loclists section emission + // Emit info into a debug loc section. emitDebugLoc(); // Corresponding abbreviations into a abbrev section. @@ -2337,6 +2335,8 @@ static MCSymbol *emitLoclistsTableHeader(AsmPrinter *Asm, const auto &DebugLocs = DD.getDebugLocs(); + // FIXME: Generate the offsets table and use DW_FORM_loclistx with the + // DW_AT_loclists_base attribute. Until then set the number of offsets to 0. Asm->OutStreamer->AddComment("Offset entry count"); Asm->emitInt32(DebugLocs.getLists().size()); Asm->OutStreamer->EmitLabel(DebugLocs.getSym()); @@ -2443,29 +2443,27 @@ static void emitRangeList( } } -// Handles emission of both debug_loclist / debug_loclist.dwo static void emitLocList(DwarfDebug &DD, AsmPrinter *Asm, const DebugLocStream::List &List) { - emitRangeList(DD, Asm, List.Label, DD.getDebugLocs().getEntries(List), - *List.CU, dwarf::DW_LLE_base_addressx, - dwarf::DW_LLE_offset_pair, dwarf::DW_LLE_startx_length, - dwarf::DW_LLE_end_of_list, llvm::dwarf::LocListEncodingString, - /* ShouldUseBaseAddress */ true, - [&](const DebugLocStream::Entry &E) { - DD.emitDebugLocEntryLocation(E, List.CU); - }); + emitRangeList( + DD, Asm, List.Label, DD.getDebugLocs().getEntries(List), *List.CU, + dwarf::DW_LLE_base_addressx, dwarf::DW_LLE_offset_pair, + dwarf::DW_LLE_startx_length, dwarf::DW_LLE_end_of_list, + llvm::dwarf::LocListEncodingString, + /* ShouldUseBaseAddress */ true, + [&](const DebugLocStream::Entry &E) { + DD.emitDebugLocEntryLocation(E, List.CU); + }); } -// Emit locations into the .debug_loc/.debug_loclists section. +// Emit locations into the .debug_loc/.debug_rnglists section. void DwarfDebug::emitDebugLoc() { if (DebugLocs.getLists().empty()) return; MCSymbol *TableEnd = nullptr; if (getDwarfVersion() >= 5) { - Asm->OutStreamer->SwitchSection( Asm->getObjFileLowering().getDwarfLoclistsSection()); - TableEnd = emitLoclistsTableHeader(Asm, *this); } else { Asm->OutStreamer->SwitchSection( @@ -2479,29 +2477,11 @@ void DwarfDebug::emitDebugLoc() { Asm->OutStreamer->EmitLabel(TableEnd); } -// Emit locations into the .debug_loc.dwo/.debug_loclists.dwo section. void DwarfDebug::emitDebugLocDWO() { - if (DebugLocs.getLists().empty()) - return; - - if (getDwarfVersion() >= 5) { - MCSymbol *TableEnd = nullptr; - Asm->OutStreamer->SwitchSection( - Asm->getObjFileLowering().getDwarfLoclistsDWOSection()); - TableEnd = emitLoclistsTableHeader(Asm, *this); - for (const auto &List : DebugLocs.getLists()) - emitLocList(*this, Asm, List); - - if (TableEnd) - Asm->OutStreamer->EmitLabel(TableEnd); - return; - } - for (const auto &List : DebugLocs.getLists()) { Asm->OutStreamer->SwitchSection( Asm->getObjFileLowering().getDwarfLocDWOSection()); Asm->OutStreamer->EmitLabel(List.Label); - for (const auto &Entry : DebugLocs.getEntries(List)) { // GDB only supports startx_length in pre-standard split-DWARF. // (in v5 standard loclists, it currently* /only/ supports base_address + @@ -2514,6 +2494,7 @@ void DwarfDebug::emitDebugLocDWO() { unsigned idx = AddrPool.getIndex(Entry.Begin); Asm->EmitULEB128(idx); Asm->EmitLabelDifference(Entry.End, Entry.Begin, 4); + emitDebugLocEntryLocation(Entry, List.CU); } Asm->emitInt8(dwarf::DW_LLE_end_of_list); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp index 012bab35460..f7b3fb495f9 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -404,14 +404,6 @@ void DWARFContext::dump( dumpLoclistsSection(OS, LLDumpOpts, Data, getRegisterInfo(), *Off); } if (const auto *Off = - shouldDump(ExplicitDWO, ".debug_loclists.dwo", DIDT_ID_DebugLoclists, - DObj->getLoclistsDWOSection().Data)) { - DWARFDataExtractor Data(*DObj, DObj->getLoclistsDWOSection(), - isLittleEndian(), 0); - dumpLoclistsSection(OS, LLDumpOpts, Data, getRegisterInfo(), *Off); - } - - if (const auto *Off = shouldDump(ExplicitDWO, ".debug_loc.dwo", DIDT_ID_DebugLoc, DObj->getLocDWOSection().Data)) { DWARFDataExtractor Data(*DObj, DObj->getLocDWOSection(), isLittleEndian(), @@ -1393,7 +1385,6 @@ class DWARFObjInMemory final : public DWARFObject { DWARFSectionMap LocSection; DWARFSectionMap LoclistsSection; - DWARFSectionMap LoclistsDWOSection; DWARFSectionMap LineSection; DWARFSectionMap RangesSection; DWARFSectionMap RnglistsSection; @@ -1420,7 +1411,6 @@ class DWARFObjInMemory final : public DWARFObject { return StringSwitch<DWARFSectionMap *>(Name) .Case("debug_loc", &LocSection) .Case("debug_loclists", &LoclistsSection) - .Case("debug_loclists.dwo", &LoclistsDWOSection) .Case("debug_line", &LineSection) .Case("debug_frame", &FrameSection) .Case("eh_frame", &EHFrameSection) @@ -1751,9 +1741,6 @@ public: const DWARFSection &getRnglistsDWOSection() const override { return RnglistsDWOSection; } - const DWARFSection &getLoclistsDWOSection() const override { - return LoclistsDWOSection; - } const DWARFSection &getAddrSection() const override { return AddrSection; } StringRef getCUIndexSection() const override { return CUIndexSection; } StringRef getGdbIndexSection() const override { return GdbIndexSection; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index b662e88816f..e5d33e13644 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -186,16 +186,9 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section, if (auto *IndexEntry = Header.getIndexEntry()) if (const auto *C = IndexEntry->getOffset(DW_SECT_LOC)) Data = Data.substr(C->Offset, C->Length); - - DWARFDataExtractor DWARFData = - Header.getVersion() >= 5 - ? DWARFDataExtractor(Context.getDWARFObj(), - Context.getDWARFObj().getLoclistsDWOSection(), - isLittleEndian, getAddressByteSize()) - : DWARFDataExtractor(Data, isLittleEndian, getAddressByteSize()); - LocTable = - std::make_unique<DWARFDebugLoclists>(DWARFData, Header.getVersion()); - + LocTable = std::make_unique<DWARFDebugLoclists>( + DWARFDataExtractor(Data, isLittleEndian, getAddressByteSize()), + Header.getVersion()); } else if (Header.getVersion() >= 5) { LocTable = std::make_unique<DWARFDebugLoclists>( DWARFDataExtractor(Context.getDWARFObj(), @@ -509,23 +502,14 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { RangeSectionBase = RngListTable->getHeaderSize(); } - // In a split dwarf unit, there is no DW_AT_loclists_base attribute. - // Setting LocSectionBase to point past the table header. - if (IsDWO) - setLocSection(&Context.getDWARFObj().getLoclistsDWOSection(), - DWARFListTableHeader::getHeaderSize(Header.getFormat())); - else - setLocSection(&Context.getDWARFObj().getLoclistsSection(), - toSectionOffset(UnitDie.find(DW_AT_loclists_base), 0)); + // FIXME: add loclists.dwo support + setLocSection(&Context.getDWARFObj().getLoclistsSection(), + toSectionOffset(UnitDie.find(DW_AT_loclists_base), 0)); if (LocSection->Data.size()) { - if (IsDWO) - LoclistTableHeader.emplace(".debug_loclists.dwo", "locations"); - else - LoclistTableHeader.emplace(".debug_loclists", "locations"); - + LoclistTableHeader.emplace(".debug_loclists", "locations"); + uint64_t Offset = LocSectionBase; uint64_t HeaderSize = DWARFListTableHeader::getHeaderSize(Header.getFormat()); - uint64_t Offset = getLocSectionBase(); DWARFDataExtractor Data(Context.getDWARFObj(), *LocSection, isLittleEndian, getAddressByteSize()); if (Offset < HeaderSize) diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 5b4da1998c4..53a9467041c 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -464,9 +464,6 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) { DwarfRnglistsDWOSection = Ctx->getELFSection(".debug_rnglists.dwo", DebugSecType, ELF::SHF_EXCLUDE); - DwarfLoclistsDWOSection = - Ctx->getELFSection(".debug_loclists.dwo", DebugSecType, ELF::SHF_EXCLUDE); - // DWP Sections DwarfCUIndexSection = Ctx->getELFSection(".debug_cu_index", DebugSecType, 0); |