forked from OSchip/llvm-project
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
This commit is contained in:
parent
e72a743740
commit
7eae99999d
|
@ -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 /
|
||||
|
|
Loading…
Reference in New Issue