This will ensure that _pei386_runtime_relocator() is called as the first
function and that all those runtime init code functions are called in
guarded block which prevents duplicate code execution.
---
 mingw-w64-crt/crt/crtexe.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index c68ac3734e8e..4134b948b7ae 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -172,6 +172,14 @@ __tmainCRTStartup (void)
       {
        __native_startup_state = __initializing;
 
+       _pei386_runtime_relocator ();
+#if defined(__x86_64__) && !defined(__SEH__)
+       __mingw_init_ehandler ();
+#endif
+       __mingw_oldexcpt_handler = SetUnhandledExceptionFilter 
(_gnu_exception_handler);
+       _set_invalid_parameter_handler (__mingw_invalidParameterHandler);
+       _fpreset ();
+
        managedapp = check_managed_app ();
        if (__mingw_app_type)
          __set_app_type (_GUI_APP);
@@ -223,15 +231,6 @@ __tmainCRTStartup (void)
     
     if (__dyn_tls_init_callback != NULL)
       __dyn_tls_init_callback (NULL, DLL_THREAD_ATTACH, NULL);
-    
-    _pei386_runtime_relocator ();
-    __mingw_oldexcpt_handler = SetUnhandledExceptionFilter 
(_gnu_exception_handler);
-#if defined(__x86_64__) && !defined(__SEH__)
-    __mingw_init_ehandler ();
-#endif
-    _set_invalid_parameter_handler (__mingw_invalidParameterHandler);
-    
-    _fpreset ();
 
 #ifdef _UNICODE
     __winitenv = envp;
-- 
2.20.1



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

Reply via email to