Skip to content

Commit c6fca5e

Browse files
Revert "[BOLT][DWARF] Skip processing DWARF CUs with a DWO ID but no DWO name (#154749)"
This reverts commit e6540d2. It breaks AArch64 Buildbot builders, see: https://lab.llvm.org/staging/#/builders/219/builds/5476
1 parent 020b928 commit c6fca5e

File tree

5 files changed

+4
-657
lines changed

5 files changed

+4
-657
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,6 @@ class BinaryContext {
326326
/// Returns true if DWARF4 or lower is used.
327327
bool isDWARFLegacyUsed() const { return ContainsDwarfLegacy; }
328328

329-
/// Returns true if DWARFUnit is valid.
330-
bool isValidDwarfUnit(DWARFUnit &DU) const;
331-
332329
std::map<unsigned, DwarfLineTable> &getDwarfLineTables() {
333330
return DwarfLineTablesCUMap;
334331
}

bolt/include/bolt/Core/DIEBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ class DIEBuilder {
217217
std::optional<BOLTDWARF5AccelTableData *> Parent,
218218
uint32_t NumberParentsInChain);
219219

220-
/// Returns true if DWARFUnit is registered successfully.
221-
bool registerUnit(DWARFUnit &DU, bool NeedSort);
220+
void registerUnit(DWARFUnit &DU, bool NeedSort);
222221

223222
/// \return the unique ID of \p U if it exists.
224223
std::optional<uint32_t> getUnitId(const DWARFUnit &DU);

bolt/lib/Core/BinaryContext.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,26 +1624,10 @@ DWARFContext *BinaryContext::getDWOContext() const {
16241624
return &DWOCUs.begin()->second->getContext();
16251625
}
16261626

1627-
bool BinaryContext::isValidDwarfUnit(DWARFUnit &DU) const {
1628-
// Invalid DWARF unit with a DWOId but lacking a dwo_name.
1629-
if (DU.getDWOId() && !DU.isDWOUnit() &&
1630-
!DU.getUnitDIE().find(
1631-
{dwarf::DW_AT_dwo_name, dwarf::DW_AT_GNU_dwo_name})) {
1632-
this->outs() << "BOLT-ERROR: broken DWARF found in CU at offset 0x"
1633-
<< Twine::utohexstr(DU.getOffset()) << " (DWOId=0x"
1634-
<< Twine::utohexstr(*(DU.getDWOId()))
1635-
<< ", missing DW_AT_dwo_name / DW_AT_GNU_dwo_name)\n";
1636-
return false;
1637-
}
1638-
return true;
1639-
}
1640-
16411627
/// Handles DWO sections that can either be in .o, .dwo or .dwp files.
16421628
void BinaryContext::preprocessDWODebugInfo() {
16431629
for (const std::unique_ptr<DWARFUnit> &CU : DwCtx->compile_units()) {
16441630
DWARFUnit *const DwarfUnit = CU.get();
1645-
if (!isValidDwarfUnit(*DwarfUnit))
1646-
continue;
16471631
if (std::optional<uint64_t> DWOId = DwarfUnit->getDWOId()) {
16481632
std::string DWOName = dwarf::toString(
16491633
DwarfUnit->getUnitDIE().find(

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,7 @@ DWARFDie DIEBuilder::resolveDIEReference(
584584
if ((RefCU =
585585
getUnitForOffset(*this, *DwarfContext, TmpRefOffset, AttrSpec))) {
586586
/// Trying to add to current working set in case it's cross CU reference.
587-
if (!registerUnit(*RefCU, true))
588-
return DWARFDie();
587+
registerUnit(*RefCU, true);
589588
DWARFDataExtractor DebugInfoData = RefCU->getDebugInfoExtractor();
590589
if (DwarfDebugInfoEntry.extractFast(*RefCU, &TmpRefOffset, DebugInfoData,
591590
RefCU->getNextUnitOffset(), 0)) {
@@ -1009,14 +1008,12 @@ static uint64_t getHash(const DWARFUnit &DU) {
10091008
return DU.getOffset();
10101009
}
10111010

1012-
bool DIEBuilder::registerUnit(DWARFUnit &DU, bool NeedSort) {
1013-
if (!BC.isValidDwarfUnit(DU))
1014-
return false;
1011+
void DIEBuilder::registerUnit(DWARFUnit &DU, bool NeedSort) {
10151012
auto IterGlobal = AllProcessed.insert(getHash(DU));
10161013
// If DU is already in a current working set or was already processed we can
10171014
// skip it.
10181015
if (!IterGlobal.second)
1019-
return true;
1016+
return;
10201017
if (getState().Type == ProcessingType::DWARF4TUs) {
10211018
getState().DWARF4TUVector.push_back(&DU);
10221019
} else if (getState().Type == ProcessingType::DWARF5TUs) {
@@ -1037,7 +1034,6 @@ bool DIEBuilder::registerUnit(DWARFUnit &DU, bool NeedSort) {
10371034
if (getState().DUList.size() == getState().CloneUnitCtxMap.size())
10381035
getState().CloneUnitCtxMap.emplace_back();
10391036
getState().DUList.push_back(&DU);
1040-
return true;
10411037
}
10421038

10431039
std::optional<uint32_t> DIEBuilder::getUnitId(const DWARFUnit &DU) {

0 commit comments

Comments
 (0)