[cfe-commits] r128641 - in /cfe/trunk/lib/Driver: ToolChains.h Tools.cpp

Daniel Dunbar daniel at zuster.org
Thu Mar 31 10:12:33 PDT 2011


Author: ddunbar
Date: Thu Mar 31 12:12:33 2011
New Revision: 128641

URL: http://llvm.org/viewvc/llvm-project?rev=128641&view=rev
Log:
Driver/Darwin: Tweak link logic for simulator.

Modified:
    cfe/trunk/lib/Driver/ToolChains.h
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=128641&r1=128640&r2=128641&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Thu Mar 31 12:12:33 2011
@@ -103,6 +103,16 @@
     return TargetIsIPhoneOS;
   }
 
+  bool isTargetIOSSimulator() const {
+    // In GCC, the simulator historically was treated as being OS X in some
+    // contexts, like determining the link logic, despite generally being called
+    // with an iOS deployment target. For compatibility, we detect the
+    // simulator is iOS + x86, and treat it differently in a few contexts.
+    return isTargetIPhoneOS() && 
+      (getTriple().getArch() == llvm::Triple::x86 ||
+       getTriple().getArch() == llvm::Triple::x86_64);
+  }
+
   bool isTargetInitialized() const { return TargetInitialized; }
 
   void getTargetVersion(unsigned (&Res)[3]) const {

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=128641&r1=128640&r2=128641&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 31 12:12:33 2011
@@ -2885,7 +2885,10 @@
             CmdArgs.push_back("-lcrt0.o");
           } else {
             // Derived from darwin_crt1 spec.
-            if (getDarwinToolChain().isTargetIPhoneOS()) {
+            if (getDarwinToolChain().isTargetIOSSimulator()) {
+              // The simulator doesn't have a versioned crt1 file.
+              CmdArgs.push_back("-lcrt1.o");
+            } else if (getDarwinToolChain().isTargetIPhoneOS()) {
               if (getDarwinToolChain().isIPhoneOSVersionLT(3, 1))
                 CmdArgs.push_back("-lcrt1.o");
               else





More information about the cfe-commits mailing list