mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Just iterate the DwarfCompileUnits rather than trying to filter them out of the list of all units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bf29eb3ad1
commit
a49cbece54
@ -541,60 +541,57 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||
|
||||
// Handle anything that needs to be done on a per-unit basis after
|
||||
// all other generation.
|
||||
for (const auto &TheU : getUnits()) {
|
||||
for (const auto &P : CUMap) {
|
||||
auto &TheCU = *P.second;
|
||||
// Emit DW_AT_containing_type attribute to connect types with their
|
||||
// vtable holding type.
|
||||
TheU->constructContainingTypeDIEs();
|
||||
TheCU.constructContainingTypeDIEs();
|
||||
|
||||
// Add CU specific attributes if we need to add any.
|
||||
if (TheU->getUnitDie().getTag() == dwarf::DW_TAG_compile_unit) {
|
||||
// If we're splitting the dwarf out now that we've got the entire
|
||||
// CU then add the dwo id to it.
|
||||
DwarfCompileUnit *SkCU = TheU->getSkeleton();
|
||||
if (useSplitDwarf()) {
|
||||
// Emit a unique identifier for this CU.
|
||||
uint64_t ID = DIEHash(Asm).computeCUSignature(TheU->getUnitDie());
|
||||
TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
// If we're splitting the dwarf out now that we've got the entire
|
||||
// CU then add the dwo id to it.
|
||||
auto *SkCU = TheCU.getSkeleton();
|
||||
if (useSplitDwarf()) {
|
||||
// Emit a unique identifier for this CU.
|
||||
uint64_t ID = DIEHash(Asm).computeCUSignature(TheCU.getUnitDie());
|
||||
TheCU.addUInt(TheCU.getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||
dwarf::DW_FORM_data8, ID);
|
||||
|
||||
// We don't keep track of which addresses are used in which CU so this
|
||||
// is a bit pessimistic under LTO.
|
||||
if (!AddrPool.isEmpty())
|
||||
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
|
||||
DwarfAddrSectionSym, DwarfAddrSectionSym);
|
||||
if (!TheU->getRangeLists().empty())
|
||||
SkCU->addSectionLabel(
|
||||
SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
|
||||
DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
|
||||
}
|
||||
// We don't keep track of which addresses are used in which CU so this
|
||||
// is a bit pessimistic under LTO.
|
||||
if (!AddrPool.isEmpty())
|
||||
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
|
||||
DwarfAddrSectionSym, DwarfAddrSectionSym);
|
||||
if (!TheCU.getRangeLists().empty())
|
||||
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
|
||||
DwarfDebugRangeSectionSym,
|
||||
DwarfDebugRangeSectionSym);
|
||||
}
|
||||
|
||||
// If we have code split among multiple sections or non-contiguous
|
||||
// ranges of code then emit a DW_AT_ranges attribute on the unit that will
|
||||
// remain in the .o file, otherwise add a DW_AT_low_pc.
|
||||
// FIXME: We should use ranges allow reordering of code ala
|
||||
// .subsections_via_symbols in mach-o. This would mean turning on
|
||||
// ranges for all subprogram DIEs for mach-o.
|
||||
DwarfCompileUnit &U =
|
||||
SkCU ? *SkCU : static_cast<DwarfCompileUnit &>(*TheU);
|
||||
unsigned NumRanges = TheU->getRanges().size();
|
||||
if (NumRanges) {
|
||||
if (NumRanges > 1) {
|
||||
U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||
Asm->GetTempSymbol("cu_ranges", U.getUniqueID()),
|
||||
DwarfDebugRangeSectionSym);
|
||||
// If we have code split among multiple sections or non-contiguous
|
||||
// ranges of code then emit a DW_AT_ranges attribute on the unit that will
|
||||
// remain in the .o file, otherwise add a DW_AT_low_pc.
|
||||
// FIXME: We should use ranges allow reordering of code ala
|
||||
// .subsections_via_symbols in mach-o. This would mean turning on
|
||||
// ranges for all subprogram DIEs for mach-o.
|
||||
DwarfCompileUnit &U = SkCU ? *SkCU : *TheCU;
|
||||
unsigned NumRanges = TheCU.getRanges().size();
|
||||
if (NumRanges) {
|
||||
if (NumRanges > 1) {
|
||||
U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||
Asm->GetTempSymbol("cu_ranges", U.getUniqueID()),
|
||||
DwarfDebugRangeSectionSym);
|
||||
|
||||
// A DW_AT_low_pc attribute may also be specified in combination with
|
||||
// DW_AT_ranges to specify the default base address for use in
|
||||
// location lists (see Section 2.6.2) and range lists (see Section
|
||||
// 2.17.3).
|
||||
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
||||
0);
|
||||
} else {
|
||||
RangeSpan &Range = TheU->getRanges().back();
|
||||
U.attachLowHighPC(U.getUnitDie(), Range.getStart(), Range.getEnd());
|
||||
}
|
||||
// A DW_AT_low_pc attribute may also be specified in combination with
|
||||
// DW_AT_ranges to specify the default base address for use in
|
||||
// location lists (see Section 2.6.2) and range lists (see Section
|
||||
// 2.17.3).
|
||||
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 0);
|
||||
} else {
|
||||
RangeSpan &Range = TheCU.getRanges().back();
|
||||
U.attachLowHighPC(U.getUnitDie(), Range.getStart(), Range.getEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user