summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp46
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp17
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h14
3 files changed, 26 insertions, 51 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index f1ae89e93ae..a30e8bbd954 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -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());
@@ -831,10 +837,6 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
// skeleton units, not full units, if it's going to reference skeletons
DwarfInfoSectionSym);
- // If we're splitting the dwarf then construct the skeleton CU now.
- if (useSplitDwarf())
- NewCU->setSkeleton(constructSkeletonCU(NewCU));
-
CUMap.insert(std::make_pair(DIUnit, NewCU));
CUDieMap.insert(std::make_pair(Die, NewCU));
return NewCU;
@@ -1080,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;
@@ -1092,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);
}
}
@@ -3000,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.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 7e46d3c97d1..693e37ffe8d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -293,23 +293,6 @@ void DwarfCompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute Attribute,
}
}
-/// addLocalLabelAddress - Add a dwarf label attribute data and value using
-/// DW_FORM_addr.
-void DwarfCompileUnit::addLocalLabelAddress(DIE *Die,
- dwarf::Attribute Attribute,
- MCSymbol *Label) {
- if (Label)
- DD->addArangeLabel(SymbolCU(this, Label));
-
- if (Label != NULL) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
- Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
- } else {
- DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
- Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
- }
-}
-
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 49c9b0cedc3..7d7b351b9b0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -146,21 +146,12 @@ protected:
/// The label for the start of the range sets for the elements of this unit.
MCSymbol *LabelRange;
- /// Skeleton unit associated with this unit.
- DwarfUnit *Skeleton;
-
DwarfUnit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
public:
virtual ~DwarfUnit();
- /// Set the skeleton unit associated with this unit.
- void setSkeleton(DwarfUnit *Skel) { Skeleton = Skel; }
-
- /// Get the skeleton unit associated with this unit.
- DwarfUnit *getSkeleton() const { return Skeleton; }
-
/// 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).
@@ -530,11 +521,6 @@ public:
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
- /// addLocalLabelAddress - Add a dwarf label attribute data and value using
- /// DW_FORM_addr.
- void addLocalLabelAddress(DIE *Die, dwarf::Attribute Attribute,
- MCSymbol *Label);
-
uint16_t getLanguage() const LLVM_OVERRIDE { return getNode().getLanguage(); }
};
OpenPOWER on IntegriCloud