Skip to content

Commit 749a067

Browse files
committed
Use our libm on windows-gnu targets
Add Windows-GNU to the group of targets that gets our version of basic libm symbols available through compiler-builtins. This is done to avoid bugs in the platform `fma`, see [1]. [1]: rust-lang/rust#140515
1 parent 7ccb126 commit 749a067

File tree

1 file changed

+6
-2
lines changed
  • compiler-builtins/src/math

1 file changed

+6
-2
lines changed

compiler-builtins/src/math/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ pub mod full_availability {
3939
}
4040

4141
/* Weak linkage is unreliable on Windows and Apple, so we don't expose symbols that we know
42-
* the system libc provides in order to avoid conflicts. */
42+
* the system libc provides in order to avoid conflicts.
43+
*
44+
* Windows+GNU is an exception since we _do_ want to use our `fma` to avoid the inaccurate
45+
* system implementation. see the issue: https://github.com/rust-lang/rust/issues/140515.
46+
*/
4347

44-
#[cfg(all(not(windows), not(target_vendor = "apple")))]
48+
#[cfg(all(not(all(windows, target_env = "gnu")), not(target_vendor = "apple")))]
4549
libm_intrinsics! {
4650
/* f32 */
4751
fn cbrtf(n: f32) -> f32;

0 commit comments

Comments
 (0)