[clang] 8d17824 - [clang][Driver] Fix Linux/sparc64 -m32 (#98124)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 10 01:29:04 PDT 2024


Author: Rainer Orth
Date: 2024-07-10T10:29:00+02:00
New Revision: 8d17824890f668cca654a6b821d642bd3192dc81

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

LOG: [clang][Driver] Fix Linux/sparc64 -m32 (#98124)

`clang` currently fails to find a GCC installation on Linux/sparc64 with
`-m32`. `strace` reveals that `clang` tries to access
`/usr/lib/gcc/sparcv9-linux-gnu` (which doesn't exist) instead of
`/usr/lib/gcc/sparc64-linux-gnu`.

It turns out that 20d497c26fc95c80a1bacb38820d92e5f52bec58 was overeager
in removing some of the necessary directories.

Fixed by reverting the Linux/sparc* part of the patch.

Tested on `sparc64-unknown-linux-gnu`.

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 d2a26c8091c48..52c2ee90b1b28 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2564,9 +2564,11 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
                                                "riscv64-unknown-elf"};
 
   static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
-  static const char *const SPARCv8Triples[] = {"sparcv8-linux-gnu"};
+  static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
+                                               "sparcv8-linux-gnu"};
   static const char *const SPARCv9LibDirs[] = {"/lib64", "/lib"};
-  static const char *const SPARCv9Triples[] = {"sparcv9-linux-gnu"};
+  static const char *const SPARCv9Triples[] = {"sparc64-linux-gnu",
+                                               "sparcv9-linux-gnu"};
 
   static const char *const SystemZLibDirs[] = {"/lib64", "/lib"};
   static const char *const SystemZTriples[] = {


        


More information about the cfe-commits mailing list