Browse Source

linuxthreads: use __UCLIBC_HAS_TLS__ consistently

replace USE_TLS, HAVE___THREAD and USE___THREAD with __UCLIBC_HAS_TLS__

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Peter S. Mazinger 14 years ago
parent
commit
a3516fe1a4

+ 4 - 4
libpthread/linuxthreads/attr.c

@@ -361,7 +361,7 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
   attr->__scope = PTHREAD_SCOPE_SYSTEM;
   attr->__scope = PTHREAD_SCOPE_SYSTEM;
 
 
 #ifdef _STACK_GROWS_DOWN
 #ifdef _STACK_GROWS_DOWN
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
   attr->__stacksize = descr->p_stackaddr - (char *)descr->p_guardaddr
   attr->__stacksize = descr->p_stackaddr - (char *)descr->p_guardaddr
 		      - descr->p_guardsize;
 		      - descr->p_guardsize;
 # else
 # else
@@ -369,7 +369,7 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
 		      - descr->p_guardsize;
 		      - descr->p_guardsize;
 # endif
 # endif
 #else
 #else
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
   attr->__stacksize = (char *)descr->p_guardaddr - descr->p_stackaddr;
   attr->__stacksize = (char *)descr->p_guardaddr - descr->p_stackaddr;
 # else
 # else
   attr->__stacksize = (char *)descr->p_guardaddr - (char *)descr;
   attr->__stacksize = (char *)descr->p_guardaddr - (char *)descr;
@@ -385,7 +385,7 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
      otherwise the range of the stack area cannot be computed.  */
      otherwise the range of the stack area cannot be computed.  */
   attr->__stacksize += attr->__guardsize;
   attr->__stacksize += attr->__guardsize;
 #endif
 #endif
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   attr->__stackaddr = descr->p_stackaddr;
   attr->__stackaddr = descr->p_stackaddr;
 #else
 #else
 # ifndef _STACK_GROWS_UP
 # ifndef _STACK_GROWS_UP
@@ -395,7 +395,7 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
 # endif
 # endif
 #endif
 #endif
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   if (attr->__stackaddr == NULL)
   if (attr->__stackaddr == NULL)
 #else
 #else
   if (descr == &__pthread_initial_thread)
   if (descr == &__pthread_initial_thread)

+ 4 - 4
libpthread/linuxthreads/descr.h

@@ -23,7 +23,7 @@
 #include <stdint.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <hp-timing.h>
 #include <hp-timing.h>
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 #include <tls.h>
 #include <tls.h>
 #endif
 #endif
 #include "uClibc-glue.h"
 #include "uClibc-glue.h"
@@ -112,7 +112,7 @@ union dtv;
 
 
 struct _pthread_descr_struct
 struct _pthread_descr_struct
 {
 {
-#if !defined USE_TLS || !TLS_DTV_AT_TP || INCLUDE_TLS_PADDING
+#if !defined __UCLIBC_HAS_TLS__ || !TLS_DTV_AT_TP || INCLUDE_TLS_PADDING
   /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads.  */
   /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads.  */
   union
   union
   {
   {
@@ -157,7 +157,7 @@ struct _pthread_descr_struct
   char p_sigwaiting;            /* true if a sigwait() is in progress */
   char p_sigwaiting;            /* true if a sigwait() is in progress */
   struct pthread_start_args p_start_args; /* arguments for thread creation */
   struct pthread_start_args p_start_args; /* arguments for thread creation */
   void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE]; /* thread-specific data */
   void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE]; /* thread-specific data */
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   void * p_libc_specific[_LIBC_TSD_KEY_N]; /* thread-specific data for libc */
   void * p_libc_specific[_LIBC_TSD_KEY_N]; /* thread-specific data for libc */
   int * p_errnop;               /* pointer to used errno variable */
   int * p_errnop;               /* pointer to used errno variable */
   int p_errno;                  /* error returned by last system call */
   int p_errno;                  /* error returned by last system call */
@@ -185,7 +185,7 @@ struct _pthread_descr_struct
 #if HP_TIMING_AVAIL
 #if HP_TIMING_AVAIL
   hp_timing_t p_cpuclock_offset; /* Initial CPU clock for thread.  */
   hp_timing_t p_cpuclock_offset; /* Initial CPU clock for thread.  */
 #endif
 #endif
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   char *p_stackaddr;		/* Stack address.  */
   char *p_stackaddr;		/* Stack address.  */
 #endif
 #endif
   size_t p_alloca_cutoff;	/* Maximum size which should be allocated
   size_t p_alloca_cutoff;	/* Maximum size which should be allocated

+ 1 - 1
libpthread/linuxthreads/errno.c

@@ -20,7 +20,7 @@
 #include "pthread.h"
 #include "pthread.h"
 #include "internals.h"
 #include "internals.h"
 
 
-#if !USE_TLS || !HAVE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
 /* The definition in libc is sufficient if we use TLS.  */
 /* The definition in libc is sufficient if we use TLS.  */
 int *
 int *
 __errno_location (void)
 __errno_location (void)

+ 2 - 2
libpthread/linuxthreads/libc_pthread_init.c

@@ -20,7 +20,7 @@
 #include <locale.h>
 #include <locale.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 #include <tls.h>
 #include <tls.h>
 #endif
 #endif
 #include "internals.h"
 #include "internals.h"
@@ -42,7 +42,7 @@ __libc_pthread_init (functions)
 	  sizeof (__libc_pthread_functions));
 	  sizeof (__libc_pthread_functions));
 #endif
 #endif
 
 
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   /* Initialize thread-locale current locale to point to the global one.
   /* Initialize thread-locale current locale to point to the global one.
      With __thread support, the variable's initializer takes care of this.  */
      With __thread support, the variable's initializer takes care of this.  */
   __uselocale (LC_GLOBAL_LOCALE);
   __uselocale (LC_GLOBAL_LOCALE);

+ 22 - 22
libpthread/linuxthreads/manager.c

@@ -126,7 +126,7 @@ __pthread_manager(void *arg)
 #ifdef INIT_THREAD_SELF
 #ifdef INIT_THREAD_SELF
   INIT_THREAD_SELF(self, 1);
   INIT_THREAD_SELF(self, 1);
 #endif
 #endif
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   /* Set the error variable.  */
   /* Set the error variable.  */
   self->p_errnop = &self->p_errno;
   self->p_errnop = &self->p_errno;
   self->p_h_errnop = &self->p_h_errno;
   self->p_h_errnop = &self->p_h_errno;
