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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 2 18:00:43 UTC 2021


Module: Mesa
Branch: main
Commit: 3161bc5c1a5297f3261e9263a2d54bda94af1bc4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3161bc5c1a5297f3261e9263a2d54bda94af1bc4

Author: Alex Xu (Hello71) <alex_y_xu at yahoo.ca>
Date:   Tue Nov 23 15:05:01 2021 -0500

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

Reviewed-by: Emma Anholt <emma at anholt.net>
Tested-by: Michel Dänzer <mdaenzer at redhat.com>
Signed-off-by: Alex Xu (Hello71) <alex_y_xu at yahoo.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13934>

---

 meson.build | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7d1a39e131e..23b17a3e2ac 100644
--- a/meson.build
+++ b/meson.build
@@ -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 at TLSDESC(%rip), %rax\n"
+                "movq y at GOTPCREL(%rip), %rdx\n"
+                "call *x at TLSCALL(%rax)\n"); }''', name: 'split TLSDESC')
+          )
       c_args += '-mtls-dialect=gnu2'
       cpp_args += '-mtls-dialect=gnu2'
     endif



More information about the mesa-commit mailing list