[Mesa-dev] [PATCH 3/3] meson: Only GLX_USE_TLS when glx is in use

Alexander von Gluck IV kallisti5 at unixzen.com
Mon Feb 19 18:40:53 UTC 2018


February 19, 2018 12:25 PM, "Alexander von Gluck IV" <kallisti5 at unixzen.com> wrote:

> ---
> meson.build | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 6fc7ec7fc9..54572a5bb8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -331,7 +331,6 @@ if with_egl and not (with_platform_drm or with_platform_surfaceless)
> endif
> endif
> 
> -pre_args += '-DGLX_USE_TLS'
> if with_glx != 'disabled'
> if not (with_platform_x11 and with_any_opengl)
> if with_glx == 'auto'
> @@ -365,6 +364,10 @@ if with_glvnd
> endif
> endif
> 
> +if with_glx != 'disabled'
> + pre_args += '-DGLX_USE_TLS'
> +endif
> +
> # TODO: toggle for this
> with_glx_direct = true

Some comments on this one. I was seeing problems loading static TLS binaries
on Haiku, turns out GLX_USE_TLS impacts more than just GLX. I'm guessing our
(non-glx) libGL.so is getting it via libglapi linkages.

https://kallisti5.keybase.pub/Screenshots/meson_build_tls.png

Thanks to Dylan for figuring this one out.

This was discussed previously on the ML
"
This can be applied to all GLX implementations, and in autotools this is
guarded only by the --enable-glx-tls flag. Since this is on by default
in autotools, and is strictly better than being off, the meson build
doesn't even have a toggle for it.
"

Since the GLX_USE_TLS reaches beyond GLX, i'm guarding it with_glx after
the glx auto-detection tri-state (which can disable it)


I noticed under Fedora the Meson-built libGL differs from the system's
in terms of TLS.. not sure if relevant (or an issue)

meson-compiled HEAD:
$ readelf -a ./src/glx/libGL.so | grep TLS
    L (link order), O (extra OS processing required), G (group), T (TLS),
    TLS            0x0000000000068d68 0x0000000000268d68 0x0000000000268d68
   0x000000000000001e (FLAGS)              SYMBOLIC STATIC_TLS
     214: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND _glapi_tls_Dispatch
     934: 0000000000000000     8 TLS     LOCAL  DEFAULT   17 __glX_tls_Context
    2900: 0000000000000000     0 TLS     GLOBAL DEFAULT  UND _glapi_tls_Dispatch


mesa-libGL-17.2.4-3.fc27.x86_64:
  $ readelf -a /usr/lib/libGL.so.1.0.0 | grep TLS
    L (link order), O (extra OS processing required), G (group), T (TLS),
   0x0000001e (FLAGS)                      BIND_NOW STATIC_TLS
  0005fff4  0000110e R_386_TLS_TPOFF   00000000   _glapi_tls_Current
      17: 00000000     0 TLS     GLOBAL DEFAULT  UND _glapi_tls_Current


-- Alex


More information about the mesa-dev mailing list