Function _copysignf is in i386 natively available only in msvcr120 and
UCRT. mingw-w64 already provides emulation in crtdll and msvcrt i386 import
libraries. Include this emulation also into all other i386 CRT import
libraries.

Note that function _copysignf is available in all x64 and arm versions of
msvcrt libraries. So ensure that i386 emulation is not included into
non-i386 builds by adding #if guard for the whole source file. So when it
is compiled for non-i386 build, it would not provide any symbol or
function. Also rename this file to i386__copysignf.c, so it will be clear
that this file i386-only.
---
 mingw-w64-crt/Makefile.am                                  | 4 ++--
 mingw-w64-crt/math/{x86/_copysignf.c => i386__copysignf.c} | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
 rename mingw-w64-crt/math/{x86/_copysignf.c => i386__copysignf.c} (82%)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 54b70b8f8773..cd136ab6ea5f 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -456,7 +456,7 @@ src_ucrtbasearm64=\
 src_msvcrt32=\
   $(src_msvcrt) \
   $(src_msvcrt_add_x86) \
-  math/x86/_copysignf.c \
+  math/i386__copysignf.c \
   misc/___mb_cur_max_func.c \
   misc/__p__osplatform.c \
   misc/__pctype_func.c \
@@ -752,6 +752,7 @@ src_pre_msvcr100=\
   misc/imaxdiv.c
 
 src_pre_msvcr120=\
+  math/i386__copysignf.c \
   misc/isblank.c \
   misc/iswblank.c \
   misc/wctrans.c \
@@ -774,7 +775,6 @@ src_crtdll=\
   misc/crtdll__ismbblead.c \
   misc/crtdll_fstat.c \
   misc/crtdll_stat.c \
-  math/x86/_copysignf.c \
   misc/__p__mbctype.c
 
 src_msvcrt10=\
diff --git a/mingw-w64-crt/math/x86/_copysignf.c 
b/mingw-w64-crt/math/i386__copysignf.c
similarity index 82%
rename from mingw-w64-crt/math/x86/_copysignf.c
rename to mingw-w64-crt/math/i386__copysignf.c
index 134adf20e0ff..b46814445a29 100644
--- a/mingw-w64-crt/math/x86/_copysignf.c
+++ b/mingw-w64-crt/math/i386__copysignf.c
@@ -4,6 +4,9 @@
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
 
+/* This source file is i386-only */
+#if defined(_X86_) || defined(__i386__)
+
 #include <math.h>
 
 float __cdecl _copysignf(float aX, float aY)
@@ -12,3 +15,5 @@ float __cdecl _copysignf(float aX, float aY)
 }
 
 float (__cdecl *__MINGW_IMP_SYMBOL(_copysignf))(float, float) = _copysignf;
+
+#endif
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to