Fails to build on 32-bit x86: TLS attribute mismatch: _glapi_tls_Dispatch
Regressed by 8570a2a2. CC @alxu. From error log:
FAILED: src/mapi/shared-glapi/libglapi.so.0.0.0
ld: error: TLS attribute mismatch: _glapi_tls_Dispatch
>>> defined in src/mapi/shared-glapi/libglapi.so.0.0.0.p/.._u_current.c.o
>>> defined in src/mapi/shared-glapi/libglapi.so.0.0.0.p/.._entry.c.o
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Switching to GCC doesn't help:
FAILED: src/mapi/shared-glapi/libglapi.so.0.0.0
/usr/bin/ld.bfd: _glapi_tls_Dispatch: TLS definition in src/mapi/shared-glapi/libglapi.so.0.0.0.p/.._u_current.c.o section .tdata._glapi_tls_Dispatch mismatches non-TLS reference in src/mapi/shared-glapi/libglapi.so.0.0.0.p/.._entry.c.o
/usr/bin/ld.bfd: src/mapi/shared-glapi/libglapi.so.0.0.0.p/.._u_current.c.o: error adding symbols: bad value
collect2: error: ld returned 1 exit status
Workaround: -Dglx-read-only-text=true
(disables entry_x86_tsd.h)
--- src/mapi/entry.c~ (git-7603187aec36)
+++ src/mapi/entry.c (working copy)
@@ -49,14 +49,14 @@
/* REALLY_INITIAL_EXEC implies USE_ELF_TLS and __GNUC__ */
/* Use TSD stubs for non-IE ELF TLS even though first access is slower because
* future accesses will be patched */
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
#include "entry_x86_tls.h"
-#elif defined(USE_X86_ASM) && !defined(GLX_X86_READONLY_TEXT) && defined(__GNUC__)
+#elif defined(USE_X86_ASM) && !defined(GLX_X86_READONLY_TEXT) && defined(REALLY_INITIAL_EXEC)
#include "entry_x86_tsd.h"
#elif defined(USE_X86_64_ASM) && defined(REALLY_INITIAL_EXEC)
#include "entry_x86-64_tls.h"
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(REALLY_INITIAL_EXEC)
#include "entry_ppc64le_tls.h"
#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && defined(__GNUC__)
#include "entry_ppc64le_tsd.h"
#else
Note, defining REALLY_INITIAL_EXEC
breaks runtime:
$ glxgears
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: No space available for static Thread Local Storage (search paths /usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
Error: glXCreateContext failed
Found on FreeBSD but may affect other non-GNU systems: Alpine (musl), Android (bionic), Haiku, NetBSD, OpenBSD, Solaris.
Edited by Jan Beich