crt: Add _copysignf into all i386 CRT libraries

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.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Pali Rohár 2024-11-08 18:11:08 +01:00 committed by Martin Storsjö
parent 44e074667a
commit 0e10c9a767
2 changed files with 7 additions and 2 deletions

View File

@ -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=\

View File

@ -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