OSDN Git Service

tools: Fix unavoidable GCC call in Clang builds
authorAdrian Ratiu <adrian.ratiu@collabora.com>
Tue, 8 Mar 2022 12:14:28 +0000 (14:14 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 8 Mar 2022 22:36:37 +0000 (23:36 +0100)
commit7fd9fd46a459272e641be78c1cc36baab1921fa1
tree77c749933c7d6d7c6740953128e2e257e5f0cc8a
parentd23a8720327d33616f584d76c80824bfa4699be6
tools: Fix unavoidable GCC call in Clang builds

In ChromeOS and Gentoo we catch any unwanted mixed Clang/LLVM
and GCC/binutils usage via toolchain wrappers which fail builds.
This has revealed that GCC is called unconditionally in Clang
configured builds to populate GCC_TOOLCHAIN_DIR.

Allow the user to override CLANG_CROSS_FLAGS to avoid the GCC
call - in our case we set the var directly in the ebuild recipe.

In theory Clang could be able to autodetect these settings so
this logic could be removed entirely, but in practice as the
commit cebdb7374577 ("tools: Help cross-building with clang")
mentions, this does not always work, so giving distributions
more control to specify their flags & sysroot is beneficial.

Suggested-by: Manoj Gupta <manojgupta@chromium.com>
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/lkml/87czjk4osi.fsf@ryzen9.i-did-not-set--mail-host-address--so-tickle-me
Link: https://lore.kernel.org/bpf/20220308121428.81735-1-adrian.ratiu@collabora.com
tools/scripts/Makefile.include