Mesa (main): win32: Fixes thread local on win32 with clang/mingw (!14062)

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 6 15:32:42 UTC 2021


Module: Mesa
Branch: main
Commit: c691149f3e8632243dbf9003fc8c6bcf1d22b822
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c691149f3e8632243dbf9003fc8c6bcf1d22b822

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Sat Dec  4 17:39:09 2021 +0800

win32: Fixes thread local on win32 with clang/mingw (!14062)

The mingw compiling error:
```
../../src/mapi/glapi/glapi.h:86:66: error: '_glapi_tls_Dispatch' cannot be thread local when declared 'dllimport'
_GLAPI_EXPORT extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch;
                                                                 ^
../../src/mapi/glapi/glapi.h:88:51: error: '_glapi_tls_Context' cannot be thread local when declared 'dllimport'
_GLAPI_EXPORT extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context;
```

Fixes: c47fd3dc ("windows: Use TLS context/dispatch with shared-glapi")

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14062>

---

 src/mapi/glapi/glapi.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index d0bc5cdda28..8842dad851f 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -79,12 +79,11 @@ struct _glapi_table;
 
 #if defined (USE_ELF_TLS)
 
-#ifdef _MSC_VER
-extern __declspec(thread) struct _glapi_table * _glapi_tls_Dispatch;
-extern __declspec(thread) void * _glapi_tls_Context;
+#if defined(USE_TLS_BEHIND_FUNCTIONS)
+extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch;
+extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context;
 #else
 _GLAPI_EXPORT extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch;
-
 _GLAPI_EXPORT extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context;
 #endif
 



More information about the mesa-commit mailing list