DwarfDebug: Avoid emitting an empty debug_aranges section when aranges are disabled
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 25 Feb 2014 22:46:44 +0000 (22:46 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 25 Feb 2014 22:46:44 +0000 (22:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202201 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/X86/fission-cu.ll

index b18e8d49ac0bc8706fd5c15a3555130b7de67ec8..ff5a8213deb0c3b884f4ff8af8b9c5d923c04b87 100644 (file)
@@ -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");
index 43d36266c8b03759ae717461683a5d96d36ab3df..af179a7a9f985f2e6139bda6624443a357028a05 100644 (file)
@@ -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
 
 ; OBJ-NEXT: R_X86_64_32 .debug_str
 ; OBJ-NEXT: }
 
+; HDR-NOT: .debug_aranges
+
 !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}