]> granicus.if.org Git - clang/commitdiff
Driver/Darwin: Add one -L for the DarwinClang toolchain to point into the gcc
authorDaniel Dunbar <daniel@zuster.org>
Wed, 30 Jun 2010 23:56:13 +0000 (23:56 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 30 Jun 2010 23:56:13 +0000 (23:56 +0000)
library directory, as we still rely on a few libraries that are hiding there (in
particular libstdc++.dylib).

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

lib/Driver/ToolChains.cpp

index a31978c0bccfcc48c37dd5f286ffe68a4bca6074..b071864e2179c727e79a54adc2d55cb8261a10d1 100644 (file)
@@ -325,6 +325,33 @@ DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple,
 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,