made COFF target dllexport logic apply to all subtargets

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103373 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nathan Jeffords 2010-05-09 05:52:28 +00:00
parent 72e57f9441
commit 071de920a0

View File

@ -580,34 +580,32 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer.EndCOFFSymbolDef(); OutStreamer.EndCOFFSymbolDef();
} }
if (Subtarget->isTargetCygMing()) { // Necessary for dllexport support
// Necessary for dllexport support std::vector<const MCSymbol*> DLLExportedFns, DLLExportedGlobals;
std::vector<const MCSymbol*> DLLExportedFns, DLLExportedGlobals;
const TargetLoweringObjectFileCOFF &TLOFCOFF = const TargetLoweringObjectFileCOFF &TLOFCOFF =
static_cast<const TargetLoweringObjectFileCOFF&>(getObjFileLowering()); static_cast<const TargetLoweringObjectFileCOFF&>(getObjFileLowering());
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
if (I->hasDLLExportLinkage()) if (I->hasDLLExportLinkage())
DLLExportedFns.push_back(Mang->getSymbol(I)); DLLExportedFns.push_back(Mang->getSymbol(I));
for (Module::const_global_iterator I = M.global_begin(), for (Module::const_global_iterator I = M.global_begin(),
E = M.global_end(); I != E; ++I) E = M.global_end(); I != E; ++I)
if (I->hasDLLExportLinkage()) if (I->hasDLLExportLinkage())
DLLExportedGlobals.push_back(Mang->getSymbol(I)); DLLExportedGlobals.push_back(Mang->getSymbol(I));
// Output linker support code for dllexported globals on windows. // Output linker support code for dllexported globals on windows.
if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) { if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) {
OutStreamer.SwitchSection(TLOFCOFF.getDrectveSection()); OutStreamer.SwitchSection(TLOFCOFF.getDrectveSection());
for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i)
OutStreamer.EmitRawText("\t.ascii \" -export:" + OutStreamer.EmitRawText("\t.ascii \" -export:" +
Twine(DLLExportedGlobals[i]->getName()) + Twine(DLLExportedGlobals[i]->getName()) +
",data\""); ",data\"");
for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i)
OutStreamer.EmitRawText("\t.ascii \" -export:" + OutStreamer.EmitRawText("\t.ascii \" -export:" +
Twine(DLLExportedFns[i]->getName()) + "\""); Twine(DLLExportedFns[i]->getName()) + "\"");
}
} }
} }