Mesa (main): mapi: Remove usage of USE_ELF_TLS

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jul 30 02:03:35 UTC 2022


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

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Tue Jun 21 17:21:50 2022 +0800

mapi: Remove usage of USE_ELF_TLS

After commit c47fd3dc006 ("windows: Use TLS context/dispatch with shared-glapi")
USE_ELF_TLS are always defined by
pre_args += '-DUSE_ELF_TLS'
So we can remove it safety

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>

---

 src/mapi/entry.c                    |   7 +-
 src/mapi/entry_ppc64le_tsd.h        | 210 ------------------------------------
 src/mapi/entry_x86_tsd.h            | 155 --------------------------
 src/mapi/glapi/gen/gl_SPARC_asm.py  |  78 --------------
 src/mapi/glapi/gen/gl_x86-64_asm.py |  49 ---------
 src/mapi/glapi/gen/gl_x86_asm.py    |   4 +-
 src/mapi/glapi/glapi.c              |   4 -
 src/mapi/glapi/glapi.h              |  17 ---
 src/mapi/glapi/glapi_entrypoint.c   | 116 +-------------------
 src/mapi/glapi/glapi_priv.h         |  10 +-
 src/mapi/glapi/meson.build          |   2 -
 src/mapi/mapi_glapi.c               |   4 -
 src/mapi/u_current.c                | 114 --------------------
 src/mapi/u_current.h                |  20 ----
 14 files changed, 6 insertions(+), 784 deletions(-)

diff --git a/src/mapi/entry.c b/src/mapi/entry.c
index 5ebd85011c6..a2afab6ddc6 100644
--- a/src/mapi/entry.c
+++ b/src/mapi/entry.c
@@ -46,18 +46,13 @@
 #define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_table_internal)
 #endif
 
-/* REALLY_INITIAL_EXEC implies USE_ELF_TLS and __GNUC__ */
+/* REALLY_INITIAL_EXEC implies __GLIBC__ */
 #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__)
-#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"
-/* ppc64le non-IE TSD stubs are possible but not currently implemented */
-#elif defined(USE_PPC64LE_ASM) && UTIL_ARCH_LITTLE_ENDIAN && !defined(USE_ELF_TLS) && defined(__GNUC__)
-#include "entry_ppc64le_tsd.h"
 #else
 
 static inline const struct _glapi_table *
