From: Alice Ryhl <aliceryhl@google.com>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
"Alice Ryhl" <aliceryhl@google.com>
Subject: [PATCH] rust: kbuild: add `no_io_statics` to `core-cfgs`
Date: Fri, 04 Sep 2026 09:31:09 +0000 [thread overview]
Message-ID: <20260904-no-io-statics-v1-1-a2386eb0d255@google.com> (raw)
In upstream Rust, PR #155625 moved `std::io::Error` into `core` under
the `core_io` feature gate. To support decoding and formatting raw OS
errors (`RawOsError`) from within `core` without depending on OS
facilities, `core` introduced a global atomic pointer:
static OS_FUNCTIONS: atomic::AtomicPtr<OsFunctions>
At runtime, `std` registers its OS error vtable with this pointer via
`set_functions()`, which uses `core::sync::atomic` to modify the value
of this atomic variable.
To ensure that `core` does not introduce usage of `core::sync::atomic`
into the kernel image, set the `no_io_statics` cfg, which removes this
logic from the build.
Note that changing the `OS_FUNCTIONS` global is only possible via the
unstable `from_raw_os_error_with_functions()` function from `core`,
which is called by `std`. There is no way for us to invoke it from the
kernel, as we do not use `std`.
Link: https://github.com/rust-lang/rust/pull/155625
Link: https://github.com/rust-lang/rust/issues/154046
Link: https://github.com/rust-lang/libs-team/issues/755
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
rust/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile
index da1a7409d984..8cbee5b6b0bd 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -75,7 +75,8 @@ endif
cfgs-to-flags = $(patsubst %,--cfg='%',$1)
core-cfgs := \
- no_fp_fmt_parse
+ no_fp_fmt_parse \
+ no_io_statics
core-edition := $(if $(call rustc-min-version,108700),2024,2021)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260904-no-io-statics-ab07a70358c8
Best regards,
--
Alice Ryhl <aliceryhl@google.com>
next reply other threads:[~2026-09-04 9:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 9:31 Alice Ryhl [this message]
2026-09-04 10:59 ` Gary Guo
2026-10-02 13:30 ` Miguel Ojeda
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=20260904-no-io-statics-v1-1-a2386eb0d255@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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
all inboxes | Powered by JetHome®