Skip to contentSkip to conversation

rust: kbuild: add intrinsics to fix Rust 1.100.0 builds

PATCH In review Miguel Ojeda 2 participants 2 messages Sep 2 – Sep 4

Subsystems (3)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 rust: kbuild: add intrinsics to fix Rust 1.100.0 builds

Starting with Rust 1.100.0 (expected 2026-11-12), a kernel build may fail at the final link with:

ld.lld: error: undefined symbol: fmaximum_numf >>> referenced by core.1f440ee8661e09f9-cgu.0
>>> rust/core.o:(<core::ops::range::RangeFrom<f32> as core::cmp::clamp::ClampBounds<f32>>::clamp) in archive vmlinux.a

(and similar for f{min,max}imum_num{f,} and __gt{s,d}f2). The issue reproduces on x86_64 and arm64.

This happens due to upstream Rust commit bd174e1b20a8 ("Implement clamp_to") [1], which added concrete ClampBounds implementations for floating-point ranges to core, and which, in turn, require the compiler runtime symbols above.

Thus add those intrinsics to our usual workaround, i.e. redirect them to weak panicking definitions.

Cc [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs).

---
I sent a PR to upstream Rust to make the methods simply #[inline] instead, and it seems like it will be merged, so we can most likely skip this workaround:

https://github.com/rust-lang/rust/pull/162191

But I am sending this so that it is archived in the list in case others hit the same issue meanwhile.

 rust/Makefile             | 4 ++--
 rust/compiler_builtins.rs | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
rust/Makefile +2 -2
index da1a7409d984..51e5f83a44b8 100644
@@ -679,8 +679,8 @@ rust-analyzer:
 		> rust-project.json
 
 redirect-intrinsics = \
-	__addsf3 __eqsf2 __extendsfdf2 __gesf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __truncdfsf2 __unordsf2 \
-	__adddf3 __eqdf2 __ledf2 __ltdf2 __muldf3 __unorddf2 \
+	__addsf3 __eqsf2 __extendsfdf2 __gesf2 __gtsf2 __lesf2 __ltsf2 __mulsf3 __nesf2 __truncdfsf2 __unordsf2 fmaximum_numf fminimum_numf \
+	__adddf3 __eqdf2 __gtdf2 __ledf2 __ltdf2 __muldf3 __unorddf2 fmaximum_num fminimum_num \
 	__muloti4 __multi3 \
 	__udivmodti4 __udivti3 __umodti3
 
rust/compiler_builtins.rs +6 -0
index fc6b54636dd5..31b991e1619d 100644
@@ -42,21 +42,27 @@ pub extern "C" fn $ident() {
     __eqsf2,
     __extendsfdf2,
     __gesf2,
+    __gtsf2,
     __lesf2,
     __ltsf2,
     __mulsf3,
     __nesf2,
     __truncdfsf2,
     __unordsf2,
+    fmaximum_numf,
+    fminimum_numf,
 });
 
 define_panicking_intrinsics!("`f64` should not be used", {
     __adddf3,
     __eqdf2,
+    __gtdf2,
     __ledf2,
     __ltdf2,
     __muldf3,
     __unorddf2,
+    fmaximum_num,
+    fminimum_num,
 });
 
 define_panicking_intrinsics!("`i128` should not be used", {

base-commit: e510334fbaeaa016ac76d80b4c5f47611c5f7860 --
2.55.0

#1 lore raw
Quoted 6 lines · Miguel Ojeda

I sent a PR to upstream Rust to make the methods simply #[inline] instead, and it seems like it will be merged, so we can most likely skip this workaround:

https://github.com/rust-lang/rust/pull/162191

The PR has been merged for Rust 1.100.0, so no patch needed.

Cheers,
Miguel