GDB is buildable with LLVM/Clang but uses a GCC_FOR_TARGET variable in its configure.ac (in the root of the binutils-gdb repo) which defaults to gcc and is the only thing causing mixed compiler usage in an otherwise pure LLVM/Clang build. A quick hack which I did in the binutils-gdb repo and works to remove the hardcoded GCC call: diff --git a/configure.ac b/configure.ac index 7c0c03317ff..bc46c700665 100644 --- a/configure.ac +++ b/configure.ac @@ -3393,7 +3393,7 @@ AC_ARG_WITH([build-time-tools], NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc) NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx) -NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) +NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, clang gcc, ${CC_FOR_TARGET}) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) But this is undesirable for a number of reasons, so I think it would be best to just set something like the following in the GDB ebuild to ensure the correct compiler is used: export GCC_FOR_TARGET="$(tc-getCC)" Reproducible: Always Steps to Reproduce: I have some local GCC/binutils tools wrappers which fail the build if they get called in LLVM/Clang configured builds. Actual Results: Both GCC & Clang are used Expected Results: Only one compiler should be used, in this case Clang.
Preference might be to do sommething like ${CC_FOR_TARGET:-$(tc-getCC)} (notably we only have tc-getTARGET_CPP in toolchain-funcs.eclass!)
Thank you @Sam, I tested & created a PR with your suggestion.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdc76112c33f0cc7606a88be8e3d4c7498b29cc7 commit bdc76112c33f0cc7606a88be8e3d4c7498b29cc7 Author: Adrian Ratiu <adrian.ratiu@collabora.com> AuthorDate: 2022-01-14 17:42:24 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-01-14 18:47:03 +0000 sys-devel/gdb: fix GCC/Clang build mixture GDB configure will use a mix of GCC and Clang due to $GCC_FOR_TARGET defaulting to GCC in Clang-configured builds, so set the var to ensure the proper compilers are detected and to avoid mixing them. Before setting the variable (example from ChromiumOS): checking for x86_64-cros-linux-gnu-gcc... x86_64-cros-linux-gnu-gcc After: checking for gcc... (cached) x86_64-cros-linux-gnu-clang Bug: https://bugs.gentoo.org/831202 Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Closes: https://github.com/gentoo/gentoo/pull/23796 Signed-off-by: Sam James <sam@gentoo.org> sys-devel/gdb/gdb-10.2-r1.ebuild | 3 +++ sys-devel/gdb/gdb-11.1.ebuild | 3 +++ sys-devel/gdb/gdb-9999.ebuild | 3 +++ 3 files changed, 9 insertions(+)
Pff, I forgot to change s/Bug:/Closes:/ in the commit again! Thanks!