Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.69 -> 1.70 X86AsmPrinter.cpp updated: 1.207 -> 1.208 X86AsmPrinter.h updated: 1.33 -> 1.34 X86ISelLowering.cpp updated: 1.282 -> 1.283 X86InstrInfo.td updated: 1.292 -> 1.293 X86TargetAsmInfo.cpp updated: 1.5 -> 1.6 --- Log message: Add debug support for X86/ELF targets (Linux). This allows llvm-gcc4 generated object modules to be debugged with gdb. Hopefully this helps pre-release debugging. --- Diffs of the changes: (+39 -9) X86ATTAsmPrinter.cpp | 6 +++--- X86AsmPrinter.cpp | 8 +++++++- X86AsmPrinter.h | 2 +- X86ISelLowering.cpp | 2 +- X86InstrInfo.td | 6 +++--- X86TargetAsmInfo.cpp | 24 ++++++++++++++++++++++++ 6 files changed, 39 insertions(+), 9 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.69 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.70 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.69 Wed Oct 18 04:12:29 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Oct 30 16:32:30 2006 @@ -52,7 +52,7 @@ /// method to print assembly for each instruction. /// bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - if (Subtarget->isTargetDarwin()) { + if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { // Let PassManager know we need debug information and relay // the MachineDebugInfo address on to DwarfWriter. DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>()); @@ -111,7 +111,7 @@ F->getLinkage() == Function::WeakLinkage)) O << "_llvm$workaround$fake$stub_" << CurrentFnName << ":\n"; - if (Subtarget->isTargetDarwin()) { + if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { // Emit pre-function debug information. DW.BeginFunction(&MF); } @@ -141,7 +141,7 @@ if (TAI->hasDotTypeDotSizeDirective()) O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; - if (Subtarget->isTargetDarwin()) { + if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { // Emit post-function debug information. DW.EndFunction(); } Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.207 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.208 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.207 Sat Oct 28 00:56:06 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Oct 30 16:32:30 2006 @@ -116,6 +116,9 @@ // Emit initial debug information. DW.BeginModule(&M); + } else if (Subtarget->isTargetELF()) { + // Emit initial debug information. + DW.BeginModule(&M); } return AsmPrinter::doInitialization(M); @@ -278,7 +281,7 @@ O << "\t.long\t0\n"; } - // Emit initial debug information. + // Emit final debug information. DW.EndModule(); // Funny Darwin hack: This flag tells the linker that no global symbols @@ -287,6 +290,9 @@ // linker can safely perform dead code stripping. Since LLVM never // generates code that does this, it is always safe to set. O << "\t.subsections_via_symbols\n"; + } else if (Subtarget->isTargetELF()) { + // Emit final debug information. + DW.EndModule(); } AsmPrinter::doFinalization(M); Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.33 llvm/lib/Target/X86/X86AsmPrinter.h:1.34 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.33 Mon Sep 25 22:57:53 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Mon Oct 30 16:32:30 2006 @@ -67,7 +67,7 @@ void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); - if (Subtarget->isTargetDarwin()) { + if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { AU.addRequired<MachineDebugInfo>(); } MachineFunctionPass::getAnalysisUsage(AU); Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.282 llvm/lib/Target/X86/X86ISelLowering.cpp:1.283 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.282 Mon Oct 30 02:02:39 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Oct 30 16:32:30 2006 @@ -219,7 +219,7 @@ setOperationAction(ISD::LOCATION, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); // FIXME - use subtarget debug flags - if (!Subtarget->isTargetDarwin()) + if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetELF()) setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); // VASTART needs to be custom lowered to use the VarArgsFrameIndex Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.292 llvm/lib/Target/X86/X86InstrInfo.td:1.293 --- llvm/lib/Target/X86/X86InstrInfo.td:1.292 Fri Oct 13 16:14:26 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Mon Oct 30 16:32:30 2006 @@ -2451,9 +2451,9 @@ [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>; -def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id), - "\nLdebug_loc${id:debug}:", - [(dwarf_label (i32 imm:$id))]>; +def DWARF_LABEL : I<0, Pseudo, (ops i32imm:$id), + "\n${:private}debug_loc${id:debug}:", + [(dwarf_label (i32 imm:$id))]>; //===----------------------------------------------------------------------===// // Non-Instruction Patterns Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.5 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.6 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.5 Thu Oct 26 14:18:18 2006 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Mon Oct 30 16:32:30 2006 @@ -60,6 +60,30 @@ DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; break; + + case X86Subtarget::isELF: + // Set up DWARF directives + HasLEB128 = true; // Target asm supports leb128 directives (little-endian) + // bool HasLEB128; // Defaults to false. + // hasDotLoc - True if target asm supports .loc directives. + // bool HasDotLoc; // Defaults to false. + // HasDotFile - True if target asm supports .file directives. + // bool HasDotFile; // Defaults to false. + PrivateGlobalPrefix = "."; // Prefix for private global symbols + DwarfRequiresFrameSection = false; + DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits"; + DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits"; + DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits"; + DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits"; + DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits"; + DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits"; + DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits"; + DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits"; + DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits"; + DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits"; + DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits"; + break; + case X86Subtarget::isCygwin: GlobalPrefix = "_"; COMMDirectiveTakesAlignment = false; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits