greened created this revision.
greened added reviewers: rsmith, mcrosier, danalbert.
greened added a project: clang.
Herald added a subscriber: cfe-commits.

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.  Add sysroot to the list of paths to search, even if 
a gcc toolchain is provided with cmake or a command-line option.  The sysroot 
is searched after the provided install.


Repository:
  rC Clang

https://reviews.llvm.org/D49244

Files:
  lib/Driver/ToolChains/Gnu.cpp


Index: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1670,6 +1670,15 @@
       GCCToolchainDir = GCCToolchainDir.drop_back(); // remove the /
 
     Prefixes.push_back(GCCToolchainDir);
+
+    // If we have a SysRoot, try that too as GCCToolchainDir may not
+    // have support for the target.  This can happen, for example, if
+    // clang was configured with -DGCC_INSTALL_PREFIX and we run
+    // regression tests with --sysroot.
+    if (!D.SysRoot.empty()) {
+      Prefixes.push_back(D.SysRoot);
+      AddDefaultGCCPrefixes(TargetTriple, Prefixes, D.SysRoot);
+    }
   } else {
     // If we have a SysRoot, try that first.
     if (!D.SysRoot.empty()) {


Index: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -1670,6 +1670,15 @@
       GCCToolchainDir = GCCToolchainDir.drop_back(); // remove the /
 
     Prefixes.push_back(GCCToolchainDir);
+
+    // If we have a SysRoot, try that too as GCCToolchainDir may not
+    // have support for the target.  This can happen, for example, if
+    // clang was configured with -DGCC_INSTALL_PREFIX and we run
+    // regression tests with --sysroot.
+    if (!D.SysRoot.empty()) {
+      Prefixes.push_back(D.SysRoot);
+      AddDefaultGCCPrefixes(TargetTriple, Prefixes, D.SysRoot);
+    }
   } else {
     // If we have a SysRoot, try that first.
     if (!D.SysRoot.empty()) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to