From f6fb29d22eefb208c0c7da463c31229d50ccbe01 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 2 Apr 2018 18:08:37 +0000 Subject: 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 . (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 . (pthread_testcancel): Call __pthread_exit instead of pthread_exit. * sysdeps/htl/pt-attr-getstack.c: Include (__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 . (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 . (__pthread_cond_timedwait_internal): Use __pthread_exit instead of pthread_exit. * sysdeps/htl/pt-key-create.c: Include . (__pthread_key_create): New hidden def. * sysdeps/htl/pt-key.h: Include . * 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 . (call_exit): Call __pthread_exit instead of pthread_exit. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Include . (_pthread_mutex_init): New hidden definition. * sysdeps/mach/hurd/htl/pt-sysdep.c: Include . (_init_routine): Call __pthread_attr_init and __pthread_attr_setstack instead of pthread_attr_init and pthread_attr_setstack. --- sysdeps/htl/pthreadP.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'sysdeps/htl/pthreadP.h') diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index c37974945a..6c9aa6cb75 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -27,20 +27,48 @@ extern pthread_t __pthread_self (void); extern int __pthread_kill (pthread_t threadid, int signo); extern struct __pthread **__pthread_threads; +extern int _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); +extern int __pthread_cond_broadcast (pthread_cond_t *cond); + typedef struct __cthread *__cthread_t; typedef int __cthread_key_t; typedef void * (*__cthread_fn_t)(void *__arg); __cthread_t __cthread_fork (__cthread_fn_t, void *); +int __pthread_create (pthread_t *newthread, + const pthread_attr_t *attr, + void *(*start_routine) (void *), void *arg); + void __cthread_detach (__cthread_t); +int __pthread_detach (pthread_t __threadp); +void __pthread_exit (void *value) __attribute__ ((__noreturn__)); int __cthread_keycreate (__cthread_key_t *); int __cthread_getspecific (__cthread_key_t, void **); int __cthread_setspecific (__cthread_key_t, void *); +int __pthread_key_create (pthread_key_t *key, void (*destr) (void *)); +void *__pthread_getspecific (pthread_key_t key); +int __pthread_setspecific (pthread_key_t key, const void *value); + +int __pthread_setcancelstate (int state, int *oldstate); int __pthread_getattr_np (pthread_t, pthread_attr_t *); +int __pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr, + void **__restrict __stackaddr); +int __pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr); +int __pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr, + size_t *__restrict __stacksize); +int __pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize); +int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, + size_t __stacksize); int __pthread_attr_getstack (const pthread_attr_t *, void **, size_t *); +struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void); + +#if IS_IN (libpthread) +hidden_proto (__pthread_key_create) +hidden_proto (_pthread_mutex_init) +#endif #endif /* pthreadP.h */ -- cgit 1.4.1