Update the libm submodule

This commit is contained in:
Trevor Gross 2025-01-06 01:10:04 +00:00 committed by Trevor Gross
parent cf08352443
commit f4f942c3e9
4 changed files with 54 additions and 6 deletions

View file

@ -14,12 +14,9 @@ fn main() {
configure_check_cfg();
configure_f16_f128(&target);
println!("cargo:compiler-rt={}", cwd.join("compiler-rt").display());
configure_libm(&target);
// Activate libm's unstable features to make full use of Nightly.
println!("cargo::rustc-check-cfg=cfg(feature, values(\"unstable\", \"force-soft-floats\"))");
println!("cargo:rustc-cfg=feature=\"unstable\"");
println!("cargo:rustc-cfg=feature=\"force-soft-floats\"");
println!("cargo:compiler-rt={}", cwd.join("compiler-rt").display());
// Emscripten's runtime includes all the builtins
if target.os == "emscripten" {
@ -104,6 +101,48 @@ fn main() {
}
}
/// Run configuration for `libm` since it is included directly.
///
/// Much of this is copied from `libm/configure.rs`.
fn configure_libm(target: &Target) {
println!("cargo:rustc-check-cfg=cfg(intrinsics_enabled)");
println!("cargo:rustc-check-cfg=cfg(arch_enabled)");
println!("cargo:rustc-check-cfg=cfg(optimizations_enabled)");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"unstable-public-internals\"))");
// Always use intrinsics
println!("cargo:rustc-cfg=intrinsics_enabled");
// The arch module may contain assembly.
if cfg!(feature = "no-asm") {
println!("cargo:rustc-cfg=feature=\"force-soft-floats\"");
} else {
println!("cargo:rustc-cfg=arch_enabled");
}
println!("cargo:rustc-check-cfg=cfg(optimizations_enabled)");
if target.opt_level >= 2 {
println!("cargo:rustc-cfg=optimizations_enabled");
}
// Config shorthands
println!("cargo:rustc-check-cfg=cfg(x86_no_sse)");
if target.arch == "x86" && !target.features.iter().any(|f| f == "sse") {
// Shorthand to detect i586 targets
println!("cargo:rustc-cfg=x86_no_sse");
}
println!(
"cargo:rustc-env=CFG_CARGO_FEATURES={:?}",
target.cargo_features
);
println!("cargo:rustc-env=CFG_OPT_LEVEL={}", target.opt_level);
println!("cargo:rustc-env=CFG_TARGET_FEATURES={:?}", target.features);
// Activate libm's unstable features to make full use of Nightly.
println!("cargo:rustc-cfg=feature=\"unstable-intrinsics\"");
}
fn aarch64_symbol(ordering: Ordering) -> &'static str {
match ordering {
Ordering::Relaxed => "relax",

View file

@ -6,6 +6,8 @@ use std::env;
#[allow(dead_code)]
pub struct Target {
pub triple: String,
pub opt_level: u8,
pub cargo_features: Vec<String>,
pub os: String,
pub arch: String,
pub vendor: String,
@ -22,10 +24,16 @@ impl Target {
"big" => false,
x => panic!("unknown endian {x}"),
};
let cargo_features = env::vars()
.filter_map(|(name, _value)| name.strip_prefix("CARGO_FEATURE_").map(ToOwned::to_owned))
.map(|s| s.to_lowercase().replace("_", "-"))
.collect();
Self {
triple: env::var("TARGET").unwrap(),
os: env::var("CARGO_CFG_TARGET_OS").unwrap(),
opt_level: env::var("OPT_LEVEL").unwrap().parse().unwrap(),
cargo_features,
arch: env::var("CARGO_CFG_TARGET_ARCH").unwrap(),
vendor: env::var("CARGO_CFG_TARGET_VENDOR").unwrap(),
env: env::var("CARGO_CFG_TARGET_ENV").unwrap(),

@ -1 +1 @@
Subproject commit f4e5b38aee0e0c592a82ed45b21cd068c9b6c89a
Subproject commit 424c3ece1a7546de8530fa9d0fbf90d3b182cd18

View file

@ -1,3 +1,4 @@
#[rustfmt::skip]
#[allow(dead_code)]
#[allow(unused_imports)]
#[allow(clippy::all)]