]> granicus.if.org Git - clang/commitdiff
Add the Objective-C runtime linking arguments after user-specified
authorDouglas Gregor <dgregor@apple.com>
Tue, 15 May 2012 21:00:27 +0000 (21:00 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 15 May 2012 21:00:27 +0000 (21:00 +0000)
linker arguments. Fixes <rdar://problem/11417441>.

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

lib/Driver/Tools.cpp
test/Driver/arclite-link.c

index bed29abd82ca6af255e4bfc9b67ba2e0e32c961b..887c64cff037659702c6e0f53ca8dc5a0dd792ba 100644 (file)
@@ -4224,6 +4224,8 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
     // This is more complicated in gcc...
     CmdArgs.push_back("-lgomp");
 
+  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
+  
   if (isObjCRuntimeLinked(Args) &&
       !Args.hasArg(options::OPT_nostdlib) &&
       !Args.hasArg(options::OPT_nodefaultlibs)) {
@@ -4246,8 +4248,6 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-lobjc");
   }
 
-  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
-
   if (LinkingOutput) {
     CmdArgs.push_back("-arch_multiple");
     CmdArgs.push_back("-final_output");
index ebb0f1afab6ad829f340e3c569e984d5979d2ace..735555f9170f1ccf77ad1751c0ae0c56386dc6ae 100644 (file)
@@ -1,9 +1,10 @@
 // RUN: touch %t.o
-// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
 // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.8 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
 // RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
 // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -nostdlib %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOSTDLIB %s
 
+// CHECK-ARCLITE-OSX: -lfoo
 // CHECK-ARCLITE-OSX: libarclite_macosx.a
 // CHECK-ARCLITE-OSX: -framework
 // CHECK-ARCLITE-OSX: Foundation