r257468 - Revert r253898 and r253899, this breaks mingw compilation on openSUSE.

Ismail Donmez via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 02:41:25 PST 2016


Author: ismail
Date: Tue Jan 12 04:41:20 2016
New Revision: 257468

URL: http://llvm.org/viewvc/llvm-project?rev=257468&view=rev
Log:
Revert r253898 and r253899, this breaks mingw compilation on openSUSE.
Will re-apply after llvm 3.8 is branched. 

Original commit message:

Driver: fallback to the location of clang if no sysroot,

hard coding /usr makes little sense for mingw-w64.
If we have portable toolchains having /usr breaks that.
If the clang we use is in /usr/bin or /usr/sbin etc this will
still detect as though it was hard coded to /usr

This makes the most sense going forward for mingw-w64 toolchains
on both linux and mac


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

Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MinGWToolChain.cpp?rev=257468&r1=257467&r2=257468&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/MinGWToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MinGWToolChain.cpp Tue Jan 12 04:41:20 2016
@@ -66,17 +66,23 @@ MinGW::MinGW(const Driver &D, const llvm
     : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-  // On Windows if there is no sysroot we search for gcc on the PATH.
-  if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
+// In Windows there aren't any standard install locations, we search
+// for gcc on the PATH. In Linux the base is always /usr.
 #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()));
-#endif
-  if (!Base.size())
+  else
     Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
+#else
+  if (getDriver().SysRoot.size())
+    Base = getDriver().SysRoot;
+  else
+    Base = "/usr";
+#endif
 
   Base += llvm::sys::path::get_separator();
   findGccLibDir();




More information about the cfe-commits mailing list