From: bot+bpf-ci@kernel.org
To: irogers@google.com,peterz@infradead.org,mingo@redhat.com,acme@kernel.org,namhyung@kernel.org,jolsa@kernel.org,irogers@google.com,adrian.hunter@intel.com,qmo@kernel.org,ojeda@kernel.org,nathan@kernel.org,nsc@kernel.org
Cc: boqun@kernel.org,gary@garyguo.net,bjorn3_gh@protonmail.com,lossin@kernel.org,a.hindborg@kernel.org,aliceryhl@google.com,tmgross@umich.edu,dakr@kernel.org,ndesaulniers@google.com,morbo@google.com,justinstitt@google.com,linux-perf-users@vger.kernel.org,bpf@vger.kernel.org,rust-for-linux@vger.kernel.org,linux-kbuild@vger.kernel.org,llvm@lists.linux.dev,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [RFC PATCH v3 1/3] tools build: Add Rust library build infrastructure and zlib-rs feature test
Date: Thu, 5 Nov 2026 18:53:56 +0000 (UTC) [thread overview]
Message-ID: <a05891adfdd81e0ba070615ac434052257f0f0fb5c462725677f7b48c62a43b0@mail.kernel.org> (raw)
In-Reply-To: <20261105180923.3441359-2-irogers@google.com>
[-- Attachment #1: Type: text/plain, Size: 3342 bytes --]
> tools build: Add Rust library build infrastructure and zlib-rs feature test
TL;DR: Prepending CLANG_CROSS_FLAGS to CXXFLAGS in the feature tests may break
C++ checks (cxa-demangle, llvm) when cross-building with CC=clang but a g++
CXX, silently dropping perf features.
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 4d37d11f674c..ecf27626d493 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -5,10 +5,11 @@ ifneq ($(OUTPUT),)
> OUTPUT_FEATURES = $(OUTPUT)feature/
> $(shell mkdir -p $(OUTPUT_FEATURES))
> endif
> +RUST_OUTPUT ?= $(abspath $(or $(OUTPUT),$(CURDIR)))/
>
> feature_check = $(eval $(feature_check_code))
> define feature_check_code
> - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CC="$(CC)" CXX="$(CXX)" CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
> + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) RUST_OUTPUT="$(RUST_OUTPUT)" CC="$(CC)" CXX="$(CXX)" CARGO="$(CARGO)" RUSTC="$(RUSTC)" $(if $(PKG_CONFIG),PKG_CONFIG="$(PKG_CONFIG)") CFLAGS="$(CLANG_CROSS_FLAGS) $(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" CXXFLAGS="$(CLANG_CROSS_FLAGS) $(EXTRA_CXXFLAGS) $(FEATURE_CHECK_CXXFLAGS-$(1))" RUST_FLAGS="$(RUST_FLAGS)" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(feature_dir) $(OUTPUT_FEATURES)test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
> endef
Is it correct to prepend $(CLANG_CROSS_FLAGS) to CXXFLAGS here?
CLANG_CROSS_FLAGS is computed in tools/scripts/Makefile.include from a
probe of CC alone (CC_NO_CLANG == 0 && CROSS_COMPILE set), and holds
clang-only options such as --target=<triple>, --prefix=, --sysroot= and
--gcc-toolchain=. Nothing checks that CXX is clang.
With 'make CC=clang CROSS_COMPILE=aarch64-linux-gnu-' (no LLVM=1),
Makefile.include leaves CXX as $(CROSS_COMPILE)g++, so each C++ feature
test would run as something like:
aarch64-linux-gnu-g++ --target=aarch64-linux-gnu ... --gcc-toolchain=/usr
-MD -Wall -Werror -o test-cxa-demangle.bin test-cxa-demangle.cpp
and g++ rejects the unrecognized --target option. The probe is silent
(output goes to /dev/null), so feature_check for cxa-demangle, llvm and
llvm-perf would return 0 and perf would drop HAVE_CXA_DEMANGLE_SUPPORT
and libllvm support without any error.
Before this patch CXXFLAGS in the feature sub-make did not contain
CLANG_CROSS_FLAGS, and Makefile.include only appends it to CFLAGS and
AFLAGS, so those tests passed. The same kind of failure was already fixed
for native perf builds in c8592f8da838 ("perf build: Only pass clang flags
to CXX when CXX is clang"), where tools/perf/Makefile.config probes
CXX_NO_CLANG separately.
Could CLANG_CROSS_FLAGS be added to CXXFLAGS only when CXX is clang, or
left on CFLAGS only? The commit message also does not mention that
CLANG_CROSS_FLAGS is now passed to every tool's feature tests.
---
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/42083491750
next prev parent reply other threads:[~2026-11-05 18:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 18:09 [RFC PATCH v3 0/3] tools: Add Rust library build infrastructure and prefer zlib-rs Ian Rogers
2026-11-05 18:09 ` [RFC PATCH v3 1/3] tools build: Add Rust library build infrastructure and zlib-rs feature test Ian Rogers
2026-11-05 18:53 ` bot+bpf-ci [this message]
2026-11-05 18:09 ` [RFC PATCH v3 2/3] perf build: Prefer zlib-rs over zlib when available Ian Rogers
2026-11-05 18:53 ` bot+bpf-ci
2026-11-05 18:09 ` [RFC PATCH v3 3/3] bpftool: " Ian Rogers
2026-11-05 18:53 ` bot+bpf-ci
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=a05891adfdd81e0ba070615ac434052257f0f0fb5c462725677f7b48c62a43b0@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=aliceryhl@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dakr@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gary@garyguo.net \
--cc=ihor.solodrai@linux.dev \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=lossin@kernel.org \
--cc=martin.lau@kernel.org \
--cc=mason@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=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=yonghong.song@linux.dev \
/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 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®