diff --git a/src/mapi/entry_ppc64le_tsd.h b/src/mapi/entry_ppc64le_tsd.h
deleted file mode 100644
index a583b93e5e2..00000000000
--- a/src/mapi/entry_ppc64le_tsd.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2017 Red Hat
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Ben Crocker <bcrocker at redhat.com>
- */
-
-#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY
-#define HIDDEN __attribute__((visibility("hidden")))
-#else
-#define HIDDEN
-#endif
-
-// NOTE: These must be powers of two:
-#define PPC64LE_ENTRY_SIZE 256
-#define PPC64LE_PAGE_ALIGN 65536
-#if ((PPC64LE_ENTRY_SIZE & (PPC64LE_ENTRY_SIZE - 1)) != 0)
-#error PPC64LE_ENTRY_SIZE must be a power of two!
-#endif
-#if ((PPC64LE_PAGE_ALIGN & (PPC64LE_PAGE_ALIGN - 1)) != 0)
-#error PPC64LE_PAGE_ALIGN must be a power of two!
-#endif
-
-__asm__(".text\n"
-        ".balign " U_STRINGIFY(PPC64LE_ENTRY_SIZE) "\n"
-        "ppc64le_entry_start:");
-
-#define STUB_ASM_ENTRY(func)                            \
-   ".globl " func "\n"                                  \
-   ".type " func ", @function\n"                        \
-   ".balign " U_STRINGIFY(PPC64LE_ENTRY_SIZE) "\n"        \
-   func ":\n\t"                                         \
-   "  addis  2, 12, .TOC.-" func "@ha\n\t"              \
-   "  addi   2, 2, .TOC.-" func "@l\n\t"                \
-   "  .localentry  " func ", .-" func "\n\t"
-
-#define STUB_ASM_CODE(slot)                                         \
-   "  addis  11, 2, " ENTRY_CURRENT_TABLE "@got at ha\n\t"             \
-   "  ld     11, " ENTRY_CURRENT_TABLE "@got at l(11)\n\t"             \
-   "  ld     11, 0(11)\n\t"                                         \
-   "  cmpldi 11, 0\n\t"                                             \
-   "  beq    2000f\n"                                               \
-   "1050:\n\t"                                                      \
-   "  ld     12, " slot "*8(11)\n\t"                                \
-   "  mtctr  12\n\t"                                                \
-   "  bctr\n"                                                       \
-   "2000:\n\t"                                                      \
-   "  mflr   0\n\t"                                                 \
-   "  std    0, 16(1)\n\t"                                          \
-   "  std    2, 40(1)\n\t"                                          \
-   "  stdu   1, -144(1)\n\t"                                        \
-   "  std    3, 56(1)\n\t"                                          \
-   "  std    4, 64(1)\n\t"                                          \
-   "  std    5, 72(1)\n\t"                                          \
-   "  std    6, 80(1)\n\t"                                          \
-   "  std    7, 88(1)\n\t"                                          \
-   "  std    8, 96(1)\n\t"                                          \
-   "  std    9, 104(1)\n\t"                                         \
-   "  std    10, 112(1)\n\t"                                        \
-   "  std    12, 128(1)\n\t"                                        \
-   "  addis  12, 2, " ENTRY_CURRENT_TABLE_GET "@got at ha\n\t"         \
-   "  ld     12, " ENTRY_CURRENT_TABLE_GET "@got at l(12)\n\t"         \
-   "  mtctr  12\n\t"                                                \
-   "  bctrl\n\t"                                                    \
-   "  ld     2, 144+40(1)\n\t"                                      \
-   "  mr     11, 3\n\t"                                             \
-   "  ld     3, 56(1)\n\t"                                          \
-   "  ld     4, 64(1)\n\t"                                          \
-   "  ld     5, 72(1)\n\t"                                          \
-   "  ld     6, 80(1)\n\t"                                          \
-   "  ld     7, 88(1)\n\t"                                          \
-   "  ld     8, 96(1)\n\t"                                          \
-   "  ld     9, 104(1)\n\t"                                         \
-   "  ld     10, 112(1)\n\t"                                        \
-   "  ld     12, 128(1)\n\t"                                        \
-   "  addi   1, 1, 144\n\t"                                         \
-   "  ld     0, 16(1)\n\t"                                          \
-   "  mtlr   0\n\t"                                                 \
-   "  b      1050b\n"
-
-#define MAPI_TMP_STUB_ASM_GCC
-#include "mapi_tmp.h"
-
-#ifndef MAPI_MODE_BRIDGE
-
-#include <string.h>
-#include "u_execmem.h"
-
-void
-entry_patch_public(void)
-{
-}
-
-extern char
-ppc64le_entry_start[] HIDDEN;
-
-mapi_func
-entry_get_public(int slot)
-{
-   return (mapi_func) (ppc64le_entry_start + slot * PPC64LE_ENTRY_SIZE);
-}
-
-static const uint32_t code_templ[] = {
-   // This should be functionally the same code as would be generated from
-   // the STUB_ASM_CODE macro, but defined as a buffer.
-   // This is used to generate new dispatch stubs. Mesa will copy this
-   // data to the dispatch stub, and then it will patch the slot number and
-   // any addresses that it needs to.
-   // NOTE!!!  NOTE!!!  NOTE!!!
-   // This representation is correct for both little- and big-endian systems.
-   // However, more work needs to be done for big-endian Linux because it
-   // adheres to an older, AIX-compatible ABI that uses function descriptors.
-   // 1000:
-   0x7C0802A6,    // <ENTRY+000>:    mflr   0
-   0xF8010010,    // <ENTRY+004>:    std    0, 16(1)
-   0xE96C0098,    // <ENTRY+008>:    ld     11, 9000f-1000b+0(12)
-   0xE96B0000,    // <ENTRY+012>:    ld     11, 0(11)
-   0x282B0000,    // <ENTRY+016>:    cmpldi 11, 0
-   0x41820014,    // <ENTRY+020>:    beq    2000f
-   // 1050:
-   0xE80C00A8,    // <ENTRY+024>:    ld     0, 9000f-1000b+16(12)
-   0x7D8B002A,    // <ENTRY+028>:    ldx    12, 11, 0
-   0x7D8903A6,    // <ENTRY+032>:    mtctr  12
-   0x4E800420,    // <ENTRY+036>:    bctr
-   // 2000:
-   0xF8410028,    // <ENTRY+040>:    std    2, 40(1)
-   0xF821FF71,    // <ENTRY+044>:    stdu   1, -144(1)
-   0xF8610038,    // <ENTRY+048>:    std    3, 56(1)
-   0xF8810040,    // <ENTRY+052>:    std    4, 64(1)
-   0xF8A10048,    // <ENTRY+056>:    std    5, 72(1)
-   0xF8C10050,    // <ENTRY+060>:    std    6, 80(1)
-   0xF8E10058,    // <ENTRY+064>:    std    7, 88(1)
-   0xF9010060,    // <ENTRY+068>:    std    8, 96(1)
-   0xF9210068,    // <ENTRY+072>:    std    9, 104(1)
-   0xF9410070,    // <ENTRY+076>:    std    10, 112(1)
-   0xF9810080,    // <ENTRY+080>:    std    12, 128(1)
-   0xE98C00A0,    // <ENTRY+084>:    ld     12, 9000f-1000b+8(12)
-   0x7D8903A6,    // <ENTRY+088>:    mtctr  12
-   0x4E800421,    // <ENTRY+092>:    bctrl
-   0x7C6B1B78,    // <ENTRY+096>:    mr     11, 3
-   0xE8610038,    // <ENTRY+100>:    ld     3, 56(1)
-   0xE8810040,    // <ENTRY+104>:    ld     4, 64(1)
-   0xE8A10048,    // <ENTRY+108>:    ld     5, 72(1)
-   0xE8C10050,    // <ENTRY+112>:    ld     6, 80(1)
-   0xE8E10058,    // <ENTRY+116>:    ld     7, 88(1)
-   0xE9010060,    // <ENTRY+120>:    ld     8, 96(1)
-   0xE9210068,    // <ENTRY+124>:    ld     9, 104(1)
-   0xE9410070,    // <ENTRY+128>:    ld     10, 112(1)
-   0xE9810080,    // <ENTRY+132>:    ld     12, 128(1)
-   0x38210090,    // <ENTRY+136>:    addi   1, 1, 144
-   0xE8010010,    // <ENTRY+140>:    ld     0, 16(1)
-   0x7C0803A6,    // <ENTRY+144>:    mtlr   0
-   0x4BFFFF84,    // <ENTRY+148>:    b      1050b
-   // 9000:
-   0, 0,          // <ENTRY+152>:    .quad ENTRY_CURRENT_TABLE
-   0, 0,          // <ENTRY+160>:    .quad ENTRY_CURRENT_TABLE_GET
-   0, 0           // <ENTRY+168>:    .quad <slot>*8
-};
-static const uint64_t TEMPLATE_OFFSET_CURRENT_TABLE = sizeof(code_templ) - 3*8;
-static const uint64_t TEMPLATE_OFFSET_CURRENT_TABLE_GET = sizeof(code_templ) - 2*8;
-static const uint64_t TEMPLATE_OFFSET_SLOT = sizeof(code_templ) - 1*8;
-
-void
-entry_patch(mapi_func entry, int slot)
-{
-   char *code = (char *) entry;
-   *((uint64_t *) (code + TEMPLATE_OFFSET_CURRENT_TABLE)) = (uint64_t) ENTRY_CURRENT_TABLE;
-   *((uint64_t *) (code + TEMPLATE_OFFSET_CURRENT_TABLE_GET)) = (uint64_t) ENTRY_CURRENT_TABLE_GET;
-   *((uint64_t *) (code + TEMPLATE_OFFSET_SLOT)) = slot * sizeof(mapi_func);
-}
-
-mapi_func
-entry_generate(int slot)
-{
-   char *code;
-   mapi_func entry;
-
-   code = u_execmem_alloc(sizeof(code_templ));
-   if (!code)
-      return NULL;
-
-   memcpy(code, code_templ, sizeof(code_templ));
-
-   entry = (mapi_func) code;
-   entry_patch(entry, slot);
-
-   return entry;
-}
-
-#endif /* MAPI_MODE_BRIDGE */
diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h
deleted file mode 100644
index 2aa724a70f3..00000000000
--- a/src/mapi/entry_x86_tsd.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2010 LunarG Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Chia-I Wu <olv at lunarg.com>
- */
-
-#ifdef __CET__
-#define ENDBR "endbr32\n\t"
-#else
-#define ENDBR
-#endif
-
-#ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY
-#define HIDDEN __attribute__((visibility("hidden")))
-#else
-#define HIDDEN
-#endif
-
-#define X86_ENTRY_SIZE 64
-
-__asm__(".text\n");
-
-__asm__("x86_got:\n\t"
-        "call 1f\n"
-        "1:\n\t"
-        "popl %eax\n\t"
-        "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t"
-        "ret");
-
-__asm__(".balign 32\n"
-        "x86_entry_start:");
-
-#define STUB_ASM_ENTRY(func)        \
-   ".globl " func "\n"              \
-   ".type " func ", @function\n"    \
-   ".balign 32\n"                   \
-   func ":"
-
-#define LOC_BEGIN_SET_ECX
-#define LOC_END_SET_ECX
-#define LOC_END_JMP
-
-#define STUB_ASM_CODE(slot)         \
-   ENDBR                            \
-   LOC_BEGIN_SET_ECX	            \
-   "call 1f\n\t"                    \
-   "1:\n\t"                         \
-   "popl %ecx\n\t"                  \
-   "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx\n\t" \
-   LOC_END_SET_ECX                                \
-   "movl _glapi_Dispatch at GOT(%ecx), %eax\n\t" \
-   "mov (%eax), %eax\n\t"           \
-   "testl %eax, %eax\n\t"           \
-   "jne 1f\n\t"                     \
-   "push %ebx\n\t"                  \
-   "movl %ecx, %ebx\n\t"            \
-   "call " ENTRY_CURRENT_TABLE_GET "@PLT\n\t" \
-   "popl %ebx\n\t"                  \
-   "1:\n\t"                         \
-   "jmp *(4 * " slot ")(%eax)\n\t" \
-   LOC_END_JMP
-
-#define MAPI_TMP_STUB_ASM_GCC
-#include "mapi_tmp.h"
-
-#ifndef MAPI_MODE_BRIDGE
-
-__asm__(".balign 32\n"
-        "x86_entry_end:");
-
-#undef LOC_BEGIN_SET_ECX
-#undef LOC_END_SET_ECX
-#undef LOC_END_JMP
-#define LOC_BEGIN_SET_ECX "jmp set_ecx\n\t"
-#define LOC_END_SET_ECX "set_ecx:movl $0x12345678, %ecx\n\tloc_end_set_ecx:\n\t"
-#define LOC_END_JMP "loc_end_jmp:"
-
-/* Any number big enough works. This is to make sure the final
- * jmp is a long jmp */
-__asm__(STUB_ASM_CODE("10000"));
-
-extern const char loc_end_set_ecx[] HIDDEN;
-extern const char loc_end_jmp[] HIDDEN;
-
-#include <string.h>
-#include "u_execmem.h"
-
-extern unsigned long
-x86_got();
-
-extern const char x86_entry_start[] HIDDEN;
-extern const char x86_entry_end[] HIDDEN;
-
-void
-entry_patch_public(void)
-{
-}
-
-mapi_func
-entry_get_public(int slot)
-{
-   return (mapi_func) (x86_entry_start + slot * X86_ENTRY_SIZE);
-}
-
-void
-entry_patch(mapi_func entry, int slot)
-{
-   char *code = (char *) entry;
-   int offset = loc_end_jmp - x86_entry_end - sizeof(unsigned long);
-   *((unsigned long *) (code + offset)) = slot * sizeof(mapi_func);
-}
-
-mapi_func
-entry_generate(int slot)
-{
-   const char *code_templ = x86_entry_end;
-   char *code;
-   mapi_func entry;
-
-   code = u_execmem_alloc(X86_ENTRY_SIZE);
-   if (!code)
-      return NULL;
-
-   memcpy(code, code_templ, X86_ENTRY_SIZE);
-   entry = (mapi_func) code;
-   int ecx_value_off = loc_end_set_ecx - x86_entry_end - sizeof(unsigned long);
-   *((unsigned long *) (code + ecx_value_off)) = x86_got();
-
-   entry_patch(entry, slot);
-
-   return entry;
-}
-
-#endif /* MAPI_MODE_BRIDGE */
diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py b/src/mapi/glapi/gen/gl_SPARC_asm.py
index d2f9fcd5cf4..795be406f3b 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -75,7 +75,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
         print('\t add\t%o7, %g2, %g2')
         print('\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc')
         print('')
