Skip to content

Commit 60cb1da

Browse files
committed
Merge tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux
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
2 parents 5b179fe + 0eba65f commit 60cb1da

File tree

7 files changed

+18
-11
lines changed

7 files changed

+18
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ tags TAGS cscope gtags: FORCE
19631963
# Protocol).
19641964
PHONY += rust-analyzer
19651965
rust-analyzer:
1966-
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh
1966+
+$(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh
19671967
$(Q)$(MAKE) $(build)=rust $@
19681968

19691969
# Script to generate missing namespace dependencies

init/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,15 +1920,15 @@ config RUST
19201920
config RUSTC_VERSION_TEXT
19211921
string
19221922
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)"
19241924

19251925
config BINDGEN_VERSION_TEXT
19261926
string
19271927
depends on RUST
19281928
# The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0
19291929
# (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when
19301930
# 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)"
19321932

19331933
#
19341934
# Place an empty function call at each tracepoint site. Can be

rust/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
227227
-fno-reorder-blocks -fno-allow-store-data-races -fasan-shadow-offset=% \
228228
-fzero-call-used-regs=% -fno-stack-clash-protection \
229229
-fno-inline-functions-called-once -fsanitize=bounds-strict \
230-
-fstrict-flex-arrays=% \
230+
-fstrict-flex-arrays=% -fmin-function-alignment=% \
231231
--param=% --param asan-%
232232

233233
# Derived from `scripts/Makefile.clang`.
@@ -350,12 +350,12 @@ rust-analyzer:
350350
$(Q)$(srctree)/scripts/generate_rust_analyzer.py \
351351
--cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \
352352
$(realpath $(srctree)) $(realpath $(objtree)) \
353-
$(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
353+
$(rustc_sysroot) $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
354354
$(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
355355

356356
redirect-intrinsics = \
357-
__addsf3 __eqsf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __unordsf2 \
358-
__adddf3 __ledf2 __ltdf2 __muldf3 __unorddf2 \
357+
__addsf3 __eqsf2 __extendsfdf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __truncdfsf2 __unordsf2 \
358+
__adddf3 __eqdf2 __ledf2 __ltdf2 __muldf3 __unorddf2 \
359359
__muloti4 __multi3 \
360360
__udivmodti4 __udivti3 __umodti3
361361

rust/compiler_builtins.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,19 @@ macro_rules! define_panicking_intrinsics(
4040
define_panicking_intrinsics!("`f32` should not be used", {
4141
__addsf3,
4242
__eqsf2,
43+
__extendsfdf2,
4344
__gesf2,
4445
__lesf2,
4546
__ltsf2,
4647
__mulsf3,
4748
__nesf2,
49+
__truncdfsf2,
4850
__unordsf2,
4951
});
5052

5153
define_panicking_intrinsics!("`f64` should not be used", {
5254
__adddf3,
55+
__eqdf2,
5356
__ledf2,
5457
__ltdf2,
5558
__muldf3,

rust/macros/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use proc_macro::TokenStream;
9494
/// - `license`: ASCII string literal of the license of the kernel module (required).
9595
/// - `alias`: array of ASCII string literals of the alias names of the kernel module.
9696
/// - `firmware`: array of ASCII string literals of the firmware files of
97-
/// the kernel module.
97+
/// the kernel module.
9898
#[proc_macro]
9999
pub fn module(ts: TokenStream) -> TokenStream {
100100
module::module(ts)

scripts/generate_rust_analyzer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def main():
145145
parser.add_argument('--cfgs', action='append', default=[])
146146
parser.add_argument("srctree", type=pathlib.Path)
147147
parser.add_argument("objtree", type=pathlib.Path)
148+
parser.add_argument("sysroot", type=pathlib.Path)
148149
parser.add_argument("sysroot_src", type=pathlib.Path)
149150
parser.add_argument("exttree", type=pathlib.Path, nargs="?")
150151
args = parser.parse_args()
@@ -154,9 +155,12 @@ def main():
154155
level=logging.INFO if args.verbose else logging.WARNING
155156
)
156157

158+
# Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain.
159+
assert args.sysroot in args.sysroot_src.parents
160+
157161
rust_project = {
158162
"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),
160164
}
161165

162166
json.dump(rust_project, sys.stdout, sort_keys=True, indent=4)

scripts/generate_rust_target.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn main() {
162162
"data-layout",
163163
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
164164
);
165-
let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
165+
let mut features = "-mmx,+soft-float".to_string();
166166
if cfg.has("MITIGATION_RETPOLINE") {
167167
features += ",+retpoline-external-thunk";
168168
}
@@ -179,7 +179,7 @@ fn main() {
179179
"data-layout",
180180
"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",
181181
);
182-
let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
182+
let mut features = "-mmx,+soft-float".to_string();
183183
if cfg.has("MITIGATION_RETPOLINE") {
184184
features += ",+retpoline-external-thunk";
185185
}

0 commit comments

Comments
 (0)