[llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 16:12:35 PST 2018


Author: probinson
Date: Wed Feb 28 16:12:35 2018
New Revision: 326395

URL: http://llvm.org/viewvc/llvm-project?rev=326395&view=rev
Log:
[DWARF] Emit a split line table only if there are split type units.

A .debug_info.dwo section doesn't use the .debug_line.dwo section.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/test/DebugInfo/Generic/empty.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=326395&r1=326394&r2=326395&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 28 16:12:35 2018
@@ -2105,6 +2105,8 @@ void DwarfDebug::emitDebugAbbrevDWO() {
 
 void DwarfDebug::emitDebugLineDWO() {
   assert(useSplitDwarf() && "No split dwarf?");
+  if (!HasSplitTypeUnits)
+    return;
   Asm->OutStreamer->SwitchSection(
       Asm->getObjFileLowering().getDwarfLineDWOSection());
   SplitTypeUnitFileTable.Emit(*Asm->OutStreamer, MCDwarfLineTableParams());
@@ -2220,6 +2222,7 @@ void DwarfDebug::addDwarfTypeUnitType(Dw
       InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
       InfoHolder.emitUnit(TU.first.get(), useSplitDwarf());
     }
+    HasSplitTypeUnits = useSplitDwarf();
   }
   CU.addDIETypeSignature(RefDie, Signature);
 }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=326395&r1=326394&r2=326395&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 28 16:12:35 2018
@@ -274,6 +274,10 @@ class DwarfDebug : public DebugHandlerBa
   /// a monolithic sequence of string offsets.
   bool UseSegmentedStringOffsetsTable;
 
+  /// Whether we have emitted any type units with split DWARF (and therefore
+  /// need to emit a line table to the .dwo file).
+  bool HasSplitTypeUnits = false;
+
   /// Separated Dwarf Variables
   /// In general these will all be for bits that are left in the
   /// original object file, rather than things that are meant

Modified: llvm/trunk/test/DebugInfo/Generic/empty.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/empty.ll?rev=326395&r1=326394&r2=326395&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/empty.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/empty.ll Wed Feb 28 16:12:35 2018
@@ -16,7 +16,9 @@
 ; CHECK: contents:
 
 ; Don't emit DW_AT_addr_base when there are no addresses.
+; Also don't emit a split line table when there are no type units.
 ; FISSION-NOT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]
+; FISSION-NOT: .debug_line.dwo contents:
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!5}




More information about the llvm-commits mailing list