From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Jiri Olsa" <jolsa@kernel.org>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Quentin Monnet" <qmo@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>
Cc: "Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
linux-perf-users@vger.kernel.org, bpf@vger.kernel.org,
linux-kbuild@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/3] perf build: Prefer zlib-rs over zlib when available
Date: Fri, 30 Oct 2026 20:46:23 +0000 [thread overview]
Message-ID: <sashiko-outbox-191493@kernel.org> (raw)
In-Reply-To: <20261030202710.3863806-3-irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf build: missing -lz in BUILD_NONDISTRO when NO_ZLIB=1
--
commit db3abd69d02d2d4c46341fce54f1b1da8d6457de
Author: Ian Rogers <irogers@google.com>
perf build: Prefer zlib-rs over zlib when available
This commit detects and prefers zlib-rs over C zlib in the perf build unless
disabled with NO_ZLIB_RS=1, NO_ZLIB=1, or NO_RUST=1. It also integrates
libz_rs.a into the perf and bootstrap bpftool build rules and exposes zlib-rs
in perf check feature and build tests.
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index b4764f69f47f4..d447f4bd8f5b1 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
[ ... ]
> @@ -532,13 +538,54 @@ ifdef CORESIGHT
> endif
> endif
>
> +ifndef NO_RUST
> + $(call feature_check,rust)
> + ifneq ($(feature-rust), 1)
> + $(warning Rust is not found. Test workloads with rust are disabled.)
> + NO_RUST := 1
> + else
> + NO_RUST := 0
> + CFLAGS += -DHAVE_RUST_SUPPORT
> + $(call detected,CONFIG_RUST_SUPPORT)
> + endif
> +
> + ifneq ($(CROSS_COMPILE),)
> + ifeq ($(RUST_TARGET_FLAGS_$(ARCH)),)
> + $(error Unknown rust cross compilation architecture $(ARCH))
> + endif
> + endif
> +endif
> +
> +# Building zlib-rs from Cargo crate sources requires a working rustc.
> +ifneq ($(NO_RUST), 0)
> + NO_ZLIB_RS := 1
> +endif
> +
> +# Prefer zlib-rs over C zlib when available, unless disabled via NO_ZLIB=1 or
> +# NO_ZLIB_RS=1. Both provide the standard zlib C API (HAVE_ZLIB_SUPPORT), while
> +# HAVE_ZLIB_RS_SUPPORT records that zlib-rs is the implementation in use.
> ifndef NO_ZLIB
> - ifeq ($(feature-zlib), 1)
> + ifndef NO_ZLIB_RS
> + $(call feature_check,zlib-rs)
> + ifeq ($(feature-zlib-rs), 1)
> + $(call feature_rust_lib,zlib-rs)
> + ZLIB_CFLAGS := $(FEATURE_CFLAGS-zlib-rs)
> + ZLIB_LIBS := $(FEATURE_LIBS-zlib-rs)
> + CFLAGS += -DHAVE_ZLIB_RS_SUPPORT $(ZLIB_CFLAGS)
> + $(call detected,CONFIG_ZLIB_RS)
> + endif
> + endif
> + ifeq ($(ZLIB_LIBS),)
> + ifeq ($(feature-zlib), 1)
> + ZLIB_LIBS := -lz
> + else
> + NO_ZLIB := 1
> + endif
> + endif
> + ifneq ($(ZLIB_LIBS),)
> CFLAGS += -DHAVE_ZLIB_SUPPORT
> - EXTLIBS += -lz
> + EXTLIBS += $(ZLIB_LIBS)
> $(call detected,CONFIG_ZLIB)
> - else
> - NO_ZLIB := 1
> endif
> endif
>
> @@ -908,7 +955,7 @@ ifdef BUILD_NONDISTRO
> else ifeq ($(feature-libbfd-liberty), 1)
> EXTLIBS += -lbfd -lopcodes -liberty
> else ifeq ($(feature-libbfd-liberty-z), 1)
> - EXTLIBS += -lbfd -lopcodes -liberty -lz
> + EXTLIBS += -lbfd -lopcodes -liberty $(ZLIB_LIBS)
> endif
[Severity: Low]
In the BUILD_NONDISTRO block of tools/perf/Makefile.config, ZLIB_LIBS is only
populated inside the ifndef NO_ZLIB block above, where it is already appended
to EXTLIBS.
When building with BUILD_NONDISTRO=1 and NO_ZLIB=1 on a system where libbfd
requires -liberty and -lz (so feature-libbfd-liberty-z is 1), ZLIB_LIBS is
empty.
Will replacing -lz with $(ZLIB_LIBS) here cause the link against libbfd to
fail with unresolved zlib symbols when NO_ZLIB=1, and duplicate $(ZLIB_LIBS)
in EXTLIBS when NO_ZLIB is not set?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261030202710.3863806-1-irogers@google.com?part=2
next prev parent reply other threads:[~2026-10-30 20:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 20:27 [RFC PATCH v2 0/3] tools: Add Rust library build infrastructure and prefer zlib-rs Ian Rogers
2026-10-30 20:27 ` [RFC PATCH v2 1/3] tools build: Add Rust library build infrastructure and zlib-rs feature test Ian Rogers
2026-10-30 20:44 ` sashiko-bot
2026-10-30 20:27 ` [RFC PATCH v2 2/3] perf build: Prefer zlib-rs over zlib when available Ian Rogers
2026-10-30 20:46 ` sashiko-bot [this message]
2026-10-30 20:27 ` [RFC PATCH v2 3/3] bpftool: " Ian Rogers
2026-10-30 20:39 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-191493@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=qmo@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.