From 22f8dcb2b501aaa5442f947f508540ec1cabe175 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sun, 7 Sep 2014 17:31:42 +0000 Subject: [PATCH] DebugInfo: Do not use DW_FORM_GNU_addr_index in skeleton CUs, GDB 7.8 errors on this. It's probably not a huge deal to not do this - if we could, maybe the address could be reused by a subprogram low_pc and avoid an extra relocation, but it's just one per CU at best. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217338 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 2 +- test/DebugInfo/X86/cu-ranges.ll | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index a67eb762e84..c995e8bd244 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -288,7 +288,7 @@ void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute, void DwarfCompileUnit::addLabelAddress(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label) { - if (!DD->useSplitDwarf()) + if (!DD->useSplitDwarf() || !Skeleton) return addLocalLabelAddress(Die, Attribute, Label); if (Label) diff --git a/test/DebugInfo/X86/cu-ranges.ll b/test/DebugInfo/X86/cu-ranges.ll index 405a498155f..2ff4eb108ae 100644 --- a/test/DebugInfo/X86/cu-ranges.ll +++ b/test/DebugInfo/X86/cu-ranges.ll @@ -1,9 +1,9 @@ ; RUN: llc -split-dwarf=Enable -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t -; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s +; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s ; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s ; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t -; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s +; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s ; From: ; int foo (int a) { @@ -21,6 +21,8 @@ ; Without function sections enabled make sure that we have no DW_AT_ranges attribute. ; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges +; NO-FUNCTION-SECTIONS: DW_AT_low_pc DW_FORM_addr +; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges ; Function Attrs: nounwind uwtable define i32 @foo(i32 %a) #0 {