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;
forDarwin = false;
PrivateGlobalPrefix = ".L";
+ DefaultTextSection = ".text";
+ DefaultDataSection = ".data";
switch (Subtarget->TargetType) {
case X86Subtarget::isDarwin:
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;
O << "\t.globl " << name << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
- SwitchToDataSection(".data", I);
+ SwitchToDataSection(DefaultDataSection, I);
break;
default:
assert(0 && "Unknown linkage type!");
}
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;
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";
Data64bitsDirective = "\tdq\t";
HasDotTypeDotSizeDirective = false;
Mang->markCharUnacceptable('.');
+
+ DefaultTextSection = "_text";
+ DefaultDataSection = "_data";
O << "\t.686\n\t.model flat\n\n";
O << "\tpublic " << name << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
- SwitchToDataSection(".data", I);
+ SwitchToDataSection(DefaultDataSection, I);
break;
default:
assert(0 && "Unknown linkage type!");
// Bypass X86SharedAsmPrinter::doFinalization().
AsmPrinter::doFinalization(M);
- SwitchToDataSection("", 0);
+ SwitchToDataSection("_data", 0);
+ O << "_data\tends\n";
O << "\tend\n";
return false; // success
}