https://github.com/etiennemlb created 
https://github.com/llvm/llvm-project/pull/178459

Adding these additional paths to mitigate tedious environment hoops (config, 
flags injection in wrappers) in RHEL-based distros with GCC 14 & 15 toolset.

Current toolsets:
https://pkgs.org/search/?q=gcc-toolset

Reasoning:

In High Performance Computing (HPC) site, people often have to deal with 
multiple Clang LLVM forks (AMD, Intel, or vanilla LLVM). Current upstream clang 
supports gcc toolset by default up to version 13 since only 3 weeks ago 
(https://github.com/llvm/llvm-project/commit/7c5eb6ab0cbfeb29f980c8fa17c0ee3ca5270984).
 Now the first GCC 14 was released in may 2024 
(https://developers.redhat.com/articles/2024/05/15/new-c-features-gcc-14). 
Until this commit 
https://github.com/llvm/llvm-project/commit/4a5184f4c357eeafcced3371cd8539fa0ac9f24d,
 search was automatic (Tough broken according to the author).

The result is that HPC admin, which dont always know/understand the subtle 
details of toolchain interaction, install new RHEL gcc tool set without 
ensuring that the clang fork they also install will use them (either via the 
gcc-toolchain flag injected in wrappers or via a cfg). 

In addition, while Intel seems to keep up with upstream LLVM, AMD is a bit 
behind 
(https://github.com/ROCm/llvm-project/blob/9abbec66bfa34922521ef88fad1d6fcd43c1c462/clang/lib/Driver/ToolChains/Gnu.cpp#L2298).
 So we end up with say, the system installed Clang/LLVM@v17, finding the GCC 
toolset 13, but the recent amdclang (ROCm 7) finding only gcc-toolset-12.

>From 2cfa4e3a0ebb8ce1d76a18efbdd28ea6fe1c0ebe Mon Sep 17 00:00:00 2001
From: Etienne Malaboeuf <[email protected]>
Date: Wed, 28 Jan 2026 17:08:57 +0100
Subject: [PATCH] [Clang][Driver] Add gcc-14 & gcc-15 toolset path on RHEL

Adding these additional paths to mitigate tidious environment hoops
(config, flags injection in wrappers) in RHEL-based distros with GCC 14
& 15 toolset.
---
 clang/lib/Driver/ToolChains/Gnu.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index ac31a45b557f1..50e70e6d71e1b 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2298,6 +2298,8 @@ void 
Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
       D.getVFS().exists("/opt/rh")) {
     // TODO: We may want to remove this, since the functionality
     //   can be achieved using config files.
+    Prefixes.push_back("/opt/rh/gcc-toolset-15/root/usr");
+    Prefixes.push_back("/opt/rh/gcc-toolset-14/root/usr");
     Prefixes.push_back("/opt/rh/gcc-toolset-13/root/usr");
     Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr");
     Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr");

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to