mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
Rust fixes for v6.18
Toolchain and infrastructure:
- Fix/workaround a couple Rust 1.91.0 build issues when sanitizers are
enabled due to extra checking performed by the compiler and an
upstream issue already fixed for Rust 1.93.0.
- Fix future Rust 1.93.0 builds by supporting the stabilized name for
the 'no-jump-tables' flag.
- Fix a couple private/broken intra-doc links uncovered by the future
move of pin-init to 'syn'.
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmkLYvMACgkQGXyLc2ht
IW2I9g/+IIP7rJEQug5EpyTuxO2GX1gKOf3lbV5YxpUi+BXIFL5ZY7Nlgi3EssSd
Cj3LaoEiDzFeYewCnjhk3JAsuzmr/bEjN5xWiDT3Rk/yhBIX+oRBJjW+yze+gfoe
27gqS20W08WSfIj2n91EDwbdrhiz0Lp87cMlcesdDVZKnY215Whf8zsYNGIGutSe
ISdDPsHdoCe2RHoxLcP0Yo6OD/bRK7hTQxEp6rPh787+SK4znjdJWmOVoi4D/HdI
fMHG3T8HfDIOTQJITDTlvne9CRvq6+JaUDQBPFDZBFwxA7S83SdiDDIqWb4N7zlh
ETySFSblkrJdCdT2LelRu/JPv25h1vUvhQObNBY77enBeOxJdeJNWk7iY2p6GRCD
4+qunebeRsLuAQqzAAhk5gLz5Jb7mPcGbhJzAebOlp/bixwS3YQb9710FvWwmjQY
dPxbkxAQj1dAHgkVLDk91mzwU3R2m3OcWMrwC6rU2O2Evraq58B7N2xDOSSi1uzK
e77oBk8CEuFLw/EIZq32dWhRf+9F8x1CrG4K6bTXTax1ZgHp/UZ4/yNrd5+7z2wZ
5gVoCqswTqQg4YOPhwk+tACFDS0vDYMnsdT7BNNkRAUibBC7q52jbPpBsMBaJ3ji
3VwS93idCkEGYYjNlPRKxtlL3nIFbbN4PbsvfjIKSauv2MyxV7Y=
=0bvf
-----END PGP SIGNATURE-----
Merge tag 'rust-fixes-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux
Pull rust fixes from Miguel Ojeda:
- Fix/workaround a couple Rust 1.91.0 build issues when sanitizers are
enabled due to extra checking performed by the compiler and an
upstream issue already fixed for Rust 1.93.0
- Fix future Rust 1.93.0 builds by supporting the stabilized name for
the 'no-jump-tables' flag
- Fix a couple private/broken intra-doc links uncovered by the future
move of pin-init to 'syn'
* tag 'rust-fixes-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux:
rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0
rust: kbuild: workaround `rustdoc` doctests modifier bug
rust: kbuild: treat `build_error` and `rustdoc` as kernel objects
rust: condvar: fix broken intra-doc link
rust: devres: fix private intra-doc link
This commit is contained in:
commit
dc77806cf3
|
|
@ -109,7 +109,7 @@ endif
|
|||
ifdef CONFIG_RUSTC_HAS_ANNOTATE_TABLEJUMP
|
||||
KBUILD_RUSTFLAGS += -Cllvm-args=--loongarch-annotate-tablejump
|
||||
else
|
||||
KBUILD_RUSTFLAGS += -Zno-jump-tables # keep compatibility with older compilers
|
||||
KBUILD_RUSTFLAGS += $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-jump-tables) # keep compatibility with older compilers
|
||||
endif
|
||||
ifdef CONFIG_LTO_CLANG
|
||||
# The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ ifeq ($(CONFIG_X86_KERNEL_IBT),y)
|
|||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816
|
||||
#
|
||||
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=branch -fno-jump-tables)
|
||||
KBUILD_RUSTFLAGS += -Zcf-protection=branch -Zno-jump-tables
|
||||
KBUILD_RUSTFLAGS += -Zcf-protection=branch $(if $(call rustc-min-version,109300),-Cjump-tables=n,-Zno-jump-tables)
|
||||
else
|
||||
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ core-edition := $(if $(call rustc-min-version,108700),2024,2021)
|
|||
# the time being (https://github.com/rust-lang/rust/issues/144521).
|
||||
rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18)
|
||||
|
||||
# Similarly, for doctests (https://github.com/rust-lang/rust/issues/146465).
|
||||
doctests_modifiers_workaround := $(rustdoc_modifiers_workaround)$(if $(call rustc-min-version,109100),$(comma)sanitizer)
|
||||
|
||||
# `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only
|
||||
# since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust
|
||||
# 1.82.0 (https://github.com/rust-lang/rust/issues/138520). Thus workaround both
|
||||
|
|
@ -127,9 +130,14 @@ rustdoc-core: private rustc_target_flags = --edition=$(core-edition) $(core-cfgs
|
|||
rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs rustdoc-clean FORCE
|
||||
+$(call if_changed,rustdoc)
|
||||
|
||||
# Even if `rustdoc` targets are not kernel objects, they should still be
|
||||
# treated as such so that we pass the same flags. Otherwise, for instance,
|
||||
# `rustdoc` will complain about missing sanitizer flags causing an ABI mismatch.
|
||||
rustdoc-compiler_builtins: private is-kernel-object := y
|
||||
rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE
|
||||
+$(call if_changed,rustdoc)
|
||||
|
||||
rustdoc-ffi: private is-kernel-object := y
|
||||
rustdoc-ffi: $(src)/ffi.rs rustdoc-core FORCE
|
||||
+$(call if_changed,rustdoc)
|
||||
|
||||
|
|
@ -147,6 +155,7 @@ rustdoc-pin_init: $(src)/pin-init/src/lib.rs rustdoc-pin_init_internal \
|
|||
rustdoc-macros FORCE
|
||||
+$(call if_changed,rustdoc)
|
||||
|
||||
rustdoc-kernel: private is-kernel-object := y
|
||||
rustdoc-kernel: private rustc_target_flags = --extern ffi --extern pin_init \
|
||||
--extern build_error --extern macros \
|
||||
--extern bindings --extern uapi
|
||||
|
|
@ -230,7 +239,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC TK $<
|
|||
--extern bindings --extern uapi \
|
||||
--no-run --crate-name kernel -Zunstable-options \
|
||||
--sysroot=/dev/null \
|
||||
$(rustdoc_modifiers_workaround) \
|
||||
$(doctests_modifiers_workaround) \
|
||||
--test-builder $(objtree)/scripts/rustdoc_test_builder \
|
||||
$< $(rustdoc_test_kernel_quiet); \
|
||||
$(objtree)/scripts/rustdoc_test_gen
|
||||
|
|
@ -522,6 +531,10 @@ $(obj)/pin_init.o: $(src)/pin-init/src/lib.rs $(obj)/compiler_builtins.o \
|
|||
$(obj)/$(libpin_init_internal_name) $(obj)/$(libmacros_name) FORCE
|
||||
+$(call if_changed_rule,rustc_library)
|
||||
|
||||
# Even if normally `build_error` is not a kernel object, it should still be
|
||||
# treated as such so that we pass the same flags. Otherwise, for instance,
|
||||
# `rustc` will complain about missing sanitizer flags causing an ABI mismatch.
|
||||
$(obj)/build_error.o: private is-kernel-object := y
|
||||
$(obj)/build_error.o: private skip_gendwarfksyms = 1
|
||||
$(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE
|
||||
+$(call if_changed_rule,rustc_library)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ struct Inner<T: Send> {
|
|||
///
|
||||
/// # Invariants
|
||||
///
|
||||
/// [`Self::inner`] is guaranteed to be initialized and is always accessed read-only.
|
||||
/// `Self::inner` is guaranteed to be initialized and is always accessed read-only.
|
||||
#[pin_data(PinnedDrop)]
|
||||
pub struct Devres<T: Send> {
|
||||
dev: ARef<Device>,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ macro_rules! new_condvar {
|
|||
/// spuriously.
|
||||
///
|
||||
/// Instances of [`CondVar`] need a lock class and to be pinned. The recommended way to create such
|
||||
/// instances is with the [`pin_init`](crate::pin_init!) and [`new_condvar`] macros.
|
||||
/// instances is with the [`pin_init`](pin_init::pin_init!) and [`new_condvar`] macros.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user