diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp index d6cfbdb37e5..1107e020696 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp @@ -356,6 +356,8 @@ void AppleAccelTableEmitter::emit() const { void Dwarf5AccelTableEmitter::Header::emit( const Dwarf5AccelTableEmitter &Ctx) const { + assert(CompUnitCount > 0 && "Index must have at least one CU."); + AsmPrinter *Asm = Ctx.Asm; Asm->OutStreamer->AddComment("Header: unit length"); Asm->EmitLabelDifference(Ctx.ContributionEnd, Ctx.ContributionStart, diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5cd59b4da9e..177a094b68b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1468,6 +1468,10 @@ void DwarfDebug::emitAccel(AccelTableT &Accel, MCSection *Section, } void DwarfDebug::emitAccelDebugNames() { + // Don't emit anything if we have no compilation units to index. + if (getUnits().empty()) + return; + Asm->OutStreamer->SwitchSection( Asm->getObjFileLowering().getDwarfDebugNamesSection()); emitDWARF5AccelTable(Asm, AccelDebugNames, *this, getUnits()); |