From: Andrii Nakryiko Date: Thu, 16 Dec 2021 20:15:05 +0000 (-0800) Subject: Merge branch 'tools/bpf: Enable cross-building with clang' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1a6369ba624929c8bfa412045af79dbf7703b8c8;p=linux.git Merge branch 'tools/bpf: Enable cross-building with clang' Jean-Philippe Brucker says: ==================== Since v1 [1], I added Quentin's acks and applied Andrii's suggestions: * Pass CFLAGS to libbpf link in patch 3 * Substitute CLANG_CROSS_FLAGS whole in HOST_CFLAGS to avoid accidents, patch 4 Add support for cross-building BPF tools and selftests with clang, by passing LLVM=1 or CC=clang to make, as well as CROSS_COMPILE. A single clang toolchain can generate binaries for multiple architectures, so instead of having prefixes such as aarch64-linux-gnu-gcc, clang uses the -target parameter: `clang -target aarch64-linux-gnu'. Patch 1 adds the parameter in Makefile.include so tools can easily support this. Patch 2 prepares for the libbpf change from patch 3 (keep building resolve_btfids's libbpf in the host arch, when cross-building the kernel with clang). Patches 3-6 enable cross-building BPF tools with clang. [1] https://lore.kernel.org/bpf/20211122192019.1277299-1-jean-philippe@linaro.org/ ==================== Signed-off-by: Andrii Nakryiko --- 1a6369ba624929c8bfa412045af79dbf7703b8c8