aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/htl
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/htl')
-rw-r--r--sysdeps/htl/include/bits/cancelation.h5
-rw-r--r--sysdeps/htl/libc-lock.h19
-rw-r--r--sysdeps/htl/libc-lockP.h6
-rw-r--r--sysdeps/htl/pt-destroy-specific.c2
-rw-r--r--sysdeps/htl/pt-getspecific.c9
-rw-r--r--sysdeps/htl/pt-key-create.c11
-rw-r--r--sysdeps/htl/pt-key-delete.c9
-rw-r--r--sysdeps/htl/pt-setspecific.c10
-rw-r--r--sysdeps/htl/pthread-functions.h10
-rw-r--r--sysdeps/htl/pthreadP.h24
10 files changed, 63 insertions, 42 deletions
diff --git a/sysdeps/htl/include/bits/cancelation.h b/sysdeps/htl/include/bits/cancelation.h
new file mode 100644
index 0000000..ef2cd70
--- /dev/null
+++ b/sysdeps/htl/include/bits/cancelation.h
@@ -0,0 +1,5 @@
+#include_next <bits/cancelation.h>
+
+#ifndef _ISOMAC
+#include <pthreadP.h>
+#endif
diff --git a/sysdeps/htl/libc-lock.h b/sysdeps/htl/libc-lock.h
index 66779b9..8e764a7 100644
--- a/sysdeps/htl/libc-lock.h
+++ b/sysdeps/htl/libc-lock.h
@@ -37,13 +37,10 @@
{ \
__handler.__handler = FCT; \
__handler.__arg = ARG; \
- if (__pthread_get_cleanup_stack != NULL) \
- { \
- __handlers = __pthread_get_cleanup_stack (); \
- __handler.__next = *__handlers; \
- *__handlers = &__handler; \
- __registered = 1; \
- } \
+ __handlers = __pthread_get_cleanup_stack (); \
+ __handler.__next = *__handlers; \
+ *__handlers = &__handler; \
+ __registered = 1; \
} \
#define __libc_cleanup_end(DOIT) \
@@ -59,12 +56,4 @@
#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
-#if !IS_IN (libpthread)
-# ifdef weak_extern
-weak_extern (__pthread_get_cleanup_stack)
-# else
-# pragma weak __pthread_get_cleanup_stack
-# endif
-#endif
-
#endif
diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h
index 092eb35..e9977e4 100644
--- a/sysdeps/htl/libc-lockP.h
+++ b/sysdeps/htl/libc-lockP.h
@@ -126,15 +126,9 @@ libc_hidden_proto (__pthread_setcancelstate)
single-threaded processes. */
#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
# ifdef weak_extern
-weak_extern (__pthread_key_create)
-weak_extern (__pthread_setspecific)
-weak_extern (__pthread_getspecific)
weak_extern (__pthread_initialize)
weak_extern (__pthread_atfork)
# else
-# pragma weak __pthread_key_create
-# pragma weak __pthread_setspecific
-# pragma weak __pthread_getspecific
# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
# endif
diff --git a/sysdeps/htl/pt-destroy-specific.c b/sysdeps/htl/pt-destroy-specific.c
index e63b807..b5eb0ba 100644
--- a/sysdeps/htl/pt-destroy-specific.c
+++ b/sysdeps/htl/pt-destroy-specific.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <pt-internal.h>
+#include <string.h>
void
__pthread_destroy_specific (struct __pthread *thread)
@@ -100,3 +101,4 @@ __pthread_destroy_specific (struct __pthread *thread)
memset (&thread->static_thread_specifics, 0,
sizeof (thread->static_thread_specifics));
}
+libc_hidden_def (__pthread_destroy_specific)
diff --git a/sysdeps/htl/pt-getspecific.c b/sysdeps/htl/pt-getspecific.c
index 0052ce8..d3ebb31 100644
--- a/sysdeps/htl/pt-getspecific.c
+++ b/sysdeps/htl/pt-getspecific.c
@@ -19,6 +19,7 @@
#include <pthread.h>
#include <pt-internal.h>
+#include <shlib-compat.h>
void *
__pthread_getspecific (pthread_key_t key)
@@ -42,5 +43,9 @@ __pthread_getspecific (pthread_key_t key)
return self->thread_specifics[key];
}
-weak_alias (__pthread_getspecific, pthread_getspecific);
-hidden_def (__pthread_getspecific)
+libc_hidden_def (__pthread_getspecific)
+versioned_symbol (libc, __pthread_getspecific, pthread_getspecific, GLIBC_2_42);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
+compat_symbol (libpthread, __pthread_getspecific, pthread_getspecific, GLIBC_2_12);
+#endif
diff --git a/sysdeps/htl/pt-key-create.c b/sysdeps/htl/pt-key-create.c
index cf8a8d1..92a9db8 100644
--- a/sysdeps/htl/pt-key-create.c
+++ b/sysdeps/htl/pt-key-create.c
@@ -22,6 +22,9 @@
#include <pt-internal.h>
#include <pthreadP.h>
+#include <shlib-compat.h>
+#include <ldsodefs.h>
+
pthread_mutex_t __pthread_key_lock;
pthread_once_t __pthread_key_once = PTHREAD_ONCE_INIT;
@@ -116,5 +119,9 @@ do_search:
__pthread_mutex_unlock (&__pthread_key_lock);
return 0;
}
-weak_alias (__pthread_key_create, pthread_key_create)
-hidden_def (__pthread_key_create)
+libc_hidden_def (__pthread_key_create)
+versioned_symbol (libc, __pthread_key_create, pthread_key_create, GLIBC_2_42);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
+compat_symbol (libpthread, __pthread_key_create, pthread_key_create, GLIBC_2_12);
+#endif
diff --git a/sysdeps/htl/pt-key-delete.c b/sysdeps/htl/pt-key-delete.c
index 79879e9..666314f 100644
--- a/sysdeps/htl/pt-key-delete.c
+++ b/sysdeps/htl/pt-key-delete.c
@@ -19,6 +19,8 @@
#include <pthread.h>
#include <pt-internal.h>
+#include <shlib-compat.h>
+#include <ldsodefs.h>
int
__pthread_key_delete (pthread_key_t key)
@@ -69,4 +71,9 @@ __pthread_key_delete (pthread_key_t key)
return err;
}
-weak_alias (__pthread_key_delete, pthread_key_delete)
+libc_hidden_def (__pthread_key_delete)
+versioned_symbol (libc, __pthread_key_delete, pthread_key_delete, GLIBC_2_42);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
+compat_symbol (libpthread, __pthread_key_delete, pthread_key_delete, GLIBC_2_12);
+#endif
diff --git a/sysdeps/htl/pt-setspecific.c b/sysdeps/htl/pt-setspecific.c
index dfd55b6..0535225 100644
--- a/sysdeps/htl/pt-setspecific.c
+++ b/sysdeps/htl/pt-setspecific.c
@@ -19,6 +19,8 @@
#include <pthread.h>
#include <pt-internal.h>
+#include <shlib-compat.h>
+#include <string.h>
int
__pthread_setspecific (pthread_key_t key, const void *value)
@@ -68,5 +70,9 @@ __pthread_setspecific (pthread_key_t key, const void *value)
self->thread_specifics[key] = (void *) value;
return 0;
}
-weak_alias (__pthread_setspecific, pthread_setspecific);
-hidden_def (__pthread_setspecific)
+libc_hidden_def (__pthread_setspecific)
+versioned_symbol (libc, __pthread_setspecific, pthread_setspecific, GLIBC_2_42);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
+compat_symbol (libpthread, __pthread_setspecific, pthread_setspecific, GLIBC_2_12);
+#endif
diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h
index 467d031..aec13a6 100644
--- a/sysdeps/htl/pthread-functions.h
+++ b/sysdeps/htl/pthread-functions.h
@@ -22,11 +22,6 @@
#include <pthread.h>
void __pthread_exit (void *) __attribute__ ((__noreturn__));
-struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
-int __pthread_once (pthread_once_t *, void (*) (void));
-int __pthread_key_create (pthread_key_t *, void (*) (void *));
-void *__pthread_getspecific (pthread_key_t);
-int __pthread_setspecific (pthread_key_t, const void *);
void _cthreads_flockfile (FILE *);
void _cthreads_funlockfile (FILE *);
@@ -38,11 +33,6 @@ int _cthreads_ftrylockfile (FILE *);
struct pthread_functions
{
void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
- struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void);
- int (*ptr_pthread_once) (pthread_once_t *, void (*) (void));
- int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *));
- void *(*ptr___pthread_getspecific) (pthread_key_t);
- int (*ptr___pthread_setspecific) (pthread_key_t, const void *);
void (*ptr__IO_flockfile) (FILE *);
void (*ptr__IO_funlockfile) (FILE *);
int (*ptr__IO_ftrylockfile) (FILE *);
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index 78ef4e7..535740f 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -23,6 +23,7 @@
#include <pthread.h>
#include <link.h>
+#include <bits/cancelation.h>
/* Attribute to indicate thread creation was issued from C11 thrd_create. */
#define ATTR_C11_THREAD ((void*)(uintptr_t)-1)
@@ -181,9 +182,13 @@ 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 *));
+libc_hidden_proto (__pthread_key_create)
void *__pthread_getspecific (pthread_key_t key);
+libc_hidden_proto (__pthread_getspecific)
int __pthread_setspecific (pthread_key_t key, const void *value);
+libc_hidden_proto (__pthread_setspecific)
int __pthread_key_delete (pthread_key_t key);
+libc_hidden_proto (__pthread_key_delete)
int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void));
int __pthread_getattr_np (pthread_t, pthread_attr_t *);
@@ -211,14 +216,11 @@ int __pthread_condattr_init (pthread_condattr_t *attr);
libc_hidden_proto (__pthread_self)
libc_hidden_proto (__pthread_attr_init)
libc_hidden_proto (__pthread_condattr_init)
+libc_hidden_proto (__pthread_get_cleanup_stack)
#if IS_IN (libpthread)
hidden_proto (__pthread_create)
hidden_proto (__pthread_detach)
-hidden_proto (__pthread_key_create)
-hidden_proto (__pthread_getspecific)
-hidden_proto (__pthread_setspecific)
-hidden_proto (__pthread_get_cleanup_stack)
#endif
#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
@@ -233,4 +235,18 @@ weak_extern (__pthread_exit)
_Static_assert (sizeof (type) == size, \
"sizeof (" #type ") != " #size)
+ /* Special cleanup macros which register cleanup both using
+ __pthread_cleanup_{push,pop} and using cleanup attribute. This is needed
+ for qsort, so that it supports both throwing exceptions from the caller
+ sort function callback (only cleanup attribute works there) and
+ cancellation of the thread running the callback if the callback or some
+ routines it calls don't have unwind information.
+ TODO: add support for cleanup routines. */
+#ifndef pthread_cleanup_combined_push
+# define pthread_cleanup_combined_push __pthread_cleanup_push
+#endif
+#ifndef pthread_cleanup_combined_pop
+# define pthread_cleanup_combined_pop __pthread_cleanup_pop
+#endif
+
#endif /* pthreadP.h */