From c691149f3e8632243dbf9003fc8c6bcf1d22b822 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 4 Dec 2021 17:39:09 +0800 Subject: [PATCH] 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 Reviewed-by: Jesse Natalie Part-of: --- 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