1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

mc'ize elf stub printing, convert cygwin stuff to EmitRawText,

which will abort in .o file writing mode.

llvm-svn: 100314
This commit is contained in:
Chris Lattner 2010-04-04 05:35:04 +00:00
parent 00699c02d5
commit 4b7a56f4fe

View File

@ -577,10 +577,11 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
// Emit type information for external functions // Emit type information for external functions
for (X86COFFMachineModuleInfo::stub_iterator I = COFFMMI.stub_begin(), for (X86COFFMachineModuleInfo::stub_iterator I = COFFMMI.stub_begin(),
E = COFFMMI.stub_end(); I != E; ++I) { E = COFFMMI.stub_end(); I != E; ++I) {
O << "\t.def\t " << I->getKeyData() OutStreamer.EmitRawText("\t.def\t " + Twine(I->getKeyData()) +
<< ";\t.scl\t" << COFF::C_EXT ";\t.scl\t" + Twine(COFF::C_EXT) +
<< ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT) ";\t.type\t" +
<< ";\t.endef\n"; Twine(COFF::DT_FCN << COFF::N_BTSHFT) +
";\t.endef");
} }
if (Subtarget->isTargetCygMing()) { if (Subtarget->isTargetCygMing()) {
@ -605,10 +606,13 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
true, true,
SectionKind::getMetadata())); SectionKind::getMetadata()));
for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i)
O << "\t.ascii \" -export:" << *DLLExportedGlobals[i] << ",data\"\n"; OutStreamer.EmitRawText("\t.ascii \" -export:" +
Twine(DLLExportedGlobals[i]->getName()) +
",data\"");
for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i)
O << "\t.ascii \" -export:" << *DLLExportedFns[i] << "\"\n"; OutStreamer.EmitRawText("\t.ascii \" -export:" +
Twine(DLLExportedFns[i]->getName()) + "\"");
} }
} }
} }
@ -625,12 +629,11 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer.SwitchSection(TLOFELF.getDataRelSection()); OutStreamer.SwitchSection(TLOFELF.getDataRelSection());
const TargetData *TD = TM.getTargetData(); const TargetData *TD = TM.getTargetData();
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
O << *Stubs[i].first << ":\n" OutStreamer.EmitLabel(Stubs[i].first);
<< (TD->getPointerSize() == 8 ? OutStreamer.EmitSymbolValue(Stubs[i].second.getPointer(),
MAI->getData64bitsDirective() : MAI->getData32bitsDirective()) TD->getPointerSize(), 0);
<< *Stubs[i].second.getPointer() << '\n'; }
Stubs.clear(); Stubs.clear();
} }
} }