summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2018-10-22 13:46:12 +0000
committerDavid Greene <greened@obbligato.org>2018-10-22 13:46:12 +0000
commit7eae99999d42384b57dfdd6437032b7450dbc265 (patch)
tree24bb6d491b18e83b3f81e4acd3b934d964f0235e
parente72a7437404db25339ffdb26e78e09e44fc4e217 (diff)
downloadbcm5719-llvm-7eae99999d42384b57dfdd6437032b7450dbc265.tar.gz
bcm5719-llvm-7eae99999d42384b57dfdd6437032b7450dbc265.zip
Always search sysroot for GCC installs
Previously, if clang was configured with -DGCC_INSTALL_PREFIX, then it would not search a provided sysroot for a gcc install. This caused a number of regression tests to fail. If a sysroot is given, skip searching GCC_INSTALL_PREFIX as it is likely not valid for the provided sysroot. llvm-svn: 344901
-rw-r--r--clang/lib/Driver/ToolChains/Gnu.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index c397f05749e..77fb6513cd4 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1651,10 +1651,18 @@ Generic_GCC::GCCVersion Generic_GCC::GCCVersion::Parse(StringRef VersionText) {
return GoodVersion;
}
-static llvm::StringRef getGCCToolchainDir(const ArgList &Args) {
+static llvm::StringRef getGCCToolchainDir(const ArgList &Args,
+ llvm::StringRef SysRoot) {
const Arg *A = Args.getLastArg(clang::driver::options::OPT_gcc_toolchain);
if (A)
return A->getValue();
+
+ // If we have a SysRoot, ignore GCC_INSTALL_PREFIX.
+ // GCC_INSTALL_PREFIX specifies the gcc installation for the default
+ // sysroot and is likely not valid with a different sysroot.
+ if (!SysRoot.empty())
+ return "";
+
return GCC_INSTALL_PREFIX;
}
@@ -1686,7 +1694,7 @@ void Generic_GCC::GCCInstallationDetector::init(
SmallVector<std::string, 8> Prefixes(D.PrefixDirs.begin(),
D.PrefixDirs.end());
- StringRef GCCToolchainDir = getGCCToolchainDir(Args);
+ StringRef GCCToolchainDir = getGCCToolchainDir(Args, D.SysRoot);
if (GCCToolchainDir != "") {
if (GCCToolchainDir.back() == '/')
GCCToolchainDir = GCCToolchainDir.drop_back(); // remove the /
OpenPOWER on IntegriCloud