[llvm] r204668 - DebugInfo: Implement relative addressing for DW_AT_ranges under fission

David Blaikie dblaikie at gmail.com
Mon Mar 24 14:07:27 PDT 2014


Author: dblaikie
Date: Mon Mar 24 16:07:27 2014
New Revision: 204668

URL: http://llvm.org/viewvc/llvm-project?rev=204668&view=rev
Log:
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)

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/X86/fission-ranges.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=204668&r1=204667&r2=204668&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Mar 24 16:07:27 2014
@@ -456,8 +456,15 @@ void DwarfDebug::addScopeRangeList(Dwarf
   // 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) {

Modified: llvm/trunk/test/DebugInfo/X86/fission-ranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-ranges.ll?rev=204668&r1=204667&r2=204668&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fission-ranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/fission-ranges.ll Mon Mar 24 16:07:27 2014
@@ -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





More information about the llvm-commits mailing list