summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJean-Philippe Brucker <jean-philippe@linaro.org>2022-02-01 10:31:20 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2022-02-01 23:04:12 +0100
commitb7892f7d5cb2b8187c603dd8ea3a7c44059ccfc2 (patch)
tree4fc170e24f566a4c27d1c38c2090dee22d2268c6 /tools
parenttools headers UAPI: remove stale lirc.h (diff)
downloadlinux-b7892f7d5cb2b8187c603dd8ea3a7c44059ccfc2.tar.xz
linux-b7892f7d5cb2b8187c603dd8ea3a7c44059ccfc2.zip
tools: Ignore errors from `which' when searching a GCC toolchain
When cross-building tools with clang, we run `which $(CROSS_COMPILE)gcc` to detect whether a GCC toolchain provides the standard libraries. It is only a helper because some distros put libraries where LLVM does not automatically find them. On other systems, LLVM detects the libc automatically and does not need this. There, it is completely fine not to have a GCC at all, but some versions of `which' display an error when the command is not found: which: no aarch64-linux-gnu-gcc in ($PATH) Since the error can safely be ignored, throw it to /dev/null. Fixes: cebdb7374577 ("tools: Help cross-building with clang") Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/bpf/20220201093119.1713207-1-jean-philippe@linaro.org
Diffstat (limited to 'tools')
-rw-r--r--tools/scripts/Makefile.include2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index b0be5f40a3f1..79d102304470 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -90,7 +90,7 @@ EXTRA_WARNINGS += -Wstrict-aliasing=3
else ifneq ($(CROSS_COMPILE),)
CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
-GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc))
+GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
ifneq ($(GCC_TOOLCHAIN_DIR),)
CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot)