From: Dmitrii Dolgov <9erthalion6@gmail.com>
To: linux-perf-users@vger.kernel.org,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>
Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
Subject: [RFC PATCH v2 1/4] tools/build: Add a feature test for rust compiler
Date: Sun, 8 Feb 2026 13:22:23 +0100 [thread overview]
Message-ID: <20260208122227.3524-2-9erthalion6@gmail.com> (raw)
In-Reply-To: <20260208122227.3524-1-9erthalion6@gmail.com>
Add a feature test to identify if the rust compiler is available, so
that perf could build rust based worloads based on that.
Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
---
tools/build/Makefile.feature | 6 ++++--
tools/build/feature/Makefile | 7 +++++++
tools/build/feature/test-rust.rs | 4 ++++
tools/perf/Makefile.config | 11 +++++++++++
tools/perf/builtin-check.c | 1 +
5 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 tools/build/feature/test-rust.rs
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 7f119eafc7c..64d21152fc8 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -100,7 +100,8 @@ FEATURE_TESTS_BASIC := \
disassembler-four-args \
disassembler-init-styled \
file-handle \
- libopenssl
+ libopenssl \
+ rust
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
# of all feature tests
@@ -149,7 +150,8 @@ FEATURE_DISPLAY ?= \
bpf \
libaio \
libzstd \
- libopenssl
+ libopenssl \
+ rust
#
# Declare group members of a feature to display the logical OR of the detection
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 5c15572d505..9ae69d85716 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -112,6 +112,9 @@ __BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(
__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
+__BUILDRS = $(RUSTC) $(RUSTC_FLAGS) -o $@ $(patsubst %.bin,%.rs,$(@F))
+ BUILDRS = $(__BUILDRS) > $(@:.bin=.make.output) 2>&1
+
###############################
$(OUTPUT)test-all.bin:
@@ -388,6 +391,10 @@ $(OUTPUT)test-libopenssl.bin:
$(OUTPUT)test-bpftool-skeletons.bin:
$(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
> $(@:.bin=.make.output) 2>&1
+
+$(OUTPUT)test-rust.bin:
+ $(BUILDRS) > $(@:.bin=.make.output) 2>&1
+
###############################
clean:
diff --git a/tools/build/feature/test-rust.rs b/tools/build/feature/test-rust.rs
new file mode 100644
index 00000000000..f2fc91cc4f6
--- /dev/null
+++ b/tools/build/feature/test-rust.rs
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+fn main() {
+ println!("hi")
+}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b683aab3ab9..94aecfe38b9 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1153,6 +1153,17 @@ ifneq ($(NO_LIBTRACEEVENT),1)
endif
endif
+ifndef NO_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
+endif
+
# Among the variables below, these:
# perfexecdir
# libbpf_include_dir
diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c
index d19769a8f68..27a41beeadd 100644
--- a/tools/perf/builtin-check.c
+++ b/tools/perf/builtin-check.c
@@ -60,6 +60,7 @@ struct feature_status supported_features[] = {
FEATURE_STATUS("numa_num_possible_cpus", HAVE_LIBNUMA_SUPPORT),
FEATURE_STATUS("zlib", HAVE_ZLIB_SUPPORT),
FEATURE_STATUS("zstd", HAVE_ZSTD_SUPPORT),
+ FEATURE_STATUS("rust", HAVE_RUST_SUPPORT),
/* this should remain at end, to know the array end */
FEATURE_STATUS(NULL, _)
--
2.52.0
next prev parent reply other threads:[~2026-02-08 12:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-08 12:22 [RFC PATCH v2 0/4] Test annotate with data type profiling Dmitrii Dolgov
2026-02-08 12:22 ` Dmitrii Dolgov [this message]
2026-02-08 12:22 ` [RFC PATCH v2 2/4] perf test workload: Add code_with_type test workload Dmitrii Dolgov
2026-02-09 17:29 ` Ian Rogers
2026-02-11 10:57 ` Dmitry Dolgov
2026-02-09 17:33 ` Ian Rogers
2026-02-11 10:02 ` Dmitry Dolgov
2026-02-08 12:22 ` [RFC PATCH v2 3/4] perf tests: Test annotate with data type profiling and rust Dmitrii Dolgov
2026-02-08 12:22 ` [RFC PATCH v2 4/4] perf tests: Test annotate with data type profiling and C Dmitrii Dolgov
2026-02-10 5:39 ` Ian Rogers
2026-02-10 11:57 ` Dmitry Dolgov
2026-03-02 23:58 ` [PATCH v1] perf test type profiling: Remote typedef on struct Ian Rogers
2026-03-04 10:44 ` Dmitry Dolgov
2026-03-04 20:34 ` Arnaldo Carvalho de Melo
2026-03-04 21:48 ` Namhyung Kim
2026-03-04 22:04 ` Arnaldo Carvalho de Melo
2026-02-08 14:39 ` [RFC PATCH v2 0/4] Test annotate with data type profiling Arnaldo Carvalho de Melo
2026-02-08 14:42 ` Rust data-type profiling working in perf was: " Arnaldo Carvalho de Melo
2026-02-08 15:16 ` Miguel Ojeda
2026-02-09 8:45 ` Dmitry Dolgov
2026-02-10 1:26 ` Namhyung Kim
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=20260208122227.3524-2-9erthalion6@gmail.com \
--to=9erthalion6@gmail.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
/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