llvm.org GIT mirror llvm / 717979b
Merging r182344: ------------------------------------------------------------------------ r182344 | mren | 2013-05-20 17:57:22 -0700 (Mon, 20 May 2013) | 7 lines Dwarf: use a single line table to generate assembly when .loc is used. This is to fix PR15408 where an undefined symbol Lline_table_start1 is used. Since we do not generate the debug_line section when .loc is used, Lline_table_start1 is not emitted and we can't refer to it when calculating at_stmt_list for a compile unit. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182346 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 20 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
707707 Asm->OutStreamer.getContext().setMCLineTableSymbol(LineTableStartSym,
708708 NewCU->getUniqueID());
709709
710 // Use a single line table if we are using .loc and generating assembly.
711 bool UseTheFirstCU =
712 (Asm->TM.hasMCUseLoc() &&
713 Asm->OutStreamer.getKind() == MCStreamer::SK_AsmStreamer) ||
714 (NewCU->getUniqueID() == 0);
715
710716 // DW_AT_stmt_list is a offset of line number information for this
711717 // compile unit in debug_line section. For split dwarf this is
712718 // left in the skeleton CU and so not included.
715721 if (!useSplitDwarf()) {
716722 if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
717723 NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
718 NewCU->getUniqueID() == 0 ?
724 UseTheFirstCU ?
719725 Asm->GetTempSymbol("section_line") : LineTableStartSym);
720 else if (NewCU->getUniqueID() == 0)
726 else if (UseTheFirstCU)
721727 NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
722728 else
723729 NewCU->addDelta(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
14401446 LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
14411447 CompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
14421448 assert(TheCU && "Unable to find compile unit!");
1443 Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
1449 if (Asm->TM.hasMCUseLoc() &&
1450 Asm->OutStreamer.getKind() == MCStreamer::SK_AsmStreamer)
1451 // Use a single line table if we are using .loc and generating assembly.
1452 Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
1453 else
1454 Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
14441455
14451456 FunctionBeginSym = Asm->GetTempSymbol("func_begin",
14461457 Asm->getFunctionNumber());
0 ; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
11 ; RUN: llvm-dwarfdump %t | FileCheck %s
2 ; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM
23
34 ; rdar://13067005
45 ; CHECK: .debug_info contents:
1920 ; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
2021 ; CHECK-NOT: file_names
2122
23 ; PR15408
24 ; ASM: L__DWARF__debug_info_begin0:
25 ; ASM: .long 0 ## DW_AT_stmt_list
26 ; ASM: L__DWARF__debug_info_begin1:
27 ; ASM: .long 0 ## DW_AT_stmt_list
2228 define i32 @test(i32 %a) nounwind uwtable ssp {
2329 entry:
2430 %a.addr = alloca i32, align 4