-        print('#ifdef USE_ELF_TLS')
         print('')
         print('\tGLOBL_FN(__glapi_sparc_get_dispatch)')
         print('\tHIDDEN(__glapi_sparc_get_dispatch)')
@@ -120,83 +119,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
         print('\t sethi\tGL_OFF(off), %g3;\t\t\t\\')
         print('\t.size\tfn,.-fn;')
         print('')
-        print('#elif defined(HAVE_PTHREAD)')
-        print('')
-        print('\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */')
-        print('\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */')
-        print('\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */')
-        print('\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */')
-        print('\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */')
-        print('\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */')
-        print('')
-        print('\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */')
-        print('\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */')
-        print('')
-        print('\t.data')
-        print('\t.align\t32')
-        print('')
-        print('\tGLOBL_FN(__glapi_sparc_pthread_stub)')
-        print('\tHIDDEN(__glapi_sparc_pthread_stub)')
-        print('__glapi_sparc_pthread_stub: /* Call offset in %g3 */')
-        print('\tmov\t%o7, %g1')
-        print('\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2')
-        print('\tcall\t__glapi_sparc_get_pc')
-        print('\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2')
-        print('\tmov\t%g1, %o7')
-        print('\tsethi\t%hi(_glapi_Dispatch), %g1')
-        print('\tor\t%g1, %lo(_glapi_Dispatch), %g1')
-        print('\tsrl\t%g3, 10, %g3')
-        print('\tGL_LL\t[%g2+%g1], %g2')
-        print('\tGL_LL\t[%g2], %g1')
-        print('\tcmp\t%g1, 0')
-        print('\tbe\t2f')
-        print('\t nop')
-        print('1:\tGL_LL\t[%g1 + %g3], %g1')
-        print('\tjmp\t%g1')
-        print('\t nop')
-        print('2:\tsave\t%sp, GL_STACK_SIZE, %sp')
-        print('\tmov\t%g3, %l0')
-        print('\tcall\t_glapi_get_dispatch')
-        print('\t nop')
-        print('\tmov\t%o0, %g1')
-        print('\tmov\t%l0, %g3')
-        print('\tba\t1b')
-        print('\t restore %g0, %g0, %g0')
-        print('\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub')
-        print('')
-        print('#define GL_STUB(fn, off)\t\t\t\\')
-        print('\tGLOBL_FN(fn);\t\t\t\t\\')
-        print('fn:\tba\t__glapi_sparc_pthread_stub;\t\\')
-        print('\t sethi\tGL_OFF(off), %g3;\t\t\\')
-        print('\t.size\tfn,.-fn;')
-        print('')
-        print('#else /* Non-threaded version. */')
-        print('')
-        print('\t.type	__glapi_sparc_nothread_stub, @function')
-        print('__glapi_sparc_nothread_stub: /* Call offset in %g3 */')
-        print('\tmov\t%o7, %g1')
-        print('\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2')
-        print('\tcall\t__glapi_sparc_get_pc')
-        print('\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2')
-        print('\tmov\t%g1, %o7')
-        print('\tsrl\t%g3, 10, %g3')
-        print('\tsethi\t%hi(_glapi_Dispatch), %g1')
-        print('\tor\t%g1, %lo(_glapi_Dispatch), %g1')
-        print('\tGL_LL\t[%g2+%g1], %g2')
-        print('\tGL_LL\t[%g2], %g1')
-        print('\tGL_LL\t[%g1 + %g3], %g1')
-        print('\tjmp\t%g1')
-        print('\t nop')
-        print('\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub')
-        print('')
-        print('#define GL_STUB(fn, off)\t\t\t\\')
-        print('\tGLOBL_FN(fn);\t\t\t\t\\')
-        print('fn:\tba\t__glapi_sparc_nothread_stub;\t\\')
-        print('\t sethi\tGL_OFF(off), %g3;\t\t\\')
-        print('\t.size\tfn,.-fn;')
-        print('')
-        print('#endif')
-        print('')
         print('#define GL_STUB_ALIAS(fn, alias)		\\')
         print('	.globl	fn;				\\')
         print('	.set	fn, alias')
diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
index 487843dd000..5d5a265e2a1 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -136,32 +136,12 @@ class PrintGenericStubs(gl_XML.gl_print_base):
         print('')
         print('\t.text')
         print('')
-        print('#ifdef USE_ELF_TLS')
-        print('')
         print('_x86_64_get_dispatch:')
         print('\tmovq\t_glapi_tls_Dispatch at GOTTPOFF(%rip), %rax')
         print('\tmovq\t%fs:(%rax), %rax')
         print('\tret')
         print('\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch')
         print('')
-        print('#elif defined(HAVE_PTHREAD)')
-        print('')
-        print('\t.extern\t_glapi_Dispatch')
-        print('\t.extern\t_gl_DispatchTSD')
-        print('\t.extern\tpthread_getspecific')
-        print('')
-        print('\t.p2align\t4,,15')
-        print('_x86_64_get_dispatch:')
-        print('\tmovq\t_gl_DispatchTSD at GOTPCREL(%rip), %rax')
-        print('\tmovl\t(%rax), %edi')
-        print('\tjmp\tpthread_getspecific at PLT')
-        print('')
-        print('#else')
-        print('')
-        print('\t.extern\t_glapi_get_dispatch')
-        print('')
-        print('#endif')
-        print('')
         return
 
 
@@ -220,38 +200,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
         if not f.is_static_entry_point(f.name):
             print('\tHIDDEN(GL_PREFIX(%s))' % (name))
         print('GL_PREFIX(%s):' % (name))
