Merge branch 'tls-config-options' into 'master'
Add test coverage for TLS/TSD combinations See merge request glvnd/libglvnd!251
This commit is contained in:
commit
f73ae47989
|
@ -84,7 +84,13 @@ build-x86_64-tsd-meson:
|
||||||
extends:
|
extends:
|
||||||
- .build-check-meson
|
- .build-check-meson
|
||||||
variables:
|
variables:
|
||||||
CONFIGURE_OPTIONS: -Dtls=disabled
|
CONFIGURE_OPTIONS: -Dtls=false
|
||||||
|
|
||||||
|
build-x86_64-tsd-tls-meson:
|
||||||
|
extends:
|
||||||
|
- .build-check-meson
|
||||||
|
variables:
|
||||||
|
CONFIGURE_OPTIONS: -Ddispatch-tls=false
|
||||||
|
|
||||||
build-i386-tsd:
|
build-i386-tsd:
|
||||||
extends:
|
extends:
|
||||||
|
@ -96,7 +102,13 @@ build-i386-tsd-meson:
|
||||||
extends:
|
extends:
|
||||||
- .build-check-meson
|
- .build-check-meson
|
||||||
variables:
|
variables:
|
||||||
CONFIGURE_OPTIONS: -Dtls=disabled --cross-file .gitlab-ci/i686-linux-gnu
|
CONFIGURE_OPTIONS: -Dtls=false --cross-file .gitlab-ci/i686-linux-gnu
|
||||||
|
|
||||||
|
build-i386-tsd-tls-meson:
|
||||||
|
extends:
|
||||||
|
- .build-check-meson
|
||||||
|
variables:
|
||||||
|
CONFIGURE_OPTIONS: -Ddispatch-tls=false --cross-file .gitlab-ci/i686-linux-gnu
|
||||||
|
|
||||||
build-pure-c-tls:
|
build-pure-c-tls:
|
||||||
extends:
|
extends:
|
||||||
|
@ -120,4 +132,4 @@ build-pure-c-tld-meson:
|
||||||
extends:
|
extends:
|
||||||
- .build-check-meson
|
- .build-check-meson
|
||||||
variables:
|
variables:
|
||||||
CONFIGURE_OPTIONS: -Dasm=disabled -Dtls=disabled
|
CONFIGURE_OPTIONS: -Dasm=disabled -Dtls=false
|
||||||
|
|
17
meson.build
17
meson.build
|
@ -110,14 +110,17 @@ if cc.compiles('typeof(int *);', name : 'typeof')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
with_tls = get_option('tls')
|
with_tls = get_option('tls')
|
||||||
if with_tls.auto()
|
if with_tls
|
||||||
|
# Use a __thread variable if possible, even if we can't use the TLS assembly
|
||||||
|
# stubs, because it's still faster than calling pthread_getspecific.
|
||||||
have_tls = cc.compiles(
|
have_tls = cc.compiles(
|
||||||
'__thread int foo;',
|
'__thread int foo;',
|
||||||
name : '__thread',
|
name : '__thread',
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
have_tls = with_tls.enabled()
|
have_tls = false
|
||||||
endif
|
endif
|
||||||
|
message('Using TLS variable for dispatch table: @0@'.format(have_tls))
|
||||||
|
|
||||||
if have_tls
|
if have_tls
|
||||||
add_project_arguments('-DGLDISPATCH_USE_TLS', language : ['c'])
|
add_project_arguments('-DGLDISPATCH_USE_TLS', language : ['c'])
|
||||||
|
@ -129,7 +132,15 @@ if use_asm
|
||||||
# FreeBSD and glibc). on other platforms we use TSD stubs to allow calling
|
# FreeBSD and glibc). on other platforms we use TSD stubs to allow calling
|
||||||
# extension functions unknown at compile time.
|
# extension functions unknown at compile time.
|
||||||
# https://gitlab.freedesktop.org/glvnd/libglvnd/-/merge_requests/249
|
# https://gitlab.freedesktop.org/glvnd/libglvnd/-/merge_requests/249
|
||||||
thread_type = have_tls and (host_machine.system() == 'freebsd' or cc.has_header_symbol('features.h', '__GLIBC__')) ? 'tls' : 'tsd'
|
thread_type = 'tsd'
|
||||||
|
if get_option('dispatch-tls')
|
||||||
|
if have_tls
|
||||||
|
if host_machine.system() == 'freebsd' or cc.has_header_symbol('features.h', '__GLIBC__')
|
||||||
|
thread_type = 'tls'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if host_machine.cpu_family().startswith('x86')
|
if host_machine.cpu_family().startswith('x86')
|
||||||
gl_dispatch_type = '@0@_@1@'.format(
|
gl_dispatch_type = '@0@_@1@'.format(
|
||||||
host_machine.cpu_family(),
|
host_machine.cpu_family(),
|
||||||
|
|
|
@ -56,8 +56,15 @@ option(
|
||||||
)
|
)
|
||||||
option(
|
option(
|
||||||
'tls',
|
'tls',
|
||||||
type : 'feature',
|
type : 'boolean',
|
||||||
description : 'Use Thread Local Storage.'
|
value : true,
|
||||||
|
description : 'Use Thread Local Storage (if supported).'
|
||||||
|
)
|
||||||
|
option(
|
||||||
|
'dispatch-tls',
|
||||||
|
type : 'boolean',
|
||||||
|
value : true,
|
||||||
|
description : 'Use TLS-based stubs in libGLdispatch (if supported).'
|
||||||
)
|
)
|
||||||
option(
|
option(
|
||||||
'dispatch-page-size',
|
'dispatch-page-size',
|
||||||
|
|
Loading…
Reference in a new issue