about summary refs log tree commit diff
path: root/htl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-04-02 18:08:37 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-04-02 18:08:37 +0000
commitf6fb29d22eefb208c0c7da463c31229d50ccbe01 (patch)
tree3db5f5950b7fb2ae65d2fc09f33fab2646687c94 /htl
parentfa9e15558d711c098183be531043eae465b81036 (diff)
downloadglibc-f6fb29d22eefb208c0c7da463c31229d50ccbe01.tar.gz
glibc-f6fb29d22eefb208c0c7da463c31229d50ccbe01.tar.xz
glibc-f6fb29d22eefb208c0c7da463c31229d50ccbe01.zip
hurd: Avoid local PLTs in libpthread.
	* htl/cthreads-compat.c (__cthread_detach): Call __pthread_detach
	instead of pthread_detach.
	(__cthread_fork): Call __pthread_create instead of pthread_create.
	(__cthread_keycreate): Call __pthread_key_create instead of
	pthread_key_create.
	(__cthread_getspecific): Call __pthread_getspecific instead of
	pthread_getspecific.
	(__cthread_setspecific): Call __pthread_setspecific instead of
	pthread_setspecific.
	* htl/pt-alloc.c (__pthread_alloc): Call __pthread_mutex_lock and
	__pthread_mutex_unlock instead of pthread_mutex_lock and
	pthread_mutex_unlock.
	* htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to
	___pthread_get_cleanup_stack.
	(__pthread_get_cleanup_stack): New strong alias.
	* htl/pt-create.c: Include <pthreadP.h>.
	(entry_point): Call __pthread_exit instead of pthread_exit.
	(pthread_create): Rename to __pthread_create.
	(pthread_create): New strong alias.
	* htl/pt-detach.c (pthread_detach): Rename to __pthread_detach.
	(pthread_detach): New strong alias.
	(__pthread_detach): Call __pthread_cond_broadcast instead of
	pthread_cond_broadcast.
	* htl/pt-exit.c (__pthread_exit): Call __pthread_setcancelstate
	instead of pthread_setcancelstate.
	* htl/pt-testcancel.c: Include <pthreadP.h>.
	(pthread_testcancel): Call __pthread_exit instead of pthread_exit.
	* sysdeps/htl/pt-attr-getstack.c: Include <pthreadP.h>
	(__pthread_attr_getstack): Call __pthread_attr_getstackaddr and
	__pthread_attr_getstacksize instead of pthread_attr_getstackaddr and
	pthread_attr_getstacksize.
	* sysdeps/htl/pt-attr-getstackaddr.c (pthread_attr_getstackaddr):
	Rename to __pthread_attr_getstackaddr.
	(pthread_attr_getstackaddr): New strong alias.
	* sysdeps/htl/pt-attr-getstacksize.c (pthread_attr_getstacksize):
	Rename to __pthread_attr_getstacksize.
	(pthread_attr_getstacksize): New strong alias.
	* sysdeps/htl/pt-attr-setstack.c: Include <pthreadP.h>.
	(pthread_attr_setstack): Rename to __pthread_attr_setstack.
	(pthread_attr_setstack): New strong alias.
	(__pthread_attr_setstack): Call __pthread_attr_getstacksize,
	__pthread_attr_setstacksize and __pthread_attr_setstackaddr instead of
	pthread_attr_getstacksize, pthread_attr_setstacksize and
	pthread_attr_setstackaddr.
	* sysdeps/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr):
	Rename to __pthread_attr_setstackaddr.
	(pthread_attr_setstackaddr): New strong alias.
	* sysdeps/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize):
	Rename to __pthread_attr_setstacksize.
	(pthread_attr_setstacksize): New strong alias.
	* sysdeps/htl/pt-cond-timedwait.c: Include <pthreadP.h>.
	(__pthread_cond_timedwait_internal): Use __pthread_exit instead of
	pthread_exit.
	* sysdeps/htl/pt-key-create.c: Include <pthreadP.h>.
	(__pthread_key_create): New hidden def.
	* sysdeps/htl/pt-key.h: Include <pthreadP.h>.
	* sysdeps/htl/pthreadP.h (_pthread_mutex_init,
	__pthread_cond_broadcast, __pthread_create, __pthread_detach,
	__pthread_exit, __pthread_key_create, __pthread_getspecific,
	__pthread_setspecific, __pthread_setcancelstate,
	__pthread_attr_getstackaddr, __pthread_attr_setstackaddr,
	__pthread_attr_getstacksize, __pthread_attr_setstacksize,
	__pthread_attr_setstack, ___pthread_get_cleanup_stack): New
	declarations.
	(__pthread_key_create, _pthread_mutex_init): New hidden declarations.
	* sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c
	(pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr.
	(pthread_attr_setstackaddr): New strong alias.
	* sysdeps/mach/hurd/htl/pt-attr-setstacksize.c
	(pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize.
	(pthread_attr_setstacksize): New strong alias.
	* sysdeps/mach/hurd/htl/pt-docancel.c: Include <pthreadP.h>.
	(call_exit): Call __pthread_exit instead of pthread_exit.
	* sysdeps/mach/hurd/htl/pt-mutex-init.c: Include <pthreadP.h>.
	(_pthread_mutex_init): New hidden definition.
	* sysdeps/mach/hurd/htl/pt-sysdep.c: Include <pthreadP.h>.
	(_init_routine): Call __pthread_attr_init and __pthread_attr_setstack
	instead of pthread_attr_init and pthread_attr_setstack.
Diffstat (limited to 'htl')
-rw-r--r--htl/cthreads-compat.c10
-rw-r--r--htl/pt-alloc.c4
-rw-r--r--htl/pt-cleanup.c3
-rw-r--r--htl/pt-create.c8
-rw-r--r--htl/pt-detach.c5
-rw-r--r--htl/pt-exit.c4
-rw-r--r--htl/pt-testcancel.c3
7 files changed, 21 insertions, 16 deletions
diff --git a/htl/cthreads-compat.c b/htl/cthreads-compat.c
index 7ae013b54a..6b2db646fc 100644
--- a/htl/cthreads-compat.c
+++ b/htl/cthreads-compat.c
@@ -26,7 +26,7 @@ __cthread_detach (__cthread_t thread)
 {
   int err;
 
-  err = pthread_detach ((pthread_t) thread);
+  err = __pthread_detach ((pthread_t) thread);
   assert_perror (err);
 }
 weak_alias (__cthread_detach, cthread_detach)
@@ -37,7 +37,7 @@ __cthread_fork (__cthread_fn_t func, void *arg)
   pthread_t thread;
   int err;
 
-  err = pthread_create (&thread, NULL, func, arg);
+  err = __pthread_create (&thread, NULL, func, arg);
   assert_perror (err);
 
   return (__cthread_t) thread;
@@ -49,7 +49,7 @@ __cthread_keycreate (__cthread_key_t *key)
 {
   error_t err;
 
-  err = pthread_key_create (key, 0);
+  err = __pthread_key_create (key, 0);
   if (err)
     {
       errno = err;
@@ -64,7 +64,7 @@ weak_alias (__cthread_keycreate, cthread_keycreate)
 int
 __cthread_getspecific (__cthread_key_t key, void **val)
 {
-  *val = pthread_getspecific (key);
+  *val = __pthread_getspecific (key);
   return 0;
 }
 weak_alias (__cthread_getspecific, cthread_getspecific)
@@ -74,7 +74,7 @@ __cthread_setspecific (__cthread_key_t key, void *val)
 {
   error_t err;
 
-  err = pthread_setspecific (key, (const void *) val);
+  err = __pthread_setspecific (key, (const void *) val);
   if (err)
     {
       errno = err;
diff --git a/htl/pt-alloc.c b/htl/pt-alloc.c
index aa3721d663..f87829fe78 100644
--- a/htl/pt-alloc.c
+++ b/htl/pt-alloc.c
@@ -91,7 +91,7 @@ __pthread_alloc (struct __pthread **pthread)
   int max_threads;
   int new_max_threads;
 
-  pthread_mutex_lock (&__pthread_free_threads_lock);
+  __pthread_mutex_lock (&__pthread_free_threads_lock);
   for (new = __pthread_free_threads; new; new = new->next)
     {
       /* There is no need to take NEW->STATE_LOCK: if NEW is on this
@@ -105,7 +105,7 @@ __pthread_alloc (struct __pthread **pthread)
 	  break;
 	}
     }
-  pthread_mutex_unlock (&__pthread_free_threads_lock);
+  __pthread_mutex_unlock (&__pthread_free_threads_lock);
 
   if (new)
     {
diff --git a/htl/pt-cleanup.c b/htl/pt-cleanup.c
index 3c2d83a5b5..05c187306c 100644
--- a/htl/pt-cleanup.c
+++ b/htl/pt-cleanup.c
@@ -21,7 +21,8 @@
 #include <pt-internal.h>
 
 struct __pthread_cancelation_handler **
-__pthread_get_cleanup_stack (void)
+___pthread_get_cleanup_stack (void)
 {
   return &_pthread_self ()->cancelation_handlers;
 }
+strong_alias (___pthread_get_cleanup_stack, __pthread_cleanup_stack)
diff --git a/htl/pt-create.c b/htl/pt-create.c
index 2b53658b23..a555c2f062 100644
--- a/htl/pt-create.c
+++ b/htl/pt-create.c
@@ -26,6 +26,7 @@
 #include <hurd/resource.h>
 
 #include <pt-internal.h>
+#include <pthreadP.h>
 
 #if IS_IN (libpthread)
 # include <ctype.h>
@@ -58,14 +59,14 @@ entry_point (struct __pthread *self, void *(*start_routine) (void *), void *arg)
 
   __pthread_startup ();
 
-  pthread_exit (start_routine (arg));
+  __pthread_exit (start_routine (arg));
 }
 
 /* Create a thread with attributes given by ATTR, executing
    START_ROUTINE with argument ARG.  */
 int
-pthread_create (pthread_t * thread, const pthread_attr_t * attr,
-		void *(*start_routine) (void *), void *arg)
+__pthread_create (pthread_t * thread, const pthread_attr_t * attr,
+		  void *(*start_routine) (void *), void *arg)
 {
   int err;
   struct __pthread *pthread;
@@ -78,6 +79,7 @@ pthread_create (pthread_t * thread, const pthread_attr_t * attr,
 
   return err;
 }
+strong_alias (__pthread_create, pthread_create)
 
 /* Internal version of pthread_create.  See comment in
    pt-internal.h.  */
diff --git a/htl/pt-detach.c b/htl/pt-detach.c
index 25f23eaabf..40082c507f 100644
--- a/htl/pt-detach.c
+++ b/htl/pt-detach.c
@@ -25,7 +25,7 @@
 /* Indicate that the storage for THREAD can be reclaimed when it
    terminates.  */
 int
-pthread_detach (pthread_t thread)
+__pthread_detach (pthread_t thread)
 {
   struct __pthread *pthread;
   int err = 0;
@@ -47,7 +47,7 @@ pthread_detach (pthread_t thread)
       /* Broadcast the condition.  This will make threads that are
          waiting to join THREAD continue with hopefully disastrous
          consequences instead of blocking indefinitely.  */
-      pthread_cond_broadcast (&pthread->state_cond);
+      __pthread_cond_broadcast (&pthread->state_cond);
       __pthread_mutex_unlock (&pthread->state_lock);
 
       __pthread_dealloc (pthread);
@@ -77,3 +77,4 @@ pthread_detach (pthread_t thread)
 
   return err;
 }
+strong_alias (__pthread_detach, pthread_detach)
diff --git a/htl/pt-exit.c b/htl/pt-exit.c
index 6cde55853b..0815dbcd98 100644
--- a/htl/pt-exit.c
+++ b/htl/pt-exit.c
@@ -38,14 +38,14 @@ __pthread_exit (void *status)
   /* Run any cancelation handlers.  According to POSIX, the
      cancellation cleanup handlers should be called with cancellation
      disabled.  */
-  pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
+  __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
 
   for (handlers = __pthread_get_cleanup_stack ();
        *handlers != NULL;
        *handlers = (*handlers)->__next)
     (*handlers)->__handler ((*handlers)->__arg);
 
-  pthread_setcancelstate (oldstate, &oldstate);
+  __pthread_setcancelstate (oldstate, &oldstate);
 
   /* Decrease the number of threads.  We use an atomic operation to
      make sure that only the last thread calls `exit'.  */
diff --git a/htl/pt-testcancel.c b/htl/pt-testcancel.c
index b15eb6badd..116a3076dd 100644
--- a/htl/pt-testcancel.c
+++ b/htl/pt-testcancel.c
@@ -19,6 +19,7 @@
 #include <pthread.h>
 
 #include <pt-internal.h>
+#include <pthreadP.h>
 
 void
 pthread_testcancel (void)
@@ -31,5 +32,5 @@ pthread_testcancel (void)
   __pthread_mutex_unlock (&p->cancel_lock);
 
   if (cancelled)
-    pthread_exit (PTHREAD_CANCELED);
+    __pthread_exit (PTHREAD_CANCELED);
 }