]> granicus.if.org Git - clang/commitdiff
Stop linking with crt1.o etc. for the iOS simulator. <rdar://problem/11800973>
authorBob Wilson <bob.wilson@apple.com>
Tue, 21 Jan 2014 00:17:10 +0000 (00:17 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 21 Jan 2014 00:17:10 +0000 (00:17 +0000)
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.

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

lib/Driver/ToolChains.cpp
test/Driver/darwin-ld.c

index e364fa7ba31cfb21a0f220bf6ec5203c6969f4ab..727cfbaa9ba4cee9dbfac69f965173ce4d9cc3fd 100644 (file)
@@ -1007,8 +1007,7 @@ void Darwin::addStartObjectFileArgs(const llvm::opt::ArgList &Args,
   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(const llvm::opt::ArgList &Args,
       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(const llvm::opt::ArgList &Args,
         } 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");
index 1675fe6bb88a3741c19b6d31e4b8c409be5042b1..25b28d6e7db4e9dc821a7bce0c387706fcdf5825 100644 (file)
 // 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
 //