Skip to content

Commit 5a9460a

Browse files
committed
add test
1 parent 8851f2e commit 5a9460a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,11 +1727,12 @@ void BinaryContext::preprocessDebugInfo() {
17271727
StringRef GlobalPrefix = AsmInfo->getPrivateGlobalPrefix();
17281728
for (const std::unique_ptr<DWARFUnit> &CU : DwCtx->compile_units()) {
17291729
const uint64_t CUID = CU->getOffset();
1730+
std::optional<uint64_t> DWOID = CU->getDWOId();
17301731
DwarfLineTable &BinaryLineTable = getDwarfLineTable(CUID);
17311732
BinaryLineTable.setLabel(Ctx->getOrCreateSymbol(
17321733
GlobalPrefix + "line_table_start" + Twine(CUID)));
17331734

1734-
if (!ProcessedCUs.count(CU.get()))
1735+
if (!ProcessedCUs.count(CU.get()) || (DWOID && *DWOID == 0))
17351736
continue;
17361737

17371738
const DWARFDebugLine::LineTable *LineTable =
@@ -1746,7 +1747,7 @@ void BinaryContext::preprocessDebugInfo() {
17461747
Checksum = LineTable->Prologue.FileNames[0].Checksum;
17471748
std::optional<const char *> Name =
17481749
dwarf::toString(CU->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
1749-
if (std::optional<uint64_t> DWOID = CU->getDWOId()) {
1750+
if (DWOID) {
17501751
auto Iter = DWOCUs.find(*DWOID);
17511752
if (Iter == DWOCUs.end()) {
17521753
this->errs() << "BOLT-ERROR: DWO CU was not found for " << Name

bolt/test/X86/dwarf5-dwoid-zero.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# RUN: rm -rf %t && mkdir -p %t
22
# RUN: %clang -O3 -g -gdwarf-5 -gsplit-dwarf -Wl,-q %p/Inputs/thinlto-split-dwarf-inlining.s -o %t/main.exe
3-
# RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -update-debug-sections -comp-dir-override="./" 2>&1 | FileCheck %s
3+
# RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -update-debug-sections -comp-dir-override="%t" 2>&1 | FileCheck %s
44

55
# CHECK-NOT: Assertion `RangeListsWritersByCU.count(*DWOId) == 0 && "RangeLists writer for DWO unit already exists."'
66
# CHECK: BOLT-WARNING: Found DWO file of ID 0:
7-

0 commit comments

Comments
 (0)