Driver/Darwin: Catch another case where ld ends up using ld_classic.

llvm-svn: 113226
This commit is contained in:
Daniel Dunbar 2010-09-07 17:50:41 +00:00
parent ba6f71b030
commit 3d7e0e2c6b
1 changed files with 10 additions and 0 deletions

View File

@ -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");
}