diff options
author | Martell Malone <martellmalone@gmail.com> | 2015-11-23 18:59:48 +0000 |
---|---|---|
committer | Martell Malone <martellmalone@gmail.com> | 2015-11-23 18:59:48 +0000 |
commit | f6301faa8bd91cd11f73c2b7a9c75127bb7d94bb (patch) | |
tree | e390b493d2be1f515c133e3064b48d4f2365dba5 /clang/lib/Driver | |
parent | 7c7f12017844fb21a59e3a603edd42e315187bd1 (diff) | |
download | bcm5719-llvm-f6301faa8bd91cd11f73c2b7a9c75127bb7d94bb.tar.gz bcm5719-llvm-f6301faa8bd91cd11f73c2b7a9c75127bb7d94bb.zip |
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
Differential Revision: http://reviews.llvm.org/D14164
llvm-svn: 253898
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r-- | clang/lib/Driver/MinGWToolChain.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/clang/lib/Driver/MinGWToolChain.cpp b/clang/lib/Driver/MinGWToolChain.cpp index 938440b08f6..2896bde9c9e 100644 --- a/clang/lib/Driver/MinGWToolChain.cpp +++ b/clang/lib/Driver/MinGWToolChain.cpp @@ -66,24 +66,20 @@ MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : ToolChain(D, Triple, Args) { 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. +// On Windows if there is no sysroot we search for gcc on the PATH. + +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 |