[PATCH] D14164: Driver: fallback to parent directory of clang if no sysroot for mingw-w64 target

Martell Malone via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 08:22:10 PST 2015


martell updated this revision to Diff 39069.
martell added a comment.

Thanks for the tip.
That does make sense :)
Updated accordingly with the comment also


http://reviews.llvm.org/D14164

Files:
  lib/Driver/MinGWToolChain.cpp

Index: lib/Driver/MinGWToolChain.cpp
===================================================================
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -67,23 +67,20 @@
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
 // In Windows there aren't any standard install locations, we search
-// for gcc on the PATH. In Linux the base is always /usr.
+// for gcc on the PATH. In Linux the base is always the parent dir of clang.
+
+if (getDriver().SysRoot.size())
+  Base = getDriver().SysRoot;
 #ifdef LLVM_ON_WIN32
-  if (getDriver().SysRoot.size())
-    Base = getDriver().SysRoot;
-  else if (llvm::ErrorOr<std::string> GPPName =
-               llvm::sys::findProgramByName("gcc"))
-    Base = llvm::sys::path::parent_path(
-        llvm::sys::path::parent_path(GPPName.get()));
-  else
-    Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
-#else
-  if (getDriver().SysRoot.size())
-    Base = getDriver().SysRoot;
-  else
-    Base = "/usr";
+else if (llvm::ErrorOr<std::string> GPPName =
+             llvm::sys::findProgramByName("gcc"))
+  Base = llvm::sys::path::parent_path(
+      llvm::sys::path::parent_path(GPPName.get()));
 #endif
 
+if (!Base.size())
+  Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
+
   Base += llvm::sys::path::get_separator();
   findGccLibDir();
   // GccLibDir must precede Base/lib so that the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14164.39069.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151103/406900ee/attachment.bin>


More information about the llvm-commits mailing list