diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2006-10-31 08:31:24 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2006-10-31 08:31:24 +0000 |
commit | ab4022f196059745c0ca0780b71a80fa67e896be (patch) | |
tree | 742dfb8841ee2a9e5852a81bc3770321aaae38ea /lib/Target | |
parent | d03f1581c8a854fdbe4f5a738e9322341c2bc77f (diff) |
1. Clean up code due to changes in SwitchTo*Section(2)
2. Added partial debug support for mingw\cygwin targets (the same as
Linux\ELF). Please note, that currently mingw\cygwin uses 'stabs' format
for storing debug info by default, thus many (runtime) libraries has
this information included. These formats shouldn't be mixed in one binary
('stabs' & 'DWARF'), otherwise binutils tools will be confused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31311 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/PowerPC/PPCAsmPrinter.cpp | 10 | ||||
-rwxr-xr-x | lib/Target/X86/X86ATTAsmPrinter.cpp | 12 | ||||
-rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 12 | ||||
-rwxr-xr-x | lib/Target/X86/X86AsmPrinter.h | 4 | ||||
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 4 | ||||
-rwxr-xr-x | lib/Target/X86/X86IntelAsmPrinter.cpp | 8 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 18 |
7 files changed, 48 insertions, 20 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 21c2f740af..aafc7825f4 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -577,7 +577,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { SwitchToTextSection(".section __TEXT,__picsymbolstub1,symbol_stubs," - "pure_instructions,32", 0); + "pure_instructions,32"); EmitAlignment(4); O << "L" << *i << "$stub:\n"; O << "\t.indirect_symbol " << *i << "\n"; @@ -593,7 +593,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr-L0$" << *i << ")(r11)\n"; O << "\tmtctr r12\n"; O << "\tbctr\n"; - SwitchToDataSection(".lazy_symbol_pointer", 0); + SwitchToDataSection(".lazy_symbol_pointer"); O << "L" << *i << "$lazy_ptr:\n"; O << "\t.indirect_symbol " << *i << "\n"; if (isPPC64) @@ -605,7 +605,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { SwitchToTextSection(".section __TEXT,__symbol_stub1,symbol_stubs," - "pure_instructions,16", 0); + "pure_instructions,16"); EmitAlignment(4); O << "L" << *i << "$stub:\n"; O << "\t.indirect_symbol " << *i << "\n"; @@ -616,7 +616,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr)(r11)\n"; O << "\tmtctr r12\n"; O << "\tbctr\n"; - SwitchToDataSection(".lazy_symbol_pointer", 0); + SwitchToDataSection(".lazy_symbol_pointer"); O << "L" << *i << "$lazy_ptr:\n"; O << "\t.indirect_symbol " << *i << "\n"; if (isPPC64) @@ -630,7 +630,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { // Output stubs for external and common global variables. if (GVStubs.begin() != GVStubs.end()) { - SwitchToDataSection(".non_lazy_symbol_pointer", 0); + SwitchToDataSection(".non_lazy_symbol_pointer"); for (std::set<std::string>::iterator I = GVStubs.begin(), E = GVStubs.end(); I != E; ++I) { O << "L" << *I << "$non_lazy_ptr:\n"; diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index 42af5b69ac..d6199dc0e9 100755 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -52,7 +52,9 @@ std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const { /// method to print assembly for each instruction. /// bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { + if (Subtarget->isTargetDarwin() || + Subtarget->isTargetELF() || + Subtarget->isTargetCygwin()) { // Let PassManager know we need debug information and relay // the MachineDebugInfo address on to DwarfWriter. DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>()); @@ -111,7 +113,9 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { F->getLinkage() == Function::WeakLinkage)) O << "_llvm$workaround$fake$stub_" << CurrentFnName << ":\n"; - if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { + if (Subtarget->isTargetDarwin() || + Subtarget->isTargetELF() || + Subtarget->isTargetCygwin()) { // Emit pre-function debug information. DW.BeginFunction(&MF); } @@ -141,7 +145,9 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { if (TAI->hasDotTypeDotSizeDirective()) O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; - if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { + if (Subtarget->isTargetDarwin() || + Subtarget->isTargetELF() || + Subtarget->isTargetCygwin()) { // Emit post-function debug information. DW.EndFunction(); } diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 9ef0ad1027..41ce91a1a3 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -116,7 +116,7 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) { // Emit initial debug information. DW.BeginModule(&M); - } else if (Subtarget->isTargetELF()) { + } else if (Subtarget->isTargetELF() || Subtarget->isTargetCygwin()) { // Emit initial debug information. DW.BeginModule(&M); } @@ -253,7 +253,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { // Output linker support code for dllexported globals if (DLLExportedGVs.begin() != DLLExportedGVs.end()) { - SwitchToDataSection(".section .drectve", 0); + SwitchToDataSection(".section .drectve"); } for (std::set<std::string>::iterator i = DLLExportedGVs.begin(), @@ -263,7 +263,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { } if (DLLExportedFns.begin() != DLLExportedFns.end()) { - SwitchToDataSection(".section .drectve", 0); + SwitchToDataSection(".section .drectve"); } for (std::set<std::string>::iterator i = DLLExportedFns.begin(), @@ -273,7 +273,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { } if (Subtarget->isTargetDarwin()) { - SwitchToDataSection("", 0); + SwitchToDataSection(""); // Output stubs for dynamically-linked functions unsigned j = 1; @@ -291,7 +291,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { // Output stubs for external and common global variables. if (GVStubs.begin() != GVStubs.end()) SwitchToDataSection( - ".section __IMPORT,__pointers,non_lazy_symbol_pointers", 0); + ".section __IMPORT,__pointers,non_lazy_symbol_pointers"); for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end(); i != e; ++i) { O << "L" << *i << "$non_lazy_ptr:\n"; @@ -308,7 +308,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { // 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()) { + } else if (Subtarget->isTargetELF() || Subtarget->isTargetCygwin()) { // Emit final debug information. DW.EndModule(); } diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h index b2fbe0529c..3503e37c0b 100755 --- a/lib/Target/X86/X86AsmPrinter.h +++ b/lib/Target/X86/X86AsmPrinter.h @@ -67,7 +67,9 @@ struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter { void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); - if (Subtarget->isTargetDarwin() || Subtarget->isTargetELF()) { + if (Subtarget->isTargetDarwin() || + Subtarget->isTargetELF() || + Subtarget->isTargetCygwin()) { AU.addRequired<MachineDebugInfo>(); } MachineFunctionPass::getAnalysisUsage(AU); diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 6de5032ff3..96ab93949d 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -219,7 +219,9 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM) setOperationAction(ISD::LOCATION, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); // FIXME - use subtarget debug flags - if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetELF()) + if (!Subtarget->isTargetDarwin() && + !Subtarget->isTargetELF() && + !Subtarget->isTargetCygwin()) setOperationAction(ISD::DEBUG_LABEL, MVT::Other, Expand); // VASTART needs to be custom lowered to use the VarArgsFrameIndex diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index 11caea9dbe..7b2396345c 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -393,14 +393,14 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { switch (I->getLinkage()) { case GlobalValue::LinkOnceLinkage: case GlobalValue::WeakLinkage: - SwitchToDataSection("", 0); + SwitchToDataSection(""); O << name << "?\tsegment common 'COMMON'\n"; bCustomSegment = true; // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256 // are also available. break; case GlobalValue::AppendingLinkage: - SwitchToDataSection("", 0); + SwitchToDataSection(""); O << name << "?\tsegment public 'DATA'\n"; bCustomSegment = true; // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256 @@ -434,7 +434,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { // Output linker support code for dllexported globals if ((DLLExportedGVs.begin() != DLLExportedGVs.end()) || (DLLExportedFns.begin() != DLLExportedFns.end())) { - SwitchToDataSection("", 0); + SwitchToDataSection(""); O << "; WARNING: The following code is valid only with MASM v8.x and (possible) higher\n" << "; This version of MASM is usually shipped with Microsoft Visual Studio 2005\n" << "; or (possible) further versions. Unfortunately, there is no way to support\n" @@ -461,7 +461,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { // Bypass X86SharedAsmPrinter::doFinalization(). AsmPrinter::doFinalization(M); - SwitchToDataSection("", 0); + SwitchToDataSection(""); O << "\tend\n"; return false; // success } diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 93596c04b4..229473c89c 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -90,6 +90,24 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { HasDotTypeDotSizeDirective = false; StaticCtorsSection = "\t.section .ctors,\"aw\""; StaticDtorsSection = "\t.section .dtors,\"aw\""; + + // Set up DWARF directives + HasLEB128 = true; // Target asm supports leb128 directives (little-endian) + PrivateGlobalPrefix = "L"; // Prefix for private global symbols + DwarfRequiresFrameSection = false; + DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\""; + DwarfInfoSection = "\t.section\t.debug_info,\"dr\""; + DwarfLineSection = "\t.section\t.debug_line,\"dr\""; + DwarfFrameSection = "\t.section\t.debug_frame,\"dr\""; + DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\""; + DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\""; + DwarfStrSection = "\t.section\t.debug_str,\"dr\""; + DwarfLocSection = "\t.section\t.debug_loc,\"dr\""; + DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\""; + DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; + DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\""; + break; + break; case X86Subtarget::isWindows: GlobalPrefix = "_"; |