[clang] 8d8a919 - [Driver] Drop $sysroot/usr special case from Gentoo gcc-config detection

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 11 10:13:07 PST 2021


Author: Fangrui Song
Date: 2021-03-11T10:13:01-08:00
New Revision: 8d8a9190db19b487198680adab9a6ca173f20bb3

URL: https://github.com/llvm/llvm-project/commit/8d8a9190db19b487198680adab9a6ca173f20bb3
DIFF: https://github.com/llvm/llvm-project/commit/8d8a9190db19b487198680adab9a6ca173f20bb3.diff

LOG: [Driver] Drop $sysroot/usr special case from Gentoo gcc-config detection

If --gcc-toolchain is specified, we should detect GCC installation there, and suppress other directories for detection.

Reviewed By: mgorny, manojgupta

Differential Revision: https://reviews.llvm.org/D97894

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 3d88053c6b08..fbf2f29e0514 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1934,13 +1934,10 @@ void Generic_GCC::GCCInstallationDetector::init(
       // Typically /usr.
       AddDefaultGCCPrefixes(TargetTriple, Prefixes, D.SysRoot);
     }
-  }
 
-  // Try to respect gcc-config on Gentoo. However, do that only
-  // if --gcc-toolchain is not provided or equal to the Gentoo install
-  // in /usr. This avoids accidentally enforcing the system GCC version
-  // when using a custom toolchain.
-  if (GCCToolchainDir == "" || GCCToolchainDir == D.SysRoot + "/usr") {
+    // Try to respect gcc-config on Gentoo if --gcc-toolchain is not provided.
+    // This avoids accidentally enforcing the system GCC version when using a
+    // custom toolchain.
     SmallVector<StringRef, 16> GentooTestTriples;
     // Try to match an exact triple as target triple first.
     // e.g. crossdev -S x86_64-gentoo-linux-gnu will install gcc libs for


        


More information about the cfe-commits mailing list