From 83794755b7ecce9ebcf96321b98db4eca50ea572 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Fri, 30 Jan 2026 21:35:07 -0600 Subject: [PATCH] clif: Only set has_reliable_f128_math with glibc New float tests in core are failing on clif with issues like the following: Undefined symbols for architecture arm64: "_coshf128", referenced from: __RNvMNtCshY0fR2o0hOA_3std4f128C4f1284coshCs5TKtJxXQNGL_9coretests in coretests-e38519c0cc90db54.coretests.44b6247a565e10d1-cgu.10.rcgu.o "_exp2f128", referenced from: __RNvMNtCshY0fR2o0hOA_3std4f128C4f1284exp2Cs5TKtJxXQNGL_9coretests in coretests-e38519c0cc90db54.coretests.44b6247a565e10d1-cgu.10.rcgu.o ... Disable f128 math unless the symbols are known to be available, which for now is only glibc targets. This matches the LLVM backend. --- compiler/rustc_codegen_cranelift/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index 656e7b0aec5b..7bab07def63d 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -180,6 +180,10 @@ impl CodegenBackend for CraneliftCodegenBackend { && sess.target.env == Env::Gnu && sess.target.abi != Abi::Llvm); + // FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always + // filled in by compiler-builtins. The only libc that provides these currently is glibc. + let has_reliable_f128_math = has_reliable_f16_f128 && sess.target.env == Env::Gnu; + TargetConfig { target_features, unstable_target_features, @@ -188,7 +192,7 @@ impl CodegenBackend for CraneliftCodegenBackend { has_reliable_f16: has_reliable_f16_f128, has_reliable_f16_math: has_reliable_f16_f128, has_reliable_f128: has_reliable_f16_f128, - has_reliable_f128_math: has_reliable_f16_f128, + has_reliable_f128_math, } }