[cfe-commits] r107353 - /cfe/trunk/lib/Driver/ToolChains.cpp

Daniel Dunbar daniel at zuster.org
Wed Jun 30 16:56:13 PDT 2010


Author: ddunbar
Date: Wed Jun 30 18:56:13 2010
New Revision: 107353

URL: http://llvm.org/viewvc/llvm-project?rev=107353&view=rev
Log:
Driver/Darwin: Add one -L for the DarwinClang toolchain to point into the gcc
library directory, as we still rely on a few libraries that are hiding there (in
particular libstdc++.dylib).

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

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=107353&r1=107352&r2=107353&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jun 30 18:56:13 2010
@@ -325,6 +325,33 @@
 void DarwinClang::AddLinkSearchPathArgs(const ArgList &Args,
                                        ArgStringList &CmdArgs) const {
   // The Clang toolchain uses explicit paths for internal libraries.
+
+  // Unfortunately, we still might depend on a few of the libraries that are
+  // only available in the gcc library directory (in particular
+  // libstdc++.dylib). For now, hardcode the path to the known install location.
+  llvm::sys::Path P(getDriver().Dir);
+  P.eraseComponent(); // .../usr/bin -> ../usr
+  P.appendComponent("lib");
+  P.appendComponent("gcc");
+  switch (getTriple().getArch()) {
+  default:
+    assert(0 && "Invalid Darwin arch!");
+  case llvm::Triple::x86:
+  case llvm::Triple::x86_64:
+    P.appendComponent("i686-apple-darwin10");
+    break;
+  case llvm::Triple::arm:
+  case llvm::Triple::thumb:
+    P.appendComponent("arm-apple-darwin10");
+    break;
+  case llvm::Triple::ppc:
+  case llvm::Triple::ppc64:
+    P.appendComponent("powerpc-apple-darwin10");
+    break;
+  }
+  P.appendComponent("4.2.1");
+  if (P.exists())
+    CmdArgs.push_back(Args.MakeArgString("-L" + P.str()));
 }
 
 void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,





More information about the cfe-commits mailing list