AX_TLS detects when toolchains support __thread or __declspec(thread), but existing code assumed __thread.
Found-by: Tinderbox http://tinderbox.x.org/builds/2011-03-22-0007 Regression-from: 82b1eaa6cad20f39dbf15573bdb3d62acbcd91f9 Signed-off-by: Jeremy Huddleston <[email protected]> --- configure.ac | 1 + glx/glapi.c | 4 ++-- glx/glapi.h | 2 +- glx/glthread.h | 2 +- include/dix-config.h.in | 3 +++ 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index b9516b3..ad6e6d8 100644 --- a/configure.ac +++ b/configure.ac @@ -1022,6 +1022,7 @@ AM_CONDITIONAL(AIGLX, test "x$AIGLX" = xyes) if test "x$GLX_USE_TLS" = xyes ; then GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS" GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread" + AC_DEFINE(__XSERVER_TLS, ${ac_cv_tls}, [Thread local storage directive]) fi AC_SUBST([GLX_DEFINES]) diff --git a/glx/glapi.c b/glx/glapi.c index d6a568e..eedf737 100644 --- a/glx/glapi.c +++ b/glx/glapi.c @@ -190,11 +190,11 @@ static GLint NoOpUnused(void) /*@{*/ #if defined(GLX_USE_TLS) -PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch +PUBLIC __XSERVER_TLS struct _glapi_table * _glapi_tls_Dispatch __attribute__((tls_model("initial-exec"))) = (struct _glapi_table *) __glapi_noop_table; -PUBLIC __thread void * _glapi_tls_Context +PUBLIC __XSERVER_TLS void * _glapi_tls_Context __attribute__((tls_model("initial-exec"))); PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL; diff --git a/glx/glapi.h b/glx/glapi.h index 8f2cf66..1b10f6e 100644 --- a/glx/glapi.h +++ b/glx/glapi.h @@ -83,7 +83,7 @@ typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); const extern void *_glapi_Context; const extern struct _glapi_table *_glapi_Dispatch; -extern __thread void * _glapi_tls_Context +extern __XSERVER_TLS void * _glapi_tls_Context __attribute__((tls_model("initial-exec"))); # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context diff --git a/glx/glthread.h b/glx/glthread.h index e2765ce..8265e4e 100644 --- a/glx/glthread.h +++ b/glx/glthread.h @@ -300,7 +300,7 @@ _glthread_SetTSD(_glthread_TSD *, void *); #if defined(GLX_USE_TLS) -extern __thread struct _glapi_table * _glapi_tls_Dispatch +extern __XSERVER_TLS struct _glapi_table * _glapi_tls_Dispatch __attribute__((tls_model("initial-exec"))); #define GET_DISPATCH() _glapi_tls_Dispatch diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 5622766..2f1146e 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -441,6 +441,9 @@ /* Define to 1 if you have the `ffs' function. */ #undef HAVE_FFS +/* Thread local storage directive */ +#undef __XSERVER_TLS + /* Correctly set _XSERVER64 for OSX fat binaries */ #ifdef __APPLE__ #include "dix-config-apple-verbatim.h" -- 1.7.4.1 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
