Skip to content

Commit 9c1fe0e

Browse files
authored
Merge pull request #680 from Amjad50/fix-builtin-math-symbols-ignored
Don't include `math` for `unix` and `wasi` targets
2 parents 081192c + 0fab77e commit 9c1fe0e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/lib.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@ mod macros;
4747
pub mod float;
4848
pub mod int;
4949

50-
// Disabled on x86 without sse2 due to ABI issues
51-
// <https://github.com/rust-lang/rust/issues/114479>
52-
#[cfg(not(all(target_arch = "x86", not(target_feature = "sse2"))))]
50+
// Disable for any of the following:
51+
// - x86 without sse2 due to ABI issues
52+
// - <https://github.com/rust-lang/rust/issues/114479>
53+
// - All unix targets (linux, macos, freebsd, android, etc)
54+
// - wasm with known target_os
55+
#[cfg(not(any(
56+
all(target_arch = "x86", not(target_feature = "sse2")),
57+
unix,
58+
all(target_family = "wasm", not(target_os = "unknown"))
59+
)))]
5360
pub mod math;
5461
pub mod mem;
5562

src/math.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ macro_rules! no_mangle {
1717
}
1818
}
1919

20-
#[cfg(all(not(windows), not(target_vendor = "apple")))]
20+
#[cfg(not(windows))]
2121
no_mangle! {
2222
fn acos(x: f64) -> f64;
2323
fn asin(x: f64) -> f64;
@@ -92,6 +92,7 @@ no_mangle! {
9292
fn fmodf(x: f32, y: f32) -> f32;
9393
}
9494

95+
// allow for windows (and other targets)
9596
intrinsics! {
9697
pub extern "C" fn lgamma_r(x: f64, s: &mut i32) -> f64 {
9798
let r = self::libm::lgamma_r(x);

0 commit comments

Comments
 (0)