@@ -289,7 +289,7 @@ pthread_start_thread(void *arg)
       __sched_setscheduler(THREAD_GETMEM(self, p_pid),
       __sched_setscheduler(THREAD_GETMEM(self, p_pid),
                            SCHED_OTHER, &default_params);
                            SCHED_OTHER, &default_params);
     }
     }
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   /* Initialize thread-locale current locale to point to the global one.
   /* Initialize thread-locale current locale to point to the global one.
      With __thread support, the variable's initializer takes care of this.  */
      With __thread support, the variable's initializer takes care of this.  */
   __uselocale (LC_GLOBAL_LOCALE);
   __uselocale (LC_GLOBAL_LOCALE);
@@ -333,7 +333,7 @@ pthread_start_thread_event(void *arg)
   pthread_start_thread (arg);
   pthread_start_thread (arg);
 }
 }
 
 
-#if defined USE_TLS && !FLOATING_STACKS
+#if defined __UCLIBC_HAS_TLS__ && !FLOATING_STACKS
 # error "TLS can only work with floating stacks"
 # error "TLS can only work with floating stacks"
 #endif
 #endif
 
 
@@ -351,7 +351,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
   char * guardaddr;
   char * guardaddr;
   size_t stacksize, guardsize;
   size_t stacksize, guardsize;
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   /* TLS cannot work with fixed thread descriptor addresses.  */
   /* TLS cannot work with fixed thread descriptor addresses.  */
   assert (default_new_thread == NULL);
   assert (default_new_thread == NULL);
 #endif
 #endif
