Rust fixes for v6.14
Toolchain and infrastructure: - Do not export KASAN ODR symbols to avoid gendwarfksyms warnings. - Fix future Rust 1.86.0 (to be released 2025-04-03) x86_64 builds. - Clean future Rust 1.86.0 (to be released 2025-04-03) warning. - Fix future GCC 15 (to be released in a few months) builds. - Fix `rusttest` target in macOS. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmenl9gACgkQGXyLc2ht IW05yQ/+MyOV2z6sCGduien6SVWYzNKXGgeevV4keNNSdQazSOw5NpEmvjfhhgBx CyPkO6J4Dw25rPind3kdweO6eJJWKRneqBNxZOoNYt2dHzINXTax+Y/Gls7+F91n gPCkQZaP8JNrjyJ2XrC+oo2221xU+Y+kXcY6DRLYkvjyvJP/6zRDbqFXIutP7z9q /X34fmcGToni+iYRDS5YytKRfh1Ss6S+piCDNq3/ktIQ3cvEQu3JNsJwqipq75sv UI5Ycvh9tMonHJc/4DeTyZLLthC/yfJfEc7T2Nur3AjPH4xp92LEJIG70ZTSgmMn X/kiSh4S+CRNNerOxdXyV+F+JXocbC7ef+kJXfimC4Gpt4HApTwWMrZvftMvO7P0 JbA2YDmido+/3wYgA79uROGSLxvJ1SFrpshdSm7s39knRsDSwjqoUYoY4YOoykUp 14CoL76JHBBWnpFz1baXcnAjuxVRce67imRU6YMd4kai30h3VCyJADKovgE67LlA KedJyBZ9yFBn12+n95XHiDJPFWe8ndt73XiBS0BSE4pPXz2XNSfA3Ass1CvvEYYm JHieHnMfnKD4cKi9rzUm4segGr9Wrb/kkRxTzqfBFrTHI/42oHIMLb1eCeZt2gV6 ZtTjfm8Ss7K/7v8zbFMgZxxo9toNqeAADrTwHbtL5LY3QeLzn3s= =bpGz -----END PGP SIGNATURE----- Merge tag 'rust-fixes-6.14' of https://github.com/Rust-for-Linux/linux Pull rust fixes from Miguel Ojeda: - Do not export KASAN ODR symbols to avoid gendwarfksyms warnings - Fix future Rust 1.86.0 (to be released 2025-04-03) x86_64 builds - Clean future Rust 1.86.0 (to be released 2025-04-03) warning - Fix future GCC 15 (to be released in a few months) builds - Fix `rusttest` target in macOS * tag 'rust-fixes-6.14' of https://github.com/Rust-for-Linux/linux: x86: rust: set rustc-abi=x86-softfloat on rustc>=1.86.0 rust: kbuild: do not export generated KASAN ODR symbols rust: kbuild: add -fzero-init-padding-bits to bindgen_skip_cflags rust: init: use explicit ABI to clean warning in future compilers rust: kbuild: use host dylib naming in rusttestlib-kernel
This commit is contained in:
commit
595ab66f1b
3 changed files with 22 additions and 3 deletions
|
@ -144,7 +144,7 @@ rusttestlib-kernel: private rustc_target_flags = --extern ffi \
|
|||
--extern bindings --extern uapi
|
||||
rusttestlib-kernel: $(src)/kernel/lib.rs \
|
||||
rusttestlib-bindings rusttestlib-uapi rusttestlib-build_error \
|
||||
$(obj)/libmacros.so $(obj)/bindings.o FORCE
|
||||
$(obj)/$(libmacros_name) $(obj)/bindings.o FORCE
|
||||
+$(call if_changed,rustc_test_library)
|
||||
|
||||
rusttestlib-bindings: private rustc_target_flags = --extern ffi
|
||||
|
@ -240,6 +240,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
|
|||
-fzero-call-used-regs=% -fno-stack-clash-protection \
|
||||
-fno-inline-functions-called-once -fsanitize=bounds-strict \
|
||||
-fstrict-flex-arrays=% -fmin-function-alignment=% \
|
||||
-fzero-init-padding-bits=% \
|
||||
--param=% --param asan-%
|
||||
|
||||
# Derived from `scripts/Makefile.clang`.
|
||||
|
@ -331,7 +332,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ;
|
|||
$(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE
|
||||
$(call if_changed_dep,bindgen)
|
||||
|
||||
rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$$3 }'
|
||||
rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ && $$3!~/__odr_asan/ { printf $(2),$$3 }'
|
||||
|
||||
quiet_cmd_exports = EXPORTS $@
|
||||
cmd_exports = \
|
||||
|
|
|
@ -870,7 +870,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
|
|||
/// use kernel::{types::Opaque, init::pin_init_from_closure};
|
||||
/// #[repr(C)]
|
||||
/// struct RawFoo([u8; 16]);
|
||||
/// extern {
|
||||
/// extern "C" {
|
||||
/// fn init_foo(_: *mut RawFoo);
|
||||
/// }
|
||||
///
|
||||
|
|
|
@ -165,6 +165,18 @@ impl KernelConfig {
|
|||
let option = "CONFIG_".to_owned() + option;
|
||||
self.0.contains_key(&option)
|
||||
}
|
||||
|
||||
/// Is the rustc version at least `major.minor.patch`?
|
||||
fn rustc_version_atleast(&self, major: u32, minor: u32, patch: u32) -> bool {
|
||||
let check_version = 100000 * major + 100 * minor + patch;
|
||||
let actual_version = self
|
||||
.0
|
||||
.get("CONFIG_RUSTC_VERSION")
|
||||
.unwrap()
|
||||
.parse::<u32>()
|
||||
.unwrap();
|
||||
check_version <= actual_version
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -182,6 +194,9 @@ fn main() {
|
|||
}
|
||||
} else if cfg.has("X86_64") {
|
||||
ts.push("arch", "x86_64");
|
||||
if cfg.rustc_version_atleast(1, 86, 0) {
|
||||
ts.push("rustc-abi", "x86-softfloat");
|
||||
}
|
||||
ts.push(
|
||||
"data-layout",
|
||||
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
|
||||
|
@ -215,6 +230,9 @@ fn main() {
|
|||
panic!("32-bit x86 only works under UML");
|
||||
}
|
||||
ts.push("arch", "x86");
|
||||
if cfg.rustc_version_atleast(1, 86, 0) {
|
||||
ts.push("rustc-abi", "x86-softfloat");
|
||||
}
|
||||
ts.push(
|
||||
"data-layout",
|
||||
"e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
|
||||
|
|
Loading…
Add table
Reference in a new issue