summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-02-12 00:00:38 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-02-12 00:00:38 +0000
commit104dcb348f3b6b00fb4b3c932e32bc2a0386adc7 (patch)
tree88d9f4f7c5a62d74e3b586d4d612b9595aa33fb5 /llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
parent6a3862e3c29e6981d2c39ec563ac1a52be3309c6 (diff)
downloadbcm5719-llvm-104dcb348f3b6b00fb4b3c932e32bc2a0386adc7.tar.gz
bcm5719-llvm-104dcb348f3b6b00fb4b3c932e32bc2a0386adc7.zip
DebugInfo: Split DWARF + gmlt + no-split-dwarf-inlining shouldn't emit anything to the .dwo file
This configuration (due to r349207) was intended not to emit any DWO CU, but a degenerate CU was still being emitted - containing a header and a DW_TAG_compile_unit with no attributes. Under that situation, emit nothing to the .dwo file. (since this is a dynamic property of the input the .dwo file is still emitted, just with nothing in it (so a valid, but empty, ELF file) - if some other CU didn't satisfy this criteria, its DWO CU would still go there, etc) llvm-svn: 353771
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
index 56a99b5365b..e3c9095d134 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
@@ -43,6 +43,11 @@ void DwarfFile::emitUnit(DwarfUnit *TheU, bool UseOffsets) {
if (!S)
return;
+ // Skip CUs that ended up not being needed (split CUs that were abandoned
+ // because they added no information beyond the non-split CU)
+ if (llvm::empty(TheU->getUnitDie().values()))
+ return;
+
Asm->OutStreamer->SwitchSection(S);
TheU->emitHeader(UseOffsets);
Asm->emitDwarfDIE(TheU->getUnitDie());
@@ -62,6 +67,11 @@ void DwarfFile::computeSizeAndOffsets() {
if (TheU->getCUNode()->isDebugDirectivesOnly())
continue;
+ // Skip CUs that ended up not being needed (split CUs that were abandoned
+ // because they added no information beyond the non-split CU)
+ if (llvm::empty(TheU->getUnitDie().values()))
+ return;
+
TheU->setDebugSectionOffset(SecOffset);
SecOffset += computeSizeAndOffsetsForUnit(TheU.get());
}
OpenPOWER on IntegriCloud