mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rust: Kbuild: set frame-pointer llvm module flag for CONFIG_FRAME_POINTER
@ 2026-06-16 12:30 Alice Ryhl
  2026-06-16 13:34 ` Miguel Ojeda
  2026-06-19  8:01 ` Miguel Ojeda
  0 siblings, 2 replies; 4+ messages in thread
From: Alice Ryhl @ 2026-06-16 12:30 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Miguel Ojeda
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Danilo Krummrich, Daniel Almeida,
	Tamir Duberstein, Alexandre Courbot, Onur Özkan,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Douglas Su,
	Alex Gaynor, Fiona Behrens, Sven Van Asbroeck, Kees Cook,
	Wedson Almeida Filho, linux-kbuild, linux-kernel, rust-for-linux,
	llvm, stable, Alice Ryhl

Due to a rustc bug, the -Cforce-frame-pointers=y flag only emits the
frame-pointer annotation for functions, but not for the module. This
means that functions generated by the LLVM backend such as
'asan.module_ctor' do not receive the frame-pointer annotation.

This is likely to lead to broken backtraces and may also cause issues
with ftrace if these features are used with functions generated by the
LLVM backend.

Thus, use -Zllvm_module_flag to work around this rustc bug if using a
rustc without the fix.

Cc: stable@kernel.org
Fixes: 2f7ab1267dc9 ("Kbuild: add Rust support")
Link: https://github.com/rust-lang/rust/pull/156980
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 5e73bba74da3..4bfa87e2562a 100644
--- a/Makefile
+++ b/Makefile
@@ -966,6 +966,7 @@ KBUILD_CFLAGS += $(stackp-flags-y)
 ifdef CONFIG_FRAME_POINTER
 KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
 KBUILD_RUSTFLAGS += -Cforce-frame-pointers=y
+KBUILD_RUSTFLAGS += $(if $(call rustc-min-version,109800),,-Zllvm_module_flag=frame-pointer:u32:2:max)
 else
 # Some targets (ARM with Thumb2, for example), can't be built with frame
 # pointers.  For those, we don't have FUNCTION_TRACER automatically

---
base-commit: 0e0611827f3349d0a2ac121c023a6d3260dcecdb
change-id: 20260616-frame-ptr-fix-1c3733f3c764

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


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

end of thread, other threads:[~2026-06-19  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 12:30 [PATCH] rust: Kbuild: set frame-pointer llvm module flag for CONFIG_FRAME_POINTER Alice Ryhl
2026-06-16 13:34 ` Miguel Ojeda
2026-06-16 13:41   ` Alice Ryhl
2026-06-19  8:01 ` Miguel Ojeda

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®