-        print('#if defined(USE_ELF_TLS)')
         print('\tcall\t_x86_64_get_dispatch at PLT')
         print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
         print('\tjmp\t*%r11')
-        print('#elif defined(HAVE_PTHREAD)')
-
-        save_all_regs(registers)
-        print('\tcall\t_x86_64_get_dispatch at PLT')
-        restore_all_regs(registers)
-
-        if f.offset == 0:
-            print('\tmovq\t(%rax), %r11')
-        else:
-            print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
-
-        print('\tjmp\t*%r11')
-
-        print('#else')
-        print('\tmovq\t_glapi_Dispatch(%rip), %rax')
-        print('\ttestq\t%rax, %rax')
-        print('\tje\t1f')
-        print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
-        print('\tjmp\t*%r11')
-        print('1:')
-
-        save_all_regs(registers)
-        print('\tcall\t_glapi_get_dispatch')
-        restore_all_regs(registers)
-
-        print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
-        print('\tjmp\t*%r11')
-        print('#endif /* defined(USE_ELF_TLS) */')
 
         print('\t.size\tGL_PREFIX(%s), .-GL_PREFIX(%s)' % (name, name))
         print('')
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index 057aa54ba3f..1196b3ab98c 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -128,9 +128,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
         print('#endif')
         print('')
 
-        print('#if defined( USE_ELF_TLS ) && !defined( GLX_X86_READONLY_TEXT )')
+        print('#if !defined( GLX_X86_READONLY_TEXT )')
         print('\t\t.section\twtext, "awx", @progbits')
-        print('#endif /* defined( USE_ELF_TLS ) */')
+        print('#endif /* !defined( GLX_X86_READONLY_TEXT ) */')
 
         print('')
         print('\t\tALIGNTEXT16')
diff --git a/src/mapi/glapi/glapi.c b/src/mapi/glapi/glapi.c
index 53cfd7f087a..1c0a75a8b1c 100644
--- a/src/mapi/glapi/glapi.c
+++ b/src/mapi/glapi/glapi.c
@@ -33,22 +33,18 @@
  * u_current.c.
  */
 
-#ifdef USE_ELF_TLS
 /* not used, but defined for compatibility */
 const struct _glapi_table *_glapi_Dispatch;
 const void *_glapi_Context;
-#endif /* USE_ELF_TLS */
 
 void
 _glapi_destroy_multithread(void)
 {
-   u_current_destroy();
 }
 
 void
 _glapi_check_multithread(void)
 {
-   u_current_init();
 }
 
 void
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index 1903c3054fd..d51ba0ff9ce 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -77,9 +77,6 @@ typedef void (*_glapi_nop_handler_proc)(const char *name);
 
 struct _glapi_table;
 
-
-#if defined (USE_ELF_TLS)
-
 #if DETECT_OS_WINDOWS
 extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch;
 extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context;
@@ -99,20 +96,6 @@ _GLAPI_EXPORT extern const void *_glapi_Context;
 # define GET_CURRENT_CONTEXT(C)  struct gl_context *C = (struct gl_context *) _glapi_tls_Context
 #endif
 
-#else
-
-_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
-_GLAPI_EXPORT extern void *_glapi_Context;
-
-#define GET_DISPATCH() \
-     (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
-
-#define GET_CURRENT_CONTEXT(C)  struct gl_context *C = (struct gl_context *) \
-     (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
-
-#endif /* defined (USE_ELF_TLS) */
-
-
 _GLAPI_EXPORT void
 _glapi_destroy_multithread(void);
 
diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c
index b99819afa0d..e2c4b997c6d 100644
--- a/src/mapi/glapi/glapi_entrypoint.c
+++ b/src/mapi/glapi/glapi_entrypoint.c
@@ -38,12 +38,8 @@
 
 #ifdef USE_X86_ASM
 
-#if defined( USE_ELF_TLS )
 extern       GLubyte gl_dispatch_functions_start[];
 extern       GLubyte gl_dispatch_functions_end[];
-#else
-extern const GLubyte gl_dispatch_functions_start[];
-#endif
 
 #endif /* USE_X86_ASM */
 
@@ -68,7 +64,7 @@ get_entrypoint_address(unsigned int functionOffset)
 static void
 init_glapi_relocs( void )
 {
-#if defined(USE_ELF_TLS) && !defined(GLX_X86_READONLY_TEXT)
+#if !defined(GLX_X86_READONLY_TEXT)
     extern unsigned long _x86_get_dispatch(void);
     char run_time_patch[] = {
        0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
@@ -121,12 +117,7 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset)
 {
    GLubyte * const code = (GLubyte *) entrypoint;
 
-#if defined(USE_ELF_TLS)
    *((unsigned int *)(code +  8)) = 4 * offset;
-#else
-   *((unsigned int *)(code + 11)) = 4 * offset;
-   *((unsigned int *)(code + 22)) = 4 * offset;
-#endif
 }
 
 
@@ -137,9 +128,7 @@ extern void __glapi_sparc_icache_flush(unsigned int *);
 static void
 init_glapi_relocs( void )
 {
-#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
     static const unsigned int template[] = {
-#ifdef USE_ELF_TLS
 	0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
 	0x8730e00a, /* srl %g3, 10, %g3 */
 	0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
@@ -152,58 +141,12 @@ init_glapi_relocs( void )
 #endif
 	0x81c04000, /* jmp %g1 */
 	0x01000000, /* nop  */
-#else
-#ifdef __arch64__
-	0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
-	0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
-	0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
-	0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */
-	0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */
-	0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */
-	0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
-#else
-	0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
-	0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */
-	0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
-#endif
-	0x80a06000, /*             --> cmp %g1, 0 */
-	0x02800005, /*             --> be +4*5 */
-	0x01000000, /*             -->  nop  */
-#ifdef __arch64__
-	0xc2584003, /* 64-bit      --> ldx [%g1 + %g3], %g1 */
-#else
-	0xc2004003, /* 32-bit      --> ld [%g1 + %g3], %g1 */
-#endif
-	0x81c04000, /*             --> jmp %g1 */
-	0x01000000, /*             --> nop  */
-#ifdef __arch64__
-	0x9de3bf80, /* 64-bit      --> save  %sp, -128, %sp */
-#else
-	0x9de3bfc0, /* 32-bit      --> save  %sp, -64, %sp */
-#endif
-	0xa0100003, /*             --> mov  %g3, %l0 */
-	0x40000000, /*             --> call _glapi_get_dispatch */
-	0x01000000, /*             -->  nop */
-	0x82100008, /*             --> mov %o0, %g1 */
-	0x86100010, /*             --> mov %l0, %g3 */
-	0x10bffff7, /*             --> ba -4*9 */
-	0x81e80000, /*             -->  restore  */
-#endif
     };
-#ifdef USE_ELF_TLS
     extern unsigned int __glapi_sparc_tls_stub;
     extern unsigned long __glapi_sparc_get_dispatch(void);
     unsigned int *code = &__glapi_sparc_tls_stub;
     unsigned long dispatch = __glapi_sparc_get_dispatch();
-#else
-    extern unsigned int __glapi_sparc_pthread_stub;
-    unsigned int *code = &__glapi_sparc_pthread_stub;
-    unsigned long dispatch = (unsigned long) &_glapi_Dispatch;
-    unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch;
-    int idx;
-#endif
 
-#ifdef USE_ELF_TLS
     code[0] = template[0] | (dispatch >> 10);
     code[1] = template[1];
     __glapi_sparc_icache_flush(&code[0]);
@@ -215,72 +158,20 @@ init_glapi_relocs( void )
     __glapi_sparc_icache_flush(&code[4]);
     code[6] = template[6];
     __glapi_sparc_icache_flush(&code[6]);
-#else
-#if defined(__arch64__)
-    code[0] = template[0] | (dispatch >> (32 + 10));
-    code[1] = template[1] | ((dispatch & 0xffffffff) >> 10);
-    __glapi_sparc_icache_flush(&code[0]);
-    code[2] = template[2] | ((dispatch >> 32) & 0x3ff);
-    code[3] = template[3];
-    __glapi_sparc_icache_flush(&code[2]);
-    code[4] = template[4];
-    code[5] = template[5];
-    __glapi_sparc_icache_flush(&code[4]);
-    code[6] = template[6] | (dispatch & 0x3ff);
-    idx = 7;
-#else
-    code[0] = template[0] | (dispatch >> 10);
-    code[1] = template[1];
-    __glapi_sparc_icache_flush(&code[0]);
-    code[2] = template[2] | (dispatch & 0x3ff);
-    idx = 3;
-#endif
-    code[idx + 0] = template[idx + 0];
-    __glapi_sparc_icache_flush(&code[idx - 1]);
-    code[idx + 1] = template[idx + 1];
-    code[idx + 2] = template[idx + 2];
-    __glapi_sparc_icache_flush(&code[idx + 1]);
-    code[idx + 3] = template[idx + 3];
-    code[idx + 4] = template[idx + 4];
-    __glapi_sparc_icache_flush(&code[idx + 3]);
-    code[idx + 5] = template[idx + 5];
-    code[idx + 6] = template[idx + 6];
-    __glapi_sparc_icache_flush(&code[idx + 5]);
-    code[idx + 7] = template[idx + 7];
-    code[idx + 8] = template[idx + 8] |
-	    (((call_dest - ((unsigned long) &code[idx + 8]))
-	      >> 2) & 0x3fffffff);
-    __glapi_sparc_icache_flush(&code[idx + 7]);
-    code[idx + 9] = template[idx + 9];
-    code[idx + 10] = template[idx + 10];
-    __glapi_sparc_icache_flush(&code[idx + 9]);
-    code[idx + 11] = template[idx + 11];
-    code[idx + 12] = template[idx + 12];
-    __glapi_sparc_icache_flush(&code[idx + 11]);
-    code[idx + 13] = template[idx + 13];
-    __glapi_sparc_icache_flush(&code[idx + 13]);
-#endif
-#endif
 }
 
 
 _glapi_proc
 generate_entrypoint(GLuint functionOffset)
 {
-#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
    static const unsigned int template[] = {
       0x07000000, /* sethi %hi(0), %g3 */
       0x8210000f, /* mov  %o7, %g1 */
       0x40000000, /* call */
       0x9e100001, /* mov  %g1, %o7 */
    };
-#ifdef USE_ELF_TLS
    extern unsigned int __glapi_sparc_tls_stub;
    unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
-#else
-   extern unsigned int __glapi_sparc_pthread_stub;
-   unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub;
-#endif
    unsigned int *code = (unsigned int *) u_execmem_alloc(sizeof(template));
    if (code) {
       code[0] = template[0] | (functionOffset & 0x3fffff);
@@ -293,7 +184,6 @@ generate_entrypoint(GLuint functionOffset)
       __glapi_sparc_icache_flush(&code[2]);
    }
    return (_glapi_proc) code;
-#endif
 }
 
 
@@ -310,12 +200,10 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
 
 #else /* USE_*_ASM */
 
-#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
 static void
 init_glapi_relocs( void )
 {
 }
-#endif
 
 
 _glapi_proc
@@ -340,8 +228,6 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
 void
 init_glapi_relocs_once( void )
 {
-#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
    static once_flag flag = ONCE_FLAG_INIT;
    call_once(&flag, init_glapi_relocs);
-#endif
 }
diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index ad37c8bfdf3..04d8fd0c2ce 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -62,17 +62,11 @@ get_entrypoint_address(unsigned int functionOffset);
  * Size (in bytes) of dispatch function (entrypoint).
  */
 #if defined(USE_X86_ASM)
-# if defined(USE_ELF_TLS)
-#  define DISPATCH_FUNCTION_SIZE  16
-# else
-#  define DISPATCH_FUNCTION_SIZE  32
-# endif
+#define DISPATCH_FUNCTION_SIZE  16
 #endif
 
 #if defined(USE_X64_64_ASM)
-# if defined(USE_ELF_TLS)
-#  define DISPATCH_FUNCTION_SIZE  16
-# endif
+#define DISPATCH_FUNCTION_SIZE  16
 #endif
 
 
diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index db4a12664b8..d823482f2b5 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -37,9 +37,7 @@ bridge_glapi_files += files(
   '../entry.h',
   '../entry_x86-64_tls.h',
   '../entry_x86_tls.h',
-  '../entry_x86_tsd.h',
   '../entry_ppc64le_tls.h',
-  '../entry_ppc64le_tsd.h',
   '../mapi_tmp.h',
 )
 bridge_glapi_files += glapi_mapi_tmp_h
diff --git a/src/mapi/mapi_glapi.c b/src/mapi/mapi_glapi.c
index afc466504bb..b44c64b018f 100644
--- a/src/mapi/mapi_glapi.c
+++ b/src/mapi/mapi_glapi.c
@@ -38,22 +38,18 @@
  * u_current.c.
  */
 
-#ifdef USE_ELF_TLS
 /* not used, but defined for compatibility */
 const struct _glapi_table *_glapi_Dispatch;
 const void *_glapi_Context;
-#endif /* USE_ELF_TLS */
 
 void
 _glapi_destroy_multithread(void)
 {
-   u_current_destroy();
 }
 
 void
 _glapi_check_multithread(void)
 {
-   u_current_init();
 }
 
 void
diff --git a/src/mapi/u_current.c b/src/mapi/u_current.c
index a2c43962e94..39db11b54df 100644
--- a/src/mapi/u_current.c
+++ b/src/mapi/u_current.c
@@ -85,11 +85,6 @@ extern void (*__glapi_noop_table[])(void);
  * static dispatch functions access these variables via \c _glapi_get_dispatch
  * and \c _glapi_get_context.
  *
- * There is a race condition in setting \c _glapi_Dispatch to \c NULL.  It is
- * possible for the original thread to be setting it at the same instant a new
- * thread, perhaps running on a different processor, is clearing it.  Because
- * of that, \c ThreadSafe, which can only ever be changed to \c GL_TRUE, is
- * used to determine whether or not the application is multithreaded.
  *
  * In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are
  * hardcoded to \c NULL.  Instead the TLS variables \c _glapi_tls_Dispatch and
@@ -98,91 +93,14 @@ extern void (*__glapi_noop_table[])(void);
  * between TLS enabled loaders and non-TLS DRI drivers.
  */
 /*@{*/
-#if defined(USE_ELF_TLS)
 
 __THREAD_INITIAL_EXEC struct _glapi_table *u_current_table
     = (struct _glapi_table *) table_noop_array;
 
 __THREAD_INITIAL_EXEC void *u_current_context;
 
-#else
-
-struct _glapi_table *u_current_table =
-   (struct _glapi_table *) table_noop_array;
-void *u_current_context;
-
-tss_t u_current_table_tsd;
-static tss_t u_current_context_tsd;
-static int ThreadSafe;
-
-#endif /* defined(USE_ELF_TLS) */
 /*@}*/
 
-
-void
-u_current_destroy(void)
-{
-#if !defined(USE_ELF_TLS)
-   tss_delete(u_current_table_tsd);
-   tss_delete(u_current_context_tsd);
-#endif
-}
-
-
-#if !defined(USE_ELF_TLS)
-
-static void
-u_current_init_tsd(void)
-{
-   tss_create(&u_current_table_tsd, NULL);
-   tss_create(&u_current_context_tsd, NULL);
-}
-
-/**
- * Mutex for multithread check.
- */
-static mtx_t ThreadCheckMutex = _MTX_INITIALIZER_NP;
-
-static thread_id knownID;
-
-/**
- * We should call this periodically from a function such as glXMakeCurrent
- * in order to test if multiple threads are being used.
- */
-void
-u_current_init(void)
-{
-   static int firstCall = 1;
-
-   if (ThreadSafe)
-      return;
-
-   mtx_lock(&ThreadCheckMutex);
-   if (firstCall) {
-      u_current_init_tsd();
-
-      knownID = util_get_thread_id();
-      firstCall = 0;
-   }
-   else if (!util_thread_id_equal(knownID, util_get_thread_id())) {
-      ThreadSafe = 1;
-      u_current_set_table(NULL);
-      u_current_set_context(NULL);
-   }
-   mtx_unlock(&ThreadCheckMutex);
-}
-
-#else
-
-void
-u_current_init(void)
-{
-}
-
-#endif
-
-
-
 /**
  * Set the current context pointer for this thread.
  * The context pointer is an opaque type which should be cast to
@@ -191,14 +109,7 @@ u_current_init(void)
 void
 u_current_set_context(const void *ptr)
 {
-   u_current_init();
-
-#if defined(USE_ELF_TLS)
    u_current_context = (void *) ptr;
-#else
-   tss_set(u_current_context_tsd, (void *) ptr);
-   u_current_context = (ThreadSafe) ? NULL : (void *) ptr;
-#endif
 }
 
 /**
@@ -209,16 +120,7 @@ u_current_set_context(const void *ptr)
 void *
 u_current_get_context_internal(void)
 {
-#if defined(USE_ELF_TLS)
    return u_current_context;
-#else
-   if (ThreadSafe)
-      return tss_get(u_current_context_tsd);
-   else if (!util_thread_id_equal(knownID, util_get_thread_id()))
-      return NULL;
-   else
-      return u_current_context;
-#endif
 }
 
 /**
@@ -229,19 +131,12 @@ u_current_get_context_internal(void)
 void
 u_current_set_table(const struct _glapi_table *tbl)
 {
-   u_current_init();
-
    stub_init_once();
 
    if (!tbl)
       tbl = (const struct _glapi_table *) table_noop_array;
 
-#if defined(USE_ELF_TLS)
    u_current_table = (struct _glapi_table *) tbl;
-#else
-   tss_set(u_current_table_tsd, (void *) tbl);
-   u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
-#endif
 }
 
 /**
@@ -250,14 +145,5 @@ u_current_set_table(const struct _glapi_table *tbl)
 struct _glapi_table *
 u_current_get_table_internal(void)
 {
-#if defined(USE_ELF_TLS)
    return u_current_table;
-#else
-   if (ThreadSafe)
-      return (struct _glapi_table *) tss_get(u_current_table_tsd);
-   else if (!util_thread_id_equal(knownID, util_get_thread_id()))
-      return (struct _glapi_table *) table_noop_array;
-   else
-      return (struct _glapi_table *) u_current_table;
-#endif
 }
diff --git a/src/mapi/u_current.h b/src/mapi/u_current.h
index a21a0779ae0..b5a4310044b 100644
--- a/src/mapi/u_current.h
+++ b/src/mapi/u_current.h
@@ -9,13 +9,8 @@
 
 #include "glapi/glapi.h"
 
-#ifdef USE_ELF_TLS
 #define u_current_table _glapi_tls_Dispatch
 #define u_current_context _glapi_tls_Context
-#else
-#define u_current_table _glapi_Dispatch
-#define u_current_context _glapi_Context
-#endif
 
 #define u_current_get_table_internal _glapi_get_dispatch
 #define u_current_get_context_internal _glapi_get_context
@@ -26,26 +21,11 @@
 
 struct _glapi_table;
 
-#ifdef USE_ELF_TLS
-
 extern __THREAD_INITIAL_EXEC struct _glapi_table *u_current_table;
 extern __THREAD_INITIAL_EXEC void *u_current_context;
 
-#else /* USE_ELF_TLS */
-
-extern struct _glapi_table *u_current_table;
-extern void *u_current_context;
-
-#endif /* USE_ELF_TLS */
-
 #endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
 
-void
-u_current_init(void);
-
-void
-u_current_destroy(void);
-
 void
 u_current_set_table(const struct _glapi_table *tbl);
 



More information about the mesa-commit mailing list