@@ -360,7 +360,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
     {
     {
 #ifdef _STACK_GROWS_UP
 #ifdef _STACK_GROWS_UP
       /* The user provided a stack. */
       /* The user provided a stack. */
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
       /* This value is not needed.  */
       /* This value is not needed.  */
       new_thread = (pthread_descr) attr->__stackaddr;
       new_thread = (pthread_descr) attr->__stackaddr;
       new_thread_bottom = (char *) new_thread;
       new_thread_bottom = (char *) new_thread;
@@ -381,7 +381,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
 	 addresses, stackaddr would be the lowest address in the stack
 	 addresses, stackaddr would be the lowest address in the stack
 	 segment, so that it is consistently close to the initial sp
 	 segment, so that it is consistently close to the initial sp
 	 value. */
 	 value. */
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
       new_thread = (pthread_descr) attr->__stackaddr;
       new_thread = (pthread_descr) attr->__stackaddr;
 # else
 # else
       new_thread =
       new_thread =
@@ -394,7 +394,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
 #ifndef THREAD_SELF
 #ifndef THREAD_SELF
       __pthread_nonstandard_stacks = 1;
       __pthread_nonstandard_stacks = 1;
 #endif
 #endif
-#ifndef USE_TLS
+#ifndef __UCLIBC_HAS_TLS__
       /* Clear the thread data structure.  */
       /* Clear the thread data structure.  */
       memset (new_thread, '\0', sizeof (*new_thread));
       memset (new_thread, '\0', sizeof (*new_thread));
 #endif
 #endif
@@ -438,7 +438,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
 	mprotect (guardaddr, guardsize, PROT_NONE);
 	mprotect (guardaddr, guardsize, PROT_NONE);
 
 
       new_thread_bottom = (char *) map_addr;
       new_thread_bottom = (char *) map_addr;
-#  ifdef USE_TLS
+#  ifdef __UCLIBC_HAS_TLS__
       new_thread = ((pthread_descr) (new_thread_bottom + stacksize
       new_thread = ((pthread_descr) (new_thread_bottom + stacksize
 				     + guardsize));
 				     + guardsize));
 #  else
 #  else
@@ -451,7 +451,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
 	mprotect (guardaddr, guardsize, PROT_NONE);
 	mprotect (guardaddr, guardsize, PROT_NONE);
 
 
       new_thread_bottom = (char *) map_addr + guardsize;
       new_thread_bottom = (char *) map_addr + guardsize;
-#  ifdef USE_TLS
+#  ifdef __UCLIBC_HAS_TLS__
       new_thread = ((pthread_descr) (new_thread_bottom + stacksize));
       new_thread = ((pthread_descr) (new_thread_bottom + stacksize));
 #  else
 #  else
       new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1;
       new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1;
@@ -462,7 +462,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
 	mprotect (guardaddr, guardsize, PROT_NONE);
 	mprotect (guardaddr, guardsize, PROT_NONE);
 
 
       new_thread = (pthread_descr) map_addr;
       new_thread = (pthread_descr) map_addr;
-#  ifdef USE_TLS
+#  ifdef __UCLIBC_HAS_TLS__
       new_thread_bottom = (char *) new_thread;
       new_thread_bottom = (char *) new_thread;
 #  else
 #  else
       new_thread_bottom = (char *) (new_thread + 1);
       new_thread_bottom = (char *) (new_thread + 1);
@@ -597,7 +597,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   int pagesize = __getpagesize();
   int pagesize = __getpagesize();
   int saved_errno = 0;
   int saved_errno = 0;
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   new_thread = _dl_allocate_tls (NULL);
   new_thread = _dl_allocate_tls (NULL);
   if (new_thread == NULL)
   if (new_thread == NULL)
     return EAGAIN;
     return EAGAIN;
@@ -621,7 +621,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
     {
     {
       if (sseg >= PTHREAD_THREADS_MAX)
       if (sseg >= PTHREAD_THREADS_MAX)
 	{
 	{
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 # if defined(TLS_DTV_AT_TP)
 # if defined(TLS_DTV_AT_TP)
 	  new_thread = (pthread_descr) ((char *) new_thread + TLS_PRE_TCB_SIZE);
 	  new_thread = (pthread_descr) ((char *) new_thread + TLS_PRE_TCB_SIZE);
 # endif
 # endif
@@ -635,7 +635,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
 				 pagesize, &stack_addr, &new_thread_bottom,
 				 pagesize, &stack_addr, &new_thread_bottom,
                                  &guardaddr, &guardsize, &stksize) == 0)
                                  &guardaddr, &guardsize, &stksize) == 0)
 	{
 	{
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 	  new_thread->p_stackaddr = stack_addr;
 	  new_thread->p_stackaddr = stack_addr;
 #else
 #else
 	  new_thread = (pthread_descr) stack_addr;
 	  new_thread = (pthread_descr) stack_addr;
@@ -657,18 +657,18 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   new_thread_id = sseg + pthread_threads_counter;
   new_thread_id = sseg + pthread_threads_counter;
   /* Initialize the thread descriptor.  Elements which have to be
   /* Initialize the thread descriptor.  Elements which have to be
      initialized to zero already have this value.  */
      initialized to zero already have this value.  */
-#if !defined USE_TLS || !TLS_DTV_AT_TP
+#if !defined __UCLIBC_HAS_TLS__ || !TLS_DTV_AT_TP
   new_thread->p_header.data.tcb = new_thread;
   new_thread->p_header.data.tcb = new_thread;
   new_thread->p_header.data.self = new_thread;
   new_thread->p_header.data.self = new_thread;
 #endif
 #endif
-#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
+#if TLS_MULTIPLE_THREADS_IN_TCB || !defined __UCLIBC_HAS_TLS__ || !TLS_DTV_AT_TP
   new_thread->p_multiple_threads = 1;
   new_thread->p_multiple_threads = 1;
 #endif
 #endif
   new_thread->p_tid = new_thread_id;
   new_thread->p_tid = new_thread_id;
   new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
   new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
   new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
   new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
   new_thread->p_canceltype = PTHREAD_CANCEL_DEFERRED;
   new_thread->p_canceltype = PTHREAD_CANCEL_DEFERRED;
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   new_thread->p_errnop = &new_thread->p_errno;
   new_thread->p_errnop = &new_thread->p_errno;
   new_thread->p_h_errnop = &new_thread->p_h_errno;
   new_thread->p_h_errnop = &new_thread->p_h_errno;
   new_thread->p_resp = &new_thread->p_res;
   new_thread->p_resp = &new_thread->p_res;
@@ -807,7 +807,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
 	munmap((caddr_t)new_thread_bottom,
 	munmap((caddr_t)new_thread_bottom,
 	       2 * stacksize + new_thread->p_guardsize);
 	       2 * stacksize + new_thread->p_guardsize);
 #elif defined _STACK_GROWS_UP
 #elif defined _STACK_GROWS_UP
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
 	size_t stacksize = guardaddr - stack_addr;
 	size_t stacksize = guardaddr - stack_addr;
 	munmap(stack_addr, stacksize + guardsize);
 	munmap(stack_addr, stacksize + guardsize);
 # else
 # else
@@ -815,7 +815,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
 	munmap(new_thread, stacksize + guardsize);
 	munmap(new_thread, stacksize + guardsize);
 # endif
 # endif
 #else
 #else
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
 	size_t stacksize = stack_addr - new_thread_bottom;
 	size_t stacksize = stack_addr - new_thread_bottom;
 # else
 # else
 	size_t stacksize = (char *)(new_thread+1) - new_thread_bottom;
 	size_t stacksize = (char *)(new_thread+1) - new_thread_bottom;
@@ -823,7 +823,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
 	munmap(new_thread_bottom - guardsize, guardsize + stacksize);
 	munmap(new_thread_bottom - guardsize, guardsize + stacksize);
 #endif
 #endif
       }
       }
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 # if defined(TLS_DTV_AT_TP)
 # if defined(TLS_DTV_AT_TP)
     new_thread = (pthread_descr) ((char *) new_thread + TLS_PRE_TCB_SIZE);
     new_thread = (pthread_descr) ((char *) new_thread + TLS_PRE_TCB_SIZE);
 # endif
 # endif
@@ -890,7 +890,7 @@ static void pthread_free(pthread_descr th)
       /* Free the stack and thread descriptor area */
       /* Free the stack and thread descriptor area */
       char *guardaddr = th->p_guardaddr;
       char *guardaddr = th->p_guardaddr;
 #ifdef _STACK_GROWS_UP
 #ifdef _STACK_GROWS_UP
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
       size_t stacksize = guardaddr - th->p_stackaddr;
       size_t stacksize = guardaddr - th->p_stackaddr;
       guardaddr = th->p_stackaddr;
       guardaddr = th->p_stackaddr;
 # else
 # else
@@ -900,7 +900,7 @@ static void pthread_free(pthread_descr th)
 #else
 #else
       /* Guardaddr is always set, even if guardsize is 0.  This allows
       /* Guardaddr is always set, even if guardsize is 0.  This allows
 	 us to compute everything else.  */
 	 us to compute everything else.  */
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
       size_t stacksize = th->p_stackaddr - guardaddr - guardsize;
       size_t stacksize = th->p_stackaddr - guardaddr - guardsize;
 # else
 # else
       size_t stacksize = (char *)(th+1) - guardaddr - guardsize;
       size_t stacksize = (char *)(th+1) - guardaddr - guardsize;
@@ -916,7 +916,7 @@ static void pthread_free(pthread_descr th)
 
 
     }
     }
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 # if defined(TLS_DTV_AT_TP)
 # if defined(TLS_DTV_AT_TP)
   th = (pthread_descr) ((char *) th + TLS_PRE_TCB_SIZE);
   th = (pthread_descr) ((char *) th + TLS_PRE_TCB_SIZE);
 # endif
 # endif

+ 33 - 37
libpthread/linuxthreads/pthread.c

@@ -37,7 +37,7 @@
 # error "This must not happen"
 # error "This must not happen"
 #endif
 #endif
 
 
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
 /* These variables are used by the setup code.  */
 /* These variables are used by the setup code.  */
 extern int _errno;
 extern int _errno;
 extern int _h_errno;
 extern int _h_errno;
@@ -50,7 +50,7 @@ extern struct __res_state *__resp;
 # endif
 # endif
 #endif
 #endif
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 
 
 /* We need only a few variables.  */
 /* We need only a few variables.  */
 #define manager_thread __pthread_manager_threadp
 #define manager_thread __pthread_manager_threadp
