summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-03-24 21:07:27 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-03-24 21:07:27 +0000
commit26b2bd04fd7a4fbd80e1791c07722467d66329ba (patch)
tree347b372979174ec27dd19e4682c6defb3b398421
parent3c9a3cc495c3eed7b60dc9cac6d816524a0cf47d (diff)
downloadbcm5719-llvm-26b2bd04fd7a4fbd80e1791c07722467d66329ba.tar.gz
bcm5719-llvm-26b2bd04fd7a4fbd80e1791c07722467d66329ba.zip
DebugInfo: Implement relative addressing for DW_AT_ranges under fission
This removes the debug_ranges relocations from debug_info.dwo (but doesn't implement the DW_AT_GNU_ranges_base which is also necessary for correct functioning) llvm-svn: 204668
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp11
-rw-r--r--llvm/test/DebugInfo/X86/fission-ranges.ll13
2 files changed, 19 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index eb769fe7ae3..a368f03f753 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -456,8 +456,15 @@ void DwarfDebug::addScopeRangeList(DwarfCompileUnit *TheCU, DIE *ScopeDIE,
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
// emitting it appropriately.
MCSymbol *RangeSym = Asm->GetTempSymbol("debug_ranges", GlobalRangeCount++);
- addSectionLabel(Asm, TheCU, ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
- DwarfDebugRangeSectionSym);
+
+ // Under fission, ranges are specified by constant offsets relative to the
+ // CU's DW_AT_GNU_ranges_base.
+ if (useSplitDwarf())
+ TheCU->addSectionDelta(ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
+ DwarfDebugRangeSectionSym);
+ else
+ addSectionLabel(Asm, TheCU, ScopeDIE, dwarf::DW_AT_ranges, RangeSym,
+ DwarfDebugRangeSectionSym);
RangeSpanList List(RangeSym);
for (const InsnRange &R : Range) {
diff --git a/llvm/test/DebugInfo/X86/fission-ranges.ll b/llvm/test/DebugInfo/X86/fission-ranges.ll
index 6a2bb487a75..b95038bacc1 100644
--- a/llvm/test/DebugInfo/X86/fission-ranges.ll
+++ b/llvm/test/DebugInfo/X86/fission-ranges.ll
@@ -1,5 +1,14 @@
; 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 %s
+; RUN: llvm-dwarfdump -debug-dump=info.dwo %t | FileCheck %s
+; RUN: llvm-objdump -r %t | FileCheck --check-prefix=RELA %s
+
+; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x000000a0)
+
+; Make sure we don't produce any relocations in any .dwo section (though in particular, debug_info.dwo)
+; FIXME: There should be no relocations in .dwo sections at all, but for now there are debug_loc relocs here.
+; RELA: RELOCATION RECORDS FOR [.rela.debug_info.dwo]
+; RELA-NOT: R_X86_64_32 .debug_ranges
+; RELA: RELOCATION RECORDS FOR
; From the code:
@@ -29,8 +38,6 @@
; clang -g -S -gsplit-dwarf -O1 small.c
-; CHECK: DW_AT_ranges
-
@c = external global i32
; Function Attrs: nounwind uwtable
OpenPOWER on IntegriCloud