]> granicus.if.org Git - clang/commitdiff
Driver/Darwin: Forward -ObjC when linking, which may be needed when using static
authorDaniel Dunbar <daniel@zuster.org>
Mon, 18 Oct 2010 22:08:36 +0000 (22:08 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 18 Oct 2010 22:08:36 +0000 (22:08 +0000)
libraries with Objective-C code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116758 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp

index 8bce56636adb236796833257b38c1a0612f15de8..99e7e3fe0c95adc0b63379049db4c71b7cfe0bb0 100644 (file)
@@ -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());