mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
DwarfDebug: Reduce code duplication for sec offset emission
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -724,6 +724,28 @@ unsigned DwarfDebug::getOrCreateSourceID(StringRef FileName, StringRef DirName,
|
|||||||
return SrcId;
|
return SrcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void addSectionLabel(AsmPrinter *Asm, Unit *U, DIE *D,
|
||||||
|
dwarf::Attribute A, const MCSymbol *L,
|
||||||
|
const MCSymbol *Sec) {
|
||||||
|
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||||
|
U->addSectionLabel(D, A, L);
|
||||||
|
else
|
||||||
|
U->addSectionDelta(D, A, L, Sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DwarfDebug::addGnuPubAttributes(Unit *U, DIE *D) const {
|
||||||
|
if (!GenerateGnuPubSections)
|
||||||
|
return;
|
||||||
|
|
||||||
|
addSectionLabel(Asm, U, D, dwarf::DW_AT_GNU_pubnames,
|
||||||
|
Asm->GetTempSymbol("gnu_pubnames", U->getUniqueID()),
|
||||||
|
DwarfGnuPubNamesSectionSym);
|
||||||
|
|
||||||
|
addSectionLabel(Asm, U, D, dwarf::DW_AT_GNU_pubtypes,
|
||||||
|
Asm->GetTempSymbol("gnu_pubtypes", U->getUniqueID()),
|
||||||
|
DwarfGnuPubTypesSectionSym);
|
||||||
|
}
|
||||||
|
|
||||||
// Create new CompileUnit for the given metadata node with tag
|
// Create new CompileUnit for the given metadata node with tag
|
||||||
// DW_TAG_compile_unit.
|
// DW_TAG_compile_unit.
|
||||||
CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) {
|
CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) {
|
||||||
@@ -783,29 +805,7 @@ CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) {
|
|||||||
if (!CompilationDir.empty())
|
if (!CompilationDir.empty())
|
||||||
NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
||||||
|
|
||||||
// Flags to let the linker know we have emitted new style pubnames. Only
|
addGnuPubAttributes(NewCU, Die);
|
||||||
// emit it here if we don't have a skeleton CU for split dwarf.
|
|
||||||
if (GenerateGnuPubSections) {
|
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
|
||||||
NewCU->addSectionLabel(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubnames,
|
|
||||||
Asm->GetTempSymbol("gnu_pubnames", NewCU->getUniqueID()));
|
|
||||||
else
|
|
||||||
NewCU->addSectionDelta(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubnames,
|
|
||||||
Asm->GetTempSymbol("gnu_pubnames", NewCU->getUniqueID()),
|
|
||||||
DwarfGnuPubNamesSectionSym);
|
|
||||||
|
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
|
||||||
NewCU->addSectionLabel(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubtypes,
|
|
||||||
Asm->GetTempSymbol("gnu_pubtypes", NewCU->getUniqueID()));
|
|
||||||
else
|
|
||||||
NewCU->addSectionDelta(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubtypes,
|
|
||||||
Asm->GetTempSymbol("gnu_pubtypes", NewCU->getUniqueID()),
|
|
||||||
DwarfGnuPubTypesSectionSym);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DIUnit.isOptimized())
|
if (DIUnit.isOptimized())
|
||||||
@@ -3018,41 +3018,13 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
|
|||||||
if (!CompilationDir.empty())
|
if (!CompilationDir.empty())
|
||||||
NewCU->addLocalString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
NewCU->addLocalString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
||||||
|
|
||||||
// Flags to let the linker know we have emitted new style pubnames.
|
addGnuPubAttributes(NewCU, Die);
|
||||||
if (GenerateGnuPubSections) {
|
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
|
||||||
NewCU->addSectionLabel(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubnames,
|
|
||||||
Asm->GetTempSymbol("gnu_pubnames", NewCU->getUniqueID()));
|
|
||||||
else
|
|
||||||
NewCU->addSectionDelta(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubnames,
|
|
||||||
Asm->GetTempSymbol("gnu_pubnames", NewCU->getUniqueID()),
|
|
||||||
DwarfGnuPubNamesSectionSym);
|
|
||||||
|
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
|
||||||
NewCU->addSectionLabel(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubtypes,
|
|
||||||
Asm->GetTempSymbol("gnu_pubtypes", NewCU->getUniqueID()));
|
|
||||||
else
|
|
||||||
NewCU->addSectionDelta(
|
|
||||||
Die, dwarf::DW_AT_GNU_pubtypes,
|
|
||||||
Asm->GetTempSymbol("gnu_pubtypes", NewCU->getUniqueID()),
|
|
||||||
DwarfGnuPubTypesSectionSym);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attribute if we've emitted any ranges and their location for the compile unit.
|
// Attribute if we've emitted any ranges and their location for the compile unit.
|
||||||
if (!CU->getRangeLists().empty()) {
|
if (!CU->getRangeLists().empty())
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
addSectionLabel(Asm, NewCU, Die, dwarf::DW_AT_GNU_ranges_base,
|
||||||
NewCU->addSectionLabel(
|
Asm->GetTempSymbol("gnu_ranges", NewCU->getUniqueID()),
|
||||||
Die, dwarf::DW_AT_GNU_ranges_base,
|
DwarfDebugRangeSectionSym);
|
||||||
Asm->GetTempSymbol("gnu_ranges", NewCU->getUniqueID()));
|
|
||||||
else
|
|
||||||
NewCU->addSectionDelta(
|
|
||||||
Die, dwarf::DW_AT_GNU_ranges_base,
|
|
||||||
Asm->GetTempSymbol("gnu_ranges", NewCU->getUniqueID()),
|
|
||||||
DwarfDebugRangeSectionSym);
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonHolder.addUnit(NewCU);
|
SkeletonHolder.addUnit(NewCU);
|
||||||
|
|
||||||
|
@@ -627,6 +627,10 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
/// \brief Emit the debug str dwo section.
|
/// \brief Emit the debug str dwo section.
|
||||||
void emitDebugStrDWO();
|
void emitDebugStrDWO();
|
||||||
|
|
||||||
|
/// Flags to let the linker know we have emitted new style pubnames. Only
|
||||||
|
/// emit it here if we don't have a skeleton CU for split dwarf.
|
||||||
|
void addGnuPubAttributes(Unit *U, DIE *D) const;
|
||||||
|
|
||||||
/// \brief Create new CompileUnit for the given metadata node with tag
|
/// \brief Create new CompileUnit for the given metadata node with tag
|
||||||
/// DW_TAG_compile_unit.
|
/// DW_TAG_compile_unit.
|
||||||
CompileUnit *constructCompileUnit(DICompileUnit DIUnit);
|
CompileUnit *constructCompileUnit(DICompileUnit DIUnit);
|
||||||
|
Reference in New Issue
Block a user