Pull rust fixes from Miguel Ojeda: - Fix '-Os' Rust 1.80.0+ builds adding more intrinsics (also tweaked in upstream Rust for the upcoming 1.82.0). - Fix support for the latest version of rust-analyzer due to a change on rust-analyzer config file semantics (considered a fix since most developers use the latest version of the tool, which is the only one actually supported by upstream). I am discussing stability of the config file with upstream -- they may be able to start versioning it. - Fix GCC 14 builds due to '-fmin-function-alignment' not skipped for libclang (bindgen). - A couple Kconfig fixes around '{RUSTC,BINDGEN}_VERSION_TEXT' to suppress error messages in a foreign architecture chroot and to use a proper default format. - Clean 'rust-analyzer' target warning due to missing recursive make invocation mark. - Clean Clippy warning due to missing indentation in docs. - Clean LLVM 19 build warning due to removed 3dnow feature upstream. * tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux: rust: x86: remove `-3dnow{,a}` from target features kbuild: rust-analyzer: mark `rust_is_available.sh` invocation as recursive rust: add intrinsics to fix `-Os` builds kbuild: rust: skip -fmin-function-alignment in bindgen flags rust: Support latest version of `rust-analyzer` rust: macros: indent list item in `module!`'s docs rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
Unified · Split
| @@ -1963,7 +1963,7 @@ tags TAGS cscope gtags: FORCE · 1962 unmodified lines | |||
| 1963 | # Protocol). | 1963 | # Protocol). |
| 1964 | PHONY += rust-analyzer | 1964 | PHONY += rust-analyzer |
| 1965 | rust-analyzer: | 1965 | rust-analyzer: |
| 1966 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh | 1966 | +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh |
| 1967 | $(Q)$(MAKE) $(build)=rust $@ | 1967 | $(Q)$(MAKE) $(build)=rust $@ |
| 1968 | 1968 | ||
| 1969 | # Script to generate missing namespace dependencies | 1969 | # Script to generate missing namespace dependencies |
| @@ -1920,7 +1920,7 @@ config RUST · 1919 unmodified lines | |||
| 1920 | config RUSTC_VERSION_TEXT | 1920 | config RUSTC_VERSION_TEXT |
| 1921 | string | 1921 | string |
| 1922 | depends on RUST | 1922 | depends on RUST |
| 1923 | default $(shell,command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version || echo n) | 1923 | default "$(shell,$(RUSTC) --version 2>/dev/null)" |
| 1924 | 1924 | ||
| 1925 | config BINDGEN_VERSION_TEXT | 1925 | config BINDGEN_VERSION_TEXT |
| 1926 | string | 1926 | string |
| @@ -1928,7 +1928,7 @@ config BINDGEN_VERSION_TEXT · 1 unmodified line | |||
| 1928 | # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 | 1928 | # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 |
| 1929 | # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when | 1929 | # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when |
| 1930 | # the minimum version is upgraded past that (0.69.1 already fixed the issue). | 1930 | # the minimum version is upgraded past that (0.69.1 already fixed the issue). |
| 1931 | default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version workaround-for-0.69.0 || echo n) | 1931 | default "$(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null)" |
| 1932 | 1932 | ||
| 1933 | # | 1933 | # |
| 1934 | # Place an empty function call at each tracepoint site. Can be | 1934 | # Place an empty function call at each tracepoint site. Can be |
| @@ -227,7 +227,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \ · 226 unmodified lines | |||
| 227 | -fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \ | 227 | -fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \ |
| 228 | -fzero-call-used-regs=% -fno-stack-clash-protection \ | 228 | -fzero-call-used-regs=% -fno-stack-clash-protection \ |
| 229 | -fno-inline-functions-called-once -fsanitize=bounds-strict \ | 229 | -fno-inline-functions-called-once -fsanitize=bounds-strict \ |
| 230 | -fstrict-flex-arrays=% \ | 230 | -fstrict-flex-arrays=% -fmin-function-alignment=% \ |
| 231 | --param=% --param asan-% | 231 | --param=% --param asan-% |
| 232 | 232 | ||
| 233 | # Derived from `scripts/Makefile.clang`. | 233 | # Derived from `scripts/Makefile.clang`. |
| @@ -350,12 +350,12 @@ rust-analyzer: · 116 unmodified lines | |||
| 350 | $(Q)$(srctree)/scripts/generate_rust_analyzer.py \ | 350 | $(Q)$(srctree)/scripts/generate_rust_analyzer.py \ |
| 351 | --cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \ | 351 | --cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \ |
| 352 | $(realpath $(srctree)) $(realpath $(objtree)) \ | 352 | $(realpath $(srctree)) $(realpath $(objtree)) \ |
| 353 | $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \ | 353 | $(rustc_sysroot) $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \ |
| 354 | $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json | 354 | $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json |
| 355 | 355 | ||
| 356 | redirect-intrinsics = \ | 356 | redirect-intrinsics = \ |
| 357 | __addsf3 __eqsf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __unordsf2 \ | 357 | __addsf3 __eqsf2 __extendsfdf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __truncdfsf2 __unordsf2 \ |
| 358 | __adddf3 __ledf2 __ltdf2 __muldf3 __unorddf2 \ | 358 | __adddf3 __eqdf2 __ledf2 __ltdf2 __muldf3 __unorddf2 \ |
| 359 | __muloti4 __multi3 \ | 359 | __muloti4 __multi3 \ |
| 360 | __udivmodti4 __udivti3 __umodti3 | 360 | __udivmodti4 __udivti3 __umodti3 |
| 361 | 361 | ||
| @@ -40,16 +40,19 @@ macro_rules! define_panicking_intrinsics( · 39 unmodified lines | |||
| 40 | define_panicking_intrinsics!("`f32` should not be used", { | 40 | define_panicking_intrinsics!("`f32` should not be used", { |
| 41 | __addsf3, | 41 | __addsf3, |
| 42 | __eqsf2, | 42 | __eqsf2, |
| 43 | __extendsfdf2, | ||
| 43 | __gesf2, | 44 | __gesf2, |
| 44 | __lesf2, | 45 | __lesf2, |
| 45 | __ltsf2, | 46 | __ltsf2, |
| 46 | __mulsf3, | 47 | __mulsf3, |
| 47 | __nesf2, | 48 | __nesf2, |
| 49 | __truncdfsf2, | ||
| 48 | __unordsf2, | 50 | __unordsf2, |
| 49 | }); | 51 | }); |
| 50 | 52 | ||
| 51 | define_panicking_intrinsics!("`f64` should not be used", { | 53 | define_panicking_intrinsics!("`f64` should not be used", { |
| 52 | __adddf3, | 54 | __adddf3, |
| 55 | __eqdf2, | ||
| 53 | __ledf2, | 56 | __ledf2, |
| 54 | __ltdf2, | 57 | __ltdf2, |
| 55 | __muldf3, | 58 | __muldf3, |
| @@ -94,7 +94,7 @@ use proc_macro::TokenStream; · 93 unmodified lines | |||
| 94 | /// - `license`: ASCII string literal of the license of the kernel module (required). | 94 | /// - `license`: ASCII string literal of the license of the kernel module (required). |
| 95 | /// - `alias`: array of ASCII string literals of the alias names of the kernel module. | 95 | /// - `alias`: array of ASCII string literals of the alias names of the kernel module. |
| 96 | /// - `firmware`: array of ASCII string literals of the firmware files of | 96 | /// - `firmware`: array of ASCII string literals of the firmware files of |
| 97 | /// the kernel module. | 97 | /// the kernel module. |
| 98 | #[proc_macro] | 98 | #[proc_macro] |
| 99 | pub fn module(ts: TokenStream) -> TokenStream { | 99 | pub fn module(ts: TokenStream) -> TokenStream { |
| 100 | module::module(ts) | 100 | module::module(ts) |
| @@ -145,6 +145,7 @@ def main(): · 144 unmodified lines | |||
| 145 | parser.add_argument('--cfgs', action='append', default=[]) | 145 | parser.add_argument('--cfgs', action='append', default=[]) |
| 146 | parser.add_argument("srctree", type=pathlib.Path) | 146 | parser.add_argument("srctree", type=pathlib.Path) |
| 147 | parser.add_argument("objtree", type=pathlib.Path) | 147 | parser.add_argument("objtree", type=pathlib.Path) |
| 148 | parser.add_argument("sysroot", type=pathlib.Path) | ||
| 148 | parser.add_argument("sysroot_src", type=pathlib.Path) | 149 | parser.add_argument("sysroot_src", type=pathlib.Path) |
| 149 | parser.add_argument("exttree", type=pathlib.Path, nargs="?") | 150 | parser.add_argument("exttree", type=pathlib.Path, nargs="?") |
| 150 | args = parser.parse_args() | 151 | args = parser.parse_args() |
| @@ -154,9 +155,12 @@ def main(): · 3 unmodified lines | |||
| 154 | level=logging.INFO if args.verbose else logging.WARNING | 155 | level=logging.INFO if args.verbose else logging.WARNING |
| 155 | ) | 156 | ) |
| 156 | 157 | ||
| 158 | # Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain. | ||
| 159 | assert args.sysroot in args.sysroot_src.parents | ||
| 160 | |||
| 157 | rust_project = { | 161 | rust_project = { |
| 158 | "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs), | 162 | "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs), |
| 159 | "sysroot_src": str(args.sysroot_src), | 163 | "sysroot": str(args.sysroot), |
| 160 | } | 164 | } |
| 161 | 165 | ||
| 162 | json.dump(rust_project, sys.stdout, sort_keys=True, indent=4) | 166 | json.dump(rust_project, sys.stdout, sort_keys=True, indent=4) |
| @@ -162,7 +162,7 @@ fn main() { · 161 unmodified lines | |||
| 162 | "data-layout", | 162 | "data-layout", |
| 163 | "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", | 163 | "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", |
| 164 | ); | 164 | ); |
| 165 | let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string(); | 165 | let mut features = "-mmx,+soft-float".to_string(); |
| 166 | if cfg.has("MITIGATION_RETPOLINE") { | 166 | if cfg.has("MITIGATION_RETPOLINE") { |
| 167 | features += ",+retpoline-external-thunk"; | 167 | features += ",+retpoline-external-thunk"; |
| 168 | } | 168 | } |
| @@ -179,7 +179,7 @@ fn main() { · 10 unmodified lines | |||
| 179 | "data-layout", | 179 | "data-layout", |
| 180 | "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", | 180 | "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", |
| 181 | ); | 181 | ); |
| 182 | let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string(); | 182 | let mut features = "-mmx,+soft-float".to_string(); |
| 183 | if cfg.has("MITIGATION_RETPOLINE") { | 183 | if cfg.has("MITIGATION_RETPOLINE") { |
| 184 | features += ",+retpoline-external-thunk"; | 184 | features += ",+retpoline-external-thunk"; |
| 185 | } | 185 | } |