diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-09 05:12:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-09 05:12:53 +0000 |
commit | dad9c5a14ff29cf4b5f7d7352da8f15337bae51f (patch) | |
tree | a012ec7962b56ed67247bb5380f23b7814f80ed9 /lib | |
parent | 4632d7a57008564c4b0f8246e85bd813a200d2c6 (diff) | |
download | external_llvm-dad9c5a14ff29cf4b5f7d7352da8f15337bae51f.zip external_llvm-dad9c5a14ff29cf4b5f7d7352da8f15337bae51f.tar.gz external_llvm-dad9c5a14ff29cf4b5f7d7352da8f15337bae51f.tar.bz2 |
Fix the MASM asmprinter's lies. It does not want to emit code to .text/.data
it wants it emitted to _text/_data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28185 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Target/X86/X86ATTAsmPrinter.cpp | 4 | ||||
-rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 6 | ||||
-rwxr-xr-x | lib/Target/X86/X86AsmPrinter.h | 4 | ||||
-rwxr-xr-x | lib/Target/X86/X86IntelAsmPrinter.cpp | 10 |
4 files changed, 17 insertions, 7 deletions
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index b674f15..7adc1c5 100755 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -46,11 +46,11 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. - SwitchToTextSection(".text", F); + SwitchToTextSection(DefaultTextSection, F); EmitAlignment(4, F); // FIXME: This should be parameterized somewhere. break; case Function::ExternalLinkage: - SwitchToTextSection(".text", F); + SwitchToTextSection(DefaultTextSection, F); EmitAlignment(4, F); // FIXME: This should be parameterized somewhere. O << "\t.globl\t" << CurrentFnName << "\n"; break; diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 0e2bab7..dceade4 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -50,6 +50,8 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) { forDarwin = false; PrivateGlobalPrefix = ".L"; + DefaultTextSection = ".text"; + DefaultDataSection = ".data"; switch (Subtarget->TargetType) { case X86Subtarget::isDarwin: @@ -119,7 +121,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { O << "\t.zerofill __DATA__, __common, " << name << ", " << Size << ", " << Align; } else { - SwitchToDataSection(".data", I); + SwitchToDataSection(DefaultDataSection, I); if (LCOMMDirective != NULL) { if (I->hasInternalLinkage()) { O << LCOMMDirective << name << "," << Size; @@ -157,7 +159,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchToDataSection(".data", I); + SwitchToDataSection(DefaultDataSection, I); break; default: assert(0 && "Unknown linkage type!"); diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h index c4d67b6..b653b34 100755 --- a/lib/Target/X86/X86AsmPrinter.h +++ b/lib/Target/X86/X86AsmPrinter.h @@ -69,6 +69,10 @@ struct X86SharedAsmPrinter : public AsmPrinter { } bool forDarwin; // FIXME: eliminate. + + const char *DefaultTextSection; // "_text" for MASM, ".text" for others. + const char *DefaultDataSection; // "_data" for MASM, ".data" for others. + // Necessary for Darwin to print out the apprioriate types of linker stubs std::set<std::string> FnStubs, GVStubs, LinkOnceStubs; diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index d33cb8c..4bc0e10 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -37,7 +37,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) { EmitConstantPool(MF.getConstantPool()); // Print out labels for the function. - SwitchToTextSection(".code", MF.getFunction()); + SwitchToTextSection("_text", MF.getFunction()); EmitAlignment(4); if (MF.getFunction()->getLinkage() == GlobalValue::ExternalLinkage) O << "\tpublic " << CurrentFnName << "\n"; @@ -302,6 +302,9 @@ bool X86IntelAsmPrinter::doInitialization(Module &M) { Data64bitsDirective = "\tdq\t"; HasDotTypeDotSizeDirective = false; Mang->markCharUnacceptable('.'); + + DefaultTextSection = "_text"; + DefaultDataSection = "_data"; O << "\t.686\n\t.model flat\n\n"; @@ -359,7 +362,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { O << "\tpublic " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchToDataSection(".data", I); + SwitchToDataSection(DefaultDataSection, I); break; default: assert(0 && "Unknown linkage type!"); @@ -378,7 +381,8 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { // Bypass X86SharedAsmPrinter::doFinalization(). AsmPrinter::doFinalization(M); - SwitchToDataSection("", 0); + SwitchToDataSection("_data", 0); + O << "_data\tends\n"; O << "\tend\n"; return false; // success } |