Move _fpreset call so it is called for each thread rather than only at startup
Reverts d82c6defa723b6e7986091ce0fb74da544b9e0f6.
(cherry picked from commit b2fbefa65860a34f5851a439316d9e4b4d8ce3f2)
diff --git a/mingw-w64-crt/crt/tlssup.c b/mingw-w64-crt/crt/tlssup.c
index b1db2ed..16a602f 100644
--- a/mingw-w64-crt/crt/tlssup.c
+++ b/mingw-w64-crt/crt/tlssup.c
@@ -29,7 +29,6 @@
#endif
extern WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
-extern void __cdecl __MINGW_NOTHROW _fpreset (void);
#define FUNCS_PER_NODE 30
@@ -96,7 +95,6 @@
return TRUE;
}
- _fpreset();
ps = (uintptr_t) &__xd_a;
ps += sizeof (uintptr_t);
for ( ; ps != (uintptr_t) &__xd_z; ps += sizeof (uintptr_t))
diff --git a/mingw-w64-crt/crt/tlsthrd.c b/mingw-w64-crt/crt/tlsthrd.c
index c367ca1..bebe27b 100644
--- a/mingw-w64-crt/crt/tlsthrd.c
+++ b/mingw-w64-crt/crt/tlsthrd.c
@@ -17,6 +17,7 @@
#include <windows.h>
#include <stdlib.h>
+extern void __cdecl __MINGW_NOTHROW _fpreset (void);
WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
int ___w64_mingwthr_remove_key_dtor (DWORD key);
int ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *));
@@ -146,6 +147,7 @@
}
break;
case DLL_THREAD_ATTACH:
+ _fpreset();
break;
case DLL_THREAD_DETACH:
__mingwthr_run_key_dtors();