mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-05 07:38:22 +02:00
GLX: Support TLS with better portability
AX_TLS detects when toolchains support __thread or __declspec(thread), but existing code assumed __thread. This also adds a check to configure.ac to error out if TLS is requested but unsupported. Found-by: Tinderbox http://tinderbox.x.org/builds/2011-03-22-0007 Regression-from:82b1eaa6caSigned-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Tom Fogal <tfogal@alumni.unh.edu> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> (cherry picked from commitc55baebf4e)
This commit is contained in:
parent
b8e8579df5
commit
4edf97ad4f
5 changed files with 11 additions and 5 deletions
|
|
@ -599,7 +599,10 @@ AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerate
|
|||
[AIGLX=yes])
|
||||
AX_TLS
|
||||
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
|
||||
[GLX_USE_TLS=$enableval],
|
||||
[GLX_USE_TLS=$enableval
|
||||
if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then
|
||||
AC_MSG_ERROR([GLX with TLS support requested, but the compiler does not support it.])
|
||||
fi],
|
||||
[GLX_USE_TLS=no
|
||||
if test "${ac_cv_tls}" != "none" ; then
|
||||
GLX_USE_TLS=yes
|
||||
|
|
|
|||
|
|
@ -190,11 +190,11 @@ static GLint NoOpUnused(void)
|
|||
/*@{*/
|
||||
#if defined(GLX_USE_TLS)
|
||||
|
||||
PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch
|
||||
PUBLIC 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 TLS void * _glapi_tls_Context
|
||||
__attribute__((tls_model("initial-exec")));
|
||||
|
||||
PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
|
||||
|
|
|
|||
|
|
@ -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 TLS void * _glapi_tls_Context
|
||||
__attribute__((tls_model("initial-exec")));
|
||||
|
||||
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ _glthread_SetTSD(_glthread_TSD *, void *);
|
|||
|
||||
#if defined(GLX_USE_TLS)
|
||||
|
||||
extern __thread struct _glapi_table * _glapi_tls_Dispatch
|
||||
extern TLS struct _glapi_table * _glapi_tls_Dispatch
|
||||
__attribute__((tls_model("initial-exec")));
|
||||
|
||||
#define GET_DISPATCH() _glapi_tls_Dispatch
|
||||
|
|
|
|||
|
|
@ -441,6 +441,9 @@
|
|||
/* Define to 1 if you have the `ffs' function. */
|
||||
#undef HAVE_FFS
|
||||
|
||||
/* If the compiler supports a TLS storage class define it to that here */
|
||||
#undef TLS
|
||||
|
||||
/* Correctly set _XSERVER64 for OSX fat binaries */
|
||||
#ifdef __APPLE__
|
||||
#include "dix-config-apple-verbatim.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue