From 9acebfdd94408d5477eb673b8a82887de5e5f1f0 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 14 Feb 2014 19:51:35 +0000 Subject: DebugInfo: Don't include the name of the CU file in the line table file list when it's unneeded Recommitting r201380 (reverted in r201389) Recommitting r201351 and r201355 (reverted in r201351 and r201355) We weren't emitting the an empty (header only) line table when the line table was empty - this made the DWARF invalid (the compile unit would point to the zero-size debug_lines section where there should've been an empty line table but there was nothing at all). Fix that, and as a consequence this works around/addresses PR18809. Also, we emit a non-empty line table to workaround a darwin linker bug, so XFAILing on darwin too. Also, mark the test as 'REQUIRES: object-emission' because it does. llvm-svn: 201429 --- llvm/lib/MC/MCObjectStreamer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/MC/MCObjectStreamer.cpp') diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index f00231e3d31..bfa3c8cfa34 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -379,7 +379,8 @@ void MCObjectStreamer::EmitZeros(uint64_t NumBytes) { void MCObjectStreamer::FinishImpl() { // Dump out the dwarf file & directory tables and line tables. const MCSymbol *LineSectionSymbol = NULL; - if (getContext().hasDwarfFiles()) + if (!getContext().getMCLineTableSymbols().empty() || + getContext().hasDwarfFiles()) LineSectionSymbol = MCDwarfFileTable::Emit(this); // If we are generating dwarf for assembly source files dump out the sections. -- cgit v1.2.3