Revert r198199 (and r198202). It broke 3 DebugInfo tests for targeting i686-cygming.

r198196: Use a pointer to keep track of the skeleton unit for each normal unit and construct it up front.
  r198199: Reapply r198196 with a fix to zero initialize the skeleton pointer.
  r198202: Fix aranges and split dwarf by ensuring that the symbol and relocation back to the compile unit from the aranges section is to the skeleton unit and not the one in the dwo.

They could be reproducible with explicit target.

  llvm/lib/MC/WinCOFFObjectWriter.cpp:224: bool {anonymous}::COFFSymbol::should_keep() const: Assertion `Section->Number != -1 && "Sections with relocations must be real!"' failed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi
2013-12-30 09:26:10 +00:00
parent e18e76e424
commit b2299f0c80
7 changed files with 40 additions and 90 deletions

View File

@ -773,6 +773,12 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
DIUnit.getLanguage());
NewCU->addString(Die, dwarf::DW_AT_name, FN);
// 2.17.1 requires that we use DW_AT_low_pc for a single entry point
// into an entity. We're using 0 (or a NULL label) for this. For
// split dwarf it's in the skeleton CU so omit it here.
if (!useSplitDwarf())
NewCU->addLabelAddress(Die, dwarf::DW_AT_low_pc, NULL);
// Define start line table label for each Compile Unit.
MCSymbol *LineTableStartSym =
Asm->GetTempSymbol("line_table_start", NewCU->getUniqueID());
@ -825,11 +831,11 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
NewCU->initSection(
useSplitDwarf() ? Asm->getObjFileLowering().getDwarfInfoDWOSection()
: Asm->getObjFileLowering().getDwarfInfoSection(),
useSplitDwarf() ? DwarfInfoDWOSectionSym : DwarfInfoSectionSym);
// If we're splitting the dwarf then construct the skeleton CU now.
if (useSplitDwarf())
NewCU->setSkeleton(constructSkeletonCU(NewCU));
// 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));
CUDieMap.insert(std::make_pair(Die, NewCU));
@ -1076,9 +1082,7 @@ void DwarfDebug::finalizeModuleInfo() {
// 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 =
static_cast<DwarfCompileUnit *>(TheU->getSkeleton());
// CU then construct a skeleton CU based upon it.
if (useSplitDwarf()) {
// This should be a unique identifier when we want to build .dwp files.
uint64_t ID = 0;
@ -1088,22 +1092,19 @@ void DwarfDebug::finalizeModuleInfo() {
}
TheU->addUInt(TheU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID);
// Now construct the skeleton CU associated.
DwarfCompileUnit *SkCU =
constructSkeletonCU(static_cast<DwarfCompileUnit *>(TheU));
SkCU->addUInt(SkCU->getUnitDie(), dwarf::DW_AT_GNU_dwo_id,
dwarf::DW_FORM_data8, ID);
} else {
// Attribute if we've emitted a range list for the compile unit, this
// will get constructed for the skeleton CU separately if we have one.
if (DwarfCURanges && TheU->getRanges().size())
addSectionLabel(Asm, TheU, TheU->getUnitDie(), dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", TheU->getUniqueID()),
DwarfDebugRangeSectionSym);
}
// If we've requested ranges and have them emit a DW_AT_ranges attribute
// on the unit that will remain in the .o file, otherwise add a DW_AT_low_pc.
// FIXME: Also add a high pc if we can.
// FIXME: We should use ranges if we have multiple compile units.
DwarfCompileUnit *U = SkCU ? SkCU : static_cast<DwarfCompileUnit *>(TheU);
if (DwarfCURanges && TheU->getRanges().size())
addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
DwarfDebugRangeSectionSym);
else
U->addLocalLabelAddress(U->getUnitDie(), dwarf::DW_AT_low_pc,
TextSectionSym);
}
}
@ -2006,9 +2007,6 @@ void DwarfDebug::emitSectionLabels() {
// Dwarf sections base addresses.
DwarfInfoSectionSym =
emitSectionSym(Asm, TLOF.getDwarfInfoSection(), "section_info");
if (useSplitDwarf())
DwarfInfoDWOSectionSym =
emitSectionSym(Asm, TLOF.getDwarfInfoDWOSection(), "section_info_dwo");
DwarfAbbrevSectionSym =
emitSectionSym(Asm, TLOF.getDwarfAbbrevSection(), "section_abbrev");
if (useSplitDwarf())
@ -2874,7 +2872,7 @@ void DwarfDebug::emitDebugARanges() {
Asm->OutStreamer.AddComment("DWARF Arange version number");
Asm->EmitInt16(dwarf::DW_ARANGES_VERSION);
Asm->OutStreamer.AddComment("Offset Into Debug Info Section");
Asm->EmitSectionOffset(CU->getLocalLabelBegin(), CU->getLocalSectionSym());
Asm->EmitSectionOffset(CU->getLabelBegin(), CU->getSectionSym());
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(PtrSize);
Asm->OutStreamer.AddComment("Segment Size (in bytes)");
@ -2999,6 +2997,15 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
else
NewCU->addSectionOffset(Die, dwarf::DW_AT_GNU_addr_base, 0);
// Attribute if we've emitted a range list for the compile unit, this
// will get constructed for the skeleton CU separately if we have one.
if (DwarfCURanges && CU->getRanges().size())
addSectionLabel(Asm, NewCU, Die, dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", CU->getUniqueID()),
DwarfDebugRangeSectionSym);
else
NewCU->addUInt(Die, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr, 0);
// DW_AT_stmt_list is a offset of line number information for this
// compile unit in debug_line section.
// FIXME: Should handle multiple compile units.