From 164f6a50be90172f79f34fb5a7f90b9667066f9a Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 25 Feb 2014 22:46:44 +0000 Subject: [PATCH] DwarfDebug: Avoid emitting an empty debug_aranges section when aranges are disabled llvm-svn: 202201 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 3 ++- test/DebugInfo/X86/fission-cu.ll | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b18e8d49ac0..ff5a8213deb 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1941,7 +1941,8 @@ void DwarfDebug::emitSectionLabels() { if (useSplitDwarf()) DwarfAbbrevDWOSectionSym = emitSectionSym( Asm, TLOF.getDwarfAbbrevDWOSection(), "section_abbrev_dwo"); - emitSectionSym(Asm, TLOF.getDwarfARangesSection()); + if (GenerateARangeSection) + emitSectionSym(Asm, TLOF.getDwarfARangesSection()); DwarfLineSectionSym = emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line"); diff --git a/test/DebugInfo/X86/fission-cu.ll b/test/DebugInfo/X86/fission-cu.ll index 43d36266c8b..af179a7a9f9 100644 --- a/test/DebugInfo/X86/fission-cu.ll +++ b/test/DebugInfo/X86/fission-cu.ll @@ -1,6 +1,7 @@ ; RUN: llc -split-dwarf=Enable -generate-cu-hash -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t ; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s ; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s +; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s @a = common global i32 0, align 4 @@ -111,4 +112,6 @@ ; OBJ-NEXT: R_X86_64_32 .debug_str ; OBJ-NEXT: } +; HDR-NOT: .debug_aranges + !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}