diff --git a/builtins-test/build.rs b/builtins-test/build.rs index 5b2dcd12..b14a822b 100644 --- a/builtins-test/build.rs +++ b/builtins-test/build.rs @@ -69,6 +69,8 @@ fn main() { || target.arch == "powerpc64" || target.arch == "powerpc64le" || target.arch == "loongarch64" + // ABI only recently got specified + || target.arch == "s390x" || (target.arch == "x86" && !target.has_feature("sse")) || target.os == "windows" // Linking says "error: function signature mismatch: __extendhfsf2" and seems to diff --git a/builtins-test/src/lib.rs b/builtins-test/src/lib.rs index f1673133..09e8c6db 100644 --- a/builtins-test/src/lib.rs +++ b/builtins-test/src/lib.rs @@ -15,6 +15,7 @@ #![no_std] #![cfg_attr(f128_enabled, feature(f128))] #![cfg_attr(f16_enabled, feature(f16))] +#![feature(linkage)] pub mod bench; extern crate alloc; @@ -403,3 +404,30 @@ macro_rules! apfloat_fallback { $apfloat_op($($arg),+) }}; } + +mod bootstrap { + // Needed for testing other symbols, + #[cfg(f16_enabled)] + #[cfg(target_arch = "s390x")] + #[linkage = "weak"] + #[unsafe(no_mangle)] + pub extern "C" fn __extendhfsf2(a: f16) -> f32 { + compiler_builtins::float::extend::__extendhfsf2(a) + } + + #[cfg(f128_enabled)] + #[cfg(target_arch = "x86")] + #[linkage = "weak"] + #[unsafe(no_mangle)] + pub extern "C" fn __extenddftf2(a: f64) -> f128 { + compiler_builtins::float::extend::__extenddftf2(a) + } + + #[cfg(f128_enabled)] + #[cfg(target_arch = "x86")] + #[linkage = "weak"] + #[unsafe(no_mangle)] + pub extern "C" fn __floattitf(i: i128) -> f128 { + compiler_builtins::float::conv::__floattitf(i) + } +} diff --git a/compiler-builtins/configure.rs b/compiler-builtins/configure.rs index 79e238ab..5d8744fc 100644 --- a/compiler-builtins/configure.rs +++ b/compiler-builtins/configure.rs @@ -55,8 +55,10 @@ impl Target { .collect(), // Note that these are unstable options, so only show up with the nightly compiler or // with `RUSTC_BOOTSTRAP=1` (which is required to use the types anyway). - reliable_f128: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F128").is_some(), - reliable_f16: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F16").is_some(), + // reliable_f128: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F128").is_some(), + // reliable_f16: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F16").is_some(), + reliable_f16: true, + reliable_f128: true, } } diff --git a/libm/configure.rs b/libm/configure.rs index 76186e63..44dee856 100644 --- a/libm/configure.rs +++ b/libm/configure.rs @@ -33,13 +33,18 @@ impl Config { .map(|s| s.to_lowercase().replace("_", "-")) .collect(); + let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + // Symbols are missing so we can't test until they get to nightly + let bootstrapping_f16 = target_arch == "s390x"; + let bootstrapping_f128 = target_arch == "x86"; + Self { target_triple, manifest_dir: PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()), out_dir: PathBuf::from(env::var("OUT_DIR").unwrap()), opt_level: env::var("OPT_LEVEL").unwrap(), cargo_features, - target_arch: env::var("CARGO_CFG_TARGET_ARCH").unwrap(), + target_arch, target_env: env::var("CARGO_CFG_TARGET_ENV").unwrap(), target_family: env::var("CARGO_CFG_TARGET_FAMILY").ok(), target_os: env::var("CARGO_CFG_TARGET_OS").unwrap(), @@ -48,8 +53,10 @@ impl Config { target_features, // Note that these are unstable options, so only show up with the nightly compiler or // with `RUSTC_BOOTSTRAP=1` (which is required to use the types anyway). - reliable_f128: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F128").is_some(), - reliable_f16: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F16").is_some(), + reliable_f16: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F16").is_some() + && !bootstrapping_f16, + reliable_f128: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F128").is_some() + && !bootstrapping_f128, } } }