On Fri, 27 Jun 2025, Pali Rohár wrote:
The mingw-w64 runtime should not call these functions as they are
conditionally defined based on application compile-time macro
_USE_32BIT_TIME_T.
So hide all these functions when building the mingw-w64 runtime to prevent
ABI issues.
---
mingw-w64-headers/crt/_mingw_stat64.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mingw-w64-headers/crt/_mingw_stat64.h
b/mingw-w64-headers/crt/_mingw_stat64.h
index 84eabba9698b..c7b53bef2ca5 100644
--- a/mingw-w64-headers/crt/_mingw_stat64.h
+++ b/mingw-w64-headers/crt/_mingw_stat64.h
@@ -3,6 +3,12 @@
/* __stat64 is needed for compatibility with msvc */
#define __stat64 _stat64
+/*
+ * To prevent ABI issues, the mingw-w64 runtime should not call the
+ * _fstat, _fstati64, _stat, _stati64, _wstat and _wstati64 functions.
+ * Instead it should call the fixed-size variants.
+ */
+#ifndef _CRTBLD
#ifdef _USE_32BIT_TIME_T
#define _fstat _fstat32
#define _fstati64 _fstat32i64
@@ -18,6 +24,7 @@
#define _wstat _wstat64i32
#define _wstati64 _wstat64
#endif /* _USE_32BIT_TIME_T */
+#endif /* _CRTBLD */
struct _stat32 {
_dev_t st_dev;
--
So what is the practical effect of this patch? If I understand it
correctly, then after rebuilding mingw-w64-crt, it will still be exactly
identical to before - but if code in mingw-w64-crt refers to an unsuffixed
function like _fstat, we get errors sooner, rather than subtle ABI bugs?
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public