@@ -67,7 +67,7 @@ struct _pthread_descr_struct __pthread_initial_thread = {
   .p_tid = PTHREAD_THREADS_MAX,
   .p_tid = PTHREAD_THREADS_MAX,
   .p_lock = &__pthread_handles[0].h_lock,
   .p_lock = &__pthread_handles[0].h_lock,
   .p_start_args = PTHREAD_START_ARGS_INITIALIZER(NULL),
   .p_start_args = PTHREAD_START_ARGS_INITIALIZER(NULL),
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   .p_errnop = &_errno,
   .p_errnop = &_errno,
   .p_h_errnop = &_h_errno,
   .p_h_errnop = &_h_errno,
 #endif
 #endif
@@ -86,7 +86,7 @@ struct _pthread_descr_struct __pthread_manager_thread = {
   .p_header.data.multiple_threads = 1,
   .p_header.data.multiple_threads = 1,
   .p_lock = &__pthread_handles[1].h_lock,
   .p_lock = &__pthread_handles[1].h_lock,
   .p_start_args = PTHREAD_START_ARGS_INITIALIZER(__pthread_manager),
   .p_start_args = PTHREAD_START_ARGS_INITIALIZER(__pthread_manager),
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   .p_errnop = &__pthread_manager_thread.p_errno,
   .p_errnop = &__pthread_manager_thread.p_errno,
 #endif
 #endif
   .p_nr = 1,
   .p_nr = 1,
@@ -98,7 +98,7 @@ struct _pthread_descr_struct __pthread_manager_thread = {
 /* Pointer to the main thread (the father of the thread manager thread) */
 /* Pointer to the main thread (the father of the thread manager thread) */
 /* Originally, this is the initial thread, but this changes after fork() */
 /* Originally, this is the initial thread, but this changes after fork() */
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 pthread_descr __pthread_main_thread;
 pthread_descr __pthread_main_thread;
 #else
 #else
 pthread_descr __pthread_main_thread = &__pthread_initial_thread;
 pthread_descr __pthread_main_thread = &__pthread_initial_thread;
@@ -224,13 +224,13 @@ extern void *__dso_handle __attribute__ ((weak));
 #endif
 #endif
 
 
 
 
-#if defined USE_TLS && !defined SHARED
+#if defined __UCLIBC_HAS_TLS__ && !defined SHARED
 extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
 extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
 #endif
 #endif
 
 
 struct pthread_functions __pthread_functions =
 struct pthread_functions __pthread_functions =
   {
   {
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
     .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
     .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
     .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
     .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
     .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
     .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
@@ -292,7 +292,7 @@ static int *__libc_multiple_threads_ptr;
 void
 void
 __pthread_initialize_minimal(void)
 __pthread_initialize_minimal(void)
 {
 {
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   pthread_descr self;
   pthread_descr self;
 
 
   /* First of all init __pthread_handles[0] and [1] if needed.  */
   /* First of all init __pthread_handles[0] and [1] if needed.  */
@@ -304,7 +304,7 @@ __pthread_initialize_minimal(void)
   /* Unlike in the dynamically linked case the dynamic linker has not
   /* Unlike in the dynamically linked case the dynamic linker has not
      taken care of initializing the TLS data structures.  */
      taken care of initializing the TLS data structures.  */
   __libc_setup_tls (TLS_TCB_SIZE, TLS_TCB_ALIGN);
   __libc_setup_tls (TLS_TCB_SIZE, TLS_TCB_ALIGN);
-# elif !USE___THREAD
+# elif !defined __UCLIBC_HAS_TLS__
   if (__builtin_expect (GL(dl_tls_dtv_slotinfo_list) == NULL, 0))
   if (__builtin_expect (GL(dl_tls_dtv_slotinfo_list) == NULL, 0))
     {
     {
       tcbhead_t *tcbp;
       tcbhead_t *tcbp;
@@ -360,7 +360,7 @@ cannot allocate TLS data structures for initial thread\n";
   self->p_nextlive = self->p_prevlive = self;
   self->p_nextlive = self->p_prevlive = self;
   self->p_tid = PTHREAD_THREADS_MAX;
   self->p_tid = PTHREAD_THREADS_MAX;
   self->p_lock = &__pthread_handles[0].h_lock;
   self->p_lock = &__pthread_handles[0].h_lock;
-# ifndef HAVE___THREAD
+# ifndef __UCLIBC_HAS_TLS__
   self->p_errnop = &_errno;
   self->p_errnop = &_errno;
   self->p_h_errnop = &_h_errno;
   self->p_h_errnop = &_h_errno;
 # endif
 # endif
@@ -377,7 +377,7 @@ cannot allocate TLS data structures for initial thread\n";
   /* And fill in the pointer the the thread __pthread_handles array.  */
   /* And fill in the pointer the the thread __pthread_handles array.  */
   __pthread_handles[0].h_descr = self;
   __pthread_handles[0].h_descr = self;
 
 
-#else  /* USE_TLS */
+#else  /* __UCLIBC_HAS_TLS__ */
 
 
   /* First of all init __pthread_handles[0] and [1].  */
   /* First of all init __pthread_handles[0] and [1].  */
 # if __LT_SPINLOCK_INIT != 0
 # if __LT_SPINLOCK_INIT != 0
@@ -395,7 +395,7 @@ cannot allocate TLS data structures for initial thread\n";
 #endif
 #endif
 
 
 #if HP_TIMING_AVAIL
 #if HP_TIMING_AVAIL
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
   self->p_cpuclock_offset = GL(dl_cpuclock_offset);
   self->p_cpuclock_offset = GL(dl_cpuclock_offset);
 # else
 # else
   __pthread_initial_thread.p_cpuclock_offset = GL(dl_cpuclock_offset);
   __pthread_initial_thread.p_cpuclock_offset = GL(dl_cpuclock_offset);
@@ -439,7 +439,7 @@ __pthread_init_max_stacksize(void)
   __pthread_max_stacksize = max_stack;
   __pthread_max_stacksize = max_stack;
   if (max_stack / 4 < __MAX_ALLOCA_CUTOFF)
   if (max_stack / 4 < __MAX_ALLOCA_CUTOFF)
     {
     {
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
       pthread_descr self = THREAD_SELF;
       pthread_descr self = THREAD_SELF;
       self->p_alloca_cutoff = max_stack / 4;
       self->p_alloca_cutoff = max_stack / 4;
 #else
 #else
@@ -448,10 +448,8 @@ __pthread_init_max_stacksize(void)
     }
     }
 }
 }
 
 
-/* psm: we do not have any ld.so support yet
+#if defined SHARED && defined __UCLIBC_HAS_TLS__
- *	 remove the USE_TLS guard if nptl is added */
+# ifdef __UCLIBC_HAS_TLS__
-#if defined SHARED && defined USE_TLS
-# if USE___THREAD
 /* When using __thread for this, we do it in libc so as not
 /* When using __thread for this, we do it in libc so as not
    to give libpthread its own TLS segment just for this.  */
    to give libpthread its own TLS segment just for this.  */
 extern void **__libc_dl_error_tsd (void) __attribute__ ((const));
 extern void **__libc_dl_error_tsd (void) __attribute__ ((const));
@@ -464,7 +462,7 @@ __libc_dl_error_tsd (void)
 # endif
 # endif
 #endif
 #endif
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 static __inline__ void __attribute__((always_inline))
 static __inline__ void __attribute__((always_inline))
 init_one_static_tls (pthread_descr descr, struct link_map *map)
 init_one_static_tls (pthread_descr descr, struct link_map *map)
 {
 {
@@ -533,10 +531,10 @@ static void pthread_initialize(void)
     (char *)(((long)CURRENT_STACK_FRAME - 2 * STACK_SIZE) & ~(STACK_SIZE - 1));
     (char *)(((long)CURRENT_STACK_FRAME - 2 * STACK_SIZE) & ~(STACK_SIZE - 1));
 # endif
 # endif
 #endif
 #endif
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   /* Update the descriptor for the initial thread. */
   /* Update the descriptor for the initial thread. */
   THREAD_SETMEM (((pthread_descr) NULL), p_pid, __getpid());
   THREAD_SETMEM (((pthread_descr) NULL), p_pid, __getpid());
-# if !defined HAVE___THREAD && defined __UCLIBC_HAS_RESOLVER_SUPPORT__
+# if defined __UCLIBC_HAS_RESOLVER_SUPPORT__
   /* Likewise for the resolver state _res.  */
   /* Likewise for the resolver state _res.  */
   THREAD_SETMEM (((pthread_descr) NULL), p_resp, __resp);
   THREAD_SETMEM (((pthread_descr) NULL), p_resp, __resp);
 # endif
 # endif
@@ -587,9 +585,7 @@ static void pthread_initialize(void)
   /* How many processors.  */
   /* How many processors.  */
   __pthread_smp_kernel = is_smp_system ();
   __pthread_smp_kernel = is_smp_system ();
 
 
-/* psm: we do not have any ld.so support yet
+#if defined SHARED && defined __UCLIBC_HAS_TLS__
- *	 remove the USE_TLS guard if nptl is added */
-#if defined SHARED && defined USE_TLS
   /* Transfer the old value from the dynamic linker's internal location.  */
   /* Transfer the old value from the dynamic linker's internal location.  */
   *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
   *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
   GL(dl_error_catch_tsd) = &__libc_dl_error_tsd;
   GL(dl_error_catch_tsd) = &__libc_dl_error_tsd;
@@ -604,7 +600,7 @@ static void pthread_initialize(void)
     __pthread_mutex_lock (&GL(dl_load_lock).mutex);
     __pthread_mutex_lock (&GL(dl_load_lock).mutex);
 #endif
 #endif
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   GL(dl_init_static_tls) = &__pthread_init_static_tls;
   GL(dl_init_static_tls) = &__pthread_init_static_tls;
 #endif
 #endif
 
 
@@ -632,12 +628,12 @@ int __pthread_initialize_manager(void)
   struct pthread_request request;
   struct pthread_request request;
   int report_events;
   int report_events;
   pthread_descr mgr;
   pthread_descr mgr;
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   tcbhead_t *tcbp;
   tcbhead_t *tcbp;
 #endif
 #endif
 
 
   __pthread_multiple_threads = 1;
   __pthread_multiple_threads = 1;
-#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
+#if TLS_MULTIPLE_THREADS_IN_TCB || !defined __UCLIBC_HAS_TLS__ || !TLS_DTV_AT_TP
   __pthread_main_thread->p_multiple_threads = 1;
   __pthread_main_thread->p_multiple_threads = 1;
 #endif
 #endif
   *__libc_multiple_threads_ptr = 1;
   *__libc_multiple_threads_ptr = 1;
@@ -664,7 +660,7 @@ int __pthread_initialize_manager(void)
     return -1;
     return -1;
   }
   }
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   /* Allocate memory for the thread descriptor and the dtv.  */
   /* Allocate memory for the thread descriptor and the dtv.  */
   tcbp = _dl_allocate_tls (NULL);
   tcbp = _dl_allocate_tls (NULL);
   if (tcbp == NULL) {
   if (tcbp == NULL) {
@@ -684,7 +680,7 @@ int __pthread_initialize_manager(void)
   __pthread_handles[1].h_descr = manager_thread = mgr;
   __pthread_handles[1].h_descr = manager_thread = mgr;
 
 
   /* Initialize the descriptor.  */
   /* Initialize the descriptor.  */
-#if !defined USE_TLS || !TLS_DTV_AT_TP
+#if !defined __UCLIBC_HAS_TLS__ || !TLS_DTV_AT_TP
   mgr->p_header.data.tcb = tcbp;
   mgr->p_header.data.tcb = tcbp;
   mgr->p_header.data.self = mgr;
   mgr->p_header.data.self = mgr;
   mgr->p_header.data.multiple_threads = 1;
   mgr->p_header.data.multiple_threads = 1;
@@ -692,7 +688,7 @@ int __pthread_initialize_manager(void)
   mgr->p_multiple_threads = 1;
   mgr->p_multiple_threads = 1;
 #endif
 #endif
   mgr->p_lock = &__pthread_handles[1].h_lock;
   mgr->p_lock = &__pthread_handles[1].h_lock;
-# ifndef HAVE___THREAD
+# ifndef __UCLIBC_HAS_TLS__
   mgr->p_errnop = &mgr->p_errno;
   mgr->p_errnop = &mgr->p_errno;
 # endif
 # endif
   mgr->p_start_args = (struct pthread_start_args) PTHREAD_START_ARGS_INITIALIZER(__pthread_manager);
   mgr->p_start_args = (struct pthread_start_args) PTHREAD_START_ARGS_INITIALIZER(__pthread_manager);
@@ -710,7 +706,7 @@ int __pthread_initialize_manager(void)
 
 
   /* Start the thread manager */
   /* Start the thread manager */
   pid = 0;
   pid = 0;
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   if (__linuxthreads_initial_report_events != 0)
   if (__linuxthreads_initial_report_events != 0)
     THREAD_SETMEM (((pthread_descr) NULL), p_report_events,
     THREAD_SETMEM (((pthread_descr) NULL), p_report_events,
 		   __linuxthreads_initial_report_events);
 		   __linuxthreads_initial_report_events);
@@ -729,7 +725,7 @@ int __pthread_initialize_manager(void)
       uint32_t mask = __td_eventmask (TD_CREATE);
       uint32_t mask = __td_eventmask (TD_CREATE);
       uint32_t event_bits;
       uint32_t event_bits;
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
       event_bits = THREAD_GETMEM_NC (((pthread_descr) NULL),
       event_bits = THREAD_GETMEM_NC (((pthread_descr) NULL),
 				     p_eventbuf.eventmask.event_bits[idx]);
 				     p_eventbuf.eventmask.event_bits[idx]);
 #else
 #else
@@ -795,7 +791,7 @@ int __pthread_initialize_manager(void)
 #endif
 #endif
     }
     }
   if (__builtin_expect (pid, 0) == -1) {
   if (__builtin_expect (pid, 0) == -1) {
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
     _dl_deallocate_tls (tcbp, true);
     _dl_deallocate_tls (tcbp, true);
 #endif
 #endif
     free(__pthread_manager_thread_bos);
     free(__pthread_manager_thread_bos);
@@ -897,7 +893,7 @@ pthread_descr __pthread_self_stack(void)
   if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos)
   if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos)
     return manager_thread;
     return manager_thread;
   h = __pthread_handles + 2;
   h = __pthread_handles + 2;
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
 #  ifdef _STACK_GROWS_UP
 #  ifdef _STACK_GROWS_UP
   while (h->h_descr == NULL
   while (h->h_descr == NULL
 	 || ! (sp >= h->h_descr->p_stackaddr && sp < h->h_descr->p_guardaddr))
 	 || ! (sp >= h->h_descr->p_stackaddr && sp < h->h_descr->p_guardaddr))
@@ -991,7 +987,7 @@ static void pthread_onexit_process(int retcode, void *arg)
        children, so that timings for main thread account for all threads. */
        children, so that timings for main thread account for all threads. */
     if (self == __pthread_main_thread)
     if (self == __pthread_main_thread)
       {
       {
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 	waitpid(manager_thread->p_pid, NULL, __WCLONE);
 	waitpid(manager_thread->p_pid, NULL, __WCLONE);
 #else
 #else
 	waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
 	waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
@@ -999,7 +995,7 @@ static void pthread_onexit_process(int retcode, void *arg)
 	/* Since all threads have been asynchronously terminated
 	/* Since all threads have been asynchronously terminated
            (possibly holding locks), free cannot be used any more.
            (possibly holding locks), free cannot be used any more.
            For mtrace, we'd like to print something though.  */
            For mtrace, we'd like to print something though.  */
-	/* #ifdef USE_TLS
+	/* #ifdef __UCLIBC_HAS_TLS__
 	   tcbhead_t *tcbp = (tcbhead_t *) manager_thread;
 	   tcbhead_t *tcbp = (tcbhead_t *) manager_thread;
 	   # if defined(TLS_DTV_AT_TP)
 	   # if defined(TLS_DTV_AT_TP)
 	   tcbp = (tcbhead_t) ((char *) tcbp + TLS_PRE_TCB_SIZE);
 	   tcbp = (tcbhead_t) ((char *) tcbp + TLS_PRE_TCB_SIZE);
@@ -1057,7 +1053,7 @@ static void pthread_handle_sigcancel(int sig)
     /* Main thread should accumulate times for thread manager and its
     /* Main thread should accumulate times for thread manager and its
        children, so that timings for main thread account for all threads. */
        children, so that timings for main thread account for all threads. */
     if (self == __pthread_main_thread) {
     if (self == __pthread_main_thread) {
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
       waitpid(manager_thread->p_pid, NULL, __WCLONE);
       waitpid(manager_thread->p_pid, NULL, __WCLONE);
 #else
 #else
       waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
       waitpid(__pthread_manager_thread.p_pid, NULL, __WCLONE);
@@ -1118,7 +1114,7 @@ void __pthread_reset_main_thread(void)
   __pthread_main_thread = self;
   __pthread_main_thread = self;
   THREAD_SETMEM(self, p_nextlive, self);
   THREAD_SETMEM(self, p_nextlive, self);
   THREAD_SETMEM(self, p_prevlive, self);
   THREAD_SETMEM(self, p_prevlive, self);
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
   /* Now this thread modifies the global variables.  */
   /* Now this thread modifies the global variables.  */
   THREAD_SETMEM(self, p_errnop, &_errno);
   THREAD_SETMEM(self, p_errnop, &_errno);
   THREAD_SETMEM(self, p_h_errnop, &_h_errno);
   THREAD_SETMEM(self, p_h_errnop, &_h_errno);

+ 1 - 1
libpthread/linuxthreads/specific.c

@@ -212,7 +212,7 @@ void __pthread_destroy_specifics()
   __pthread_unlock(THREAD_GETMEM(self, p_lock));
   __pthread_unlock(THREAD_GETMEM(self, p_lock));
 }
 }
 
 
-#if !(USE_TLS && HAVE___THREAD)
+#ifndef __UCLIBC_HAS_TLS__
 
 
 /* Thread-specific data for libc. */
 /* Thread-specific data for libc. */
 
 

+ 1 - 1
libpthread/linuxthreads/sysdeps/i386/useldt.h

@@ -87,7 +87,7 @@ extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t);
    because we inherited the value set up in the main thread by TLS setup.
    because we inherited the value set up in the main thread by TLS setup.
    We need to extract that value and set up the same segment in this
    We need to extract that value and set up the same segment in this
    thread.  */
    thread.  */
-#if defined (USE_TLS) && USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 # define DO_SET_THREAD_AREA_REUSE(nr)	1
 # define DO_SET_THREAD_AREA_REUSE(nr)	1
 #else
 #else
 /* Without TLS, we do the initialization of the main thread, where NR == 0.  */
 /* Without TLS, we do the initialization of the main thread, where NR == 0.  */

+ 1 - 1
libpthread/linuxthreads/sysdeps/ia64/tcb-offsets.sym

@@ -2,7 +2,7 @@
 #include <tls.h>
 #include <tls.h>
 
 
 --
 --
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads) - sizeof (struct _pthread_descr_struct)
 MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads) - sizeof (struct _pthread_descr_struct)
 #else
 #else
 MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
 MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)

+ 1 - 1
libpthread/linuxthreads/sysdeps/powerpc/tcb-offsets.sym

@@ -3,7 +3,7 @@
 
 
 -- This line separates the #include lines from conditionals.
 -- This line separates the #include lines from conditionals.
 
 
-# ifdef USE_TLS
+# ifdef __UCLIBC_HAS_TLS__
 
 
 -- Abuse tls.h macros to derive offsets relative to the thread register.
 -- Abuse tls.h macros to derive offsets relative to the thread register.
 #  undef __thread_register
 #  undef __thread_register

+ 1 - 2
libpthread/linuxthreads/sysdeps/pthread/bits/libc-tsd.h

@@ -21,10 +21,9 @@
 #define _BITS_LIBC_TSD_H 1
 #define _BITS_LIBC_TSD_H 1
 
 
 #include <linuxthreads/descr.h>
 #include <linuxthreads/descr.h>
+#ifdef __UCLIBC_HAS_TLS__
 #include <tls.h>
 #include <tls.h>
 
 
-#if USE_TLS && HAVE___THREAD
-
 /* When __thread works, the generic definition is what we want.  */
 /* When __thread works, the generic definition is what we want.  */
 # include <sysdeps/generic/bits/libc-tsd.h>
 # include <sysdeps/generic/bits/libc-tsd.h>
 
 

+ 3 - 3
libpthread/linuxthreads/sysdeps/pthread/errno-loc.c

@@ -22,18 +22,18 @@
 #include <linuxthreads/internals.h>
 #include <linuxthreads/internals.h>
 #include <sysdep-cancel.h>
 #include <sysdep-cancel.h>
 
 
-#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
+#if !defined __UCLIBC_HAS_TLS__ && !RTLD_PRIVATE_ERRNO
 #undef errno
 #undef errno
 extern int errno;
 extern int errno;
 #endif
 #endif
 
 
 int *
 int *
-#if ! USE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
 weak_const_function
 weak_const_function
 #endif
 #endif
 __errno_location (void)
 __errno_location (void)
 {
 {
-#if ! USE___THREAD && !defined NOT_IN_libc
+#if !defined __UCLIBC_HAS_TLS__ && !defined NOT_IN_libc
   if (! SINGLE_THREAD_P)
   if (! SINGLE_THREAD_P)
     {
     {
       pthread_descr self = thread_self();
       pthread_descr self = thread_self();

+ 2 - 2
libpthread/linuxthreads/sysdeps/pthread/herrno-loc.c

@@ -21,7 +21,7 @@
 #include <linuxthreads/internals.h>
 #include <linuxthreads/internals.h>
 #include <sysdep-cancel.h>
 #include <sysdep-cancel.h>
 
 
-#if ! USE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
 # undef h_errno
 # undef h_errno
 extern int h_errno;
 extern int h_errno;
 #endif
 #endif
@@ -31,7 +31,7 @@ int *
 weak_const_function
 weak_const_function
 __h_errno_location (void)
 __h_errno_location (void)
 {
 {
-#if ! USE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
   if (! SINGLE_THREAD_P)
   if (! SINGLE_THREAD_P)
     {
     {
       pthread_descr self = thread_self();
       pthread_descr self = thread_self();

+ 3 - 3
libpthread/linuxthreads/sysdeps/pthread/res-state.c

@@ -21,19 +21,19 @@
 #include <linuxthreads/internals.h>
 #include <linuxthreads/internals.h>
 #include <sysdep-cancel.h>
 #include <sysdep-cancel.h>
 
 
-#if ! USE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
 # undef _res
 # undef _res
 extern struct __res_state _res;
 extern struct __res_state _res;
 #endif
 #endif
 
 
 /* When threaded, _res may be a per-thread variable.  */
 /* When threaded, _res may be a per-thread variable.  */
 struct __res_state *
 struct __res_state *
-#if ! USE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
 weak_const_function
 weak_const_function
 #endif
 #endif
 __res_state (void)
 __res_state (void)
 {
 {
-#if ! USE___THREAD
+#ifndef __UCLIBC_HAS_TLS__
   if (! SINGLE_THREAD_P)
   if (! SINGLE_THREAD_P)
     {
     {
       pthread_descr self = thread_self();
       pthread_descr self = thread_self();

+ 1 - 1
libpthread/linuxthreads/sysdeps/s390/s390-32/pt-machine.h

@@ -58,7 +58,7 @@ testandset (int *spinlock)
 #define CURRENT_STACK_FRAME  stack_pointer
 #define CURRENT_STACK_FRAME  stack_pointer
 register char * stack_pointer __asm__ ("15");
 register char * stack_pointer __asm__ ("15");
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 /* Return the thread descriptor for the current thread.  */
 /* Return the thread descriptor for the current thread.  */
 # define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ())
 # define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ())
 
 

+ 1 - 1
libpthread/linuxthreads/sysdeps/s390/s390-64/pt-machine.h

@@ -58,7 +58,7 @@ testandset (int *spinlock)
 #define CURRENT_STACK_FRAME  stack_pointer
 #define CURRENT_STACK_FRAME  stack_pointer
 register char * stack_pointer __asm__ ("15");
 register char * stack_pointer __asm__ ("15");
 
 
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 /* Return the thread descriptor for the current thread.  */
 /* Return the thread descriptor for the current thread.  */
 # define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ())
 # define THREAD_SELF ((pthread_descr) __builtin_thread_pointer ())
 
 

+ 1 - 1
libpthread/linuxthreads/sysdeps/sh/tcb-offsets.sym

@@ -2,7 +2,7 @@
 #include <tls.h>
 #include <tls.h>
 
 
 --
 --
-#ifdef USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
 MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads)
 MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads)
 TLS_PRE_TCB_SIZE	sizeof (struct _pthread_descr_struct)
 TLS_PRE_TCB_SIZE	sizeof (struct _pthread_descr_struct)
 #else
 #else

+ 3 - 3
libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h

@@ -139,7 +139,7 @@
 #endif
 #endif
 
 
 # ifndef __ASSEMBLER__
 # ifndef __ASSEMBLER__
-#  if defined FLOATING_STACKS && USE___THREAD && defined __PIC__
+#  if defined FLOATING_STACKS && defined __UCLIBC_HAS_TLS__ && defined __PIC__
 #   define SINGLE_THREAD_P \
 #   define SINGLE_THREAD_P \
   __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
   __builtin_expect (THREAD_GETMEM (THREAD_SELF,				      \
 				   p_header.data.multiple_threads) == 0, 1)
 				   p_header.data.multiple_threads) == 0, 1)
@@ -155,7 +155,7 @@ extern int __local_multiple_threads
 # else
 # else
 #  if !defined __PIC__
 #  if !defined __PIC__
 #   define SINGLE_THREAD_P cmpl $0, __local_multiple_threads
 #   define SINGLE_THREAD_P cmpl $0, __local_multiple_threads
-#  elif defined FLOATING_STACKS && USE___THREAD
+#  elif defined FLOATING_STACKS && defined __UCLIBC_HAS_TLS__
 #   define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
 #   define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
 #  else
 #  else
 #   if !defined NOT_IN_libc || defined IS_IN_libpthread
 #   if !defined NOT_IN_libc || defined IS_IN_libpthread
@@ -165,7 +165,7 @@ extern int __local_multiple_threads
   movl __local_multiple_threads@GOT(%ecx), %ecx;\
   movl __local_multiple_threads@GOT(%ecx), %ecx;\
   cmpl $0, (%ecx)
   cmpl $0, (%ecx)
 #   endif
 #   endif
-#   if !defined HAVE_HIDDEN || !USE___THREAD
+#   if !defined HAVE_HIDDEN || !defined __UCLIBC_HAS_TLS__
 #    define SINGLE_THREAD_P \
 #    define SINGLE_THREAD_P \
   SETUP_PIC_REG (cx);				\
   SETUP_PIC_REG (cx);				\
   addl $_GLOBAL_OFFSET_TABLE_, %ecx;		\
   addl $_GLOBAL_OFFSET_TABLE_, %ecx;		\

+ 1 - 1
libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386/vfork.S

@@ -32,7 +32,7 @@ ENTRY (__vfork)
 #ifdef __NR_vfork
 #ifdef __NR_vfork
 
 
 # ifdef SHARED
 # ifdef SHARED
-#  if !defined HAVE_HIDDEN || !USE___THREAD
+#  if !defined HAVE_HIDDEN || !defined __UCLIBC_HAS_TLS__
 	SETUP_PIC_REG (cx)
 	SETUP_PIC_REG (cx)
 #  else
 #  else
 	call	__i686.get_pc_thunk.cx
 	call	__i686.get_pc_thunk.cx

+ 2 - 2
libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h

@@ -155,7 +155,7 @@
 # endif
 # endif
 
 
 # ifndef __ASSEMBLER__
 # ifndef __ASSEMBLER__
-#  if defined FLOATING_STACKS && USE___THREAD && defined __PIC__
+#  if defined FLOATING_STACKS && defined __UCLIBC_HAS_TLS__ && defined __PIC__
 #   define SINGLE_THREAD_P \
 #   define SINGLE_THREAD_P \
   __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
   __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
 #  else
 #  else
@@ -172,7 +172,7 @@ extern int __local_multiple_threads attribute_hidden;
 	.align 2; \
 	.align 2; \
      1: .long __local_multiple_threads; \
      1: .long __local_multiple_threads; \
      2:
      2:
-#  elif defined FLOATING_STACKS && USE___THREAD
+#  elif defined FLOATING_STACKS && defined __UCLIBC_HAS_TLS__
 #   define SINGLE_THREAD_P \
 #   define SINGLE_THREAD_P \
 	stc gbr,r0; \
 	stc gbr,r0; \
 	mov.w 0f,r1; \
 	mov.w 0f,r1; \

+ 1 - 1
libpthread/linuxthreads_db/td_ta_thr_iter.c

@@ -40,7 +40,7 @@ handle_descr (const td_thragent_t *ta, td_thr_iter_f *callback,
 	  memset (&pds, '\0', sizeof (pds));
 	  memset (&pds, '\0', sizeof (pds));
 
 
 	  /* Empty thread descriptor the thread library would create.  */
 	  /* Empty thread descriptor the thread library would create.  */
-#if !defined USE_TLS || !TLS_DTV_AT_TP
+#if !defined __UCLIBC_HAS_TLS__ || !TLS_DTV_AT_TP
 	  pds.p_header.data.self = &pds;
 	  pds.p_header.data.self = &pds;
 #endif
 #endif
 	  pds.p_nextlive = pds.p_prevlive = &pds;
 	  pds.p_nextlive = pds.p_prevlive = &pds;

+ 1 - 1
libpthread/linuxthreads_db/td_thr_tls_get_addr.c

@@ -27,7 +27,7 @@ td_thr_tls_get_addr (const td_thrhandle_t *th __attribute__ ((unused)),
 		     size_t offset __attribute__ ((unused)),
 		     size_t offset __attribute__ ((unused)),
 		     void **address __attribute__ ((unused)))
 		     void **address __attribute__ ((unused)))
 {
 {
-#if USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   /* Read the module ID from the link_map.  */
   /* Read the module ID from the link_map.  */
   size_t modid;
   size_t modid;
   if (ps_pdread (th->th_ta_p->ph,
   if (ps_pdread (th->th_ta_p->ph,

+ 1 - 1
libpthread/linuxthreads_db/td_thr_tlsbase.c

@@ -30,7 +30,7 @@ td_thr_tlsbase (const td_thrhandle_t *th,
   if (modid < 1)
   if (modid < 1)
     return TD_NOTLS;
     return TD_NOTLS;
 
 
-#if USE_TLS
+#ifdef __UCLIBC_HAS_TLS__
   union dtv pdtv, *dtvp;
   union dtv pdtv, *dtvp;
 
 
   LOG ("td_thr_tlsbase");
   LOG ("td_thr_tlsbase");