mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/4] tools build: Fixes for libbfd -lzstd dependency
@ 2026-09-09 20:41 Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 1/4] tools build: Add explicitly sequenced -lzstd to libbfd feature fallback Ian Rogers
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-09 20:41 UTC (permalink / raw)
  To: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers,
	Adrian Hunter, James Clark, Nick Terrell, David Sterba,
	Tomas Glozar, Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov,
	Leo Yan, linux-kernel, linux-perf-users
  Cc: bpf

This is a fuller set of patches from v1 addressing build problems
linking with libbfd when zstd is a dependency. The original issue was
exposed on Fedora with perf's build-test. This series separates the
build from the perf changes and adds in bpftool and objtool fixes
caught by Sashiko. The changes follow the pattern used by the zlib -lz
dependency and so appear correct but are untested.

v1: https://lore.kernel.org/linux-perf-users/20260909181030.1870496-1-irogers@google.com/

Ian Rogers (4):
  tools build: Add explicitly sequenced -lzstd to libbfd feature
    fallback
  perf build: Add explicitly sequenced -lzstd to libbfd feature fallback
  bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
  objtool: Add explicitly sequenced -lzstd to libopcodes fallback

 tools/bpf/bpftool/Makefile   |  4 ++++
 tools/build/Makefile.feature |  3 ++-
 tools/build/feature/Makefile | 12 +++++++++---
 tools/objtool/Makefile       |  3 ++-
 tools/perf/Makefile.config   |  3 +++
 5 files changed, 20 insertions(+), 5 deletions(-)

-- 
2.55.0.1003.g10538fe699-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4] tools build: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-09 20:41 [PATCH v2 0/4] tools build: Fixes for libbfd -lzstd dependency Ian Rogers
@ 2026-09-09 20:41 ` Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 2/4] perf " Ian Rogers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-09 20:41 UTC (permalink / raw)
  To: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers,
	Adrian Hunter, James Clark, Nick Terrell, David Sterba,
	Tomas Glozar, Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov,
	Leo Yan, linux-kernel, linux-perf-users
  Cc: bpf

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

Extend the testing cascade in tools/build/feature/Makefile to natively
probe for '-lz -lzstd' when the basic fallback variants fail. This adds
the generic framework for referencing static binutils across all tools.

Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
---
 tools/build/Makefile.feature |  3 ++-
 tools/build/feature/Makefile | 12 +++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 99eb0ea09537..1268ac6f130e 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -121,6 +121,7 @@ FEATURE_TESTS_EXTRA :=                  \
          libcheck                       \
          libbfd-liberty                 \
          libbfd-liberty-z               \
+         libbfd-liberty-z-zstd          \
          libopencsd                     \
          libperl                        \
          llvm                           \
@@ -161,7 +162,7 @@ FEATURE_DISPLAY ?=              \
 # Declare group members of a feature to display the logical OR of the detection
 # result instead of each member result.
 #
-FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z
+FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z libbfd-liberty-z-zstd
 
 #
 # Declare list of feature dependency packages that provide pkg-config files.
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 7d165018116a..410987df3a48 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -21,6 +21,7 @@ FILES=                                          \
          test-reallocarray.bin			\
          test-libbfd-liberty.bin                \
          test-libbfd-liberty-z.bin              \
+         test-libbfd-liberty-z-zstd.bin         \
          test-cplus-demangle.bin                \
          test-cxa-demangle.bin                  \
          test-libcap.bin			\
@@ -272,15 +273,17 @@ $(OUTPUT)test-libbfd.bin:
 	$(BUILD_BFD)
 
 $(OUTPUT)test-libbfd-threadsafe.bin:
-	$(BUILD_BFD) || $(BUILD_BFD) -liberty || $(BUILD_BFD) -liberty -lz
+	$(BUILD_BFD) || $(BUILD_BFD) -liberty || $(BUILD_BFD) -liberty -lz || $(BUILD_BFD) -liberty -lz -lzstd
 
 $(OUTPUT)test-disassembler-four-args.bin:
 	$(BUILD_BFD) -lopcodes || $(BUILD_BFD) -lopcodes -liberty || \
-	$(BUILD_BFD) -lopcodes -liberty -lz
+	$(BUILD_BFD) -lopcodes -liberty -lz || \
+	$(BUILD_BFD) -lopcodes -liberty -lz -lzstd
 
 $(OUTPUT)test-disassembler-init-styled.bin:
 	$(BUILD_BFD) -lopcodes || $(BUILD_BFD) -lopcodes -liberty || \
-	$(BUILD_BFD) -lopcodes -liberty -lz
+	$(BUILD_BFD) -lopcodes -liberty -lz || \
+	$(BUILD_BFD) -lopcodes -liberty -lz -lzstd
 
 $(OUTPUT)test-reallocarray.bin:
 	$(BUILD)
@@ -291,6 +294,9 @@ $(OUTPUT)test-libbfd-liberty.bin:
 $(OUTPUT)test-libbfd-liberty-z.bin:
 	$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
 
+$(OUTPUT)test-libbfd-liberty-z-zstd.bin:
+	$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz -lzstd
+
 $(OUTPUT)test-cplus-demangle.bin:
 	$(BUILD) -liberty
 
-- 
2.55.0.1003.g10538fe699-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4] perf build: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-09 20:41 [PATCH v2 0/4] tools build: Fixes for libbfd -lzstd dependency Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 1/4] tools build: Add explicitly sequenced -lzstd to libbfd feature fallback Ian Rogers
@ 2026-09-09 20:41 ` Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 3/4] bpftool: " Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback Ian Rogers
  3 siblings, 0 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-09 20:41 UTC (permalink / raw)
  To: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers,
	Adrian Hunter, James Clark, Nick Terrell, David Sterba,
	Tomas Glozar, Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov,
	Leo Yan, linux-kernel, linux-perf-users
  Cc: bpf

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

Since libbfd generally does not reliably distribute a .pc file for
pkg-config (e.g. 'binutils-dev' evaluates missing on standard PKG_CONFIG_PATH
checks), perf historically supplements manual linker flags in fallback
chains (-lbfd -ldl -liberty -lz).

Extend the testing cascade in tools/perf/Makefile.config to utilize the
newly introduced 'libbfd-liberty-z-zstd' feature test.

Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
---
 tools/perf/Makefile.config | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 4d5993da9f94..f589a461f4be 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -893,6 +893,7 @@ ifdef BUILD_NONDISTRO
   $(call feature_check,libbfd-threadsafe)
   $(call feature_check,libbfd-liberty)
   $(call feature_check,libbfd-liberty-z)
+  $(call feature_check,libbfd-liberty-z-zstd)
 
   ifneq ($(feature-libbfd-threadsafe), 1)
     $(error binutils-dev(el) 2.42 or later is required for non-distro builds)
@@ -906,6 +907,8 @@ ifdef BUILD_NONDISTRO
     EXTLIBS += -lbfd -lopcodes -liberty
   else ifeq ($(feature-libbfd-liberty-z), 1)
     EXTLIBS += -lbfd -lopcodes -liberty -lz
+  else ifeq ($(feature-libbfd-liberty-z-zstd), 1)
+    EXTLIBS += -lbfd -lopcodes -liberty -lz -lzstd
   endif
 
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
-- 
2.55.0.1003.g10538fe699-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-09 20:41 [PATCH v2 0/4] tools build: Fixes for libbfd -lzstd dependency Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 1/4] tools build: Add explicitly sequenced -lzstd to libbfd feature fallback Ian Rogers
  2026-09-09 20:41 ` [PATCH v2 2/4] perf " Ian Rogers
@ 2026-09-09 20:41 ` Ian Rogers
  2026-09-09 21:30   ` bot+bpf-ci
  2026-09-10  9:20   ` Quentin Monnet
  2026-09-09 20:41 ` [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback Ian Rogers
  3 siblings, 2 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-09 20:41 UTC (permalink / raw)
  To: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers,
	Adrian Hunter, James Clark, Nick Terrell, David Sterba,
	Tomas Glozar, Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov,
	Leo Yan, linux-kernel, linux-perf-users
  Cc: bpf

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

Extend the newly supplemented libbfd-liberty-z-zstd feature probe into
bpftool's Makefile so it can natively build against static binutils
distributions.

Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
---
 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.55.0.1003.g10538fe699-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback
  2026-09-09 20:41 [PATCH v2 0/4] tools build: Fixes for libbfd -lzstd dependency Ian Rogers
                   ` (2 preceding siblings ...)
  2026-09-09 20:41 ` [PATCH v2 3/4] bpftool: " Ian Rogers
@ 2026-09-09 20:41 ` Ian Rogers
  2026-09-09 21:30   ` bot+bpf-ci
  2026-09-09 22:06   ` Peter Zijlstra
  3 siblings, 2 replies; 11+ messages in thread
