about summary refs log tree commit diff
path: root/library/compiler-builtins/libm/src/math/support/mod.rs
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-05-06 20:11:48 +0000
committerTrevor Gross <t.gross35@gmail.com>2025-05-06 17:59:03 -0400
commit61a14fcea05f8e9a544a5557b98633f7ace65109 (patch)
tree80002d1486286bea774c8eca21f3da1eaf33f5b6 /library/compiler-builtins/libm/src/math/support/mod.rs
parent339793d62b4c455f2a8268e09f85ee471cd4847c (diff)
downloadrust-61a14fcea05f8e9a544a5557b98633f7ace65109.tar.gz
rust-61a14fcea05f8e9a544a5557b98633f7ace65109.zip
Require `target_has_atomic = "ptr"` for runtime feature detection
The `feature_detect` module is currently being built on all targets, but
the use of `AtomicU32` causes a problem if atomics are not available
(such as with `bpfel-unknown-none`). Gate this module behind
`target_has_atomic = "ptr"`.

The below now completes successfully:

    cargo build -p compiler_builtins --target=bpfel-unknown-none -Z build-std=core

Fixes: https://github.com/rust-lang/compiler-builtins/issues/908
Diffstat (limited to 'library/compiler-builtins/libm/src/math/support/mod.rs')
-rw-r--r--library/compiler-builtins/libm/src/math/support/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/compiler-builtins/libm/src/math/support/mod.rs b/library/compiler-builtins/libm/src/math/support/mod.rs
index 727b9a360e2..a4f596ab844 100644
--- a/library/compiler-builtins/libm/src/math/support/mod.rs
+++ b/library/compiler-builtins/libm/src/math/support/mod.rs
@@ -2,7 +2,9 @@
 pub mod macros;
 mod big;
 mod env;
-mod feature_detect;
+// Runtime feature detection requires atomics.
+#[cfg(target_has_atomic = "ptr")]
+pub(crate) mod feature_detect;
 mod float_traits;
 pub mod hex_float;
 mod int_traits;
@@ -11,8 +13,6 @@ mod int_traits;
 pub use big::{i256, u256};
 pub use env::{FpResult, Round, Status};
 #[allow(unused_imports)]
-pub(crate) use feature_detect::{Flags, get_or_init_flags_cache, select_once, unique_masks};
-#[allow(unused_imports)]
 pub use float_traits::{DFloat, Float, HFloat, IntTy};
 pub(crate) use float_traits::{f32_from_bits, f64_from_bits};
 #[cfg(f16_enabled)]