mbox series

[bpf-next,v2,0/6] tools/bpf: Enable cross-building with clang

Message ID 20211216163842.829836-1-jean-philippe@linaro.org (mailing list archive)
Headers show
Series tools/bpf: Enable cross-building with clang | expand

Message

Jean-Philippe Brucker Dec. 16, 2021, 4:38 p.m. UTC
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/

Jean-Philippe Brucker (6):
  tools: Help cross-building with clang
  tools/resolve_btfids: Support cross-building the kernel with clang
  tools/libbpf: Enable cross-building with clang
  bpftool: Enable cross-building with clang
  tools/runqslower: Enable cross-building with clang
  selftests/bpf: Enable cross-building with clang

 tools/bpf/bpftool/Makefile           | 13 +++++++------
 tools/bpf/resolve_btfids/Makefile    |  1 +
 tools/bpf/runqslower/Makefile        |  4 ++--
 tools/lib/bpf/Makefile               |  3 ++-
 tools/scripts/Makefile.include       | 13 ++++++++++++-
 tools/testing/selftests/bpf/Makefile |  8 ++++----
 6 files changed, 28 insertions(+), 14 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 16, 2021, 8:32 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu, 16 Dec 2021 16:38:37 +0000 you wrote:
> 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'.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2,1/6] tools: Help cross-building with clang
    https://git.kernel.org/bpf/bpf-next/c/cebdb7374577
  - [bpf-next,v2,2/6] tools/resolve_btfids: Support cross-building the kernel with clang
    https://git.kernel.org/bpf/bpf-next/c/bf1be903461a
  - [bpf-next,v2,3/6] tools/libbpf: Enable cross-building with clang
    https://git.kernel.org/bpf/bpf-next/c/4980beb4cda2
  - [bpf-next,v2,4/6] bpftool: Enable cross-building with clang
    https://git.kernel.org/bpf/bpf-next/c/bdadbb44c90a
  - [bpf-next,v2,5/6] tools/runqslower: Enable cross-building with clang
    https://git.kernel.org/bpf/bpf-next/c/bb7b75e860ee
  - [bpf-next,v2,6/6] selftests/bpf: Enable cross-building with clang
    https://git.kernel.org/bpf/bpf-next/c/ea79020a2d9e

You are awesome, thank you!