[PATCH] D49244: Always search sysroot for GCC installs

David Greene via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 12 08:36:12 PDT 2018


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()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49244.155191.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180712/87335a23/attachment.bin>


More information about the cfe-commits mailing list