From 071de920a0811a908be46953624867a82f2b22d8 Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Sun, 9 May 2010 05:52:28 +0000 Subject: [PATCH] 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 --- lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 44 ++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index ad4e8a6c446..137e2833570 100644 --- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -580,34 +580,32 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) { OutStreamer.EndCOFFSymbolDef(); } - if (Subtarget->isTargetCygMing()) { - // Necessary for dllexport support - std::vector DLLExportedFns, DLLExportedGlobals; + // Necessary for dllexport support + std::vector DLLExportedFns, DLLExportedGlobals; - const TargetLoweringObjectFileCOFF &TLOFCOFF = - static_cast(getObjFileLowering()); + const TargetLoweringObjectFileCOFF &TLOFCOFF = + static_cast(getObjFileLowering()); - for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->hasDLLExportLinkage()) - DLLExportedFns.push_back(Mang->getSymbol(I)); + for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) + if (I->hasDLLExportLinkage()) + DLLExportedFns.push_back(Mang->getSymbol(I)); - for (Module::const_global_iterator I = M.global_begin(), - E = M.global_end(); I != E; ++I) - if (I->hasDLLExportLinkage()) - DLLExportedGlobals.push_back(Mang->getSymbol(I)); + for (Module::const_global_iterator I = M.global_begin(), + E = M.global_end(); I != E; ++I) + if (I->hasDLLExportLinkage()) + DLLExportedGlobals.push_back(Mang->getSymbol(I)); - // Output linker support code for dllexported globals on windows. - if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) { - OutStreamer.SwitchSection(TLOFCOFF.getDrectveSection()); - for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) - OutStreamer.EmitRawText("\t.ascii \" -export:" + - Twine(DLLExportedGlobals[i]->getName()) + - ",data\""); + // Output linker support code for dllexported globals on windows. + if (!DLLExportedGlobals.empty() || !DLLExportedFns.empty()) { + OutStreamer.SwitchSection(TLOFCOFF.getDrectveSection()); + for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) + OutStreamer.EmitRawText("\t.ascii \" -export:" + + Twine(DLLExportedGlobals[i]->getName()) + + ",data\""); - for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) - OutStreamer.EmitRawText("\t.ascii \" -export:" + - Twine(DLLExportedFns[i]->getName()) + "\""); - } + for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) + OutStreamer.EmitRawText("\t.ascii \" -export:" + + Twine(DLLExportedFns[i]->getName()) + "\""); } }