[PATCH v3 3/4] bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback

From: Ian Rogers

Date: Tue Nov 03 2026 - 23:32:32 EST


Distributions like Fedora ship a statically compiled binutils libbfd
that depends on zstd to decompress sections (e.g. undefined reference to
'ZSTD_decompress').

Add libbfd-liberty-z-zstd to FEATURE_TESTS and FEATURE_DISPLAY in
tools/bpf/bpftool/Makefile and append the '-lbfd -ldl -lopcodes -liberty
-lz -lzstd' branch to the libbfd fallback chain.

Acked-by: Quentin Monnet <qmo@xxxxxxxxxx>
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/bpf/bpftool/Makefile | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index b0f7168e7943..1cac4508eb0c 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -125,6 +125,7 @@ FEATURE_TESTS += libcap
FEATURE_TESTS += libbfd
FEATURE_TESTS += libbfd-liberty
FEATURE_TESTS += libbfd-liberty-z
+FEATURE_TESTS += libbfd-liberty-z-zstd
FEATURE_TESTS += disassembler-four-args
FEATURE_TESTS += disassembler-init-styled
FEATURE_TESTS += libelf-zstd
@@ -135,6 +136,7 @@ FEATURE_DISPLAY += libcap
FEATURE_DISPLAY += libbfd
FEATURE_DISPLAY += libbfd-liberty
FEATURE_DISPLAY += libbfd-liberty-z
+FEATURE_DISPLAY += libbfd-liberty-z-zstd
endif

check_feat := 1
@@ -201,6 +203,8 @@ else
LIBS += -lbfd -ldl -lopcodes -liberty
else ifeq ($(feature-libbfd-liberty-z),1)
LIBS += -lbfd -ldl -lopcodes -liberty -lz
+ else ifeq ($(feature-libbfd-liberty-z-zstd),1)
+ LIBS += -lbfd -ldl -lopcodes -liberty -lz -lzstd
endif

# If one of the above feature combinations is set, we support libbfd
--
2.56.0.385.gac671c819a-goog