Skip to content

Commit 6b4f7c9

Browse files
committed
Reenable the use of the force-soft-floats feature
This fixes an infinite recursion in sqrt for codegen backends that implement intrinsics like simd_fsqrt by calling sqrt on every element of the vector.
1 parent 1901c41 commit 6b4f7c9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler-builtins/build.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,19 @@ fn configure_libm(target: &Target) {
9595
println!("cargo:rustc-check-cfg=cfg(intrinsics_enabled)");
9696
println!("cargo:rustc-check-cfg=cfg(arch_enabled)");
9797
println!("cargo:rustc-check-cfg=cfg(optimizations_enabled)");
98-
println!("cargo:rustc-check-cfg=cfg(feature, values(\"unstable-public-internals\"))");
98+
println!("cargo:rustc-check-cfg=cfg(feature, values(\"unstable-public-internals\", \"force-soft-floats\"))");
9999

100100
// Always use intrinsics
101101
println!("cargo:rustc-cfg=intrinsics_enabled");
102102

103+
// Codegen backends (e.g. rustc_codegen_gcc) that implement intrinsics like simd_fsqrt by
104+
// calling sqrt on every element of the vector ends up with an infinite recursion without this
105+
// feature because sqrt would call simd_fsqrt, which in turn calls sqrt on those codegen
106+
// backends.
107+
println!("cargo:rustc-cfg=feature=\"force-soft-floats\"");
108+
103109
// The arch module may contain assembly.
104-
if cfg!(feature = "no-asm") {
105-
println!("cargo:rustc-cfg=feature=\"force-soft-floats\"");
106-
} else {
110+
if !cfg!(feature = "no-asm") {
107111
println!("cargo:rustc-cfg=arch_enabled");
108112
}
109113

0 commit comments

Comments
 (0)