From: Ian Rogers @ 2026-09-09 20:41 UTC (permalink / raw)
  To: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers,
	Adrian Hunter, James Clark, Nick Terrell, David Sterba,
	Tomas Glozar, Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov,
	Leo Yan, linux-kernel, linux-perf-users
  Cc: bpf

Distributions like Fedora currently ship a statically compiled binutils
libbfd (an intrinsic dependency of libopcodes) that internally utilizes
zstd to decompress sections.

Because objtool resolves host dependencies sequentially via a manual HOSTCC
shell loop, build failures will occur (e.g. undefined reference to
'ZSTD_decompress') unless the loop probes for it.

Add the '-lopcodes -lbfd -liberty -lz -lzstd' combination to the fallback
chain, assuring successful compilation on hosts packaging static binutils.

Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
---
 tools/objtool/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index a4484fd22a96..141b957c566b 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -88,7 +88,8 @@ LIBOPCODES_LIBS := $(shell \
 	for libs in "-lopcodes" \
 		    "-lopcodes -lbfd" \
 		    "-lopcodes -lbfd -liberty" \
-		    "-lopcodes -lbfd -liberty -lz"; do \
+		    "-lopcodes -lbfd -liberty -lz" \
+		    "-lopcodes -lbfd -liberty -lz -lzstd"; do \
 		echo 'extern void disassemble_init_for_target(void *);' \
 		     'int main(void) { disassemble_init_for_target(0); return 0; }' | \
 			$(HOSTCC) -xc - -o /dev/null $$libs 2>/dev/null && \
-- 
2.55.0.1003.g10538fe699-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback
  2026-09-09 20:41 ` [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback Ian Rogers
@ 2026-09-09 21:30   ` bot+bpf-ci
  2026-09-09 22:06   ` Peter Zijlstra
  1 sibling, 0 replies; 11+ messages in thread
From: bot+bpf-ci @ 2026-09-09 21:30 UTC (permalink / raw)
  To: irogers, qmo, daniel, andrii, eddyz87, memxor, martin.lau, song,
	yonghong.song, jolsa, emil, ihor.solodrai, jpoimboe, peterz,
	mingo, acme, namhyung, irogers, adrian.hunter, james.clark,
	terrelln, dsterba, tglozar, costa.shul, mjeanson, 9erthalion6,
	leo.yan, linux-kernel, linux-perf-users
  Cc: bpf, ast, andrii, daniel, martin.lau, eddyz87, yonghong.song,
	mason, ihor.solodrai

[-- Attachment #1: Type: text/plain, Size: 2238 bytes --]

> commit 1f030996083bc0f6f03bca8dc04fe12feb66957d
> Author: Ian Rogers <irogers@google.com>
> Date:   Wed Sep 9 13:41:22 2026 -0700
>
>     objtool: Add explicitly sequenced -lzstd to libopcodes fallback
>
>     Distributions like Fedora currently ship a statically compiled binutils
>     libbfd (an intrinsic dependency of libopcodes) that internally utilizes
>     zstd to decompress sections.
>
>     Because objtool resolves host dependencies sequentially via a manual HOSTCC
>     shell loop, build failures will occur (e.g. undefined reference to
>     'ZSTD_decompress') unless the loop probes for it.
>
>     Add the '-lopcodes -lbfd -liberty -lz -lzstd' combination to the fallback
>     chain, assuring successful compilation on hosts packaging static binutils.

This isn't a bug, but could the changelog say the new candidate mirrors the
existing -lz fallback (and note it is untested, as the cover letter does)
rather than stating it assures a successful build?

>     Signed-off-by: Ian Rogers <irogers@google.com>
>     Assisted-by: Antigravity:gemini-3.1-pro
>
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index a4484fd22a96..141b957c566b 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -88,7 +88,8 @@ LIBOPCODES_LIBS := $(shell \
>  	for libs in "-lopcodes" \
>  		    "-lopcodes -lbfd" \
>  		    "-lopcodes -lbfd -liberty" \
> -		    "-lopcodes -lbfd -liberty -lz"; do \
> +		    "-lopcodes -lbfd -liberty -lz" \
> +		    "-lopcodes -lbfd -liberty -lz -lzstd"; do \
>  		echo 'extern void disassemble_init_for_target(void *);' \
>  		     'int main(void) { disassemble_init_for_target(0); return 0; }' | \
>  			$(HOSTCC) -xc - -o /dev/null $$libs 2>/dev/null && \

This isn't a bug, but should the comment above the loop also mention libzstd,
so the documented dependency list still matches the candidates below it? The
comment currently says "libbfd, libiberty, and sometimes libz" but the new
candidate includes libzstd as well.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/34404437407

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-09 20:41 ` [PATCH v2 3/4] bpftool: " Ian Rogers
@ 2026-09-09 21:30   ` bot+bpf-ci
  2026-09-10  9:20   ` Quentin Monnet
  1 sibling, 0 replies; 11+ messages in thread
From: bot+bpf-ci @ 2026-09-09 21:30 UTC (permalink / raw)
  To: irogers, qmo, daniel, andrii, eddyz87, memxor, martin.lau, song,
	yonghong.song, jolsa, emil, ihor.solodrai, jpoimboe, peterz,
	mingo, acme, namhyung, irogers, adrian.hunter, james.clark,
	terrelln, dsterba, tglozar, costa.shul, mjeanson, 9erthalion6,
	leo.yan, linux-kernel, linux-perf-users
  Cc: bpf, ast, andrii, daniel, martin.lau, eddyz87, yonghong.song,
	mason, ihor.solodrai

[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]

> bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
>
> Distributions like Fedora currently ship a statically compiled binutils
> libbfd that natively depends on zstd to decompress sections (e.g.
> undefined reference to 'ZSTD_decompress').
>
> Extend the newly supplemented libbfd-liberty-z-zstd feature probe into
> bpftool's Makefile so it can natively build against static binutils
> distributions.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> Assisted-by: Antigravity:gemini-3.1-pro

This isn't a bug, but the subject line uses the phrase "explicitly
sequenced" which doesn't appear to describe what the patch does. Looking at
the diff, the patch adds libbfd-liberty-z-zstd to FEATURE_TESTS and
FEATURE_DISPLAY, then appends a new fallback branch with '-lz -lzstd' to
the existing cascade.

Similarly, "Extend the newly supplemented ... probe into bpftool's Makefile"
is a bit indirect. The patch adds the probe to FEATURE_TESTS and appends the
matching link flags to the fallback chain.

Also, "natively" appears twice ("natively depends on zstd", "natively build
against static binutils") but doesn't add meaning to either phrase.

Would a more direct subject such as "bpftool: Use libbfd-liberty-z-zstd
feature in the libbfd fallback chain" describe the change more clearly, and
could the body state simply that the new probe is added to FEATURE_TESTS
and a matching '-lz -lzstd' branch appended to the fallback?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/34404437407

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback
  2026-09-09 20:41 ` [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback Ian Rogers
  2026-09-09 21:30   ` bot+bpf-ci
@ 2026-09-09 22:06   ` Peter Zijlstra
  1 sibling, 0 replies; 11+ messages in thread
From: Peter Zijlstra @ 2026-09-09 22:06 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Quentin Monnet, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Josh Poimboeuf, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter,
	James Clark, Nick Terrell, David Sterba, Tomas Glozar,
	Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov, Leo Yan,
	linux-kernel, linux-perf-users, bpf

On Wed, Sep 09, 2026 at 01:41:22PM -0700, Ian Rogers wrote:
> Distributions like Fedora currently ship a statically compiled binutils
> libbfd (an intrinsic dependency of libopcodes) that internally utilizes
> zstd to decompress sections.
> 
> Because objtool resolves host dependencies sequentially via a manual HOSTCC
> shell loop, build failures will occur (e.g. undefined reference to
> 'ZSTD_decompress') unless the loop probes for it.
> 
> Add the '-lopcodes -lbfd -liberty -lz -lzstd' combination to the fallback
> chain, assuring successful compilation on hosts packaging static binutils.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> Assisted-by: Antigravity:gemini-3.1-pro

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  tools/objtool/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index a4484fd22a96..141b957c566b 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -88,7 +88,8 @@ LIBOPCODES_LIBS := $(shell \
>  	for libs in "-lopcodes" \
>  		    "-lopcodes -lbfd" \
>  		    "-lopcodes -lbfd -liberty" \
> -		    "-lopcodes -lbfd -liberty -lz"; do \
> +		    "-lopcodes -lbfd -liberty -lz" \
> +		    "-lopcodes -lbfd -liberty -lz -lzstd"; do \
>  		echo 'extern void disassemble_init_for_target(void *);' \
>  		     'int main(void) { disassemble_init_for_target(0); return 0; }' | \
>  			$(HOSTCC) -xc - -o /dev/null $$libs 2>/dev/null && \
> -- 
> 2.55.0.1003.g10538fe699-goog
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-09 20:41 ` [PATCH v2 3/4] bpftool: " Ian Rogers
  2026-09-09 21:30   ` bot+bpf-ci
@ 2026-09-10  9:20   ` Quentin Monnet
  2026-09-10 15:37     ` Ian Rogers
  1 sibling, 1 reply; 11+ messages in thread
From: Quentin Monnet @ 2026-09-10  9:20 UTC (permalink / raw)
  To: Ian Rogers, Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Martin KaFai Lau, Song Liu,
	Yonghong Song, Jiri Olsa, Emil Tsalapatis, Ihor Solodrai,
	Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter,
	James Clark, Nick Terrell, David Sterba, Tomas Glozar,
	Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov, Leo Yan,
	linux-kernel, linux-perf-users
  Cc: bpf

On 09/09/2026 21:41, Ian Rogers wrote:
> Distributions like Fedora currently ship a statically compiled binutils
> libbfd that natively depends on zstd to decompress sections (e.g.
> undefined reference to 'ZSTD_decompress').
> 
> Extend the newly supplemented libbfd-liberty-z-zstd feature probe into
> bpftool's Makefile so it can natively build against static binutils
> distributions.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> Assisted-by: Antigravity:gemini-3.1-pro
> ---
>  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


Hi Ian, thanks for this!

Just checking: my understanding is that if libbfd depends on libzstd,
then it always also depends on zlib, so we never need to check some
variant such as "feature-libbfd-liberty-zstd" (without the "-z"), is
this correct?

Quentin

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-10  9:20   ` Quentin Monnet
@ 2026-09-10 15:37     ` Ian Rogers
  2026-09-10 19:53       ` Quentin Monnet
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Rogers @ 2026-09-10 15:37 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Martin KaFai Lau, Song Liu,
	Yonghong Song, Jiri Olsa, Emil Tsalapatis, Ihor Solodrai,
	Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter,
	James Clark, Nick Terrell, David Sterba, Tomas Glozar,
	Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov, Leo Yan,
	linux-kernel, linux-perf-users, bpf

On Thu, Sep 10, 2026 at 2:20 AM Quentin Monnet <qmo@kernel.org> wrote:
>
> On 09/09/2026 21:41, Ian Rogers wrote:
> > Distributions like Fedora currently ship a statically compiled binutils
> > libbfd that natively depends on zstd to decompress sections (e.g.
> > undefined reference to 'ZSTD_decompress').
> >
> > Extend the newly supplemented libbfd-liberty-z-zstd feature probe into
> > bpftool's Makefile so it can natively build against static binutils
> > distributions.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > Assisted-by: Antigravity:gemini-3.1-pro
> > ---
> >  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
>
>
> Hi Ian, thanks for this!
>
> Just checking: my understanding is that if libbfd depends on libzstd,
> then it always also depends on zlib, so we never need to check some
> variant such as "feature-libbfd-liberty-zstd" (without the "-z"), is
> this correct?

Hi,

You make a good point. Normally we want to use pkg-config to get the
libraries necessary for a dependency. Unfortunately pkg-config is
generally broken around binutils/libbfd. This is why we have all of
these tests to determine the list of libraries we need to link with
libbfd for things to work, which pkg-config normally provides. It is
perfectly possible to build libbfd with libzstd and without libz, but
currently, we haven't encountered a distribution doing this. I can
imagine a memory hardened future where libz has become zlib-rs that
conveniently provides C headers.

For perf we don't build with binutils by default; this matter is only
an issue for our build tests. We don't depend on libbfd because its
GPLv3+ license isn't compatible with perf's GPLv2 license, which would
create an undistributable binary. This isn't an issue for bpftool
because its BSD 2-clause license is compatible with libbfd. In perf
we've been replacing libbfd based functionality with that in elfutils.
libLLVM is another consideration, but it's generally too heavyweight
for the effort to be worthwhile (it is generally large, distributions
don't want a dependency on it, and it runs many initialization hooks
at startup that don't benefit perf). Hopefully elfutils can provide a
stable API for its disassembler (libasm) as that would cover pretty
much everything perf needs without requiring us to fork objdump, use
libcapstone or use libLLVM.

Anyway, we could add another flavor (zstd without libz) to the feature
tests for libbfd but since this isn't currently an issue I think we
can cross our fingers for binutils to fix pkg-config or for other
tools in the kernel, like perf, to migrate away from the use of
libbfd. If we add every flavor of libbfd's dependencies, it feels like
a lot of build clutter (imo) and I don't know where we stop.

Thanks,
Ian

> Quentin

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4] bpftool: Add explicitly sequenced -lzstd to libbfd feature fallback
  2026-09-10 15:37     ` Ian Rogers
@ 2026-09-10 19:53       ` Quentin Monnet
  0 siblings, 0 replies; 11+ messages in thread
From: Quentin Monnet @ 2026-09-10 19:53 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Daniel Borkmann, Andrii Nakryiko, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Martin KaFai Lau, Song Liu,
	Yonghong Song, Jiri Olsa, Emil Tsalapatis, Ihor Solodrai,
	Josh Poimboeuf, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter,
	James Clark, Nick Terrell, David Sterba, Tomas Glozar,
	Costa Shulyupin, Michael Jeanson, Dmitrii Dolgov, Leo Yan,
	linux-kernel, linux-perf-users, bpf

2026-09-10 08:37 UTC-0700 ~ Ian Rogers <irogers@google.com>
> On Thu, Sep 10, 2026 at 2:20 AM Quentin Monnet <qmo@kernel.org> wrote:
>>
>> On 09/09/2026 21:41, Ian Rogers wrote:
>>> Distributions like Fedora currently ship a statically compiled binutils
>>> libbfd that natively depends on zstd to decompress sections (e.g.
>>> undefined reference to 'ZSTD_decompress').
>>>
>>> Extend the newly supplemented libbfd-liberty-z-zstd feature probe into
>>> bpftool's Makefile so it can natively build against static binutils
>>> distributions.
>>>
>>> Signed-off-by: Ian Rogers <irogers@google.com>
>>> Assisted-by: Antigravity:gemini-3.1-pro
>>> ---
>>>  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
>>
>>
>> Hi Ian, thanks for this!
>>
>> Just checking: my understanding is that if libbfd depends on libzstd,
>> then it always also depends on zlib, so we never need to check some
>> variant such as "feature-libbfd-liberty-zstd" (without the "-z"), is
>> this correct?
> 
> Hi,
> 
> You make a good point. Normally we want to use pkg-config to get the
> libraries necessary for a dependency. Unfortunately pkg-config is
> generally broken around binutils/libbfd. This is why we have all of
> these tests to determine the list of libraries we need to link with
> libbfd for things to work, which pkg-config normally provides. It is
> perfectly possible to build libbfd with libzstd and without libz, but
> currently, we haven't encountered a distribution doing this. I can
> imagine a memory hardened future where libz has become zlib-rs that
> conveniently provides C headers.
> 
> For perf we don't build with binutils by default; this matter is only
> an issue for our build tests. We don't depend on libbfd because its
> GPLv3+ license isn't compatible with perf's GPLv2 license, which would
> create an undistributable binary. This isn't an issue for bpftool
> because its BSD 2-clause license is compatible with libbfd. In perf


We still have some issues for bpftool related to libbfd: for Debian
packaging, building against the shared libbfd is "Not Allowed" [0]. This
was one of the motivations for introducing the use of LLVM as an
alternative dependency. I didn't know elfutils offered a similar
feature, I should look into it.

[0] https://packages.debian.org/sid/amd64/binutils-dev


> we've been replacing libbfd based functionality with that in elfutils.
> libLLVM is another consideration, but it's generally too heavyweight
> for the effort to be worthwhile (it is generally large, distributions
> don't want a dependency on it, and it runs many initialization hooks
> at startup that don't benefit perf). Hopefully elfutils can provide a
> stable API for its disassembler (libasm) as that would cover pretty
> much everything perf needs without requiring us to fork objdump, use
> libcapstone or use libLLVM.
> 
> Anyway, we could add another flavor (zstd without libz) to the feature
> tests for libbfd but since this isn't currently an issue I think we
> can cross our fingers for binutils to fix pkg-config or for other
> tools in the kernel, like perf, to migrate away from the use of
> libbfd. If we add every flavor of libbfd's dependencies, it feels like
> a lot of build clutter (imo) and I don't know where we stop.


Thanks for all the context, very much appreciated! I agree, sticking to
the zlib + zstd variant sounds like a good option for now, thanks.

Acked-by: Quentin Monnet <qmo@kernel.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-09-10 19:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 20:41 [PATCH v2 0/4] tools build: Fixes for libbfd -lzstd dependency Ian Rogers
2026-09-09 20:41 ` [PATCH v2 1/4] tools build: Add explicitly sequenced -lzstd to libbfd feature fallback Ian Rogers
2026-09-09 20:41 ` [PATCH v2 2/4] perf " Ian Rogers
2026-09-09 20:41 ` [PATCH v2 3/4] bpftool: " Ian Rogers
2026-09-09 21:30   ` bot+bpf-ci
2026-09-10  9:20   ` Quentin Monnet
2026-09-10 15:37     ` Ian Rogers
2026-09-10 19:53       ` Quentin Monnet
2026-09-09 20:41 ` [PATCH v2 4/4] objtool: Add explicitly sequenced -lzstd to libopcodes fallback Ian Rogers
2026-09-09 21:30   ` bot+bpf-ci
2026-09-09 22:06   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®