Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/resolve_btfids: Support cross-building the kernel with clang

The CROSS_COMPILE variable may be present during resolve_btfids build if
the kernel is being cross-built. Since resolve_btfids is always executed
on the host, we set CC to HOSTCC in order to use the host toolchain when
cross-building with GCC. But instead of a toolchain prefix, cross-build
with clang uses a "-target" parameter, which Makefile.include deduces
from the CROSS_COMPILE variable. In order to avoid cross-building
libbpf, clear CROSS_COMPILE before building resolve_btfids.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20211216163842.829836-3-jean-philippe@linaro.org

authored by

Jean-Philippe Brucker and committed by
Andrii Nakryiko
bf1be903 cebdb737

+1
+1
tools/bpf/resolve_btfids/Makefile
··· 19 19 LD = $(HOSTLD) 20 20 ARCH = $(HOSTARCH) 21 21 RM ?= rm 22 + CROSS_COMPILE = 22 23 23 24 OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ 24 25