Skip to content

Commit 1e0116c

Browse files
committed
[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. llvm-svn: 326395
1 parent cb9611c commit 1e0116c

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,8 @@ void DwarfDebug::emitDebugAbbrevDWO() {
21052105

21062106
void DwarfDebug::emitDebugLineDWO() {
21072107
assert(useSplitDwarf() && "No split dwarf?");
2108+
if (!HasSplitTypeUnits)
2109+
return;
21082110
Asm->OutStreamer->SwitchSection(
21092111
Asm->getObjFileLowering().getDwarfLineDWOSection());
21102112
SplitTypeUnitFileTable.Emit(*Asm->OutStreamer, MCDwarfLineTableParams());
@@ -2220,6 +2222,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
22202222
InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
22212223
InfoHolder.emitUnit(TU.first.get(), useSplitDwarf());
22222224
}
2225+
HasSplitTypeUnits = useSplitDwarf();
22232226
}
22242227
CU.addDIETypeSignature(RefDie, Signature);
22252228
}

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ class DwarfDebug : public DebugHandlerBase {
274274
/// a monolithic sequence of string offsets.
275275
bool UseSegmentedStringOffsetsTable;
276276

277+
/// Whether we have emitted any type units with split DWARF (and therefore
278+
/// need to emit a line table to the .dwo file).
279+
bool HasSplitTypeUnits = false;
280+
277281
/// Separated Dwarf Variables
278282
/// In general these will all be for bits that are left in the
279283
/// original object file, rather than things that are meant

llvm/test/DebugInfo/Generic/empty.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
; CHECK: contents:
1717

1818
; Don't emit DW_AT_addr_base when there are no addresses.
19+
; Also don't emit a split line table when there are no type units.
1920
; FISSION-NOT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]
21+
; FISSION-NOT: .debug_line.dwo contents:
2022

2123
!llvm.dbg.cu = !{!0}
2224
!llvm.module.flags = !{!5}

0 commit comments

Comments
 (0)