Revert r164907 and r164902 (+ follow-ups). They broke building on 10.6.

See PR14013.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165962 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 529f7bf..c7a8cba 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -332,9 +332,7 @@
 
   // Darwin doesn't support real static executables, don't link any runtime
   // libraries with -static.
-  if (Args.hasArg(options::OPT_static) ||
-      Args.hasArg(options::OPT_fapple_kext) ||
-      Args.hasArg(options::OPT_mkernel))
+  if (Args.hasArg(options::OPT_static))
     return;
 
   // Reject -static-libgcc for now, we can deal with this when and if someone
@@ -678,14 +676,7 @@
   llvm::sys::Path P(getDriver().ResourceDir);
   P.appendComponent("lib");
   P.appendComponent("darwin");
-
-  // Use the newer cc_kext for iOS ARM after 6.0.
-  if (!isTargetIPhoneOS() || isTargetIOSSimulator() ||
-      !isIPhoneOSVersionLT(6, 0)) {
-    P.appendComponent("libclang_rt.cc_kext.a");
-  } else {
-    P.appendComponent("libclang_rt.cc_kext_ios5.a");
-  }
+  P.appendComponent("libclang_rt.cc_kext.a");
 
   // For now, allow missing resource libraries to support developers who may
   // not have compiler-rt checked out or integrated into their build.
@@ -911,25 +902,6 @@
   if (BoundArch)
     AddDeploymentTarget(*DAL);
 
-  // For iOS 6, undo the translation to add -static for -mkernel/-fapple-kext.
-  // FIXME: It would be far better to avoid inserting those -static arguments,
-  // but we can't check the deployment target in the translation code until
-  // it is set here.
-  if (isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) {
-    for (ArgList::iterator it = DAL->begin(), ie = DAL->end(); it != ie; ) {
-      Arg *A = *it;
-      ++it;
-      if (A->getOption().getID() != options::OPT_mkernel &&
-          A->getOption().getID() != options::OPT_fapple_kext)
-        continue;
-      assert(it != ie && "unexpected argument translation");
-      A = *it;
-      assert(A->getOption().getID() == options::OPT_static &&
-             "missing expected -static argument");
-      it = DAL->getArgs().erase(it);
-    }
-  }
-
   // Validate the C++ standard library choice.
   CXXStdlibType Type = GetCXXStdlibType(*DAL);
   if (Type == ToolChain::CST_Libcxx) {