Dwarf: do not use line_table_start in at_stmt_list since we do not always emit
authorManman Ren <mren@apple.com>
Sat, 9 Feb 2013 00:41:44 +0000 (00:41 +0000)
committerManman Ren <mren@apple.com>
Sat, 9 Feb 2013 00:41:44 +0000 (00:41 +0000)
line table entries in assembly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174785 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/X86/stmt-list.ll

index 5d19a8d765e3751a84907afec1e8aed3b0e06be3..6d3759d19a7792349853f37ab8cba12cdf1f9597 100644 (file)
@@ -670,9 +670,12 @@ CompileUnit *DwarfDebug::constructCompileUnit(const MDNode *N) {
 
   // DW_AT_stmt_list is a offset of line number information for this
   // compile unit in debug_line section.
+  // The line table entries are not always emitted in assembly, so it
+  // is not okay to use line_table_start here.
   if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
     NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
-                    LineTableStartSym);
+                    NewCU->getUniqueID() == 0 ?
+                    Asm->GetTempSymbol("section_line") : LineTableStartSym);
   else if (NewCU->getUniqueID() == 0)
     NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
   else
index 8213c1b2af19f654991b59f8d952e7b2cf4353be..145649bf4592bdcaf86745c22aad7af9f534b23a 100644 (file)
@@ -3,7 +3,7 @@
 ; CHECK:      .section        .debug_line,"",@progbits
 ; CHECK-NEXT: .Lsection_line:
 
-; CHECK:      .long .Lline_table_start0 # DW_AT_stmt_list
+; CHECK:      .long   .Lsection_line          # DW_AT_stmt_list
 
 define void @f() {
 entry: