[Mingw-w64-public] [PATCH 14/14] crt: Do not include nextafter symbol alias for msvcr120* and UCRT

2024-06-18 Thread Pali Rohár
msvcr120 and UCRT provides native nextafter symbol. So do not define duplicate symbol nextafter via crt-aliases.def.in file for these import libraries. --- mingw-w64-crt/def-include/crt-aliases.def.in | 2 ++ mingw-w64-crt/lib-common/msvcrt.def.in | 1 + mingw-w64-crt/lib32/crtdll.def.in

[Mingw-w64-public] [PATCH 12/14] crt: msvcr120*.def.in: Add missing nextafter symbol

2024-06-18 Thread Pali Rohár
All msvcr120 DLL libraries provides C99 nextafter() function. i386 msvcr120d.def.in already contains it. In other def files it is missing. --- mingw-w64-crt/lib32/msvcr120.def.in | 1 + mingw-w64-crt/lib64/msvcr120.def.in | 1 + mingw-w64-crt/lib64/msvcr120d.def.in | 1 + 3 files changed, 3

[Mingw-w64-public] [PATCH 13/14] crt: msvcr120*.def.in: Don't provide long double functions for x86

2024-06-18 Thread Pali Rohár
Long double type for msvc is 64-bit but for gcc it is 80-bit. So these long double functions are not compatible with gcc. Comment them in all msvcr120 def files for x86 platform. --- mingw-w64-crt/lib-common/msvcr120_app.def.in | 122 +-- mingw-w64-crt/lib32/msvcr120.def.in

[Mingw-w64-public] [PATCH 09/14] crt: msvcr120.def.in: Fix cdecl symbols

2024-06-18 Thread Pali Rohár
Some cdecl functions have incorrect stdcall suffix @0 probably due to false-positive detection by gendef. Remove incorrect suffix. --- mingw-w64-crt/lib32/msvcr120.def.in | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mingw-w64-crt/lib32/msvcr120.def.in

[Mingw-w64-public] [PATCH 11/14] crt: msvcr120*.def.in: Cleanup comments

2024-06-18 Thread Pali Rohár
Remove Check!!! comments. --- mingw-w64-crt/lib32/msvcr120.def.in | 48 ++-- mingw-w64-crt/lib32/msvcr120d.def.in | 6 ++-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/mingw-w64-crt/lib32/msvcr120.def.in b/mingw-w64-crt/lib32/msvcr120.def.in index

[Mingw-w64-public] [PATCH 10/14] crt: msvcr120_app.def.in: Fix name of i386 NLG_Return2 symbol

2024-06-18 Thread Pali Rohár
x64 version has this symbol with two leading underlines. i386 version has this symbol with just one leading underline. Same applies for other msvcrt libraries. --- mingw-w64-crt/lib-common/msvcr120_app.def.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Mingw-w64-public] [PATCH 08/14] crt: msvcr110.def.in: Cleanup comments

2024-06-18 Thread Pali Rohár
Remove Check!!! comments and move math comments to the correct lines. --- mingw-w64-crt/lib32/msvcr110.def.in | 58 ++--- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/mingw-w64-crt/lib32/msvcr110.def.in b/mingw-w64-crt/lib32/msvcr110.def.in index

[Mingw-w64-public] [PATCH 05/14] crt: msvcr100.def.in: Make MSVCR100.dll library name upper case

2024-06-18 Thread Pali Rohár
Export name is upper case in the original Visual C++ library. --- mingw-w64-crt/lib32/msvcr100.def.in | 4 ++-- mingw-w64-crt/lib64/msvcr100.def.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mingw-w64-crt/lib32/msvcr100.def.in b/mingw-w64-crt/lib32/msvcr100.def.in

[Mingw-w64-public] [PATCH 01/14] crt: Move $I10_OUTPUT symbol out of the C++ mangled section in lib64 def.in files

2024-06-18 Thread Pali Rohár
--- mingw-w64-crt/lib64/msvcr100.def.in | 2 +- mingw-w64-crt/lib64/msvcr110.def.in | 2 +- mingw-w64-crt/lib64/msvcr120.def.in | 2 +- mingw-w64-crt/lib64/msvcr120d.def.in | 2 +- mingw-w64-crt/lib64/msvcr90.def.in | 2 +- mingw-w64-crt/lib64/msvcr90d.def.in | 2 +- 6 files changed, 6

[Mingw-w64-public] [PATCH 07/14] crt: msvcr110.def.in: Fix cdecl symbols

2024-06-18 Thread Pali Rohár
Some cdecl functions have incorrect stdcall suffix @0 probably due to false-positive detection by gendef. Remove incorrect suffix. --- mingw-w64-crt/lib32/msvcr110.def.in | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mingw-w64-crt/lib32/msvcr110.def.in

[Mingw-w64-public] [PATCH 06/14] crt: msvcr110.def.in: Add symbols introduced in Visual C++ 2012 Update 1

2024-06-18 Thread Pali Rohár
Visual C++ 2012 Update 1 introduced new symbols. Append them at the end of def files. --- mingw-w64-crt/lib32/msvcr110.def.in | 20 mingw-w64-crt/lib64/msvcr110.def.in | 19 +++ 2 files changed, 39 insertions(+) diff --git

[Mingw-w64-public] [PATCH 04/14] crt: msvcr90d.def.in: Remove Check!!! comment for _adj_fdiv_r

2024-06-18 Thread Pali Rohár
Function _adj_fdiv_r in msvcr90d.dll returns like in other msvcrt libraries. Just gendef is not able to recognize it. --- mingw-w64-crt/lib32/msvcr90d.def.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/lib32/msvcr90d.def.in

[Mingw-w64-public] [PATCH 03/14] crt: msvcr90.def.in: Make MSVCR90.dll library name upper case

2024-06-18 Thread Pali Rohár
Export name is upper case in the original Visual C++ library. --- mingw-w64-crt/lib32/msvcr90.def.in | 4 ++-- mingw-w64-crt/lib64/msvcr90.def.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mingw-w64-crt/lib32/msvcr90.def.in b/mingw-w64-crt/lib32/msvcr90.def.in index

[Mingw-w64-public] [PATCH 00/14] crt: msvcr90-120 fixes

2024-06-18 Thread Pali Rohár
Hello, after fixing msvcrt10-80 def files & import libs, I'm sending next batch of fixes for msvcr90-120 def files. Pali Rohár (14): crt: Move $I10_OUTPUT symbol out of the C++ mangled section in lib64 def.in files crt: Fix some function symbols in msvcr90.def.in and msvcr100.de

[Mingw-w64-public] [PATCH 02/14] crt: Fix some function symbols in msvcr90.def.in and msvcr100.def.in files

2024-06-18 Thread Pali Rohár
Following symbols represents functions. So remove DATA keyword from them. __report_gsfailure _byteswap_uint64 _byteswap_ulong _byteswap_ushort _get_errno _rotl64 _rotr64 _set_errno btowc mbrlen mbrtowc mbsrtowcs strnlen wcrtomb wcsnlen wcsrtombs wctob --- mingw-w64-crt/lib32/msvcr100.def.in | 34

[Mingw-w64-public] [PATCH 8/9] crt: Provide _filelengthi64() function for crtdll.dll, msvcrt10.dll and msvcrt20.dll

2024-06-16 Thread Pali Rohár
Function _filelengthi64() is available since msvcrt40.dll. For previous CRT versions, which have only 32-bit file offsets, define it as wrapper around 32-bit _filelength() function. --- mingw-w64-crt/Makefile.am| 3 +++ mingw-w64-crt/stdio/_filelengthi64.c | 16 2

[Mingw-w64-public] [PATCH 5/9] crt: Provide _get_errno() and _set_errno() functions for all CRT import libraries

2024-06-16 Thread Pali Rohár
Functions _get_errno() and _set_errno() are natively available since msvcr80.dll and also since Windows Vista version of msvcrt.dll. Import libraries for crtdll, msvcrt10-40 and msvcrt.dll already contains emulation of these functions. Include this emulation also for msvcr70 and msvcr71, so these

[Mingw-w64-public] [PATCH 9/9] crt: Provide _fseeki64() and _ftelli64() functions for all CRT import libraries

2024-06-16 Thread Pali Rohár
Functions _fseeki64() and _ftelli64() are natively available since msvcr80.dll. mingw-w64 already provides emulation of _fseeki64() and _ftelli64() functions for msvcrt.dll import library via _filelengthi64(), fgetpos(), fsetpos() and fflush() functions. So include this emulation into all

[Mingw-w64-public] [PATCH 7/9] crt: Define fgetpos64() and fsetpos64() functions in crt-aliases.def.in as symbol aliases

2024-06-16 Thread Pali Rohár
Functions fgetpos64() and fsetpos64() are just aliases for functions fgetpos() and fsetpos() as they are already using 64-bit fpos_t type. Most aliased functions are defined in crt-aliases.def.in file. Do same also for fgetpos64() and fsetpos64() functions by moving them from individual C files

[Mingw-w64-public] [PATCH 1/9] crt: Provide _configthreadlocale() function for all CRT import libraries

2024-06-16 Thread Pali Rohár
Function _configthreadlocale() is natively available since msvcr80.dll. For all previous CRT versions include mingw-w64 emulation. Emulation is already included for msvcrt-os. --- mingw-w64-crt/Makefile.am | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mingw-w64-crt/Makefile.am

[Mingw-w64-public] [PATCH 4/9] crt: Provide _wassert() function for all CRT import libraries

2024-06-16 Thread Pali Rohár
Function _wassert() is natively available since msvcr80.dll and also since Windows Vista version of msvcrt.dll. Import library for i386 version of msvcrt.dll already contains emulation of this function. Include this emulation into x64 version of msvcrt.dll and also into crtdll, msvcrt10-40 and

[Mingw-w64-public] [PATCH 6/9] crt: Fix fgetpos() and fsetpos() functions for crtdll.dll, msvcrt10.dll and msvcrt20.dll

2024-06-16 Thread Pali Rohár
Functions fgetpos() and fsetpos() in these libraries have different ABI than in all later versions starting with msvcrt40. Their second argument is pointer to 32-bit signed value, which is not compatible with the fpos_t type (64-bit), used by all later versions. So rename these functions in

[Mingw-w64-public] [PATCH 2/9] crt: Provide _get_output_format() and _set_output_format() functions for all CRT import libraries

2024-06-16 Thread Pali Rohár
These functions are natively available since msvcr80.dll and also since Vista version of msvcrt.dll. They are available also in ARM versions. For all older CRT versions include mingw-w64 emulation. Emulation in misc/output_format.c is slightly updated to optimize code for non-msvcrt.dll version

[Mingw-w64-public] [PATCH 3/9] crt: Provide _set_purecall_handler() function for all CRT import libraries

2024-06-16 Thread Pali Rohár
Function _set_purecall_handler() is natively available since msvcr70.dll. For all previous CRT versions include mingw-w64 emulation. Emulation is already included for msvcrt-os. --- mingw-w64-crt/Makefile.am | 4 1 file changed, 4 insertions(+) diff --git a/mingw-w64-crt/Makefile.am

Re: [Mingw-w64-public] [PATCH 4/4] crt: msvcr80: Fix decorated fastcall exports

2024-06-15 Thread Pali Rohár
On Saturday 15 June 2024 23:04:09 LIU Hao wrote: > 在 2024-06-15 04:54, Pali Rohár 写道: > > But I still think that it is a bug if gcc/ld can produces "broken" > > executable just because msvcr* import library contains incorrect > > symbols. And it can be simple avoide

Re: [Mingw-w64-public] Math functions declared as DATA

2024-06-14 Thread Pali Rohár
On Friday 14 June 2024 10:01:49 LIU Hao wrote: > 在 2024-06-14 04:53, Martin Storsjö 写道: > > I'm not entirely sure - that's long before my involvement with the > > project. But I would primarily believe that there were issues with > > corner case correctness wrt what e.g. C99 specifies. Possibly

Re: [Mingw-w64-public] [PATCH 4/4] crt: msvcr80: Fix decorated fastcall exports

2024-06-14 Thread Pali Rohár
On Tuesday 11 June 2024 09:25:36 LIU Hao wrote: > 在 2024-06-11 03:31, Pali Rohár 写道: > > Any opinion on this? Because currently import libs for msvcr80(d) > > contains symbols which refers to non-existent symbols in DLL. > > > > I think that import library must no

Re: [Mingw-w64-public] [PATCH 8/8] headers: Unified declaration of __argc, __argv, __wargv, _environ, _wenviron, _pgmptr, _wpgmptr, _osplatform, _osver, _winver, _winmajor, _winminor

2024-06-14 Thread Pali Rohár
On Friday 14 June 2024 00:22:17 Martin Storsjö wrote: > On Thu, 13 Jun 2024, Pali Rohár wrote: > > > On Thursday 13 June 2024 16:11:15 Martin Storsjö wrote: > > > On Fri, 7 Jun 2024, Pali Rohár wrote: > > > > > > > Declare __argc, __argv, __

Re: [Mingw-w64-public] [PATCH 8/8] headers: Unified declaration of __argc, __argv, __wargv, _environ, _wenviron, _pgmptr, _wpgmptr, _osplatform, _osver, _winver, _winmajor, _winminor

2024-06-13 Thread Pali Rohár
On Thursday 13 June 2024 16:11:15 Martin Storsjö wrote: > On Fri, 7 Jun 2024, Pali Rohár wrote: > > > Declare __argc, __argv, __wargv, _pgmptr, _wpgmptr via corresponding > > __p_func() function as now it is provided by every CRT import library > > (either directly or ma

Re: [Mingw-w64-public] Math functions declared as DATA

2024-06-12 Thread Pali Rohár
On Tuesday 11 June 2024 22:40:55 Martin Storsjö wrote: > On Mon, 10 Jun 2024, Pali Rohár wrote: > > > Hello, I see that in some CRT def files are math functions (asin, atan, > > cos, exp, fabs, ...) declared as DATA. But it is not consistent, in some > > CRT def

Re: [Mingw-w64-public] [PATCH 2/8] crt: Provide __p___wargv() function for VC20+ CRT import libraries

2024-06-11 Thread Pali Rohár
On Tuesday 11 June 2024 23:16:23 Martin Storsjö wrote: > On Fri, 7 Jun 2024, Pali Rohár wrote: > > > Function __p___wargv() returns pointer to the first member of global array > > __wargv[] and is available since VC20, it is available also in UCRT, and > > also in x86 vers

[Mingw-w64-public] Math functions declared as DATA

2024-06-10 Thread Pali Rohár
Hello, I see that in some CRT def files are math functions (asin, atan, cos, exp, fabs, ...) declared as DATA. But it is not consistent, in some CRT def files they are with DATA and in some without DATA. I guess that this is not an "gendef" false positive detection. So what is the reason that

Re: [Mingw-w64-public] [PATCH 4/4] crt: msvcr80: Fix decorated fastcall exports

2024-06-10 Thread Pali Rohár
On Tuesday 04 June 2024 19:25:42 Pali Rohár wrote: > On Tuesday 04 June 2024 09:54:20 LIU Hao wrote: > > 在 2024-06-04 05:39, Pali Rohár 写道: > > > Symbols @_calloc_crt@8, @_malloc_crt@4 and @_realloc_crt@8 are exported > > > from msvcr80 DLL libraries wi

Re: [Mingw-w64-public] [PATCH 2/4] crt: Add guards in func.def.in file

2024-06-10 Thread Pali Rohár
On Monday 10 June 2024 15:02:29 Martin Storsjö wrote: > On Sat, 8 Jun 2024, Pali Rohár wrote: > > > On Saturday 08 June 2024 08:25:49 Martin Storsjö wrote: > > > On Fri, 7 Jun 2024, Pali Rohár wrote: > > > > > > > On Tuesday 04 June 2024 15:39:46 Mar

Re: [Mingw-w64-public] [PATCH 2/4] crt: Add guards in func.def.in file

2024-06-08 Thread Pali Rohár
On Saturday 08 June 2024 08:25:49 Martin Storsjö wrote: > On Fri, 7 Jun 2024, Pali Rohár wrote: > > > On Tuesday 04 June 2024 15:39:46 Martin Storsjö wrote: > > > On Mon, 3 Jun 2024, Pali Rohár wrote: > > > > > > > Add once-guard to e

Re: [Mingw-w64-public] [PATCH 2/4] crt: Add guards in func.def.in file

2024-06-07 Thread Pali Rohár
On Tuesday 04 June 2024 15:39:46 Martin Storsjö wrote: > On Mon, 3 Jun 2024, Pali Rohár wrote: > > > Add once-guard to ensure that the file is processed only once. > > > > Add arch-guard to ensure that DEF_ is always defined to prevent an > > issue that symbols defi

[Mingw-w64-public] [PATCH 7/8] crt: __p___argv.c: Do not depend on stdlib.h

2024-06-07 Thread Pali Rohár
In followup change will be definition of __argv in stdlib.h changed and will not use __MINGW_IMP_SYMBOL(__argv) anymore. So declare __MINGW_IMP_SYMBOL(__argv) in __p___argv.c file manually. --- mingw-w64-crt/misc/__p___argv.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[Mingw-w64-public] [PATCH 8/8] headers: Unified declaration of __argc, __argv, __wargv, _environ, _wenviron, _pgmptr, _wpgmptr, _osplatform, _osver, _winver, _winmajor, _winminor

2024-06-07 Thread Pali Rohár
Declare __argc, __argv, __wargv, _pgmptr, _wpgmptr via corresponding __p_func() function as now it is provided by every CRT import library (either directly or manually by mingw-w64 code) which also provides that symbol. Declare _environ and _wenviron based on architecture. On i386 and x64 it is

[Mingw-w64-public] [PATCH 6/8] crt: Provide __p__wpgmptr() function for VC20+ CRT import libraries

2024-06-07 Thread Pali Rohár
Function __p__wpgmptr() returns pointer to global variable _wpgmptr and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. crtdll.dll and msvcrt10.dll do not provide global variable _wpgmptr and neither __p__wpgmptr() function. For

[Mingw-w64-public] [PATCH 4/8] crt: Provide __p__wenviron() function also for x64 msvcrt.dll

2024-06-07 Thread Pali Rohár
Function __p__wenviron() returns pointer to the first member of global array _wenviron[] and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. For x64 version of msvcrt.dll provide mingw-w64 version of __p__wenviron() function defined

[Mingw-w64-public] [PATCH 2/8] crt: Provide __p___wargv() function for VC20+ CRT import libraries

2024-06-07 Thread Pali Rohár
Function __p___wargv() returns pointer to the first member of global array __wargv[] and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. crtdll.dll and msvcrt10.dll do not provide __wargv[] array and __wgetmainargs() function, so for

[Mingw-w64-public] [PATCH 5/8] crt: Provide __p__pgmptr() function for all CRT import libraries

2024-06-07 Thread Pali Rohár
Function __p__pgmptr() returns pointer to global variable _pgmptr and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. For all other CRT import libraries (crtdll.dll, msvcrt10.dll and x64/arm32/arm64 msvcrt.dll) provide mingw-w64

[Mingw-w64-public] [PATCH 1/8] crt: Provide __p___argc() function for all CRT import libraries

2024-06-07 Thread Pali Rohár
Function __p___argc() returns pointer to global variable __argc and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. For all other CRT import libraries (crtdll.dll, msvcrt10.dll and x64/arm32/arm64 msvcrt.dll) provide mingw-w64

[Mingw-w64-public] [PATCH 3/8] crt: Provide __p__environ() function for most CRT import libraries

2024-06-07 Thread Pali Rohár
Function __p__environ() returns pointer to the first member of global array _environ[] and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. CRT libraries crtdll.dll, msvcrt10.dll and x64 msvcrt.dll do not provide __p__environ()

Re: [Mingw-w64-public] [PATCH 4/4] crt: msvcr80: Fix decorated fastcall exports

2024-06-04 Thread Pali Rohár
On Tuesday 04 June 2024 09:54:20 LIU Hao wrote: > 在 2024-06-04 05:39, Pali Rohár 写道: > > Symbols @_calloc_crt@8, @_malloc_crt@4 and @_realloc_crt@8 are exported > > from msvcr80 DLL libraries with their @suffix decoration. This is not > > usual. > > > > Those dec

Re: [Mingw-w64-public] [PATCH 1/4] crt: Preprocess all .def.in files with -DDEF_

2024-06-03 Thread Pali Rohár
On Monday 03 June 2024 23:39:47 Pali Rohár wrote: > Having -DDEF_ is required by func.def.in which is used either > directly or indirectly by crt-aliases.def.in in all CRT def.in files. > Some symbols in crt-aliases.def.in are defined via F* macros and these > symbols are curre

[Mingw-w64-public] [PATCH 08/10] crt: Fix _mbctype definition to be compatible with UCRT

2024-06-03 Thread Pali Rohár
Global variable _mbctype[] is not available in UCRT and msvcrt10.dll. UCRT instead provides __p__mbctype() function which returns pointer to the first _mbctype array member. msvcrt10.dll does not have any replacement. Function __p__mbctype() is present also in all msvcrt VC versions starting from

[Mingw-w64-public] [PATCH 09/10] crt: Provide __p__mbcasemap() function and use it for _mbcasemap

2024-06-03 Thread Pali Rohár
_mbcasemap[] global array is available since Microsoft Visual C++ 5.0 SP1 version of msvcrt.dll for all architectures, and then also in new msvcr* DLL libraries, and also in UCRT. __p__mbcasemap() function is available in msvcrt.dll only for i386 architecture since Microsoft Visual C++ 5.0 SP1.

[Mingw-w64-public] [PATCH 10/10] crt: Provide __sys_errlist() and __sys_nerr() by every msvcrt import library

2024-06-03 Thread Pali Rohár
Global variable _sys_nerr is present in every CRT library except UCRT. Function __sys_nerr() is present since msvcr80.dll and returns pointer to the global variable _sys_nerr. This function is not present in any msvcrt.dll library version, but is present in UCRT library. Same applies for global

[Mingw-w64-public] [PATCH 07/10] crt: Fix _wctype definitions in def files

2024-06-03 Thread Pali Rohár
_wctype is global variable exported from DLL library, so mark it with DATA and removes false-positive function stdcall @size decoration. --- mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def | 2 +- mingw-w64-crt/lib-common/msvcr120_app.def.in | 4 +---

[Mingw-w64-public] [PATCH 05/10] crt: Fix definition for _pwctype to be available also for UCRT

2024-06-03 Thread Pali Rohár
Global variable _pwctype is not available in UCRT. Instead UCRT has only __pwctype_func() function which returns value of _pwctype variable. Function __pwctype_func() is available also in msvcrt since VC70. For previous i386 msvcrt versions there is a __p__pwctype() function which returns pointer

[Mingw-w64-public] [PATCH 06/10] headers: Fix _wctype declaration in header files

2024-06-03 Thread Pali Rohár
_wctype is a global variable exported from CRT library and therefore has to be always accessed by the import symbol via __MINGW_IMP_SYMBOL(_wctype). There is no CRT function which could return pointer to this variable. _wctype variable is present since msvcr70.dll and also since Windows Server

[Mingw-w64-public] [PATCH 03/10] headers: Fix _pctype, _pwctype, _wctype and __pctype_func() declarations

2024-06-03 Thread Pali Rohár
Global variables _pctype, _pwctype, _wctype and function __pctype_func() are constant. See: * https://learn.microsoft.com/en-us/cpp/c-runtime-library/pctype-pwctype-wctype-mbctype-mbcasemap * https://learn.microsoft.com/en-us/cpp/c-runtime-library/pctype-func --- mingw-w64-headers/crt/ctype.h

[Mingw-w64-public] [PATCH 02/10] crt: Improve ___mb_cur_max_func() function support

2024-06-03 Thread Pali Rohár
Provide fallback ___mb_cur_max_func() implementation via __p___mb_cur_max() function. __p___mb_cur_max() is available since VC20. For earlier version import libraries provide fallback __p___mb_cur_max() implementation via global variable __mb_cur_max. With this change every CRT import library

[Mingw-w64-public] [PATCH 04/10] crt: Provide __p__pctype and __pctype_func symbols for every import CRT library

2024-06-03 Thread Pali Rohár
__pctype_func is available in msvcrt since VC70. __p__pctype is available in i386 msvcrt version since VC20. _pctype is available in all versions except in UCRT. Define fallback __pctype_func() function implementation via __p__pctype() function. And define __p__pctype() via _pctype variable.

[Mingw-w64-public] [PATCH 01/10] crt: Provide __iob_func function by every msvcrt import library

2024-06-03 Thread Pali Rohár
Both functions __iob_func() and __p__iob() returns same constant value - pointer to the first member of _iob[] array. Symbol for _iob[] array is present in every msvcrt DLL library. Function __p__iob() is provided by every i386 version of msvcrt DLL library since VC20. But it is not available in

[Mingw-w64-public] [PATCH 3/4] crt: Rename macro DECORATED_EXPORT() to STDCALL_DECORATED_EXPORT()

2024-06-03 Thread Pali Rohár
This macro is currently used only for stdcall functions. Rename it and includes STDCALL into the name to prevent confusion that it cannot be used for example for fastcall functions (they do not have leading underscore in name, like stdcall and cdecl). --- mingw-w64-crt/def-include/func.def.in |

[Mingw-w64-public] [PATCH 2/4] crt: Add guards in func.def.in file

2024-06-03 Thread Pali Rohár
Add once-guard to ensure that the file is processed only once. Add arch-guard to ensure that DEF_ is always defined to prevent an issue that symbols defined via F32() macro completely disappeared and which was fixed in previous change. This change applied before the previous change cause compile

[Mingw-w64-public] [PATCH 4/4] crt: msvcr80: Fix decorated fastcall exports

2024-06-03 Thread Pali Rohár
Symbols @_calloc_crt@8, @_malloc_crt@4 and @_realloc_crt@8 are exported from msvcr80 DLL libraries with their @suffix decoration. This is not usual. Those decorated symbols refers to fastcall function calling convention. When generating import library, @suffix must not be trimmed (which is done

[Mingw-w64-public] [PATCH 1/4] crt: Preprocess all .def.in files with -DDEF_

2024-06-03 Thread Pali Rohár
Having -DDEF_ is required by func.def.in which is used either directly or indirectly by crt-aliases.def.in in all CRT def.in files. Some symbols in crt-aliases.def.in are defined via F* macros and these symbols are currently missing in versioned non-os msvcrt import libraries. This change is

Re: [Mingw-w64-public] [PATCH] crt: Fix definitions of __MINGW_IMP_SYMBOL aliases

2024-06-03 Thread Pali Rohár
On Sunday 26 May 2024 02:21:20 Pali Rohár wrote: > GCC documentation for alias attribute for variables says: > > https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html > Using both the alias and the alias target to access the same object is > undefined in a t

Re: [Mingw-w64-public] [PATCH] crt: Fix definitions of __MINGW_IMP_SYMBOL aliases

2024-06-03 Thread Pali Rohár
On Wednesday 29 May 2024 21:52:12 Pali Rohár wrote: > Ok. Then it means, it is needed to just rewrite commit message. What about this commit message? crt: Declare aliased __MINGW_IMP_SYMBOL symbols via __attribute__((alias)) Currently __MINGW_IMP_SYMBOL symbols for aliased functions are defi

Re: [Mingw-w64-public] [PATCH] crt: Add import library for msvcr80d.dll

2024-06-03 Thread Pali Rohár
On Monday 03 June 2024 14:32:06 Martin Storsjö wrote: > On Sun, 2 Jun 2024, Pali Rohár wrote: > > > msvcr80d.dll is debug version of the msvcr80.dll and provides additional > > debugging functions. > > --- > > mingw-w64-crt/Makefile.am | 13 +

[Mingw-w64-public] [PATCH] crt: Move __uncaught_exception symbol out of the C++ mangled symbol section in all .def.in files

2024-06-02 Thread Pali Rohár
--- mingw-w64-crt/lib32/msvcr100.def.in | 3 ++- mingw-w64-crt/lib32/msvcr110.def.in | 3 ++- mingw-w64-crt/lib32/msvcr120.def.in | 3 ++- mingw-w64-crt/lib32/msvcr120d.def.in | 3 ++- mingw-w64-crt/lib32/msvcr70.def.in | 3 ++- mingw-w64-crt/lib32/msvcr70d.def.in | 3 ++-

[Mingw-w64-public] [PATCH] crt: Add import library for msvcr80d.dll

2024-06-02 Thread Pali Rohár
msvcr80d.dll is debug version of the msvcr80.dll and provides additional debugging functions. --- mingw-w64-crt/Makefile.am | 13 +- mingw-w64-crt/lib-common/msvcr80d.mri |6 + mingw-w64-crt/lib32/msvcr80d.def.in | 1633 +

[Mingw-w64-public] [PATCH v2] crt: crtdll.dll and msvcrt10.dll: Fix linking of the WinMain() function

2024-06-02 Thread Pali Rohár
WinMain() entry point provided by the application is called by mingw-w64 startup code, more precisely by function main() from crtexewin.c file. mingw-w64 startup code in file crtexewin.c calls _ismbblead() function. Function _ismbblead() is not available in some versions of crtdll.dll and is

Re: [Mingw-w64-public] [PATCH 5/5] crt: crtdll.dll and msvcrt10.dll: Fix linking of the WinMain() function

2024-06-02 Thread Pali Rohár
On Wednesday 29 May 2024 22:15:06 Pali Rohár wrote: > On Wednesday 29 May 2024 16:21:33 Martin Storsjö wrote: > > On Sun, 26 May 2024, Pali Rohár wrote: > > > > > WinMain() entry point defined by the application is called by mingw-w64 > > > startup code, more

Re: [Mingw-w64-public] [PATCH] crt: Add missing __cdecl decoration for functions: mbrtowc mbsrtowcs mbrlen wcrtomb wcsrtombs

2024-06-02 Thread Pali Rohár
On Wednesday 29 May 2024 15:38:19 Martin Storsjö wrote: > On Mon, 27 May 2024, Pali Rohár wrote: > > > On Monday 27 May 2024 13:04:56 LIU Hao wrote: > > > 在 2024-05-26 20:39, Pali Rohár 写道: > > > > --- > > > > mingw-w64-crt/misc/mbrtowc.c | 3 +

Re: [Mingw-w64-public] [PATCH 4/4] crt: Add import library for msvcr71d.dll

2024-05-29 Thread Pali Rohár
On Wednesday 29 May 2024 23:53:26 Martin Storsjö wrote: > On Sun, 26 May 2024, Pali Rohár wrote: > > > msvcr71d.dll is debug version of the msvcr71.dll and provides additional > > debugging functions. > > --- > > mingw-w64-crt/Makefile.am | 6 +- > >

Re: [Mingw-w64-public] [PATCH 5/5] crt: crtdll.dll and msvcrt10.dll: Fix linking of the WinMain() function

2024-05-29 Thread Pali Rohár
On Wednesday 29 May 2024 16:21:33 Martin Storsjö wrote: > On Sun, 26 May 2024, Pali Rohár wrote: > > > WinMain() entry point defined by the application is called by mingw-w64 > > startup code, more precisely by function main() from crtexewin.c file. > > > >

Re: [Mingw-w64-public] [PATCH] crt: Fix definitions of __MINGW_IMP_SYMBOL aliases

2024-05-29 Thread Pali Rohár
On Wednesday 29 May 2024 16:00:06 Martin Storsjö wrote: > On Sun, 26 May 2024, Pali Rohár wrote: > > > GCC documentation for alias attribute for variables says: > > > > https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html > > Using both the alias

[Mingw-w64-public] [PATCH] crt: getopt: Use argv[0] from getopt function argument instead from the global __argv[] array

2024-05-28 Thread Pali Rohár
getopt* functions receive also argv[0] argument. So use it for printing program name instead of the global __argv[0] variable. This avoids using and importing of the __argv[] DATA symbol from the linked CRT library, as it is not needed. --- mingw-w64-crt/misc/getopt.c | 28

[Mingw-w64-public] [PATCH] crt: Add missing __cdecl decoration for functions: mbrtowc mbsrtowcs mbrlen wcrtomb wcsrtombs

2024-05-28 Thread Pali Rohár
--- mingw-w64-crt/misc/mbrtowc.c | 3 +++ mingw-w64-crt/misc/wcrtomb.c | 5 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mingw-w64-crt/misc/mbrtowc.c b/mingw-w64-crt/misc/mbrtowc.c index 2eb480749f76..3c01156755ad 100644 --- a/mingw-w64-crt/misc/mbrtowc.c +++

[Mingw-w64-public] [PATCH 3/4] crt: Add import library for msvcr70d.dll

2024-05-28 Thread Pali Rohár
msvcr70d.dll is debug version of the msvcr70.dll and provides additional debugging functions. --- mingw-w64-crt/Makefile.am | 6 +- mingw-w64-crt/lib32/msvcr70d.def.in | 951 mingw-w64-crt/lib32/msvcr70d.mri| 6 + 3 files changed, 962 insertions(+),

[Mingw-w64-public] [PATCH 4/4] crt: Add import library for msvcr71d.dll

2024-05-28 Thread Pali Rohár
msvcr71d.dll is debug version of the msvcr71.dll and provides additional debugging functions. --- mingw-w64-crt/Makefile.am | 6 +- mingw-w64-crt/lib32/msvcr71d.def.in | 945 mingw-w64-crt/lib32/msvcr71d.mri| 6 + 3 files changed, 956 insertions(+),

[Mingw-w64-public] [PATCH 2/5] crt: crtdll.dll: Rename crtdll_compat.c to crtdll_getmainargs.c

2024-05-28 Thread Pali Rohár
Filename crtdll_getmainargs.c better describe which function it provides. --- mingw-w64-crt/Makefile.am | 2 +- mingw-w64-crt/crt/{crtdll_compat.c => crtdll_getmainargs.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename

[Mingw-w64-public] [PATCH 2/4] crt: Add import library for msvcrtd.dll

2024-05-28 Thread Pali Rohár
msvcrtd.dll is debug version of the Visual C++ 4.2, 5.x and 6.x msvcrt.dll library and provides additional debugging functions. --- mingw-w64-crt/Makefile.am | 7 +- mingw-w64-crt/lib32/msvcrtd.def.in | 864 + mingw-w64-crt/lib32/msvcrtd.mri| 6 + 3

[Mingw-w64-public] [PATCH 3/5] crt: msvcrt10: Fix calling __getmainargs() function

2024-05-28 Thread Pali Rohár
API for __getmainargs() function in msvcrt10.dll is same as __GetMainArgs() function in crtdll.dll. It is slightly different than in any other msvcrt versions. It returns void and does not the pointer to the _startupinfo structure as a last argument. So for compatibility with mingw-w64 startup

[Mingw-w64-public] [PATCH 2/3] crt: Provide fstat function symbol via alias

2024-05-28 Thread Pali Rohár
For 32-bit time_t (detected by _USE_32BIT_TIME_T), functions _fstat32(), _fstat() and fstat() are same. So fstat() can be defined as simple alias in def file. Same applies for functions _fstat64i32(), _fstat() and fstat() when time_t is 64-bit. Simplify fstat() function, remove it from

[Mingw-w64-public] [PATCH 1/3] headers: Fix *stat* macros in _mingw_stat64.h header file

2024-05-28 Thread Pali Rohár
All CRT import libraries provides UCRT-compatible *stat* symbols since commit b4638756158e947ce3ddde9e1b3b6f1f63d2ba03. So define all stat* macros consistently with definitions of aliases in def files based on UCRT. There is no need to have ifdef for non-UCRT version anymore. ---

Re: [Mingw-w64-public] [PATCH] crt: Add missing __cdecl decoration for functions: mbrtowc mbsrtowcs mbrlen wcrtomb wcsrtombs

2024-05-28 Thread Pali Rohár
On Monday 27 May 2024 13:04:56 LIU Hao wrote: > 在 2024-05-26 20:39, Pali Rohár 写道: > > --- > > mingw-w64-crt/misc/mbrtowc.c | 3 +++ > > mingw-w64-crt/misc/wcrtomb.c | 5 - > > 2 files changed, 7 insertions(+), 1 deletion(-) > > > > This patch seem

[Mingw-w64-public] [PATCH] crt: Fix definitions of __MINGW_IMP_SYMBOL aliases

2024-05-28 Thread Pali Rohár
GCC documentation for alias attribute for variables says: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html Using both the alias and the alias target to access the same object is undefined in a translation unit without a declaration of the alias with the attribute. So

[Mingw-w64-public] [PATCH 1/4] crt: Add import library for msvcr40d.dll

2024-05-28 Thread Pali Rohár
msvcr40d.dll is debug version of the msvcrt40.dll and provides additional debugging functions. msvcr40d.def.in def file was generated by gendef from the original msvcr40d.dll library version and modified with same changes (mostly documentation) which were done to the msvcrt40.def.in def file. ---

[Mingw-w64-public] [PATCH 5/5] crt: crtdll.dll and msvcrt10.dll: Fix linking of the WinMain() function

2024-05-28 Thread Pali Rohár
WinMain() entry point defined by the application is called by mingw-w64 startup code, more precisely by function main() from crtexewin.c file. mingw-w64 startup code in file crtexewin.c calls _ismbblead() function. Function _ismbblead() is not available in earlier versions of crtdll.dll and is

[Mingw-w64-public] [PATCH 4/5] crt: msvcrt20: Fix calling __getmainargs() and __wgetmainargs() functions

2024-05-28 Thread Pali Rohár
API for __getmainargs() and __wgetmainargs() functions in msvcrt20.dll is slightly different than in new msvcrt versions. In msvcrt20.dll these functions return void and take new_mode parameter instead of the pointer to the _startupinfo structure. So for compatibility with mingw-w64 startup code,

[Mingw-w64-public] [PATCH 3/3] crt: Document why the stat symbol alias is not used

2024-05-28 Thread Pali Rohár
--- mingw-w64-crt/def-include/crt-aliases.def.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in b/mingw-w64-crt/def-include/crt-aliases.def.in index 62744a54ab54..aca031d4b027 100644 ---

[Mingw-w64-public] [PATCH 1/5] crt: crtdll.dll: Define __GetMainArgs with _CRTIMP as the function is being imported

2024-05-28 Thread Pali Rohár
--- mingw-w64-crt/crt/crtdll_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/crt/crtdll_compat.c b/mingw-w64-crt/crt/crtdll_compat.c index 7ab3a82984e0..81e37aad 100644 --- a/mingw-w64-crt/crt/crtdll_compat.c +++ b/mingw-w64-crt/crt/crtdll_compat.c

Re: [Mingw-w64-public] [PATCH 6/9] crt: Fix DATA aliases for crtdll.dll

2024-05-20 Thread Pali Rohár
On Monday 20 May 2024 13:07:29 Martin Storsjö wrote: > On Thu, 9 May 2024, Pali Rohár wrote: > > > crtdll.dll library has some DATA symbols with _dll suffix. > > Fix generating aliases for these symbols. > > --- > > .../def-include/msvcrt-common.def.in | 23

Re: [Mingw-w64-public] [PATCH 2/9] crt: Include msvcrt-common.def.in after declaring all library symbols

2024-05-20 Thread Pali Rohár
On Monday 20 May 2024 13:04:33 Martin Storsjö wrote: > On Thu, 9 May 2024, Pali Rohár wrote: > > > File msvcrt-common.def.in adds just symbol aliases, so include it in CRT > > def files after having all symbols declared. > > > > Note that some def files u

Re: [Mingw-w64-public] [PATCH 1/3] crt: msvcrt.def.in: Fix definitions of _ctype and _mbcasemap symbols

2024-05-17 Thread Pali Rohár
Hello, have you looked at this and other changes? ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

[Mingw-w64-public] [PATCH] crt: crtdll.def.in: Fix library name and time symbol exports

2024-05-12 Thread Pali Rohár
Change library name to uppercase CRTDLL.dll and remove DATA keyword for all time function symbols. This is how the original crtdll.dll library is defined. --- mingw-w64-crt/lib32/crtdll.def.in | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[Mingw-w64-public] [PATCH] crt: Do not provide duplicate _fstat64i32 symbol

2024-05-12 Thread Pali Rohár
Symbol _fstat64i32 is available in all 64-bit CRT import libraries as an alias. For 32-bit CRT import libraries it is present as native import symbol since msvcr80. MinGW-w64 fallback implementation of _fstat64i32() function uses _fstat64() call which in 32-bit versions is available since msvcr70

[Mingw-w64-public] [PATCH] crt: Add missing find, stat and time aliases to api-ms-win-crt-*.def.in

2024-05-12 Thread Pali Rohár
Some find, stat and time aliases are missing in UCRT def files: api-ms-win-crt-filesystem-l1-1-0.def.in api-ms-win-crt-time-l1-1-0.def.in They are already present in ucrtbase.def.in file after change from the commit b4638756158e947ce3ddde9e1b3b6f1f63d2ba03. Add those aliases which are missing.

[Mingw-w64-public] [PATCH] crt: msvcr80.dll: Remove duplicated X64 fallback functions

2024-05-08 Thread Pali Rohár
Symbols __p___argv, __p__acmdln, __p__commode, __p__fmode, and __p__wcmdln are available in X64 version of msvcr80.dll. This was clarified and fixed in commit e0426704cce399a7517e4ec71360bbd1d5f880e3. So remove duplicated definitions of fallback functions. --- mingw-w64-crt/Makefile.am | 9

[Mingw-w64-public] [PATCH 3/3] crt: msvcrt.def.in: Move arch-specific comments in #ifdef sections

2024-05-08 Thread Pali Rohár
So comments unrelated to processing architecture would be dropped by preprocessor. --- mingw-w64-crt/lib-common/msvcrt.def.in | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index

[Mingw-w64-public] [PATCH 1/3] crt: msvcrt.def.in: Fix definitions of _ctype and _mbcasemap symbols

2024-05-08 Thread Pali Rohár
Both symbols refers to global variable, not the function. So mark them with DATA for all platforms. gendef detects that _mbcasemap is DATA for all I386 versions of msvcrt.dll (Visual C++ 5.0, 6.0, Win9x, 2000, XP, ... up to 10). But gendef since Windows XP version of msvcrt.dll cannot autodetect

[Mingw-w64-public] [PATCH 2/3] crt: msvcrt.def.in: Add comments about first X64 and ARM32 msvcrt.dll versions

2024-05-08 Thread Pali Rohár
--- mingw-w64-crt/lib-common/msvcrt.def.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 70b67a7bbd66..9043e9fb53c5 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++

Re: [Mingw-w64-public] [PATCH 1/9] crt: Move DECORATED_EXPORT from msvcrt-common.def.in to func.def.in

2024-05-08 Thread Pali Rohár
For reference these patches changes final def files. There is no change in ucrtbase.def and msvcrt.def. --- lib32/crtdll.def.in +++ lib32/crtdll.def.in -daylight DATA == _daylight +daylight DATA == _daylight_dll -timezone DATA == _timezone +timezone DATA == _timezone_dll --- lib32/msvcr100.def.in

[Mingw-w64-public] [PATCH 6/9] crt: Fix DATA aliases for crtdll.dll

2024-05-08 Thread Pali Rohár
crtdll.dll library has some DATA symbols with _dll suffix. Fix generating aliases for these symbols. --- .../def-include/msvcrt-common.def.in | 23 +++ mingw-w64-crt/lib32/crtdll.def.in | 1 + 2 files changed, 24 insertions(+) diff --git

[Mingw-w64-public] [PATCH 9/9] crt: Rename msvcrt-common.def.in to crt-aliases.def.in

2024-05-08 Thread Pali Rohár
This file contains definitions of symbol aliases for any CRT library. It is already used by msvcrt, crtdll and ucrt. So rename msvcrt-common.def.in to crt-aliases.def.in as new name better match the purpose of the file. --- .../def-include/{msvcrt-common.def.in => crt-aliases.def.in} | 0

  1   2   3   4   >