[clang] [Driver] Teach Barmetal toolchain about GCC installation (PR #121829)

Peter Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 24 03:39:10 PDT 2025


================
@@ -110,20 +110,81 @@ static std::string computeBaseSysRoot(const Driver &D, bool IncludeTriple) {
   return std::string(SysRootDir);
 }
 
+static bool hasGCCToolChainAlongSideClang(const Driver &D) {
----------------
smithp35 wrote:

> I am not aware if there is any common file that is really GCC specific. Pls do let me know if there is such a file or any other feedback/comments on how this can be handled better in general.

I don't think there's a single common file that is unique to GCC.

Stepping back a bit, there's a bit of the logic/use-case in `computeSysRoot` that I don't understand. When we find a GCC ToolChain alongside clang, I don't see any logic to validate it. There is code later on in `BareMetal::BareMetal` to use the GNU multilib detection only if the GCC installation is valid.

Is the intention here to find a valid GCC installation equivalent to the  `-gcc-install-dir` or `--gcc-toolchain`, or something else? For example this could be an equivalent to `lib/clang-runtimes` although in that case it wouldn't necessarily be a GCC installation.

If the intention is to find a valid installation then can we borrow some of the logic from the `GCCInstallation`?


https://github.com/llvm/llvm-project/pull/121829


More information about the cfe-commits mailing list