r199696 - Stop linking with crt1.o etc. for the iOS simulator. <rdar://problem/11800973>

Bob Wilson bob.wilson at apple.com
Mon Jan 20 16:17:10 PST 2014


Author: bwilson
Date: Mon Jan 20 18:17:10 2014
New Revision: 199696

URL: http://llvm.org/viewvc/llvm-project?rev=199696&view=rev
Log:
Stop linking with crt1.o etc. for the iOS simulator. <rdar://problem/11800973>

Recent versions of the iOS simulator no longer require linking with the
crt1.o, dylib1.o, or bundle1.o files. The relevant code is now included in
libSystem for the simulator.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=199696&r1=199695&r2=199696&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Jan 20 18:17:10 2014
@@ -1007,8 +1007,7 @@ void Darwin::addStartObjectFileArgs(cons
   if (Args.hasArg(options::OPT_dynamiclib)) {
     // Derived from darwin_dylib1 spec.
     if (isTargetIOSSimulator()) {
-      // The simulator doesn't have a versioned crt1 file.
-      CmdArgs.push_back("-ldylib1.o");
+      ; // iOS simulator does not need dylib1.o.
     } else if (isTargetIPhoneOS()) {
       if (isIPhoneOSVersionLT(3, 1))
         CmdArgs.push_back("-ldylib1.o");
@@ -1023,8 +1022,7 @@ void Darwin::addStartObjectFileArgs(cons
       if (!Args.hasArg(options::OPT_static)) {
         // Derived from darwin_bundle1 spec.
         if (isTargetIOSSimulator()) {
-          // The simulator doesn't have a versioned crt1 file.
-          CmdArgs.push_back("-lbundle1.o");
+          ; // iOS simulator does not need bundle1.o.
         } else if (isTargetIPhoneOS()) {
           if (isIPhoneOSVersionLT(3, 1))
             CmdArgs.push_back("-lbundle1.o");
@@ -1059,8 +1057,7 @@ void Darwin::addStartObjectFileArgs(cons
         } else {
           // Derived from darwin_crt1 spec.
           if (isTargetIOSSimulator()) {
-            // The simulator doesn't have a versioned crt1 file.
-            CmdArgs.push_back("-lcrt1.o");
+            ; // iOS simulator does not need crt1.o.
           } else if (isTargetIPhoneOS()) {
             if (isIPhoneOSVersionLT(3, 1))
               CmdArgs.push_back("-lcrt1.o");

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=199696&r1=199695&r2=199696&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Mon Jan 20 18:17:10 2014
@@ -45,6 +45,22 @@
 // LINK_IPHONE_3_1-NOT: -lbundle1.o
 // LINK_IPHONE_3_1: -lSystem
 
+// RUN: %clang -target i386-apple-darwin9 -### -arch i386 -mios-simulator-version-min=3.0 %t.o 2> %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -arch i386 -mios-simulator-version-min=3.0 -dynamiclib %t.o 2>> %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -arch i386 -mios-simulator-version-min=3.0 -bundle %t.o 2>> %t.log
+// RUN: FileCheck -check-prefix=LINK_IOSSIM_3_0 %s < %t.log
+
+// LINK_IOSSIM_3_0: {{ld(.exe)?"}}
+// LINK_IOSSIM_3_0-NOT: -lcrt1.o
+// LINK_IOSSIM_3_0: -lSystem
+// LINK_IOSSIM_3_0: {{ld(.exe)?"}}
+// LINK_IOSSIM_3_0: -dylib
+// LINK_IOSSIM_3_0-NOT: -ldylib1.o
+// LINK_IOSSIM_3_0: -lSystem
+// LINK_IOSSIM_3_0: {{ld(.exe)?"}}
+// LINK_IOSSIM_3_0-NOT: -lbundle1.o
+// LINK_IOSSIM_3_0: -lSystem
+
 // RUN: %clang -target i386-apple-darwin9 -### -fpie %t.o 2> %t.log
 // RUN: FileCheck -check-prefix=LINK_EXPLICIT_PIE %s < %t.log
 //





More information about the cfe-commits mailing list