Skip to content

Commit 8379475

Browse files
tgross35xonx4l
authored andcommitted
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.
1 parent 2c1d605 commit 8379475

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • compiler/rustc_codegen_cranelift/src

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ impl CodegenBackend for CraneliftCodegenBackend {
180180
&& sess.target.env == Env::Gnu
181181
&& sess.target.abi != Abi::Llvm);
182182

183+
// FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always
184+
// filled in by compiler-builtins. The only libc that provides these currently is glibc.
185+
let has_reliable_f128_math = has_reliable_f16_f128 && sess.target.env == Env::Gnu;
186+
183187
TargetConfig {
184188
target_features,
185189
unstable_target_features,
@@ -188,7 +192,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
188192
has_reliable_f16: has_reliable_f16_f128,
189193
has_reliable_f16_math: has_reliable_f16_f128,
190194
has_reliable_f128: has_reliable_f16_f128,
191-
has_reliable_f128_math: has_reliable_f16_f128,
195+
has_reliable_f128_math,
192196
}
193197
}
194198

0 commit comments

Comments
 (0)