If libgcc was built with the win32 thread model, the emutls allocations
are freed via __mingw_TLScallback, which is hooked up at .CRT$XLD;
move the tls_atexit callback before this, to make sure TLS destructors
are run before their memory is freed by emutls.

Signed-off-by: Martin Storsjö <[email protected]>
---
 mingw-w64-crt/crt/tls_atexit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/crt/tls_atexit.c b/mingw-w64-crt/crt/tls_atexit.c
index 27ffb84ca..1241b5673 100644
--- a/mingw-w64-crt/crt/tls_atexit.c
+++ b/mingw-w64-crt/crt/tls_atexit.c
@@ -148,4 +148,4 @@ static void WINAPI tls_callback(HANDLE hDllHandle, DWORD 
dwReason, LPVOID __UNUS
   }
 }
 
-_CRTALLOC(".CRT$XLE") PIMAGE_TLS_CALLBACK __xl_e = (PIMAGE_TLS_CALLBACK) 
tls_callback;
+_CRTALLOC(".CRT$XLB") PIMAGE_TLS_CALLBACK __xl_b = (PIMAGE_TLS_CALLBACK) 
tls_callback;
-- 
2.17.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to