[cfe-commits] r127896 - in /cfe/trunk/lib/Driver: HostInfo.cpp ToolChains.cpp ToolChains.h

Daniel Dunbar daniel at zuster.org
Fri Mar 18 12:25:10 PDT 2011


Author: ddunbar
Date: Fri Mar 18 14:25:10 2011
New Revision: 127896

URL: http://llvm.org/viewvc/llvm-project?rev=127896&view=rev
Log:
Driver/Darwin: Kill the DarwinGCC toolchain.

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

Modified: cfe/trunk/lib/Driver/HostInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HostInfo.cpp?rev=127896&r1=127895&r2=127896&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/HostInfo.cpp (original)
+++ cfe/trunk/lib/Driver/HostInfo.cpp Fri Mar 18 14:25:10 2011
@@ -113,14 +113,9 @@
     TCTriple.setArch(Arch);
 
     // If we recognized the arch, match it to the toolchains we support.
-    const char *UseNewToolChain = ::getenv("CCC_ENABLE_NEW_DARWIN_TOOLCHAIN");
-    if (UseNewToolChain || 
-        Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64 ||
+    if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64 ||
         Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
       TC = new toolchains::DarwinClang(*this, TCTriple);
-    } else if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) {
-      // We still use the legacy DarwinGCC toolchain on X86.
-      TC = new toolchains::DarwinGCC(*this, TCTriple);
     } else
       TC = new toolchains::Darwin_Generic_GCC(*this, TCTriple);
   }

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=127896&r1=127895&r2=127896&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Mar 18 14:25:10 2011
@@ -130,82 +130,6 @@
   }
 }
 
-DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple)
-  : Darwin(Host, Triple)
-{
-  // We can only work with 4.2.1 currently.
-  GCCVersion[0] = 4;
-  GCCVersion[1] = 2;
-  GCCVersion[2] = 1;
-
-  // Set up the tool chain paths to match gcc.
-  ToolChainDir = "i686-apple-darwin";
-  ToolChainDir += llvm::utostr(DarwinVersion[0]);
-  ToolChainDir += "/";
-  ToolChainDir += llvm::utostr(GCCVersion[0]);
-  ToolChainDir += '.';
-  ToolChainDir += llvm::utostr(GCCVersion[1]);
-  ToolChainDir += '.';
-  ToolChainDir += llvm::utostr(GCCVersion[2]);
-
-  // Try the next major version if that tool chain dir is invalid.
-  std::string Tmp = "/usr/lib/gcc/" + ToolChainDir;
-  bool Exists;
-  if (llvm::sys::fs::exists(Tmp, Exists) || Exists) {
-    std::string Next = "i686-apple-darwin";
-    Next += llvm::utostr(DarwinVersion[0] + 1);
-    Next += "/";
-    Next += llvm::utostr(GCCVersion[0]);
-    Next += '.';
-    Next += llvm::utostr(GCCVersion[1]);
-    Next += '.';
-    Next += llvm::utostr(GCCVersion[2]);
-
-    // Use that if it exists, otherwise hope the user isn't linking.
-    //
-    // FIXME: Drop dependency on gcc's tool chain.
-    Tmp = "/usr/lib/gcc/" + Next;
-    if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
-      ToolChainDir = Next;
-  }
-
-  std::string Path;
-  if (getArchName() == "x86_64") {
-    Path = getDriver().Dir;
-    Path += "/../lib/gcc/";
-    Path += ToolChainDir;
-    Path += "/x86_64";
-    getFilePaths().push_back(Path);
-
-    Path = "/usr/lib/gcc/";
-    Path += ToolChainDir;
-    Path += "/x86_64";
-    getFilePaths().push_back(Path);
-  }
-
-  Path = getDriver().Dir;
-  Path += "/../lib/gcc/";
-  Path += ToolChainDir;
-  getFilePaths().push_back(Path);
-
-  Path = "/usr/lib/gcc/";
-  Path += ToolChainDir;
-  getFilePaths().push_back(Path);
-
-  Path = getDriver().Dir;
-  Path += "/../libexec/gcc/";
-  Path += ToolChainDir;
-  getProgramPaths().push_back(Path);
-
-  Path = "/usr/libexec/gcc/";
-  Path += ToolChainDir;
-  getProgramPaths().push_back(Path);
-
-  getProgramPaths().push_back(getDriver().getInstalledDir());
-  if (getDriver().getInstalledDir() != getDriver().Dir)
-    getProgramPaths().push_back(getDriver().Dir);
-}
-
 Darwin::~Darwin() {
   // Free tool implementations.
   for (llvm::DenseMap<unsigned, Tool*>::iterator
@@ -294,87 +218,6 @@
   return *T;
 }
 
-void DarwinGCC::AddLinkSearchPathArgs(const ArgList &Args,
-                                      ArgStringList &CmdArgs) const {
-  std::string Tmp;
-
-  // FIXME: Derive these correctly.
-  if (getArchName() == "x86_64") {
-    CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
-                                         "/x86_64"));
-    // Intentionally duplicated for (temporary) gcc bug compatibility.
-    CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
-                                         "/x86_64"));
-  }
-
-  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + ToolChainDir));
-
-  Tmp = getDriver().Dir + "/../lib/gcc/" + ToolChainDir;
-  bool Exists;
-  if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
-    CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
-  Tmp = getDriver().Dir + "/../lib/gcc";
-  if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
-    CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
-  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
-  // Intentionally duplicated for (temporary) gcc bug compatibility.
-  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
-  Tmp = getDriver().Dir + "/../lib/" + ToolChainDir;
-  if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
-    CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
-  Tmp = getDriver().Dir + "/../lib";
-  if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
-    CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
-  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
-                                       "/../../../" + ToolChainDir));
-  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
-                                       "/../../.."));
-}
-
-void DarwinGCC::AddLinkRuntimeLibArgs(const ArgList &Args,
-                                      ArgStringList &CmdArgs) const {
-  // Note that this routine is only used for targetting OS X.
-
-  // Derived from libgcc and lib specs but refactored.
-  if (Args.hasArg(options::OPT_static)) {
-    CmdArgs.push_back("-lgcc_static");
-  } else {
-    if (Args.hasArg(options::OPT_static_libgcc)) {
-      CmdArgs.push_back("-lgcc_eh");
-    } else if (Args.hasArg(options::OPT_miphoneos_version_min_EQ)) {
-      // Derived from darwin_iphoneos_libgcc spec.
-      if (isTargetIPhoneOS()) {
-        CmdArgs.push_back("-lgcc_s.1");
-      } else {
-        CmdArgs.push_back("-lgcc_s.10.5");
-      }
-    } else if (Args.hasArg(options::OPT_shared_libgcc) ||
-               Args.hasFlag(options::OPT_fexceptions,
-                            options::OPT_fno_exceptions) ||
-               Args.hasArg(options::OPT_fgnu_runtime)) {
-      // FIXME: This is probably broken on 10.3?
-      if (isMacosxVersionLT(10, 5))
-        CmdArgs.push_back("-lgcc_s.10.4");
-      else if (isMacosxVersionLT(10, 6))
-        CmdArgs.push_back("-lgcc_s.10.5");
-    } else {
-      if (isMacosxVersionLT(10, 3, 9))
-        ; // Do nothing.
-      else if (isMacosxVersionLT(10, 5))
-        CmdArgs.push_back("-lgcc_s.10.4");
-      else if (isMacosxVersionLT(10, 6))
-        CmdArgs.push_back("-lgcc_s.10.5");
-    }
-
-    if (isTargetIPhoneOS() || isMacosxVersionLT(10, 6)) {
-      CmdArgs.push_back("-lgcc");
-      CmdArgs.push_back("-lSystem");
-    } else {
-      CmdArgs.push_back("-lSystem");
-      CmdArgs.push_back("-lgcc");
-    }
-  }
-}
 
 DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple)
   : Darwin(Host, Triple)

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=127896&r1=127895&r2=127896&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Mar 18 14:25:10 2011
@@ -246,29 +246,6 @@
   /// }
 };
 
-/// DarwinGCC - The Darwin toolchain used by GCC.
-class LLVM_LIBRARY_VISIBILITY DarwinGCC : public Darwin {
-  /// GCC version to use.
-  unsigned GCCVersion[3];
-
-  /// The directory suffix for this tool chain.
-  std::string ToolChainDir;
-
-public:
-  DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple);
-
-  /// @name Darwin ToolChain Implementation
-  /// {
-
-  virtual void AddLinkSearchPathArgs(const ArgList &Args,
-                                    ArgStringList &CmdArgs) const;
-
-  virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
-                                     ArgStringList &CmdArgs) const;
-
-  /// }
-};
-
 /// Darwin_Generic_GCC - Generic Darwin tool chain using gcc.
 class LLVM_LIBRARY_VISIBILITY Darwin_Generic_GCC : public Generic_GCC {
 public:





More information about the cfe-commits mailing list