From: Daniel Dunbar Date: Mon, 18 Oct 2010 22:08:36 +0000 (+0000) Subject: Driver/Darwin: Forward -ObjC when linking, which may be needed when using static X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=270073c1e44d073e9732204fc099f280b368fab5;p=clang Driver/Darwin: Forward -ObjC when linking, which may be needed when using static libraries with Objective-C code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116758 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 8bce56636a..99e7e3fe0c 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2504,6 +2504,12 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA, Args.AddAllArgs(CmdArgs, options::OPT_m_Separate); Args.AddAllArgs(CmdArgs, options::OPT_r); + // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading + // members of static archive libraries which implement Objective-C classes or + // categories. + if (Args.hasArg(options::OPT_ObjC) || Args.hasArg(options::OPT_ObjCXX)) + CmdArgs.push_back("-ObjC"); + CmdArgs.push_back("-o"); CmdArgs.push_back(Output.getFilename());