rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] rust: module: place cleanup_module() in .exit.text section
@ 2025-03-08  4:45 FUJITA Tomonori
  2025-03-08  5:23 ` Jarkko Sakkinen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: FUJITA Tomonori @ 2025-03-08  4:45 UTC (permalink / raw)
  To: ojeda, alex.gaynor
  Cc: rust-for-linux, boqun.feng, gary, bjorn3_gh, benno.lossin,
	a.hindborg, aliceryhl, tmgross

Place cleanup_module() in .exit.text section. Currently,
cleanup_module() is likely placed in the .text section. It's
inconsistent with the layout of C modules, where cleanup_module() is
placed in .exit.text.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
---
 rust/macros/module.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index cdf94f4982df..36daa149a691 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -275,6 +275,7 @@ mod __module_init {{
                     #[cfg(MODULE)]
                     #[doc(hidden)]
                     #[no_mangle]
+                    #[link_section = \".exit.text\"]
                     pub extern \"C\" fn cleanup_module() {{
                         // SAFETY:
                         // - This function is inaccessible to the outside due to the double

base-commit: 6ad64bf91728502fe8a4d1419c0a3e4fd323f503
-- 
2.43.0


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

end of thread, other threads:[~2025-05-22  9:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-08  4:45 [PATCH v1] rust: module: place cleanup_module() in .exit.text section FUJITA Tomonori
2025-03-08  5:23 ` Jarkko Sakkinen
2025-03-08  5:32 ` Boqun Feng
2025-03-08  5:39   ` FUJITA Tomonori
2025-03-24 19:18 ` Miguel Ojeda
2025-05-09  4:16   ` FUJITA Tomonori
2025-05-09  7:27     ` Miguel Ojeda
2025-05-22  9:47 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).