Commit b1a9061ff489 ("winpthreads: Fix thread-local storage callbacks on
MSVC") already fixed it for MSVC. For gcc with LTO optimizations it is
needed to mark the variable with __attribute__((used)).
---
mingw-w64-libraries/winpthreads/src/thread.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mingw-w64-libraries/winpthreads/src/thread.c
b/mingw-w64-libraries/winpthreads/src/thread.c
index d799b90c23f9..ce1fa076d027 100644
--- a/mingw-w64-libraries/winpthreads/src/thread.c
+++ b/mingw-w64-libraries/winpthreads/src/thread.c
@@ -544,6 +544,9 @@ __dyn_tls_pthread (HANDLE hDllHandle, DWORD dwReason,
LPVOID lpreserved)
# pragma section(".CRT$XLF", long, read)
#endif
+#if defined(__GNUC__)
+__attribute__((used))
+#endif
WINPTHREADS_ATTRIBUTE((WINPTHREADS_SECTION(".CRT$XLF")))
const PIMAGE_TLS_CALLBACK __xl_f = __dyn_tls_pthread;
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public