Re: [RFC PATCH v1 3/3] bpftool: Prefer zlib-rs over zlib when available
From: Quentin Monnet
Date: Thu Oct 29 2026 - 20:15:49 EST
2026-10-29 09:29 UTC-0700 ~ Ian Rogers <irogers@xxxxxxxxxx>
> Add zlib-rs and zlib to FEATURE_TESTS and FEATURE_DISPLAY in
> tools/bpf/bpftool/Makefile and use feature_rust_lib to configure
> ZLIB_CFLAGS and ZLIB_LIBS when zlib-rs is detected, falling back to -lz.
Hi Ian, bpftool doesn't make an intensive use of zlib (mostly, it's a
requirement from other dependencies; we may also use it to unzip the
kernel config on the host if necessary for probing BPF features on the
system, but only on some distributions). So I'm struggling to understand
the motivation for your proposal, what do we gain by switching to
zlib-rs when available? I understand this implementation is in Rust, but
I'm not sure the added complexity and feature probing in the build
system is worth it.
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> ---
> tools/bpf/bpftool/.gitignore | 1 +
> tools/bpf/bpftool/Makefile | 56 ++++++++++++++++++++++++++++++++----
> 2 files changed, 51 insertions(+), 6 deletions(-)
>
> diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore
> index a736f64dc5dc..ea2222373634 100644
> --- a/tools/bpf/bpftool/.gitignore
> +++ b/tools/bpf/bpftool/.gitignore
> @@ -6,5 +6,6 @@ bpftool*.8
> FEATURE-DUMP.bpftool
> feature
> libbpf
> +libz_rs
> /*.skel.h
> /vmlinux.h
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index b0f7168e7943..a193cf89a034 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -1,5 +1,6 @@
> # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> include ../../scripts/Makefile.include
> +include ../../scripts/Makefile.arch
Looking at the GitHub mirror repository for bpftool, I'd avoid including
this additional Makefile if I could.
Thanks,
Quentin