meson: check for lld split TLSDESC bug (fixes #5665)

Reviewed-by: Emma Anholt <emma@anholt.net>
Tested-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13934>
This commit is contained in:
Alex Xu (Hello71) 2021-11-23 15:05:01 -05:00 committed by Emma Anholt
parent 7c57346dfd
commit 3161bc5c1a
1 changed files with 9 additions and 1 deletions

View File

@ -536,7 +536,15 @@ if not have_mtls_dialect
else
# -fpic to force dynamic tls, otherwise TLS relaxation defeats check
gnu2_test = cc.run('int __thread x; int main() { return x; }', args: ['-mtls-dialect=gnu2', '-fpic'], name: '-mtls-dialect=gnu2')
if gnu2_test.returncode() == 0
if gnu2_test.returncode() == 0 and (
host_machine.cpu_family() != 'x86_64' or
# https://github.com/mesonbuild/meson/issues/6377
#cc.get_linker_id() != 'ld.lld' or
cc.links('''int __thread x; int y; int main() { __asm__(
"leaq x@TLSDESC(%rip), %rax\n"
"movq y@GOTPCREL(%rip), %rdx\n"
"call *x@TLSCALL(%rax)\n"); }''', name: 'split TLSDESC')
)
c_args += '-mtls-dialect=gnu2'
cpp_args += '-mtls-dialect=gnu2'
endif