Running `grep _f*stat` on list of symbols I get from `dumpbin -exports 
msvcrt.dll` (Windows 11) I get the following:

```
_fstat
_fstat64
_fstati64
_stat
_stat64
_stati64
```

It seems there is also no real _[f]stati32 and _[f]stat64i32 symbols. Are they 
taken care of?

- Kirill Makurin

________________________________
From: Pali Rohár <pali.ro...@gmail.com>
Sent: Friday, June 20, 2025 1:46 AM
To: Martin Storsjö <mar...@martin.st>
Cc: mingw-w64-public@lists.sourceforge.net 
<mingw-w64-public@lists.sourceforge.net>
Subject: Re: [Mingw-w64-public] [PATCH v2 00/13] Fix stat functions

On Thursday 19 June 2025 15:36:34 Martin Storsjö wrote:
> On Mon, 5 May 2025, Martin Storsjö wrote:
>
> > On Mon, 5 May 2025, Pali Rohár wrote:
> >
> > > On Monday 05 May 2025 16:10:54 Martin Storsjö wrote:
> > > > On Sun, 13 Apr 2025, Pali Rohár wrote:
> > > >
> > > > > This patch series is fixing stat functions as was discussed in the 
> > > > > long
> > > > > email thread "stat, _stat, and _stat64i32 issues (was: dirent 
> > > > > changes)".
> > > > > I have not included in this patch series Lasse's followup changes.
> > > > >
> > > > > In v2 are fixed also ftw and nftw functions which directly calls stat.
> > > > > And there are lot of other fixes to ensure that the compatibility
> > > > > functions for older CRT libs behaves like it is expected.
> > > > >
> > > > > Pali Rohár (13):
> > > > >  crt: Provide emulation of _fstat64, _stat64 and _wstat64 functions
> > > > >  crt: Fix mingw-w64 emulation of _fstat64i32, _stat64i32 and
> > > > >    _wstat64i32 functions
> > > > >  crt: Provide emulation of _fstat32i64, _stat32i64 and _wstat32i64
> > > > >    functions
> > > > >  headers: Remove broken inline stat() and fstat() functions
> > > > >  headers: Remove inline definition of _fstat64i32() and _stat64i32()
> > > > >    functions
> > > > >  headers: Add missing _CRTIMP for _fstat64i32/_stat64i32/_wstat64i32
> > > > >    functions
> > > > >  crt: Fix ABI of mingw-w64 emulation of POSIX stat* functions
> > > > >  crt: Fix ABI of POSIX ftw() and nftw() functions
> > > > >  headers: Fix declaration of POSIX stat/fstat and LFS stat64/fstat64
> > > > >    functions
> > > > >  headers: Fix declaration of POSIX ftw/nftw functions
> > > > >  crt: Fix POSIX stat() with 32-bit st_size for pre-msvcr100 build
> > > > >  crt: Provide emulation of _time64 function
> > > > >  headers: Add support for -D_TIME_BITS=64
> > > >
> > > > All in all, this patchset looks good to me now; the only
> > > > potential issue is
> > > > that compilation fails after patch 9, which gets fixed after patch 10.
> > > >
> > > > It seems possible to just swap the order of the two, though -
> > > > this at least
> > > > compiles successfully for me. Pali, does that work, or is there
> > > > a reason why
> > > > they must come in this order?
> > >
> > > Sure, you can swap order of patches:
> > > "headers: Fix declaration of POSIX ftw/nftw functions"
> > > "headers: Fix declaration of POSIX stat/fstat and LFS stat64/fstat64
> > > functions"
> >
> > Ok, I pushed this set now then.
>
> Another potential case of breakage caused by this patchset:
> https://github.com/mingw-w64/mingw-w64/issues/103
>
> Pali, can you have a look at this?
>
> // Martin

I quickly looked at it and seems that the problem is that the 64-bit
system msvcrt.dll does not provide _fstat32 symbol. It only has
ABI-incompatible 64-bit symbol.

All versioned 64-bit msvcr*.dll libs and also 64-bit UCRT provides
32-bit _fstat32 symbol.

I did not spot this inconsistency.

So for 64-bit msvcrt.dll builds it would be needed to provide mingw-w64
emulation of that function.

I will prepare a change for it and send to the list.


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

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

Reply via email to