Re: [Mingw-w64-public] [PATCH 00/10] crt: Move symbol aliases from CRT def files to msvcrt-common.def.in

2024-04-25 Thread Martin Storsjö

On Thu, 25 Apr 2024, Pali Rohár wrote:


On Thursday 25 April 2024 20:18:44 Pali Rohár wrote:

On Wednesday 24 April 2024 23:34:50 Martin Storsjö wrote:

On Mon, 22 Apr 2024, Pali Rohár wrote:


This patch series moves all aliases defined in crtdll.def.in, and
msvcr*.def.in files into one common include file msvcrt-common.def.in.

It reduces duplication of symbol alias definitions by defining symbols
in more declarative manner.

Moving aliases to one place uncovered that some def.in files were
missing some alises (mostly for __ms_* printf/scanf symbols) or some
were incorrectly defined (ctime for 64-bit msvcr90d.def.in was defined
as alias to _ctime32 instead of _ctime64, or _findfirst for 64-bit
msvcr120.def.in was defined as alias to symbol which does _not_ use
32-bit file length).

For reference what this change affects, I'm attaching a difference which
was generated for each CRT def.in file by command ($PLAT: DEF_I386 DEF_X64):

 cpp -x c -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed -E 
's/\s*;.*//' | LC_ALL=C sort -u


I presume you didn't diff the changes for ucrtbase.def.in? Because it seems
to be changes that do affect the output from that one, in patch 10/10.


Ou, I completely forgot to look at ucrtbase difference. Too many CRT libs.

For reference here is the difference before and after 10/10 patch.
I will inspect it and let know about issues.

--- lib32/ucrtbase.def.in
+++ lib32/ucrtbase.def.in
-_findfirst == _findfirst64
+_findfirst == _findfirst32
-_findnext == _findnext64
+_findnext == _findnext32
+_findfirsti64 == _findfirst32i64
+_findnexti64 == _findnext32i64
+_fstat == _fstat32
+_fstati64 == _fstat32i64
-_ftime == _ftime64
+_ftime == _ftime32
-_futime == _futime64
+_futime == _futime32
+_mkgmtime == _mkgmtime32
+_stat == _stat32
+_stati64 == _stat32i64
-_utime == _utime64
+_utime == _utime32
+_wctime == _wctime32
+_wfindfirst == _wfindfirst32
+_wfindfirsti64 == _wfindfirst32i64
+_wfindnext == _wfindnext32
+_wfindnexti64 == _wfindnext32i64
+_wstat == _wstat32
+_wstati64 == _wstat32i64
-_wutime == _wutime64
+_wutime == _wutime32
-ctime == _ctime64
+ctime == _ctime32
+difftime == _difftime32
-gmtime == _gmtime64
+gmtime == _gmtime32
-localtime == _localtime64
+localtime == _localtime32
-mktime == _mktime64
+mktime == _mktime32
-time == _time64
+time == _time32
-utime == _utime64

--- lib64/ucrtbase.def.in
+++ lib64/ucrtbase.def.in
-_findfirst == _findfirst64
+_findfirst == _findfirst64i32


On 64-bit is mingw-w64's io.h using:
#define _findfirst _findfirst64i32

And seem that this also matches 64-bit msvcrt.dll.

So I think that current ucrtbase.def.in has wrongly defined _findfirst
symbol (and also _findnext). And my change is fixing it.


Yes, it's probably fixing it - but it should be in a different patch. And 
the change for lib32/ucrtbase.def.in, making it point at _findfirst32 is 
wrong IMO, it should also point at _findfirst64i32.


// Martin

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 00/10] crt: Move symbol aliases from CRT def files to msvcrt-common.def.in

2024-04-25 Thread Pali Rohár
On Thursday 25 April 2024 20:18:44 Pali Rohár wrote:
> On Wednesday 24 April 2024 23:34:50 Martin Storsjö wrote:
> > On Mon, 22 Apr 2024, Pali Rohár wrote:
> > 
> > > This patch series moves all aliases defined in crtdll.def.in, and
> > > msvcr*.def.in files into one common include file msvcrt-common.def.in.
> > > 
> > > It reduces duplication of symbol alias definitions by defining symbols
> > > in more declarative manner.
> > > 
> > > Moving aliases to one place uncovered that some def.in files were
> > > missing some alises (mostly for __ms_* printf/scanf symbols) or some
> > > were incorrectly defined (ctime for 64-bit msvcr90d.def.in was defined
> > > as alias to _ctime32 instead of _ctime64, or _findfirst for 64-bit
> > > msvcr120.def.in was defined as alias to symbol which does _not_ use
> > > 32-bit file length).
> > > 
> > > For reference what this change affects, I'm attaching a difference which
> > > was generated for each CRT def.in file by command ($PLAT: DEF_I386 
> > > DEF_X64):
> > > 
> > >  cpp -x c -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed -E 
> > > 's/\s*;.*//' | LC_ALL=C sort -u
> > 
> > I presume you didn't diff the changes for ucrtbase.def.in? Because it seems
> > to be changes that do affect the output from that one, in patch 10/10.
> 
> Ou, I completely forgot to look at ucrtbase difference. Too many CRT libs.
> 
> For reference here is the difference before and after 10/10 patch.
> I will inspect it and let know about issues.
> 
> --- lib32/ucrtbase.def.in
> +++ lib32/ucrtbase.def.in
> -_findfirst == _findfirst64
> +_findfirst == _findfirst32
> -_findnext == _findnext64
> +_findnext == _findnext32
> +_findfirsti64 == _findfirst32i64
> +_findnexti64 == _findnext32i64
> +_fstat == _fstat32
> +_fstati64 == _fstat32i64
> -_ftime == _ftime64
> +_ftime == _ftime32
> -_futime == _futime64
> +_futime == _futime32
> +_mkgmtime == _mkgmtime32
> +_stat == _stat32
> +_stati64 == _stat32i64
> -_utime == _utime64
> +_utime == _utime32
> +_wctime == _wctime32
> +_wfindfirst == _wfindfirst32
> +_wfindfirsti64 == _wfindfirst32i64
> +_wfindnext == _wfindnext32
> +_wfindnexti64 == _wfindnext32i64
> +_wstat == _wstat32
> +_wstati64 == _wstat32i64
> -_wutime == _wutime64
> +_wutime == _wutime32
> -ctime == _ctime64
> +ctime == _ctime32
> +difftime == _difftime32
> -gmtime == _gmtime64
> +gmtime == _gmtime32
> -localtime == _localtime64
> +localtime == _localtime32
> -mktime == _mktime64
> +mktime == _mktime32
> -time == _time64
> +time == _time32
> -utime == _utime64
> 
> --- lib64/ucrtbase.def.in
> +++ lib64/ucrtbase.def.in
> -_findfirst == _findfirst64
> +_findfirst == _findfirst64i32

On 64-bit is mingw-w64's io.h using:
#define _findfirst _findfirst64i32

And seem that this also matches 64-bit msvcrt.dll.

So I think that current ucrtbase.def.in has wrongly defined _findfirst
symbol (and also _findnext). And my change is fixing it.

Please let me know what is your opinion.

> -_findnext == _findnext64
> +_findnext == _findnext64i32
> +_findfirsti64 == _findfirst64
> +_findnexti64 == _findnext64
> +_fstat == _fstat64i32
> +_fstati64 == _fstat64
> +_mkgmtime == _mkgmtime64
> +_stat == _stat64i32
> +_stati64 == _stat64
> +_wctime == _wctime64
> +_wfindfirst == _wfindfirst64i32
> +_wfindfirsti64 == _wfindfirst64
> +_wfindnext == _wfindnext64i32
> +_wfindnexti64 == _wfindnext64
> +_wstat == _wstat64i32
> +_wstati64 == _wstat64
> +difftime == _difftime64
> -utime == _utime64

But this removal of the utime symbol alias without any replacement is a
bug. I will need to fix patch 10 to properly define it (applies for
lib32 and lib64 variants).


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 00/10] crt: Move symbol aliases from CRT def files to msvcrt-common.def.in

2024-04-25 Thread Pali Rohár
On Thursday 25 April 2024 14:01:16 Martin Storsjö wrote:
> On Wed, 24 Apr 2024, Martin Storsjö wrote:
> 
> > On Mon, 22 Apr 2024, Pali Rohár wrote:
> > 
> > > This patch series moves all aliases defined in crtdll.def.in, and
> > > msvcr*.def.in files into one common include file msvcrt-common.def.in.
> > > 
> > > It reduces duplication of symbol alias definitions by defining symbols
> > > in more declarative manner.
> > > 
> > > Moving aliases to one place uncovered that some def.in files were
> > > missing some alises (mostly for __ms_* printf/scanf symbols) or some
> > > were incorrectly defined (ctime for 64-bit msvcr90d.def.in was defined
> > > as alias to _ctime32 instead of _ctime64, or _findfirst for 64-bit
> > > msvcr120.def.in was defined as alias to symbol which does _not_ use
> > > 32-bit file length).
> > > 
> > > For reference what this change affects, I'm attaching a difference which
> > > was generated for each CRT def.in file by command ($PLAT: DEF_I386
> > > DEF_X64):
> > > 
> > >  cpp -x c -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed
> > > -E 's/\s*;.*//' | LC_ALL=C sort -u
> > 
> > I presume you didn't diff the changes for ucrtbase.def.in? Because it
> > seems to be changes that do affect the output from that one, in patch
> > 10/10.
> > 
> > I looked closely at patches 1-9, and they seemed fine, so if you can
> > recheck that they don't affect the preprocessed output for ucrtbase as
> > well, we could land them and look at polishing the last one a bit more.
> 
> I checked that the output from preprocessing ucrtbase.def.in is unchanged by
> patches 1-9, so I pushed them. The output after patch 10 does change though,
> as expected, so I'll leave that one for now.
> 
> // Martin

Ok, thanks! I'm looking at patch 10.


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 00/10] crt: Move symbol aliases from CRT def files to msvcrt-common.def.in

2024-04-25 Thread Pali Rohár
On Wednesday 24 April 2024 23:34:50 Martin Storsjö wrote:
> On Mon, 22 Apr 2024, Pali Rohár wrote:
> 
> > This patch series moves all aliases defined in crtdll.def.in, and
> > msvcr*.def.in files into one common include file msvcrt-common.def.in.
> > 
> > It reduces duplication of symbol alias definitions by defining symbols
> > in more declarative manner.
> > 
> > Moving aliases to one place uncovered that some def.in files were
> > missing some alises (mostly for __ms_* printf/scanf symbols) or some
> > were incorrectly defined (ctime for 64-bit msvcr90d.def.in was defined
> > as alias to _ctime32 instead of _ctime64, or _findfirst for 64-bit
> > msvcr120.def.in was defined as alias to symbol which does _not_ use
> > 32-bit file length).
> > 
> > For reference what this change affects, I'm attaching a difference which
> > was generated for each CRT def.in file by command ($PLAT: DEF_I386 DEF_X64):
> > 
> >  cpp -x c -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed -E 
> > 's/\s*;.*//' | LC_ALL=C sort -u
> 
> I presume you didn't diff the changes for ucrtbase.def.in? Because it seems
> to be changes that do affect the output from that one, in patch 10/10.

Ou, I completely forgot to look at ucrtbase difference. Too many CRT libs.

For reference here is the difference before and after 10/10 patch.
I will inspect it and let know about issues.

--- lib32/ucrtbase.def.in
+++ lib32/ucrtbase.def.in
-_findfirst == _findfirst64
+_findfirst == _findfirst32
-_findnext == _findnext64
+_findnext == _findnext32
+_findfirsti64 == _findfirst32i64
+_findnexti64 == _findnext32i64
+_fstat == _fstat32
+_fstati64 == _fstat32i64
-_ftime == _ftime64
+_ftime == _ftime32
-_futime == _futime64
+_futime == _futime32
+_mkgmtime == _mkgmtime32
+_stat == _stat32
+_stati64 == _stat32i64
-_utime == _utime64
+_utime == _utime32
+_wctime == _wctime32
+_wfindfirst == _wfindfirst32
+_wfindfirsti64 == _wfindfirst32i64
+_wfindnext == _wfindnext32
+_wfindnexti64 == _wfindnext32i64
+_wstat == _wstat32
+_wstati64 == _wstat32i64
-_wutime == _wutime64
+_wutime == _wutime32
-ctime == _ctime64
+ctime == _ctime32
+difftime == _difftime32
-gmtime == _gmtime64
+gmtime == _gmtime32
-localtime == _localtime64
+localtime == _localtime32
-mktime == _mktime64
+mktime == _mktime32
-time == _time64
+time == _time32
-utime == _utime64

--- lib64/ucrtbase.def.in
+++ lib64/ucrtbase.def.in
-_findfirst == _findfirst64
+_findfirst == _findfirst64i32
-_findnext == _findnext64
+_findnext == _findnext64i32
+_findfirsti64 == _findfirst64
+_findnexti64 == _findnext64
+_fstat == _fstat64i32
+_fstati64 == _fstat64
+_mkgmtime == _mkgmtime64
+_stat == _stat64i32
+_stati64 == _stat64
+_wctime == _wctime64
+_wfindfirst == _wfindfirst64i32
+_wfindfirsti64 == _wfindfirst64
+_wfindnext == _wfindnext64i32
+_wfindnexti64 == _wfindnext64
+_wstat == _wstat64i32
+_wstati64 == _wstat64
+difftime == _difftime64
-utime == _utime64



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 00/10] crt: Move symbol aliases from CRT def files to msvcrt-common.def.in

2024-04-25 Thread Martin Storsjö

On Wed, 24 Apr 2024, Martin Storsjö wrote:


On Mon, 22 Apr 2024, Pali Rohár wrote:


This patch series moves all aliases defined in crtdll.def.in, and
msvcr*.def.in files into one common include file msvcrt-common.def.in.

It reduces duplication of symbol alias definitions by defining symbols
in more declarative manner.

Moving aliases to one place uncovered that some def.in files were
missing some alises (mostly for __ms_* printf/scanf symbols) or some
were incorrectly defined (ctime for 64-bit msvcr90d.def.in was defined
as alias to _ctime32 instead of _ctime64, or _findfirst for 64-bit
msvcr120.def.in was defined as alias to symbol which does _not_ use
32-bit file length).

For reference what this change affects, I'm attaching a difference which
was generated for each CRT def.in file by command ($PLAT: DEF_I386 
DEF_X64):


 cpp -x c -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed -E 
's/\s*;.*//' | LC_ALL=C sort -u


I presume you didn't diff the changes for ucrtbase.def.in? Because it seems 
to be changes that do affect the output from that one, in patch 10/10.


I looked closely at patches 1-9, and they seemed fine, so if you can recheck 
that they don't affect the preprocessed output for ucrtbase as well, we could 
land them and look at polishing the last one a bit more.


I checked that the output from preprocessing ucrtbase.def.in is unchanged 
by patches 1-9, so I pushed them. The output after patch 10 does change 
though, as expected, so I'll leave that one for now.


// Martin

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 00/10] crt: Move symbol aliases from CRT def files to msvcrt-common.def.in

2024-04-24 Thread Martin Storsjö

On Mon, 22 Apr 2024, Pali Rohár wrote:


This patch series moves all aliases defined in crtdll.def.in, and
msvcr*.def.in files into one common include file msvcrt-common.def.in.

It reduces duplication of symbol alias definitions by defining symbols
in more declarative manner.

Moving aliases to one place uncovered that some def.in files were
missing some alises (mostly for __ms_* printf/scanf symbols) or some
were incorrectly defined (ctime for 64-bit msvcr90d.def.in was defined
as alias to _ctime32 instead of _ctime64, or _findfirst for 64-bit
msvcr120.def.in was defined as alias to symbol which does _not_ use
32-bit file length).

For reference what this change affects, I'm attaching a difference which
was generated for each CRT def.in file by command ($PLAT: DEF_I386 DEF_X64):

 cpp -x c -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed -E 
's/\s*;.*//' | LC_ALL=C sort -u


I presume you didn't diff the changes for ucrtbase.def.in? Because it 
seems to be changes that do affect the output from that one, in patch 
10/10.


I looked closely at patches 1-9, and they seemed fine, so if you can 
recheck that they don't affect the preprocessed output for ucrtbase as 
well, we could land them and look at polishing the last one a bit more.


// Martin

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public