[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86IntelAsmPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon May 8 22:13:06 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.45 -> 1.46
X86AsmPrinter.cpp updated: 1.180 -> 1.181
X86AsmPrinter.h updated: 1.17 -> 1.18
X86IntelAsmPrinter.cpp updated: 1.45 -> 1.46
---
Log message:
Fix the MASM asmprinter's lies. It does not want to emit code to .text/.data
it wants it emitted to _text/_data.
---
Diffs of the changes: (+17 -7)
X86ATTAsmPrinter.cpp | 4 ++--
X86AsmPrinter.cpp | 6 ++++--
X86AsmPrinter.h | 4 ++++
X86IntelAsmPrinter.cpp | 10 +++++++---
4 files changed, 17 insertions(+), 7 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.45 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.46
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.45 Mon May 8 23:59:56 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue May 9 00:12:53 2006
@@ -46,11 +46,11 @@
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;
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.180 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.181
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.180 Mon May 8 23:59:56 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue May 9 00:12:53 2006
@@ -50,6 +50,8 @@
forDarwin = false;
PrivateGlobalPrefix = ".L";
+ DefaultTextSection = ".text";
+ DefaultDataSection = ".data";
switch (Subtarget->TargetType) {
case X86Subtarget::isDarwin:
@@ -119,7 +121,7 @@
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 @@
O << "\t.globl " << name << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
- SwitchToDataSection(".data", I);
+ SwitchToDataSection(DefaultDataSection, I);
break;
default:
assert(0 && "Unknown linkage type!");
Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.17 llvm/lib/Target/X86/X86AsmPrinter.h:1.18
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.17 Tue May 2 12:34:51 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Tue May 9 00:12:53 2006
@@ -69,6 +69,10 @@
}
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;
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.45 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.46
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.45 Mon May 8 23:59:56 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Tue May 9 00:12:53 2006
@@ -37,7 +37,7 @@
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 @@
Data64bitsDirective = "\tdq\t";
HasDotTypeDotSizeDirective = false;
Mang->markCharUnacceptable('.');
+
+ DefaultTextSection = "_text";
+ DefaultDataSection = "_data";
O << "\t.686\n\t.model flat\n\n";
@@ -359,7 +362,7 @@
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 @@
// Bypass X86SharedAsmPrinter::doFinalization().
AsmPrinter::doFinalization(M);
- SwitchToDataSection("", 0);
+ SwitchToDataSection("_data", 0);
+ O << "_data\tends\n";
O << "\tend\n";
return false; // success
}
More information about the llvm-commits
mailing list