forked from OSchip/llvm-project
"Clean up" line section symbol emission by emitting the section
syms before constructing the compile units so we're not emitting section references to sections not there already. llvm-svn: 174663
This commit is contained in:
parent
1455674741
commit
7480433dd9
|
@ -165,7 +165,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
|
||||||
|
|
||||||
DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
|
DwarfInfoSectionSym = DwarfAbbrevSectionSym = 0;
|
||||||
DwarfStrSectionSym = TextSectionSym = 0;
|
DwarfStrSectionSym = TextSectionSym = 0;
|
||||||
DwarfDebugRangeSectionSym = DwarfDebugLocSectionSym = 0;
|
DwarfDebugRangeSectionSym = DwarfDebugLocSectionSym = DwarfLineSectionSym = 0;
|
||||||
DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = 0;
|
DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = 0;
|
||||||
FunctionBeginSym = FunctionEndSym = 0;
|
FunctionBeginSym = FunctionEndSym = 0;
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
|
||||||
NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
|
NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
|
||||||
else
|
else
|
||||||
NewCU->addDelta(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
|
NewCU->addDelta(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
|
||||||
LineTableStartSym, Asm->GetTempSymbol("section_line"));
|
LineTableStartSym, DwarfLineSectionSym);
|
||||||
|
|
||||||
if (!CompilationDir.empty())
|
if (!CompilationDir.empty())
|
||||||
NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
||||||
|
@ -782,6 +782,9 @@ bool DwarfDebug::collectLegacyDebugInfo(const Module *M) {
|
||||||
}
|
}
|
||||||
if (!HasDebugInfo) return false;
|
if (!HasDebugInfo) return false;
|
||||||
|
|
||||||
|
// Emit initial sections so we can refer to them later.
|
||||||
|
emitSectionLabels();
|
||||||
|
|
||||||
// Create all the compile unit DIEs.
|
// Create all the compile unit DIEs.
|
||||||
for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(),
|
for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(),
|
||||||
E = DbgFinder.compile_unit_end(); I != E; ++I)
|
E = DbgFinder.compile_unit_end(); I != E; ++I)
|
||||||
|
@ -819,6 +822,9 @@ void DwarfDebug::beginModule() {
|
||||||
// module using debug info finder to collect debug info.
|
// module using debug info finder to collect debug info.
|
||||||
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
||||||
if (CU_Nodes) {
|
if (CU_Nodes) {
|
||||||
|
// Emit initial sections so we can reference labels later.
|
||||||
|
emitSectionLabels();
|
||||||
|
|
||||||
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
||||||
DICompileUnit CUNode(CU_Nodes->getOperand(i));
|
DICompileUnit CUNode(CU_Nodes->getOperand(i));
|
||||||
CompileUnit *CU = constructCompileUnit(CUNode);
|
CompileUnit *CU = constructCompileUnit(CUNode);
|
||||||
|
@ -951,9 +957,6 @@ void DwarfDebug::endModule() {
|
||||||
// Finalize the debug info for the module.
|
// Finalize the debug info for the module.
|
||||||
finalizeModuleInfo();
|
finalizeModuleInfo();
|
||||||
|
|
||||||
// Emit initial sections.
|
|
||||||
emitSectionLabels();
|
|
||||||
|
|
||||||
if (!useSplitDwarf()) {
|
if (!useSplitDwarf()) {
|
||||||
// Emit all the DIEs into a debug info section.
|
// Emit all the DIEs into a debug info section.
|
||||||
emitDebugInfo();
|
emitDebugInfo();
|
||||||
|
@ -1775,7 +1778,8 @@ void DwarfDebug::emitSectionLabels() {
|
||||||
if (const MCSection *MacroInfo = TLOF.getDwarfMacroInfoSection())
|
if (const MCSection *MacroInfo = TLOF.getDwarfMacroInfoSection())
|
||||||
emitSectionSym(Asm, MacroInfo);
|
emitSectionSym(Asm, MacroInfo);
|
||||||
|
|
||||||
emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
|
DwarfLineSectionSym =
|
||||||
|
emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
|
||||||
emitSectionSym(Asm, TLOF.getDwarfLocSection());
|
emitSectionSym(Asm, TLOF.getDwarfLocSection());
|
||||||
emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
|
emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
|
||||||
DwarfStrSectionSym =
|
DwarfStrSectionSym =
|
||||||
|
@ -2489,7 +2493,7 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
|
||||||
// compile unit in debug_line section.
|
// compile unit in debug_line section.
|
||||||
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
|
||||||
NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_sec_offset,
|
NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_sec_offset,
|
||||||
Asm->GetTempSymbol("section_line"));
|
DwarfLineSectionSym);
|
||||||
else
|
else
|
||||||
NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_sec_offset, 0);
|
NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_sec_offset, 0);
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,7 @@ class DwarfDebug {
|
||||||
// section offsets and are created by EmitSectionLabels.
|
// section offsets and are created by EmitSectionLabels.
|
||||||
MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
|
MCSymbol *DwarfInfoSectionSym, *DwarfAbbrevSectionSym;
|
||||||
MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
|
MCSymbol *DwarfStrSectionSym, *TextSectionSym, *DwarfDebugRangeSectionSym;
|
||||||
MCSymbol *DwarfDebugLocSectionSym;
|
MCSymbol *DwarfDebugLocSectionSym, *DwarfLineSectionSym;
|
||||||
MCSymbol *FunctionBeginSym, *FunctionEndSym;
|
MCSymbol *FunctionBeginSym, *FunctionEndSym;
|
||||||
MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
|
MCSymbol *DwarfAbbrevDWOSectionSym, *DwarfStrDWOSectionSym;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue