Re: [PATCH bpf-next v1 01/14] selftests/bpf: Pass through build flags to bpftool and resolve_btfids

From: Alexei Starovoitov

Date: Wed Feb 11 2026 - 21:39:59 EST


On Wed, Feb 11, 2026 at 5:14 PM Ihor Solodrai <ihor.solodrai@xxxxxxxxx> wrote:
>
> EXTRA_* and SAN_* build flags were not correctly propagated to bpftool
> and resolve_btids when building selftests/bpf. This led to various
> build errors on attempt to build with SAN_CFLAGS="-fsanitize=address",
> for example.
>
> Fix the makefiles to address this:
> - Pass SAN_CFLAGS/SAN_LDFLAGS to bpftool and resolve_btfids build
> - Propagate EXTRA_LDFLAGS to resolve_btfids link command
> - Use pkg-config to detect zlib and zstd for resolve_btfids, similar
> libelf handling
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
> ---
> tools/bpf/resolve_btfids/Makefile | 7 +++++--
> tools/testing/selftests/bpf/Makefile | 9 +++++----
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index 1733a6e93a07..ef083602b73a 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -65,6 +65,9 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
> LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
> LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
>
> +ZLIB_LIBS := $(shell $(HOSTPKG_CONFIG) zlib --libs 2>/dev/null || echo -lz)
> +ZSTD_LIBS := $(shell $(HOSTPKG_CONFIG) libzstd --libs 2>/dev/null || echo -lzstd)

The first two patches look serious enough and justify going to bpf tree.
The rest can probably go via bpf as well, since we're early
in the merge window.
Would be great to have some Acks first though.

Why add zstd here? It's not used by resolve_btfid. Why add it?