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.
This commit is contained in:
Trevor Gross 2026-01-30 21:35:07 -06:00 committed by xonx
parent 5868ac677e
commit b28ebc87a8

View file

@ -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,
}
}