Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH] rust: enable fentry support
@ 2026-07-24 17:01 Paul Murphy
  2026-07-24 17:53 ` Miguel Ojeda
  0 siblings, 1 reply; 2+ 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] 2+ messages in thread

* Re: [PATCH] rust: enable fentry support
  2026-07-24 17:01 [PATCH] rust: enable fentry support Paul Murphy
@ 2026-07-24 17:53 ` Miguel Ojeda
  0 siblings, 0 replies; 2+ messages in thread
From: Miguel Ojeda @ 2026-07-24 17:53 UTC (permalink / raw)
  To: Paul Murphy
  Cc: 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

On Fri, Jul 24, 2026 at 7:01 PM Paul Murphy <murp@redhat.com> wrote:
>
> Rust support was added in 1.98.0 with support for x86 and s390x targets.

"will be added"? i.e. it is not released, but I guess you mean it is
unusual to drop from beta.

Link: https://github.com/rust-lang/rust/pull/152122
Link: https://github.com/rust-lang/rust/pull/158036

Cheers,
Miguel

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

end of thread, other threads:[~2026-07-24 17:53 UTC | newest]

Thread overview: 2+ 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

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