mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +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:
@ -541,20 +541,20 @@ void DwarfDebug::finalizeModuleInfo() {
|
|||||||
|
|
||||||
// Handle anything that needs to be done on a per-unit basis after
|
// Handle anything that needs to be done on a per-unit basis after
|
||||||
// all other generation.
|
// 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
|
// Emit DW_AT_containing_type attribute to connect types with their
|
||||||
// vtable holding type.
|
// vtable holding type.
|
||||||
TheU->constructContainingTypeDIEs();
|
TheCU.constructContainingTypeDIEs();
|
||||||
|
|
||||||
// Add CU specific attributes if we need to add any.
|
// 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
|
// If we're splitting the dwarf out now that we've got the entire
|
||||||
// CU then add the dwo id to it.
|
// CU then add the dwo id to it.
|
||||||
DwarfCompileUnit *SkCU = TheU->getSkeleton();
|
auto *SkCU = TheCU.getSkeleton();
|
||||||
if (useSplitDwarf()) {
|
if (useSplitDwarf()) {
|
||||||
// Emit a unique identifier for this CU.
|
// Emit a unique identifier for this CU.
|
||||||
uint64_t ID = DIEHash(Asm).computeCUSignature(TheU->getUnitDie());
|
uint64_t ID = DIEHash(Asm).computeCUSignature(TheCU.getUnitDie());
|
||||||
TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
TheCU.addUInt(TheCU.getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||||
dwarf::DW_FORM_data8, ID);
|
dwarf::DW_FORM_data8, ID);
|
||||||
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
|
||||||
dwarf::DW_FORM_data8, ID);
|
dwarf::DW_FORM_data8, ID);
|
||||||
@ -564,10 +564,10 @@ void DwarfDebug::finalizeModuleInfo() {
|
|||||||
if (!AddrPool.isEmpty())
|
if (!AddrPool.isEmpty())
|
||||||
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
|
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_addr_base,
|
||||||
DwarfAddrSectionSym, DwarfAddrSectionSym);
|
DwarfAddrSectionSym, DwarfAddrSectionSym);
|
||||||
if (!TheU->getRangeLists().empty())
|
if (!TheCU.getRangeLists().empty())
|
||||||
SkCU->addSectionLabel(
|
SkCU->addSectionLabel(SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
|
||||||
SkCU->getUnitDie(), dwarf::DW_AT_GNU_ranges_base,
|
DwarfDebugRangeSectionSym,
|
||||||
DwarfDebugRangeSectionSym, DwarfDebugRangeSectionSym);
|
DwarfDebugRangeSectionSym);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have code split among multiple sections or non-contiguous
|
// If we have code split among multiple sections or non-contiguous
|
||||||
@ -576,9 +576,8 @@ void DwarfDebug::finalizeModuleInfo() {
|
|||||||
// FIXME: We should use ranges allow reordering of code ala
|
// FIXME: We should use ranges allow reordering of code ala
|
||||||
// .subsections_via_symbols in mach-o. This would mean turning on
|
// .subsections_via_symbols in mach-o. This would mean turning on
|
||||||
// ranges for all subprogram DIEs for mach-o.
|
// ranges for all subprogram DIEs for mach-o.
|
||||||
DwarfCompileUnit &U =
|
DwarfCompileUnit &U = SkCU ? *SkCU : *TheCU;
|
||||||
SkCU ? *SkCU : static_cast<DwarfCompileUnit &>(*TheU);
|
unsigned NumRanges = TheCU.getRanges().size();
|
||||||
unsigned NumRanges = TheU->getRanges().size();
|
|
||||||
if (NumRanges) {
|
if (NumRanges) {
|
||||||
if (NumRanges > 1) {
|
if (NumRanges > 1) {
|
||||||
U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_ranges,
|
U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_ranges,
|
||||||
@ -589,15 +588,13 @@ void DwarfDebug::finalizeModuleInfo() {
|
|||||||
// DW_AT_ranges to specify the default base address for use in
|
// DW_AT_ranges to specify the default base address for use in
|
||||||
// location lists (see Section 2.6.2) and range lists (see Section
|
// location lists (see Section 2.6.2) and range lists (see Section
|
||||||
// 2.17.3).
|
// 2.17.3).
|
||||||
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
U.addUInt(U.getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 0);
|
||||||
0);
|
|
||||||
} else {
|
} else {
|
||||||
RangeSpan &Range = TheU->getRanges().back();
|
RangeSpan &Range = TheCU.getRanges().back();
|
||||||
U.attachLowHighPC(U.getUnitDie(), Range.getStart(), Range.getEnd());
|
U.attachLowHighPC(U.getUnitDie(), Range.getStart(), Range.getEnd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Compute DIE offsets and sizes.
|
// Compute DIE offsets and sizes.
|
||||||
InfoHolder.computeSizeAndOffsets();
|
InfoHolder.computeSizeAndOffsets();
|
||||||
|
Reference in New Issue
Block a user