Finalizing math.h fixes:

- Updated msvcrt.def with symbols from 64bit version of dll - it contains the float math functions missing in the 32bit dll.
- Made sure this patch only apply to to WIN32 and WIN64. For WIN32 float functions calls the double variants, on 64bit they are called natively.
This commit is contained in:
Tyge 2020-04-11 02:29:51 +02:00
parent df67d8617b
commit 024214af2d
2 changed files with 131 additions and 171 deletions

View file

@ -205,8 +205,21 @@ extern "C" {
__CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
#if !defined (__ia64__) #if !defined (__ia64__)
__CRT_INLINE float fabsf(float x) { return (float) fabs(x); } __CRT_INLINE float __cdecl fabsf (float x)
__CRT_INLINE float ldexpf(float x, int expn) { return (float) ldexp(x, expn); } {
#ifdef _WIN64
*((int *) &x) &= 0x7fffffff;
return x;
#else
float res;
__asm__ ("fabs;" : "=t" (res) : "0" (x));
return res;
#endif
}
__CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); }
#endif
#if defined (_WIN32) && !defined(_WIN64)
__CRT_INLINE float acosf(float x) { return (float) acos(x); } __CRT_INLINE float acosf(float x) { return (float) acos(x); }
__CRT_INLINE float asinf(float x) { return (float) asin(x); } __CRT_INLINE float asinf(float x) { return (float) asin(x); }
__CRT_INLINE float atanf(float x) { return (float) atan(x); } __CRT_INLINE float atanf(float x) { return (float) atan(x); }
@ -377,6 +390,32 @@ extern "C" {
extern double __cdecl logb (double); extern double __cdecl logb (double);
extern float __cdecl logbf (float); extern float __cdecl logbf (float);
extern long double __cdecl logbl (long double); extern long double __cdecl logbl (long double);
#ifndef _WIN32
__CRT_INLINE double __cdecl logb (double x)
{
double res;
__asm__ ("fxtract\n\t"
"fstp %%st" : "=t" (res) : "0" (x));
return res;
}
__CRT_INLINE float __cdecl logbf (float x)
{
float res;
__asm__ ("fxtract\n\t"
"fstp %%st" : "=t" (res) : "0" (x));
return res;
}
__CRT_INLINE long double __cdecl logbl (long double x)
{
long double res;
__asm__ ("fxtract\n\t"
"fstp %%st" : "=t" (res) : "0" (x));
return res;
}
#endif
extern long double __cdecl modfl (long double, long double*); extern long double __cdecl modfl (long double, long double*);
/* 7.12.6.13 */ /* 7.12.6.13 */

View file

@ -1,80 +1,57 @@
LIBRARY msvcrt.dll LIBRARY msvcrt.dll
EXPORTS EXPORTS
$I10_OUTPUT ??0__non_rtti_object@@QEAA@AEBV0@@Z
??0__non_rtti_object@@QAE@ABV0@@Z ??0__non_rtti_object@@QEAA@PEBD@Z
??0__non_rtti_object@@QAE@PBD@Z
??0bad_cast@@AAE@PBQBD@Z ??0bad_cast@@AAE@PBQBD@Z
??0bad_cast@@AEAA@PEBQEBD@Z
??0bad_cast@@QAE@ABQBD@Z ??0bad_cast@@QAE@ABQBD@Z
??0bad_cast@@QAE@ABV0@@Z ??0bad_cast@@QEAA@AEBQEBD@Z
??0bad_cast@@QAE@PBD@Z ??0bad_cast@@QEAA@AEBV0@@Z
??0bad_typeid@@QAE@ABV0@@Z ??0bad_cast@@QEAA@PEBD@Z
??0bad_typeid@@QAE@PBD@Z ??0bad_typeid@@QEAA@AEBV0@@Z
??0exception@@QAE@ABQBD@Z ??0bad_typeid@@QEAA@PEBD@Z
??0exception@@QAE@ABQBDH@Z ??0exception@@QEAA@AEBQEBD@Z
??0exception@@QAE@ABV0@@Z ??0exception@@QEAA@AEBQEBDH@Z
??0exception@@QAE@XZ ??0exception@@QEAA@AEBV0@@Z
??1__non_rtti_object@@UAE@XZ ??0exception@@QEAA@XZ
??1bad_cast@@UAE@XZ ??1__non_rtti_object@@UEAA@XZ
??1bad_typeid@@UAE@XZ ??1bad_cast@@UEAA@XZ
??1exception@@UAE@XZ ??1bad_typeid@@UEAA@XZ
??1type_info@@UAE@XZ ??1exception@@UEAA@XZ
??2@YAPAXI@Z ??1type_info@@UEAA@XZ
??2@YAPAXIHPBDH@Z ??2@YAPEAX_K@Z
??3@YAXPAX@Z ??2@YAPEAX_KHPEBDH@Z
??4__non_rtti_object@@QAEAAV0@ABV0@@Z ??3@YAXPEAX@Z
??4bad_cast@@QAEAAV0@ABV0@@Z ??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z
??4bad_typeid@@QAEAAV0@ABV0@@Z ??4bad_cast@@QEAAAEAV0@AEBV0@@Z
??4exception@@QAEAAV0@ABV0@@Z ??4bad_typeid@@QEAAAEAV0@AEBV0@@Z
??8type_info@@QBEHABV0@@Z ??4exception@@QEAAAEAV0@AEBV0@@Z
??9type_info@@QBEHABV0@@Z ??8type_info@@QEBAHAEBV0@@Z
??9type_info@@QEBAHAEBV0@@Z
??_7__non_rtti_object@@6B@ ??_7__non_rtti_object@@6B@
??_7bad_cast@@6B@ ??_7bad_cast@@6B@
??_7bad_typeid@@6B@ ??_7bad_typeid@@6B@
??_7exception@@6B@ ??_7exception@@6B@
??_E__non_rtti_object@@UAEPAXI@Z ??_Fbad_cast@@QEAAXXZ
??_Ebad_cast@@UAEPAXI@Z ??_Fbad_typeid@@QEAAXXZ
??_Ebad_typeid@@UAEPAXI@Z ??_U@YAPEAX_K@Z
??_Eexception@@UAEPAXI@Z ??_U@YAPEAX_KHPEBDH@Z
??_Fbad_cast@@QAEXXZ ??_V@YAXPEAX@Z
??_Fbad_typeid@@QAEXXZ ?_query_new_handler@@YAP6AH_K@ZXZ
??_G__non_rtti_object@@UAEPAXI@Z
??_Gbad_cast@@UAEPAXI@Z
??_Gbad_typeid@@UAEPAXI@Z
??_Gexception@@UAEPAXI@Z
??_U@YAPAXI@Z
??_U@YAPAXIHPBDH@Z
??_V@YAXPAX@Z
?_query_new_handler@@YAP6AHI@ZXZ
?_query_new_mode@@YAHXZ ?_query_new_mode@@YAHXZ
?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z ?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z
?_set_new_mode@@YAHH@Z ?_set_new_mode@@YAHH@Z
?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z ?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z
?before@type_info@@QBEHABV1@@Z ?before@type_info@@QEBAHAEBV1@@Z
?name@type_info@@QBEPBDXZ ?name@type_info@@QEBAPEBDXZ
?raw_name@type_info@@QBEPBDXZ ?raw_name@type_info@@QEBAPEBDXZ
?set_new_handler@@YAP6AXXZP6AXXZ@Z ?set_new_handler@@YAP6AXXZP6AXXZ@Z
?set_terminate@@YAP6AXXZP6AXXZ@Z ?set_terminate@@YAP6AXXZP6AXXZ@Z
?set_unexpected@@YAP6AXXZP6AXXZ@Z ?set_unexpected@@YAP6AXXZP6AXXZ@Z
?terminate@@YAXXZ ?terminate@@YAXXZ
?unexpected@@YAXXZ ?unexpected@@YAXXZ
?what@exception@@UBEPBDXZ ?what@exception@@UEBAPEBDXZ
_CIacos
_CIasin
_CIatan
_CIatan2
_CIcos
_CIcosh
_CIexp
_CIfmod
_CIlog
_CIlog10
_CIpow
_CIsin
_CIsinh
_CIsqrt
_CItan
_CItanh
_CrtCheckMemory _CrtCheckMemory
_CrtDbgBreak _CrtDbgBreak
_CrtDbgReport _CrtDbgReport
@ -101,27 +78,33 @@ _CrtSetReportHook
_CrtSetReportHook2 _CrtSetReportHook2
_CrtSetReportMode _CrtSetReportMode
_CxxThrowException _CxxThrowException
_EH_prolog
_Getdays _Getdays
_Getmonths _Getmonths
_Gettnames _Gettnames
_HUGE _HUGE
_Strftime _Strftime
_W_Getdays
_W_Getmonths
_W_Gettnames
_Wcsftime
_XcptFilter _XcptFilter
__AdjustPointer
__C_specific_handler
__CppXcptFilter __CppXcptFilter
__CxxCallUnwindDelDtor
__CxxCallUnwindDtor
__CxxCallUnwindVecDtor
__CxxDetectRethrow
__CxxExceptionFilter
__CxxFrameHandler __CxxFrameHandler
__CxxFrameHandler2 __CxxFrameHandler2
__CxxFrameHandler3 __CxxFrameHandler3
__CxxLongjmpUnwind
__CxxQueryExceptionSize
__CxxRegisterExceptionObject
__CxxUnregisterExceptionObject
__DestructExceptionObject __DestructExceptionObject
__ExceptionPtrAssign
__ExceptionPtrCompare
__ExceptionPtrCopy
__ExceptionPtrCopyException
__ExceptionPtrCreate
__ExceptionPtrCurrentException
__ExceptionPtrDestroy
__ExceptionPtrRethrow
__ExceptionPtrSwap
__ExceptionPtrToBool
__RTCastToVoid __RTCastToVoid
__RTDynamicCast __RTDynamicCast
__RTtypeid __RTtypeid
@ -156,57 +139,7 @@ __lc_codepage
__lc_collate_cp __lc_collate_cp
__lc_handle __lc_handle
__lconv_init __lconv_init
__libm_sse2_acos
__libm_sse2_acosf
__libm_sse2_asin
__libm_sse2_asinf
__libm_sse2_atan
__libm_sse2_atan2
__libm_sse2_atanf
__libm_sse2_cos
__libm_sse2_cosf
__libm_sse2_exp
__libm_sse2_expf
__libm_sse2_log
__libm_sse2_log10
__libm_sse2_log10f
__libm_sse2_logf
__libm_sse2_pow
__libm_sse2_powf
__libm_sse2_sin
__libm_sse2_sinf
__libm_sse2_tan
__libm_sse2_tanf
__mb_cur_max __mb_cur_max
__p___argc
__p___argv
__p___initenv
__p___mb_cur_max
__p___wargv
__p___winitenv
__p__acmdln
__p__amblksiz
__p__commode
__p__daylight
__p__dstbias
__p__environ
__p__fileinfo
__p__fmode
__p__iob
__p__mbcasemap
__p__mbctype
__p__osver
__p__pctype
__p__pgmptr
__p__pwctype
__p__timezone
__p__tzname
__p__wcmdln
__p__wenviron
__p__winmajor
__p__winminor
__p__winver
__p__wpgmptr
__pctype_func __pctype_func
__pioinfo __pioinfo
__pwctype_func __pwctype_func
@ -228,25 +161,10 @@ __wcserror_s
__wcsncnt __wcsncnt
__wgetmainargs __wgetmainargs
__winitenv __winitenv
_abnormal_termination
_abs64 _abs64
_access _access
_access_s _access_s
_acmdln _acmdln
_adj_fdiv_m16i
_adj_fdiv_m32
_adj_fdiv_m32i
_adj_fdiv_m64
_adj_fdiv_r
_adj_fdivr_m16i
_adj_fdivr_m32
_adj_fdivr_m32i
_adj_fdivr_m64
_adj_fpatan
_adj_fprem
_adj_fprem1
_adj_fptan
_adjust_fdiv
_aexit_rtn _aexit_rtn
_aligned_free _aligned_free
_aligned_free_dbg _aligned_free_dbg
@ -285,7 +203,7 @@ _cgetws_s
_chdir _chdir
_chdrive _chdrive
_chgsign _chgsign
_chkesp _chgsignf
_chmod _chmod
_chsize _chsize
_chsize_s _chsize_s
@ -299,6 +217,7 @@ _control87
_controlfp _controlfp
_controlfp_s _controlfp_s
_copysign _copysign
_copysignf
_cprintf _cprintf
_cprintf_l _cprintf_l
_cprintf_p _cprintf_p
@ -308,6 +227,7 @@ _cprintf_s_l
_cputs _cputs
_cputws _cputws
_creat _creat
_create_locale
_crtAssertBusy _crtAssertBusy
_crtBreakAlloc _crtBreakAlloc
_crtDbgFlag _crtDbgFlag
@ -344,9 +264,6 @@ _endthreadex
_environ _environ
_eof _eof
_errno _errno
_except_handler2
_except_handler3
_except_handler4_common
_execl _execl
_execle _execle
_execlp _execlp
@ -377,11 +294,12 @@ _findnext
_findnext64 _findnext64
_findnexti64 _findnexti64
_finite _finite
_finitef
_flsbuf _flsbuf
_flushall _flushall
_fmode _fmode
_fpclass _fpclass
_fpieee_flt _fpclassf
_fpreset _fpreset
_fprintf_l _fprintf_l
_fprintf_p _fprintf_p
@ -390,6 +308,7 @@ _fprintf_s_l
_fputchar _fputchar
_fputwchar _fputwchar
_free_dbg _free_dbg
_free_locale
_freea _freea
_freea_s _freea_s
_fscanf_l _fscanf_l
@ -404,10 +323,6 @@ _ftime32
_ftime32_s _ftime32_s
_ftime64 _ftime64
_ftime64_s _ftime64_s
_ftol
_ftol2
_ftol2_sse
_ftol2_sse_excpt
_fullpath _fullpath
_fullpath_dbg _fullpath_dbg
_futime _futime
@ -421,6 +336,7 @@ _fwscanf_l
_fwscanf_s_l _fwscanf_s_l
_gcvt _gcvt
_gcvt_s _gcvt_s
_get_current_locale
_get_doserrno _get_doserrno
_get_environ _get_environ
_get_errno _get_errno
@ -443,7 +359,6 @@ _getche
_getcwd _getcwd
_getdcwd _getdcwd
_getdiskfree _getdiskfree
_getdllprocaddr
_getdrive _getdrive
_getdrives _getdrives
_getmaxstdio _getmaxstdio
@ -454,27 +369,22 @@ _getw
_getwch _getwch
_getwche _getwche
_getws _getws
_global_unwind2
_gmtime32 _gmtime32
_gmtime32_s _gmtime32_s
_gmtime64 _gmtime64
_gmtime64_s _gmtime64_s
_heapadd
_heapchk _heapchk
_heapmin _heapmin
_heapset _heapset
_heapused
_heapwalk _heapwalk
_hypot _hypot
_hypotf
_i64toa _i64toa
_i64toa_s _i64toa_s
_i64tow _i64tow
_i64tow_s _i64tow_s
_initterm _initterm
_initterm_e _initterm_e
_inp
_inpd
_inpw
_invalid_parameter _invalid_parameter
_iob _iob
_isalnum_l _isalnum_l
@ -546,6 +456,7 @@ _ismbslead_l
_ismbstrail _ismbstrail
_ismbstrail_l _ismbstrail_l
_isnan _isnan
_isnanf
_isprint_l _isprint_l
_isspace_l _isspace_l
_isupper_l _isupper_l
@ -572,9 +483,7 @@ _jn
_kbhit _kbhit
_lfind _lfind
_lfind_s _lfind_s
_loaddll _local_unwind
_local_unwind2
_local_unwind4
_localtime32 _localtime32
_localtime32_s _localtime32_s
_localtime64 _localtime64
@ -582,7 +491,7 @@ _localtime64_s
_lock _lock
_locking _locking
_logb _logb
_longjmpex _logbf
_lrotl _lrotl
_lrotr _lrotr
_lsearch _lsearch
@ -746,16 +655,14 @@ _mktemp_s
_mktime32 _mktime32
_mktime64 _mktime64
_msize _msize
_msize_debug _msize_dbg
_nextafter _nextafter
_nextafterf
_onexit _onexit
_open _open
_open_osfhandle _open_osfhandle
_osplatform _osplatform
_osver _osver
_outp
_outpd
_outpw
_pclose _pclose
_pctype _pctype
_pgmptr _pgmptr
@ -782,11 +689,8 @@ _rotl
_rotl64 _rotl64
_rotr _rotr
_rotr64 _rotr64
_safe_fdiv
_safe_fdivr
_safe_fprem
_safe_fprem1
_scalb _scalb
_scalbf
_scanf_l _scanf_l
_scanf_s_l _scanf_s_l
_scprintf _scprintf
@ -797,9 +701,6 @@ _scwprintf_l
_scwprintf_p_l _scwprintf_p_l
_searchenv _searchenv
_searchenv_s _searchenv_s
_seh_longjmp_unwind
_seh_longjmp_unwind4
_set_SSE2_enable
_set_controlfp _set_controlfp
_set_doserrno _set_doserrno
_set_errno _set_errno
@ -810,7 +711,7 @@ _set_output_format
_set_sbh_threshold _set_sbh_threshold
_seterrormode _seterrormode
_setjmp _setjmp
_setjmp3 _setjmpex
_setmaxstdio _setmaxstdio
_setmbcp _setmbcp
_setmode _setmode
@ -934,7 +835,6 @@ _umask_s
_ungetch _ungetch
_ungetwch _ungetwch
_unlink _unlink
_unloaddll
_unlock _unlock
_utime _utime
_utime32 _utime32
@ -1027,6 +927,7 @@ _wcsnset_s
_wcsrev _wcsrev
_wcsset _wcsset
_wcsset_s _wcsset_s
_wcstod_l
_wcstoi64 _wcstoi64
_wcstoi64_l _wcstoi64_l
_wcstol_l _wcstol_l
@ -1146,11 +1047,15 @@ _yn
abort abort
abs abs
acos acos
acosf
asctime asctime
asctime_s asctime_s
asin asin
asinf
atan atan
atan2 atan2
atan2f
atanf
atexit atexit
atof atof
atoi atoi
@ -1160,16 +1065,20 @@ bsearch_s
btowc btowc
calloc calloc
ceil ceil
ceilf
clearerr clearerr
clearerr_s clearerr_s
clock clock
cos cos
cosf
cosh cosh
coshf
ctime ctime
difftime difftime
div div
exit exit
exp exp
expf
fabs fabs
fclose fclose
feof feof
@ -1181,7 +1090,9 @@ fgets
fgetwc fgetwc
fgetws fgetws
floor floor
floorf
fmod fmod
fmodf
fopen fopen
fopen_s fopen_s
fprintf fprintf
@ -1246,6 +1157,8 @@ localeconv
localtime localtime
log log
log10 log10
log10f
logf
longjmp longjmp
malloc malloc
mblen mblen
@ -1266,8 +1179,10 @@ memmove_s
memset memset
mktime mktime
modf modf
modff
perror perror
pow pow
powf
printf printf
printf_s printf_s
putc putc
@ -1287,14 +1202,18 @@ rewind
scanf scanf
scanf_s scanf_s
setbuf setbuf
setjmp
setlocale setlocale
setvbuf setvbuf
signal signal
sin sin
sinf
sinh sinh
sinhf
sprintf sprintf
sprintf_s sprintf_s
sqrt sqrt
sqrtf
srand srand
sscanf sscanf
sscanf_s sscanf_s
@ -1332,7 +1251,9 @@ swscanf
swscanf_s swscanf_s
system system
tan tan
tanf
tanh tanh
tanhf
time time
tmpfile tmpfile
tmpfile_s tmpfile_s