summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp23
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp4
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp5
4 files changed, 30 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 247cd04eac7..c606efac5b1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2976,6 +2976,22 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
return NewCU;
}
+// This DIE has the following attributes: DW_AT_comp_dir, DW_AT_dwo_name,
+// DW_AT_addr_base.
+DwarfTypeUnit *DwarfDebug::constructSkeletonTU(const DwarfTypeUnit *TU) {
+
+ DIE *Die = new DIE(dwarf::DW_TAG_type_unit);
+ DwarfTypeUnit *NewTU = new DwarfTypeUnit(
+ TU->getUniqueID(), Die, TU->getCUNode(), Asm, this, &SkeletonHolder);
+ NewTU->setTypeSignature(TU->getTypeSignature());
+ NewTU->setType(NULL);
+ NewTU->initSection(
+ Asm->getObjFileLowering().getDwarfTypesSection(TU->getTypeSignature()));
+
+ initSkeletonUnit(TU, Die, NewTU);
+ return NewTU;
+}
+
// Emit the .debug_info.dwo section for separated dwarf. This contains the
// compile units that would normally be in debug_info.
void DwarfDebug::emitDebugInfoDWO() {
@@ -3018,8 +3034,6 @@ void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode,
NewTU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
CUNode.getLanguage());
- DIE *Die = NewTU->createTypeDIE(CTy);
-
MD5 Hash;
Hash.update(Identifier);
// ... take the least significant 8 bytes and return those. Our MD5
@@ -3029,7 +3043,10 @@ void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode,
Hash.final(Result);
uint64_t Signature = *reinterpret_cast<support::ulittle64_t *>(Result + 8);
NewTU->setTypeSignature(Signature);
- NewTU->setType(Die);
+ if (useSplitDwarf())
+ NewTU->setSkeleton(constructSkeletonTU(NewTU));
+
+ NewTU->setType(NewTU->createTypeDIE(CTy));
NewTU->initSection(
useSplitDwarf()
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 0c00c1be36a..5a211060554 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -596,6 +596,10 @@ class DwarfDebug : public AsmPrinterHandler {
/// section.
DwarfCompileUnit *constructSkeletonCU(const DwarfCompileUnit *CU);
+ /// \brief Construct the split debug info compile unit for the debug info
+ /// section.
+ DwarfTypeUnit *constructSkeletonTU(const DwarfTypeUnit *TU);
+
/// \brief Emit the debug info dwo section.
void emitDebugInfoDWO();
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index b066c95fe9b..7cf66954e48 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1987,7 +1987,9 @@ void DwarfTypeUnit::emitHeader(const MCSection *ASection,
Asm->OutStreamer.AddComment("Type Signature");
Asm->OutStreamer.EmitIntValue(TypeSignature, sizeof(TypeSignature));
Asm->OutStreamer.AddComment("Type DIE Offset");
- Asm->OutStreamer.EmitIntValue(Ty->getOffset(), sizeof(Ty->getOffset()));
+ // In a skeleton type unit there is no type DIE so emit a zero offset.
+ Asm->OutStreamer.EmitIntValue(Ty ? Ty->getOffset() : 0,
+ sizeof(Ty->getOffset()));
}
void DwarfTypeUnit::initSection(const MCSection *Section) {
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 5d7a5f88632..4cc872ec0e7 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -726,8 +726,9 @@ const MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
const MCSection *
MCObjectFileInfo::getDwarfTypesDWOSection(uint64_t Hash) const {
- return Ctx->getELFSection(".debug_types.dwo", ELF::SHT_GROUP, 0,
- SectionKind::getMetadata(), 0, utostr(Hash));
+ return Ctx->getELFSection(".debug_types.dwo", ELF::SHT_PROGBITS,
+ ELF::SHF_GROUP, SectionKind::getMetadata(), 0,
+ utostr(Hash));
}
void MCObjectFileInfo::InitEHFrameSection() {
OpenPOWER on IntegriCloud