[llvm] [LLVM][DWARF] Add support for monolithic types in .debug_names (PR #70515)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 16:40:08 PST 2023
================
@@ -562,36 +595,58 @@ void llvm::emitDWARF5AccelTable(
default:
continue;
}
- CUIndex[CU.index()] = Count++;
+ CUIndex[CU.index()] = CUCount++;
assert(CU.index() == CU.value()->getUniqueID());
const DwarfCompileUnit *MainCU =
DD.useSplitDwarf() ? CU.value()->getSkeleton() : CU.value().get();
CompUnits.push_back(MainCU->getLabelBegin());
}
+ for (const auto &TU : TUSymbols) {
+ TUIndex[TU.UniqueID] = TUCount++;
+ TypeUnits.push_back(TU.Label);
+ }
+
if (CompUnits.empty())
return;
Asm->OutStreamer->switchSection(
Asm->getObjFileLowering().getDwarfDebugNamesSection());
Contents.finalize(Asm, "names");
+ dwarf::Form CUIndexForm =
+ DIEInteger::BestForm(/*IsSigned*/ false, CompUnits.size() - 1);
+ dwarf::Form TUIndexForm =
+ DIEInteger::BestForm(/*IsSigned*/ false, TypeUnits.size() - 1);
Dwarf5AccelTableWriter<DWARF5AccelTableData>(
- Asm, Contents, CompUnits,
- [&](const DWARF5AccelTableData &Entry) {
- return CUIndex[Entry.getUnitID()];
+ Asm, Contents, CompUnits, TypeUnits,
+ [&](const DWARF5AccelTableData &Entry)
+ -> DWARF5AccelTableEntryReturnType {
+ if (Entry.isTU())
+ return {{TUIndex[Entry.getUnitID()],
+ {dwarf::DW_IDX_type_unit, TUIndexForm}}};
+ if (CUIndex.size() > 1)
----------------
ayermolo wrote:
For cases where there is only one CU there is no DW_IDX_compile_unit. This is basically the default for non-lto builds since each compilation unit only has one CU.
>From DWARF5 spec page 142:
"6.1.1.3 Per-CU versus Per-Module Indexes
13 In a per-CU index, the CU list may have only a single entry, and index entries may omit
14 the CU attribute."
https://github.com/llvm/llvm-project/pull/70515
More information about the llvm-commits
mailing list