crt: Make tls_atexit run before __mingw_TLScallback 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ö <martin@martin.st>
diff --git a/mingw-w64-crt/crt/tls_atexit.c b/mingw-w64-crt/crt/tls_atexit.c index 27ffb84..1241b56 100644 --- a/mingw-w64-crt/crt/tls_atexit.c +++ b/mingw-w64-crt/crt/tls_atexit.c
@@ -148,4 +148,4 @@ } } -_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;