From: Tamir Duberstein <tamird@gmail.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
Tamir Duberstein <tamird@gmail.com>
Subject: [PATCH 2/2] rust: macros: fix `make rusttest` build on macOS
Date: Fri, 07 Feb 2025 12:21:53 -0500 [thread overview]
Message-ID: <20250207-macros-section-v1-2-8f018cb05a20@gmail.com> (raw)
In-Reply-To: <20250207-macros-section-v1-0-8f018cb05a20@gmail.com>
Do not emit `#[link_section = ".modinfo"]` on macOS (i.e. when building
userspace tests); .modinfo is not a legal section specifier in mach-o.
Before this change tests failed to compile:
---- ../rust/macros/lib.rs - module (line 66) stdout ----
rustc-LLVM ERROR: Global variable '_ZN8rust_out13__module_init13__module_init27__MY_DEVICE_DRIVER_MODULE_017h141f80536770e0d4E' has an invalid section specifier '.modinfo': mach-o section specifier requires a segment and section separated by a comma.
Couldn't compile the test.
---- ../rust/macros/lib.rs - module (line 33) stdout ----
rustc-LLVM ERROR: Global variable '_ZN8rust_out13__module_init13__module_init20__MY_KERNEL_MODULE_017h5d79189564b41e07E' has an invalid section specifier '.modinfo': mach-o section specifier requires a segment and section separated by a comma.
Couldn't compile the test.
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/macros/module.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index ca1b7e6a71ff..f09431614f2b 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -58,7 +58,7 @@ fn emit_base(&mut self, field: &str, content: &str, builtin: bool) {
"
{cfg}
#[doc(hidden)]
- #[link_section = \".modinfo\"]
+ #[cfg_attr(not(target_os = \"macos\"), link_section = \".modinfo\")]
#[used]
pub static __{module}_{counter}: [u8; {length}] = *{string};
",
--
2.48.1
next prev parent reply other threads:[~2025-02-07 17:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 17:21 [PATCH 0/2] rust: macros: fix `make rusttest` build on macOS Tamir Duberstein
2025-02-07 17:21 ` [PATCH 1/2] rust: macros: improve panic messages Tamir Duberstein
2025-02-07 18:12 ` Miguel Ojeda
2025-02-07 19:01 ` Tamir Duberstein
2025-02-07 17:21 ` Tamir Duberstein [this message]
2025-02-07 18:13 ` [PATCH 2/2] rust: macros: fix `make rusttest` build on macOS Miguel Ojeda
2025-02-07 18:37 ` Tamir Duberstein
2025-02-08 8:17 ` [PATCH 0/2] " Greg KH
2025-02-08 22:59 ` Tamir Duberstein
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=20250207-macros-section-v1-2-8f018cb05a20@gmail.com \
--to=tamird@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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