mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-14 15:28:20 +00:00
DebugInfo: Include the section and start-of-section label in the unit
This is a precursor to moving type units into the correct (debug_types) section with comdat groups and full type unit headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196615 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -818,6 +818,15 @@ CompileUnit *DwarfDebug::constructCompileUnit(DICompileUnit DIUnit) {
|
|||||||
if (!FirstCU)
|
if (!FirstCU)
|
||||||
FirstCU = NewCU;
|
FirstCU = NewCU;
|
||||||
|
|
||||||
|
NewCU->initSection(
|
||||||
|
useSplitDwarf() ? Asm->getObjFileLowering().getDwarfInfoDWOSection()
|
||||||
|
: Asm->getObjFileLowering().getDwarfInfoSection(),
|
||||||
|
// FIXME: This is subtle (using the info section even when
|
||||||
|
// this CU is in the dwo section) and necessary for the
|
||||||
|
// current arange code - ideally it should iterate
|
||||||
|
// skeleton units, not full units, if it's going to reference skeletons
|
||||||
|
DwarfInfoSectionSym);
|
||||||
|
|
||||||
CUMap.insert(std::make_pair(DIUnit, NewCU));
|
CUMap.insert(std::make_pair(DIUnit, NewCU));
|
||||||
CUDieMap.insert(std::make_pair(Die, NewCU));
|
CUDieMap.insert(std::make_pair(Die, NewCU));
|
||||||
return NewCU;
|
return NewCU;
|
||||||
@@ -2064,11 +2073,11 @@ void DwarfDebug::emitDIE(DIE *Die) {
|
|||||||
assert(CU && "CUDie should belong to a CU.");
|
assert(CU && "CUDie should belong to a CU.");
|
||||||
Addr += CU->getDebugInfoOffset();
|
Addr += CU->getDebugInfoOffset();
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||||
Asm->EmitLabelPlusOffset(DwarfInfoSectionSym, Addr,
|
Asm->EmitLabelPlusOffset(CU->getSectionSym(), Addr,
|
||||||
DIEEntry::getRefAddrSize(Asm));
|
DIEEntry::getRefAddrSize(Asm));
|
||||||
else
|
else
|
||||||
Asm->EmitLabelOffsetDifference(DwarfInfoSectionSym, Addr,
|
Asm->EmitLabelOffsetDifference(CU->getSectionSym(), Addr,
|
||||||
DwarfInfoSectionSym,
|
CU->getSectionSym(),
|
||||||
DIEEntry::getRefAddrSize(Asm));
|
DIEEntry::getRefAddrSize(Asm));
|
||||||
} else {
|
} else {
|
||||||
// Make sure Origin belong to the same CU.
|
// Make sure Origin belong to the same CU.
|
||||||
@@ -2118,14 +2127,14 @@ void DwarfDebug::emitDIE(DIE *Die) {
|
|||||||
|
|
||||||
// Emit the various dwarf units to the unit section USection with
|
// Emit the various dwarf units to the unit section USection with
|
||||||
// the abbreviations going into ASection.
|
// the abbreviations going into ASection.
|
||||||
void DwarfFile::emitUnits(DwarfDebug *DD, const MCSection *USection,
|
void DwarfFile::emitUnits(DwarfDebug *DD, const MCSection *ASection,
|
||||||
const MCSection *ASection,
|
|
||||||
const MCSymbol *ASectionSym) {
|
const MCSymbol *ASectionSym) {
|
||||||
Asm->OutStreamer.SwitchSection(USection);
|
|
||||||
for (SmallVectorImpl<Unit *>::iterator I = CUs.begin(), E = CUs.end(); I != E;
|
for (SmallVectorImpl<Unit *>::iterator I = CUs.begin(), E = CUs.end(); I != E;
|
||||||
++I) {
|
++I) {
|
||||||
Unit *TheU = *I;
|
Unit *TheU = *I;
|
||||||
DIE *Die = TheU->getUnitDie();
|
DIE *Die = TheU->getUnitDie();
|
||||||
|
const MCSection *USection = TheU->getSection();
|
||||||
|
Asm->OutStreamer.SwitchSection(USection);
|
||||||
|
|
||||||
// Emit the compile units header.
|
// Emit the compile units header.
|
||||||
Asm->OutStreamer.EmitLabel(
|
Asm->OutStreamer.EmitLabel(
|
||||||
@@ -2147,8 +2156,7 @@ void DwarfFile::emitUnits(DwarfDebug *DD, const MCSection *USection,
|
|||||||
void DwarfDebug::emitDebugInfo() {
|
void DwarfDebug::emitDebugInfo() {
|
||||||
DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
|
DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
|
||||||
|
|
||||||
Holder.emitUnits(this, Asm->getObjFileLowering().getDwarfInfoSection(),
|
Holder.emitUnits(this, Asm->getObjFileLowering().getDwarfAbbrevSection(),
|
||||||
Asm->getObjFileLowering().getDwarfAbbrevSection(),
|
|
||||||
DwarfAbbrevSectionSym);
|
DwarfAbbrevSectionSym);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2437,7 +2445,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
|||||||
|
|
||||||
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
|
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
|
||||||
Asm->EmitSectionOffset(Asm->GetTempSymbol(ISec->getLabelBeginName(), ID),
|
Asm->EmitSectionOffset(Asm->GetTempSymbol(ISec->getLabelBeginName(), ID),
|
||||||
DwarfInfoSectionSym);
|
TheU->getSectionSym());
|
||||||
|
|
||||||
Asm->OutStreamer.AddComment("Compilation Unit Length");
|
Asm->OutStreamer.AddComment("Compilation Unit Length");
|
||||||
Asm->EmitLabelDifference(Asm->GetTempSymbol(ISec->getLabelEndName(), ID),
|
Asm->EmitLabelDifference(Asm->GetTempSymbol(ISec->getLabelEndName(), ID),
|
||||||
@@ -2506,7 +2514,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
|||||||
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
|
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
|
||||||
Asm->EmitSectionOffset(
|
Asm->EmitSectionOffset(
|
||||||
Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()),
|
Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()),
|
||||||
DwarfInfoSectionSym);
|
TheU->getSectionSym());
|
||||||
|
|
||||||
Asm->OutStreamer.AddComment("Compilation Unit Length");
|
Asm->OutStreamer.AddComment("Compilation Unit Length");
|
||||||
Asm->EmitLabelDifference(
|
Asm->EmitLabelDifference(
|
||||||
@@ -2860,7 +2868,7 @@ void DwarfDebug::emitDebugARanges() {
|
|||||||
Asm->OutStreamer.AddComment("Offset Into Debug Info Section");
|
Asm->OutStreamer.AddComment("Offset Into Debug Info Section");
|
||||||
Asm->EmitSectionOffset(
|
Asm->EmitSectionOffset(
|
||||||
Asm->GetTempSymbol(ISec->getLabelBeginName(), CU->getUniqueID()),
|
Asm->GetTempSymbol(ISec->getLabelBeginName(), CU->getUniqueID()),
|
||||||
DwarfInfoSectionSym);
|
CU->getSectionSym());
|
||||||
Asm->OutStreamer.AddComment("Address Size (in bytes)");
|
Asm->OutStreamer.AddComment("Address Size (in bytes)");
|
||||||
Asm->EmitInt8(PtrSize);
|
Asm->EmitInt8(PtrSize);
|
||||||
Asm->OutStreamer.AddComment("Segment Size (in bytes)");
|
Asm->OutStreamer.AddComment("Segment Size (in bytes)");
|
||||||
@@ -3001,6 +3009,8 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
|
|||||||
Asm->GetTempSymbol("gnu_ranges", NewCU->getUniqueID()),
|
Asm->GetTempSymbol("gnu_ranges", NewCU->getUniqueID()),
|
||||||
DwarfDebugRangeSectionSym);
|
DwarfDebugRangeSectionSym);
|
||||||
|
|
||||||
|
NewCU->initSection(Asm->getObjFileLowering().getDwarfInfoSection(),
|
||||||
|
DwarfInfoSectionSym);
|
||||||
SkeletonHolder.addUnit(NewCU);
|
SkeletonHolder.addUnit(NewCU);
|
||||||
|
|
||||||
return NewCU;
|
return NewCU;
|
||||||
@@ -3010,7 +3020,7 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const CompileUnit *CU) {
|
|||||||
// compile units that would normally be in debug_info.
|
// compile units that would normally be in debug_info.
|
||||||
void DwarfDebug::emitDebugInfoDWO() {
|
void DwarfDebug::emitDebugInfoDWO() {
|
||||||
assert(useSplitDwarf() && "No split dwarf debug info?");
|
assert(useSplitDwarf() && "No split dwarf debug info?");
|
||||||
InfoHolder.emitUnits(this, Asm->getObjFileLowering().getDwarfInfoDWOSection(),
|
InfoHolder.emitUnits(this,
|
||||||
Asm->getObjFileLowering().getDwarfAbbrevDWOSection(),
|
Asm->getObjFileLowering().getDwarfAbbrevDWOSection(),
|
||||||
DwarfAbbrevDWOSectionSym);
|
DwarfAbbrevDWOSectionSym);
|
||||||
}
|
}
|
||||||
@@ -3079,6 +3089,15 @@ void DwarfDebug::addTypeUnitType(uint16_t Language, DIE *RefDie,
|
|||||||
// Remove the References vector and add the type hash.
|
// Remove the References vector and add the type hash.
|
||||||
I->second.first = Signature;
|
I->second.first = Signature;
|
||||||
I->second.second = NULL;
|
I->second.second = NULL;
|
||||||
|
|
||||||
|
NewTU->initSection(
|
||||||
|
useSplitDwarf() ? Asm->getObjFileLowering().getDwarfInfoDWOSection()
|
||||||
|
: Asm->getObjFileLowering().getDwarfInfoSection(),
|
||||||
|
// FIXME: This is subtle (using the info section even when
|
||||||
|
// this CU is in the dwo section) and necessary for the
|
||||||
|
// current arange code - ideally it should iterate
|
||||||
|
// skeleton units, not full units, if it's going to reference skeletons
|
||||||
|
useSplitDwarf() ? NULL : DwarfInfoSectionSym);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate all the signatures.
|
// Populate all the signatures.
|
||||||
|
@@ -274,8 +274,8 @@ public:
|
|||||||
|
|
||||||
/// \brief Emit all of the units to the section listed with the given
|
/// \brief Emit all of the units to the section listed with the given
|
||||||
/// abbreviation section.
|
/// abbreviation section.
|
||||||
void emitUnits(DwarfDebug *DD, const MCSection *USection,
|
void emitUnits(DwarfDebug *DD, const MCSection *ASection,
|
||||||
const MCSection *ASection, const MCSymbol *ASectionSym);
|
const MCSymbol *ASectionSym);
|
||||||
|
|
||||||
/// \brief Emit a set of abbreviations to the specific section.
|
/// \brief Emit a set of abbreviations to the specific section.
|
||||||
void emitAbbrevs(const MCSection *);
|
void emitAbbrevs(const MCSection *);
|
||||||
|
@@ -41,7 +41,7 @@ static cl::opt<bool> GenerateTypeUnits("generate-type-units", cl::Hidden,
|
|||||||
Unit::Unit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,
|
Unit::Unit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,
|
||||||
DwarfDebug *DW, DwarfFile *DWU)
|
DwarfDebug *DW, DwarfFile *DWU)
|
||||||
: UniqueID(UID), Node(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), DD(DW),
|
: UniqueID(UID), Node(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), DD(DW),
|
||||||
DU(DWU), IndexTyDie(0) {
|
DU(DWU), IndexTyDie(0), Section(0) {
|
||||||
DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);
|
DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -127,12 +127,36 @@ protected:
|
|||||||
// DIEIntegerOne - A preallocated DIEValue because 1 is used frequently.
|
// DIEIntegerOne - A preallocated DIEValue because 1 is used frequently.
|
||||||
DIEInteger *DIEIntegerOne;
|
DIEInteger *DIEIntegerOne;
|
||||||
|
|
||||||
|
/// The section this unit will be emitted in.
|
||||||
|
const MCSection *Section;
|
||||||
|
|
||||||
|
/// A label at the start of the non-dwo section related to this unit.
|
||||||
|
MCSymbol *SectionSym;
|
||||||
|
|
||||||
Unit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A, DwarfDebug *DW,
|
Unit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A, DwarfDebug *DW,
|
||||||
DwarfFile *DWU);
|
DwarfFile *DWU);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Unit();
|
virtual ~Unit();
|
||||||
|
|
||||||
|
/// Pass in the SectionSym even though we could recreate it in every compile
|
||||||
|
/// unit (type units will have actually distinct symbols once they're in
|
||||||
|
/// comdat sections).
|
||||||
|
void initSection(const MCSection *Section, MCSymbol *SectionSym) {
|
||||||
|
assert(!this->Section);
|
||||||
|
this->Section = Section;
|
||||||
|
this->SectionSym = SectionSym;
|
||||||
|
}
|
||||||
|
const MCSection *getSection() const {
|
||||||
|
assert(Section);
|
||||||
|
return Section;
|
||||||
|
}
|
||||||
|
|
||||||
|
MCSymbol *getSectionSym() {
|
||||||
|
assert(Section);
|
||||||
|
return SectionSym;
|
||||||
|
}
|
||||||
|
|
||||||
// Accessors.
|
// Accessors.
|
||||||
unsigned getUniqueID() const { return UniqueID; }
|
unsigned getUniqueID() const { return UniqueID; }
|
||||||
virtual uint16_t getLanguage() const = 0;
|
virtual uint16_t getLanguage() const = 0;
|
||||||
|
Reference in New Issue
Block a user