Skip to content

Don't include math for unix and wasi targets #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ mod macros;
pub mod float;
pub mod int;

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

Expand Down
3 changes: 2 additions & 1 deletion src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! no_mangle {
}
}

#[cfg(all(not(windows), not(target_vendor = "apple")))]
#[cfg(not(windows))]
no_mangle! {
fn acos(x: f64) -> f64;
fn asin(x: f64) -> f64;
Expand Down Expand Up @@ -92,6 +92,7 @@ no_mangle! {
fn fmodf(x: f32, y: f32) -> f32;
}

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