[clang] a077271 - Revert code change of D63497 & D74399 for riscv64-*-linux GCC detection

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 20 10:28:36 PDT 2021


Author: Fangrui Song
Date: 2021-09-20T10:28:32-07:00
New Revision: a07727199db0525e9d2df41e466a2a1611b3c8e1

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

LOG: Revert code change of D63497 & D74399 for riscv64-*-linux GCC detection

This partially reverts commits 1fc2a47f0b6c415312593e43489cf9ea2507d902 and 9816e726e747d72e0c5ac92aa20e652031a10448.

See D109727. Replacing config.guess in favor of {gcc,clang} -dumpmachine
can avoid the riscv64-{redhat,suse}-linux GCC detection.

Acked-by: Luís Marques <luismarques at lowrisc.org>

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 c28fe78dbf740..79bec347baad5 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2075,6 +2075,12 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
   // Declare a bunch of static data sets that we'll select between below. These
   // are specifically designed to always refer to string literals to avoid any
   // lifetime or initialization issues.
+  //
+  // The *Triples variables hard code some triples so that, for example,
+  // --target=aarch64 (incomplete triple) can detect lib/aarch64-linux-gnu.
+  // They are not needed when the user has correct LLVM_DEFAULT_TARGET_TRIPLE
+  // and always uses the full --target (e.g. --target=aarch64-linux-gnu).  The
+  // lists should shrink over time. Please don't add more elements to *Triples.
   static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
   static const char *const AArch64Triples[] = {
       "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
@@ -2182,9 +2188,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
   static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
   static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
                                                "riscv64-linux-gnu",
-                                               "riscv64-unknown-elf",
-                                               "riscv64-redhat-linux",
-                                               "riscv64-suse-linux"};
+                                               "riscv64-unknown-elf"};
 
   static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
   static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",


        


More information about the cfe-commits mailing list