Skip to content

[clang][Driver] Fix Linux/sparc64 -m32 #98124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

rorth
Copy link
Collaborator

@rorth rorth commented Jul 9, 2024

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 20d497c 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` 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 20d497c 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`.
@rorth rorth added the clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' label Jul 9, 2024
@rorth rorth requested a review from MaskRay July 9, 2024 07:46
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2024

@llvm/pr-subscribers-clang-driver

Author: Rainer Orth (rorth)

Changes

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 20d497c 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.


Full diff: https://github.com/llvm/llvm-project/pull/98124.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+4-2)
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[] = {

@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2024

@llvm/pr-subscribers-clang

Author: Rainer Orth (rorth)

Changes

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 20d497c 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.


Full diff: https://github.com/llvm/llvm-project/pull/98124.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+4-2)
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[] = {

@rorth rorth merged commit 8d17824 into llvm:main Jul 10, 2024
10 checks passed
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
`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 20d497c 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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants