[cfe-commits] r156841 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/arclite-link.c

Bob Wilson bob.wilson at apple.com
Tue May 15 11:57:39 PDT 2012


Author: bwilson
Date: Tue May 15 13:57:39 2012
New Revision: 156841

URL: http://llvm.org/viewvc/llvm-project?rev=156841&view=rev
Log:
Do not link with Objective-C libraries with -nostdlib or -nodefaultlibs.
<rdar://problem/11433499>

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/arclite-link.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=156841&r1=156840&r2=156841&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue May 15 13:57:39 2012
@@ -4224,7 +4224,9 @@
     // This is more complicated in gcc...
     CmdArgs.push_back("-lgomp");
 
-  if (isObjCRuntimeLinked(Args)) {
+  if (isObjCRuntimeLinked(Args) &&
+      !Args.hasArg(options::OPT_nostdlib) &&
+      !Args.hasArg(options::OPT_nodefaultlibs)) {
     // Avoid linking compatibility stubs on i386 mac.
     if (!getDarwinToolChain().isTargetMacOS() ||
         getDarwinToolChain().getArchName() != "i386") {

Modified: cfe/trunk/test/Driver/arclite-link.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arclite-link.c?rev=156841&r1=156840&r2=156841&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arclite-link.c (original)
+++ cfe/trunk/test/Driver/arclite-link.c Tue May 15 13:57:39 2012
@@ -2,9 +2,11 @@
 // 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 -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: libarclite_macosx.a
 // CHECK-ARCLITE-OSX: -framework
 // CHECK-ARCLITE-OSX: Foundation
 // CHECK-ARCLITE-OSX: -lobjc
 // CHECK-NOARCLITE-NOT: libarclite
+// CHECK-NOSTDLIB-NOT: -lobjc





More information about the cfe-commits mailing list