[clang] [clang][Driver] Fix Linux/sparc64 -m32 (PR #98124)
Rainer Orth via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 00:46:31 PDT 2024
https://github.com/rorth created https://github.com/llvm/llvm-project/pull/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`.
>From 0cfc30c6db46bf61e496824afda7f11b69e2d8ff Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro at gcc.gnu.org>
Date: Tue, 9 Jul 2024 09:43:56 +0200
Subject: [PATCH] [clang][Driver] Fix Linux/sparc64 -m32
`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`.
---
clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index b141e5f2adfab..ff5e4022a2763 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2563,9 +2563,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