On Thu, 17 Apr 2025, Pali Rohár wrote:
Function __main() is function for executing gcc c++ constructors. Move it
into guarded code which prevents duplicate code execution, after executing
msvc c++ constructors (__xc_a-__xc_z callbacks).
---
mingw-w64-crt/crt/crtexe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index 620f08b9467d..46e61fcecb94 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -208,6 +208,7 @@ __tmainCRTStartup (void)
_amsg_exit (8); /* _RT_SPACEARG */
_initterm (__xc_a, __xc_z);
+ __main (); /* C++ initialization. */
__native_startup_state = __initialized;
}
@@ -229,7 +230,6 @@ __tmainCRTStartup (void)
_fpreset ();
duplicate_ppstrings (argc, &argv);
- __main (); /* C++ initialization. */
#ifdef _UNICODE
__winitenv = envp;
#else
--
This makes the constructors be called before _pei386_runtime_relocator -
this will quite certainly break things in some setup. Yes I know a later
patch fixes the order again, but we shouldn't be moving things in such an
order.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public