mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
Rust fixes for v6.3
- Build: Rust + GCC build fix and 'grep' warning fix. - Code: Missing 'extern "C"' fix. - Scripts: 'is_rust_module.sh' and 'generate_rust_analyzer.py' fixes. - A couple trivial fixes. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmRAKacACgkQGXyLc2ht IW33VRAAglNS0O0ErOmHRdlwLx2kZXhXGAPtgLe6w0BSe46zdfBs/Y2dEqQZWzSX pfYDjLfVlmrObgOA9HkXR22gYaWfTPc0qCIhIKmkkQgF4q/VjMLl5QaU6fBAzz6k J7OqJmg5NeKMQW9G6CGJdkk9XldeIlEBi9C0P+YsaU/8N6PO0BNhYTaenbKRbusC kcjFMjekQlYEHsaX4flTXNKGSbg+tBi4igiBwcbQE/uy7l75mECHIUeQbXZMyp4b lWGMl8CdlYFLJRB4oxxvOQ3JgTdq9thVXu3WTK+ETs7tBNu9VB8zKuP+iOcpPjrX 3Djt5QBL2+O3jPIrUKQfMK1Ejxh/BIHTy5643hSgppQg4+Y33RW8xKp1YHqSof46 SNVJ9taQ9nnLNviNbtxXEN2Zj00jGgOa2qqXfycJwJvWPFI+VVgHvkbfvhKYJzJ/ swVDCuYmdh74DgdwvOb4dwZqEpLwC+V8T4ll2EUpR/CLYf4FGyRAmbaxSVKzP/JT M/R7tDq10xvVB4rJsqwHri3nB0rmSM6+7fYiQHlwEGt6wImDSy0N9y1BcCZ+ckHW TmEjx93e6SjXiQKr98suBVC0W+GnHk+MN39rDhZbNJB74EBwGFEmrMweRTeFv9ya OuXkQOa3xOFt9E/eb26sPN0/sEJexnMu4vXEzCGBl51HcDqxQGQ= =zdCa -----END PGP SIGNATURE----- Merge tag 'rust-fixes-6.3' of https://github.com/Rust-for-Linux/linux Pull Rust fixes from Miguel Ojeda: "Most of these are straightforward. The last one is more complex, but it only touches Rust + GCC builds which are for the moment best-effort. - Code: Missing 'extern "C"' fix. - Scripts: 'is_rust_module.sh' and 'generate_rust_analyzer.py' fixes. - A couple trivial fixes - Build: Rust + GCC build fix and 'grep' warning fix" * tag 'rust-fixes-6.3' of https://github.com/Rust-for-Linux/linux: rust: allow to use INIT_STACK_ALL_ZERO rust: fix regexp in scripts/is_rust_module.sh rust: build: Fix grep warning scripts: generate_rust_analyzer: Handle sub-modules with no Makefile rust: kernel: Mark rust_fmt_argument as extern "C" rust: sort uml documentation arch support table rust: str: fix requierments->requirements typo
This commit is contained in:
commit
6a66fdd29e
@ -15,7 +15,7 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file.
|
||||
============ ================ ==============================================
|
||||
Architecture Level of support Constraints
|
||||
============ ================ ==============================================
|
||||
``x86`` Maintained ``x86_64`` only.
|
||||
``um`` Maintained ``x86_64`` only.
|
||||
``x86`` Maintained ``x86_64`` only.
|
||||
============ ================ ==============================================
|
||||
|
||||
|
@ -262,6 +262,20 @@ BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
|
||||
# some configurations, with new GCC versions, etc.
|
||||
bindgen_extra_c_flags = -w --target=$(BINDGEN_TARGET)
|
||||
|
||||
# Auto variable zero-initialization requires an additional special option with
|
||||
# clang that is going to be removed sometime in the future (likely in
|
||||
# clang-18), so make sure to pass this option only if clang supports it
|
||||
# (libclang major version < 16).
|
||||
#
|
||||
# https://github.com/llvm/llvm-project/issues/44842
|
||||
# https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0-rc2/clang/docs/ReleaseNotes.rst#deprecated-compiler-flags
|
||||
ifdef CONFIG_INIT_STACK_ALL_ZERO
|
||||
libclang_maj_ver=$(shell $(BINDGEN) $(srctree)/scripts/rust_is_available_bindgen_libclang.h 2>&1 | sed -ne 's/.*clang version \([0-9]*\).*/\1/p')
|
||||
ifeq ($(shell expr $(libclang_maj_ver) \< 16), 1)
|
||||
bindgen_extra_c_flags += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||
endif
|
||||
endif
|
||||
|
||||
bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
|
||||
$(bindgen_extra_c_flags)
|
||||
endif
|
||||
@ -283,7 +297,7 @@ quiet_cmd_bindgen = BINDGEN $@
|
||||
$(bindgen_target_cflags) $(bindgen_target_extra)
|
||||
|
||||
$(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
|
||||
$(shell grep -v '^\#\|^$$' $(srctree)/$(src)/bindgen_parameters)
|
||||
$(shell grep -v '^#\|^$$' $(srctree)/$(src)/bindgen_parameters)
|
||||
$(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
|
||||
$(src)/bindgen_parameters FORCE
|
||||
$(call if_changed_dep,bindgen)
|
||||
|
@ -18,7 +18,11 @@ use crate::bindings;
|
||||
|
||||
// Called from `vsprintf` with format specifier `%pA`.
|
||||
#[no_mangle]
|
||||
unsafe fn rust_fmt_argument(buf: *mut c_char, end: *mut c_char, ptr: *const c_void) -> *mut c_char {
|
||||
unsafe extern "C" fn rust_fmt_argument(
|
||||
buf: *mut c_char,
|
||||
end: *mut c_char,
|
||||
ptr: *const c_void,
|
||||
) -> *mut c_char {
|
||||
use fmt::Write;
|
||||
// SAFETY: The C contract guarantees that `buf` is valid if it's less than `end`.
|
||||
let mut w = unsafe { RawFormatter::from_ptrs(buf.cast(), end.cast()) };
|
||||
|
@ -408,7 +408,7 @@ impl RawFormatter {
|
||||
/// If `pos` is less than `end`, then the region between `pos` (inclusive) and `end`
|
||||
/// (exclusive) must be valid for writes for the lifetime of the returned [`RawFormatter`].
|
||||
pub(crate) unsafe fn from_ptrs(pos: *mut u8, end: *mut u8) -> Self {
|
||||
// INVARIANT: The safety requierments guarantee the type invariants.
|
||||
// INVARIANT: The safety requirements guarantee the type invariants.
|
||||
Self {
|
||||
beg: pos as _,
|
||||
pos: pos as _,
|
||||
|
@ -104,7 +104,10 @@ def generate_crates(srctree, objtree, sysroot_src):
|
||||
name = path.name.replace(".rs", "")
|
||||
|
||||
# Skip those that are not crate roots.
|
||||
if f"{name}.o" not in open(path.parent / "Makefile").read():
|
||||
try:
|
||||
if f"{name}.o" not in open(path.parent / "Makefile").read():
|
||||
continue
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
|
||||
logging.info("Adding %s", name)
|
||||
|
@ -13,4 +13,4 @@ set -e
|
||||
#
|
||||
# In the future, checking for the `.comment` section may be another
|
||||
# option, see https://github.com/rust-lang/rust/pull/97550.
|
||||
${NM} "$*" | grep -qE '^[0-9a-fA-F]+ r _R[^[:space:]]+16___IS_RUST_MODULE[^[:space:]]*$'
|
||||
${NM} "$*" | grep -qE '^[0-9a-fA-F]+ [Rr] _R[^[:space:]]+16___IS_RUST_MODULE[^[:space:]]*$'
|
||||
|
Loading…
Reference in New Issue
Block a user