util: thread_local doesn't support to be exported on OSX

The linkage error is:
Undefined symbols for architecture x86_64:
  "thread-local wrapper routine for _glapi_tls_Context", referenced from:
      __mesa_GetActiveUniform_impl in libmesa.a(main_uniform_query.cpp.o)

Fixes: a9e2c699aa ("util/c11: Update function u_thread_create to be c11 conformance")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6756

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17784>
This commit is contained in:
Yonggang Luo 2022-07-28 04:31:06 +08:00 committed by Marge Bot
parent 7d35d560ac
commit 73c51b5c57
1 changed files with 6 additions and 1 deletions

View File

@ -79,7 +79,12 @@
* expensive pthread_getspecific() or its equivalent).
*/
#ifdef USE_ELF_TLS
#if defined(__GLIBC__)
#if DETECT_OS_APPLE
/* Apple Clang emits wrappers when using thread_local that break module linkage,
* but not with __thread
*/
#define __THREAD_INITIAL_EXEC __thread
#elif defined(__GLIBC__)
#define __THREAD_INITIAL_EXEC thread_local __attribute__((tls_model("initial-exec")))
#define REALLY_INITIAL_EXEC
#else