From 3d7e0e2c6ba894c330398edf5d90acd4446374e8 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 7 Sep 2010 17:50:41 +0000 Subject: [PATCH] Driver/Darwin: Catch another case where ld ends up using ld_classic. llvm-svn: 113226 --- clang/lib/Driver/Tools.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 0215cdfa6116..24d05c1b27be 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/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"); }