From 8b1e42bf2ae50dab91837e5d6d8da386b945c460 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 24 Jul 2018 13:26:50 -0500 Subject: [PATCH 1/2] expose fmod{,f} symbols on thumb these symbols are required for the built-in operation `f32 % f32` --- library/compiler-builtins/src/lib.rs | 4 +--- library/compiler-builtins/src/math.rs | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/library/compiler-builtins/src/lib.rs b/library/compiler-builtins/src/lib.rs index 3e665a88d49d..5c87e90a5acc 100644 --- a/library/compiler-builtins/src/lib.rs +++ b/library/compiler-builtins/src/lib.rs @@ -47,10 +47,8 @@ mod macros; pub mod int; pub mod float; -pub mod mem; -// only for the wasm32-unknown-unknown target -#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] pub mod math; +pub mod mem; #[cfg(target_arch = "arm")] pub mod arm; diff --git a/library/compiler-builtins/src/math.rs b/library/compiler-builtins/src/math.rs index f1eaaa5fa414..6eddc3d78abb 100644 --- a/library/compiler-builtins/src/math.rs +++ b/library/compiler-builtins/src/math.rs @@ -14,6 +14,8 @@ macro_rules! no_mangle { } } +// only for the wasm32-unknown-unknown target +#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] no_mangle! { fn acos(x: f64) -> f64; fn asin(x: f64) -> f64; @@ -50,3 +52,12 @@ no_mangle! { fn fma(x: f64, y: f64, z: f64) -> f64; fn fmaf(x: f32, y: f32, z: f32) -> f32; } + +// only for the thumb*-none-eabi* targets +#[cfg(all(target_arch = "arm", target_os = "none"))] +no_mangle! { + // `f64 % f64` + fn fmod(x: f64, y: f64) -> f64; + // `f32 % f32` + fn fmodf(x: f32, y: f32) -> f32; +} From cfa1690e6918de6ee8bbe92e2cfb69817b26d636 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 24 Jul 2018 16:57:22 -0500 Subject: [PATCH 2/2] fix warnings --- library/compiler-builtins/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/compiler-builtins/src/lib.rs b/library/compiler-builtins/src/lib.rs index 5c87e90a5acc..02b6c7db953a 100644 --- a/library/compiler-builtins/src/lib.rs +++ b/library/compiler-builtins/src/lib.rs @@ -47,6 +47,8 @@ mod macros; pub mod int; pub mod float; +#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"), + all(target_arch = "arm", target_os = "none")))] pub mod math; pub mod mem;