mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 15:03:53 +02:00
Rust fixes for v6.16 (2nd)
Toolchain and infrastructure: - Fix build and modpost confusion for the upcoming Rust 1.89.0 release. - Clean objtool warning for the upcoming Rust 1.89.0 release by adding one more noreturn function. 'kernel' crate: - Fix build error when using generics in the 'try_{,pin_}init!' macros. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmh61wEACgkQGXyLc2ht IW1YRBAAy9DnnDoRkH/RS2KJK7FF6iEDfF/ny0d4Fq2bISt8v2TDLYOvm1xkOKx3 xQKb8SMw3Pcr2coze/CyOp67qHHF7Ff403gD8/e7sbfVA3Ny8iMT26FyipsdZENK KPDxBSIhrB2MFBswr1n/wQgTClYnW9yMX8FsLfZxFL9ELvluOpkS7RE67NF0yDfi NYUjr6NG7SD1fqLXJi8ekQNQDIQzj+eLFf40AE131SS8+bbrOdFVxSd/Hdx6C6qc 8GWzE5ptlqWdaJWAfHRKt9iKvRli5maBJzM0z0ZQb/LOfK9MdcHnEDzEpzD91XA0 rNq8fWNApfOrNfhz2FZJBYiZyOJtps0xkTBCfHMhafwMrVFLw0ghBccfWNd1P6Ly OSKc9xhyhs57rE75c/m8Sykta2ca/UCU9YZi7eWGOVKaMOoQMSJVF1qKx0pJpbH4 +lr11S2hV4bm5E4v3MyziarYyNdh3W3diUN37Zl2JTVyDt2SwTT4kM/oKiDBvJTA hm1388zskz886yRtHO6f2hT1/k5eX1MgxGyiQQyLdONr78CNDSNcc1kqhvfCK/lF wtjvddecArt9/J5CwdfxLIGxQsB2FerMbpRW8+h0S3bMQC2ezg6CexzlYgR6ADdf 4T7w/LJu58BL0e2UPoW7hgNW6wjtUf3go7hn16UFN3/S69eS2vQ= =mz3t -----END PGP SIGNATURE----- Merge tag 'rust-fixes-6.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux Pull Rust fixes from Miguel Ojeda: "Toolchain and infrastructure: - Fix build and modpost confusion for the upcoming Rust 1.89.0 release - Clean objtool warning for the upcoming Rust 1.89.0 release by adding one more noreturn function 'kernel' crate: - Fix build error when using generics in the 'try_{,pin_}init!' macros" * tag 'rust-fixes-6.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0 objtool/rust: add one more `noreturn` Rust function for Rust 1.89.0 rust: init: Fix generics in *_init! macros
This commit is contained in:
commit
acc0bac1c6
|
@ -194,6 +194,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $<
|
||||||
RUST_MODFILE=test.rs \
|
RUST_MODFILE=test.rs \
|
||||||
OBJTREE=$(abspath $(objtree)) \
|
OBJTREE=$(abspath $(objtree)) \
|
||||||
$(RUSTDOC) --test $(rust_common_flags) \
|
$(RUSTDOC) --test $(rust_common_flags) \
|
||||||
|
-Zcrate-attr='feature(used_with_arg)' \
|
||||||
@$(objtree)/include/generated/rustc_cfg \
|
@$(objtree)/include/generated/rustc_cfg \
|
||||||
$(rustc_target_flags) $(rustdoc_test_target_flags) \
|
$(rustc_target_flags) $(rustdoc_test_target_flags) \
|
||||||
$(rustdoc_test_quiet) \
|
$(rustdoc_test_quiet) \
|
||||||
|
|
|
@ -202,7 +202,7 @@ macro_rules! module_firmware {
|
||||||
};
|
};
|
||||||
|
|
||||||
#[link_section = ".modinfo"]
|
#[link_section = ".modinfo"]
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
static __MODULE_FIRMWARE: [u8; $($builder)*::create(__MODULE_FIRMWARE_PREFIX)
|
static __MODULE_FIRMWARE: [u8; $($builder)*::create(__MODULE_FIRMWARE_PREFIX)
|
||||||
.build_length()] = $($builder)*::create(__MODULE_FIRMWARE_PREFIX).build();
|
.build_length()] = $($builder)*::create(__MODULE_FIRMWARE_PREFIX).build();
|
||||||
};
|
};
|
||||||
|
|
|
@ -231,14 +231,14 @@ macro_rules! try_init {
|
||||||
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
||||||
$($fields:tt)*
|
$($fields:tt)*
|
||||||
}) => {
|
}) => {
|
||||||
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
|
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
|
||||||
$($fields)*
|
$($fields)*
|
||||||
}? $crate::error::Error)
|
}? $crate::error::Error)
|
||||||
};
|
};
|
||||||
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
||||||
$($fields:tt)*
|
$($fields:tt)*
|
||||||
}? $err:ty) => {
|
}? $err:ty) => {
|
||||||
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
|
::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
|
||||||
$($fields)*
|
$($fields)*
|
||||||
}? $err)
|
}? $err)
|
||||||
};
|
};
|
||||||
|
@ -291,14 +291,14 @@ macro_rules! try_pin_init {
|
||||||
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
||||||
$($fields:tt)*
|
$($fields:tt)*
|
||||||
}) => {
|
}) => {
|
||||||
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
|
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
|
||||||
$($fields)*
|
$($fields)*
|
||||||
}? $crate::error::Error)
|
}? $crate::error::Error)
|
||||||
};
|
};
|
||||||
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
|
||||||
$($fields:tt)*
|
$($fields:tt)*
|
||||||
}? $err:ty) => {
|
}? $err:ty) => {
|
||||||
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
|
::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
|
||||||
$($fields)*
|
$($fields)*
|
||||||
}? $err)
|
}? $err)
|
||||||
};
|
};
|
||||||
|
|
|
@ -302,7 +302,7 @@ macro_rules! kunit_unsafe_test_suite {
|
||||||
is_init: false,
|
is_init: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
#[allow(unused_unsafe)]
|
#[allow(unused_unsafe)]
|
||||||
#[cfg_attr(not(target_os = "macos"), link_section = ".kunit_test_suites")]
|
#[cfg_attr(not(target_os = "macos"), link_section = ".kunit_test_suites")]
|
||||||
static mut KUNIT_TEST_SUITE_ENTRY: *const ::kernel::bindings::kunit_suite =
|
static mut KUNIT_TEST_SUITE_ENTRY: *const ::kernel::bindings::kunit_suite =
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
// Expected to become stable.
|
// Expected to become stable.
|
||||||
#![feature(arbitrary_self_types)]
|
#![feature(arbitrary_self_types)]
|
||||||
//
|
//
|
||||||
|
// To be determined.
|
||||||
|
#![feature(used_with_arg)]
|
||||||
|
//
|
||||||
// `feature(derive_coerce_pointee)` is expected to become stable. Before Rust
|
// `feature(derive_coerce_pointee)` is expected to become stable. Before Rust
|
||||||
// 1.84.0, it did not exist, so enable the predecessor features.
|
// 1.84.0, it did not exist, so enable the predecessor features.
|
||||||
#![cfg_attr(CONFIG_RUSTC_HAS_COERCE_POINTEE, feature(derive_coerce_pointee))]
|
#![cfg_attr(CONFIG_RUSTC_HAS_COERCE_POINTEE, feature(derive_coerce_pointee))]
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl<'a> ModInfoBuilder<'a> {
|
||||||
{cfg}
|
{cfg}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[cfg_attr(not(target_os = \"macos\"), link_section = \".modinfo\")]
|
#[cfg_attr(not(target_os = \"macos\"), link_section = \".modinfo\")]
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
pub static __{module}_{counter}: [u8; {length}] = *{string};
|
pub static __{module}_{counter}: [u8; {length}] = *{string};
|
||||||
",
|
",
|
||||||
cfg = if builtin {
|
cfg = if builtin {
|
||||||
|
@ -249,7 +249,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
|
||||||
// key or a new section. For the moment, keep it simple.
|
// key or a new section. For the moment, keep it simple.
|
||||||
#[cfg(MODULE)]
|
#[cfg(MODULE)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
static __IS_RUST_MODULE: () = ();
|
static __IS_RUST_MODULE: () = ();
|
||||||
|
|
||||||
static mut __MOD: ::core::mem::MaybeUninit<{type_}> =
|
static mut __MOD: ::core::mem::MaybeUninit<{type_}> =
|
||||||
|
@ -273,7 +273,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
#[cfg(MODULE)]
|
#[cfg(MODULE)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
#[link_section = \".init.data\"]
|
#[link_section = \".init.data\"]
|
||||||
static __UNIQUE_ID___addressable_init_module: unsafe extern \"C\" fn() -> i32 = init_module;
|
static __UNIQUE_ID___addressable_init_module: unsafe extern \"C\" fn() -> i32 = init_module;
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
#[cfg(MODULE)]
|
#[cfg(MODULE)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
#[link_section = \".exit.data\"]
|
#[link_section = \".exit.data\"]
|
||||||
static __UNIQUE_ID___addressable_cleanup_module: extern \"C\" fn() = cleanup_module;
|
static __UNIQUE_ID___addressable_cleanup_module: extern \"C\" fn() = cleanup_module;
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
|
||||||
#[cfg(not(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS))]
|
#[cfg(not(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS))]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[link_section = \"{initcall_section}\"]
|
#[link_section = \"{initcall_section}\"]
|
||||||
#[used]
|
#[used(compiler)]
|
||||||
pub static __{ident}_initcall: extern \"C\" fn() ->
|
pub static __{ident}_initcall: extern \"C\" fn() ->
|
||||||
::kernel::ffi::c_int = __{ident}_init;
|
::kernel::ffi::c_int = __{ident}_init;
|
||||||
|
|
||||||
|
|
|
@ -312,10 +312,11 @@ $(obj)/%.lst: $(obj)/%.c FORCE
|
||||||
# - Stable since Rust 1.82.0: `feature(asm_const)`, `feature(raw_ref_op)`.
|
# - Stable since Rust 1.82.0: `feature(asm_const)`, `feature(raw_ref_op)`.
|
||||||
# - Stable since Rust 1.87.0: `feature(asm_goto)`.
|
# - Stable since Rust 1.87.0: `feature(asm_goto)`.
|
||||||
# - Expected to become stable: `feature(arbitrary_self_types)`.
|
# - Expected to become stable: `feature(arbitrary_self_types)`.
|
||||||
|
# - To be determined: `feature(used_with_arg)`.
|
||||||
#
|
#
|
||||||
# Please see https://github.com/Rust-for-Linux/linux/issues/2 for details on
|
# Please see https://github.com/Rust-for-Linux/linux/issues/2 for details on
|
||||||
# the unstable features in use.
|
# the unstable features in use.
|
||||||
rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op
|
rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op,used_with_arg
|
||||||
|
|
||||||
# `--out-dir` is required to avoid temporaries being created by `rustc` in the
|
# `--out-dir` is required to avoid temporaries being created by `rustc` in the
|
||||||
# current working directory, which may be not accessible in the out-of-tree
|
# current working directory, which may be not accessible in the out-of-tree
|
||||||
|
|
|
@ -224,6 +224,7 @@ static bool is_rust_noreturn(const struct symbol *func)
|
||||||
str_ends_with(func->name, "_4core9panicking14panic_explicit") ||
|
str_ends_with(func->name, "_4core9panicking14panic_explicit") ||
|
||||||
str_ends_with(func->name, "_4core9panicking14panic_nounwind") ||
|
str_ends_with(func->name, "_4core9panicking14panic_nounwind") ||
|
||||||
str_ends_with(func->name, "_4core9panicking18panic_bounds_check") ||
|
str_ends_with(func->name, "_4core9panicking18panic_bounds_check") ||
|
||||||
|
str_ends_with(func->name, "_4core9panicking18panic_nounwind_fmt") ||
|
||||||
str_ends_with(func->name, "_4core9panicking19assert_failed_inner") ||
|
str_ends_with(func->name, "_4core9panicking19assert_failed_inner") ||
|
||||||
str_ends_with(func->name, "_4core9panicking30panic_null_pointer_dereference") ||
|
str_ends_with(func->name, "_4core9panicking30panic_null_pointer_dereference") ||
|
||||||
str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference") ||
|
str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference") ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user