All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: enable fentry support
@ 2026-07-24 17:01 Paul Murphy
  2026-07-24 17:53 ` Miguel Ojeda
       [not found] ` <20260724172024.0648C1F000E9@smtp.kernel.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Murphy @ 2026-07-24 17:01 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Miguel Ojeda, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Daniel Almeida,
	Tamir Duberstein, Alexandre Courbot, Onur Özkan,
	linux-kbuild, linux-kernel, rust-for-linux

Turn it on when available if CONFIG_HAVE_FENTRY=y.

Rust support was added in 1.98.0 with support for x86 and s390x targets.

Signed-off-by: Paul Murphy <murp@redhat.com>
---
 Makefile                        | 2 ++
 scripts/generate_rust_target.rs | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index bfb47ad8cb9a..bdfe93702a33 100644
--- a/Makefile
+++ b/Makefile
@@ -1053,10 +1053,12 @@ ifdef CONFIG_HAVE_FENTRY
     CC_FLAGS_FTRACE	+= -mfentry
     CC_FLAGS_USING	+= -DCC_USING_FENTRY
   endif
+  RUSTFLAGS_FTRACE := $(if $(call rustc-min-version,109800),-Zinstrument-mcount=fentry,)
 endif
 export CC_FLAGS_FTRACE
 KBUILD_CFLAGS	+= $(CC_FLAGS_FTRACE) $(CC_FLAGS_USING)
 KBUILD_AFLAGS	+= $(CC_FLAGS_USING)
+KBUILD_RUSTFLAGS += $(RUSTFLAGS_FTRACE)
 endif
 
 # We trigger additional mismatches with less inlining
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 3bf296581a88..eb80a06d50d3 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -198,6 +198,7 @@ fn main() {
         ts.push("arch", "x86_64");
         if cfg.rustc_version_atleast(1, 98, 0) {
             ts.push("rustc-abi", "softfloat");
+            ts.push("supports-fentry", true);
         } else if cfg.rustc_version_atleast(1, 86, 0) {
             ts.push("rustc-abi", "x86-softfloat");
         }
@@ -240,6 +241,7 @@ fn main() {
         ts.push("arch", "x86");
         if cfg.rustc_version_atleast(1, 98, 0) {
             ts.push("rustc-abi", "softfloat");
+            ts.push("supports-fentry", true);
         } else if cfg.rustc_version_atleast(1, 86, 0) {
             ts.push("rustc-abi", "x86-softfloat");
         }

base-commit: 7059bdf4f04a3e14f4fafb3ac35fdca913e3e21a
-- 
2.55.0


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

end of thread, other threads:[~2026-07-29 15:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-24 17:01 [PATCH] rust: enable fentry support Paul Murphy
2026-07-24 17:53 ` Miguel Ojeda
     [not found] ` <20260724172024.0648C1F000E9@smtp.kernel.org>
     [not found]   ` <CALYDSrQhUbKDHsPnQqp0K4WMe2iZC-G1nGrLT6eQ9doCqdVXKQ@mail.gmail.com>
     [not found]     ` <CANiq72nJ=7TAjtArF2VzDZqwKDcuMFjeisD25R2GuA0NiJwk-Q@mail.gmail.com>
2026-07-28 22:57       ` Vasily Gorbik
2026-07-29 14:50         ` Paul Murphy
2026-07-29 15:51         ` Vasily Gorbik

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.