From: Daniel Dunbar Date: Tue, 7 Sep 2010 17:50:41 +0000 (+0000) Subject: Driver/Darwin: Catch another case where ld ends up using ld_classic. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ced7049caf7c9543badb302f3bb43a6bc264705;p=clang Driver/Darwin: Catch another case where ld ends up using ld_classic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113226 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 0215cdfa61..24d05c1b27 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2209,6 +2209,16 @@ void darwin::Link::AddLinkArgs(const ArgList &Args, // FIXME: This is a temporary workaround, ld should be handling this. bool UsesLdClassic = (getToolChain().getArch() == llvm::Triple::x86 && Args.hasArg(options::OPT_static)); + if (getToolChain().getArch() == llvm::Triple::x86) { + for (arg_iterator it = Args.filtered_begin(options::OPT_Xlinker, + options::OPT_Wl_COMMA), + ie = Args.filtered_end(); it != ie; ++it) { + const Arg *A = *it; + for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) + if (llvm::StringRef(A->getValue(Args, i)) == "-kext") + UsesLdClassic = true; + } + } if (!UsesLdClassic) CmdArgs.push_back("-demangle"); }