aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile8
-rw-r--r--nptl/Versions17
-rw-r--r--nptl/forward.c11
-rw-r--r--nptl/nptl-init.c4
-rw-r--r--nptl/pthreadP.h11
-rw-r--r--nptl/pthread_mutex_cond_lock.c3
-rw-r--r--nptl/pthread_mutex_destroy.c16
-rw-r--r--nptl/pthread_mutex_init.c14
-rw-r--r--nptl/pthread_mutex_lock.c22
-rw-r--r--nptl/pthread_mutex_unlock.c17
10 files changed, 74 insertions, 49 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index f62fdc5..9f739e2 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -85,6 +85,10 @@ routines = \
pthread_kill \
pthread_mutex_conf \
pthread_mutex_consistent \
+ pthread_mutex_destroy \
+ pthread_mutex_init \
+ pthread_mutex_lock \
+ pthread_mutex_unlock \
pthread_once \
pthread_rwlock_rdlock \
pthread_rwlock_unlock \
@@ -154,14 +158,10 @@ libpthread-routines = \
pthread_join_common \
pthread_kill_other_threads \
pthread_mutex_cond_lock \
- pthread_mutex_destroy \
pthread_mutex_getprioceiling \
- pthread_mutex_init \
- pthread_mutex_lock \
pthread_mutex_setprioceiling \
pthread_mutex_timedlock \
pthread_mutex_trylock \
- pthread_mutex_unlock \
pthread_mutexattr_destroy \
pthread_mutexattr_getprioceiling \
pthread_mutexattr_getprotocol \
diff --git a/nptl/Versions b/nptl/Versions
index 2748421..7672831 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -2,6 +2,10 @@ libc {
GLIBC_2.0 {
__pthread_getspecific;
__pthread_key_create;
+ __pthread_mutex_destroy;
+ __pthread_mutex_init;
+ __pthread_mutex_lock;
+ __pthread_mutex_unlock;
__pthread_once;
__pthread_setspecific;
_pthread_cleanup_pop;
@@ -104,6 +108,10 @@ libc {
__pthread_cleanup_routine;
__pthread_getspecific;
__pthread_key_create;
+ __pthread_mutex_destroy;
+ __pthread_mutex_init;
+ __pthread_mutex_lock;
+ __pthread_mutex_unlock;
__pthread_once;
__pthread_setspecific;
pthread_getspecific;
@@ -151,6 +159,7 @@ libc {
__pthread_getattr_default_np;
__pthread_key_delete;
__pthread_keys;
+ __pthread_mutex_unlock_usercnt;
__pthread_setcancelstate;
__pthread_tpp_change_priority;
__pthread_unwind;
@@ -168,11 +177,7 @@ libpthread {
__errno_location;
__h_errno_location;
__pthread_atfork;
- __pthread_mutex_destroy;
- __pthread_mutex_init;
- __pthread_mutex_lock;
__pthread_mutex_trylock;
- __pthread_mutex_unlock;
__pthread_mutexattr_destroy;
__pthread_mutexattr_init;
__pthread_mutexattr_settype;
@@ -190,11 +195,7 @@ libpthread {
pthread_detach;
pthread_join;
pthread_kill_other_threads_np;
- pthread_mutex_destroy;
- pthread_mutex_init;
- pthread_mutex_lock;
pthread_mutex_trylock;
- pthread_mutex_unlock;
pthread_mutexattr_destroy;
pthread_mutexattr_getkind_np;
pthread_mutexattr_init;
diff --git a/nptl/forward.c b/nptl/forward.c
index de4e9cd..c914bae 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -90,14 +90,3 @@ FORWARD (__pthread_cond_timedwait,
const struct timespec *abstime), (cond, mutex, abstime), 0)
versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait,
GLIBC_2_3_2);
-
-
-FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
-
-FORWARD (pthread_mutex_init,
- (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
- (mutex, mutexattr), 0)
-
-FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
-
-FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 646c5a9..271a29c 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -62,10 +62,6 @@ static const struct pthread_functions pthread_functions =
.ptr___pthread_cond_wait_2_0 = __pthread_cond_wait_2_0,
.ptr___pthread_cond_timedwait_2_0 = __pthread_cond_timedwait_2_0,
# endif
- .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
- .ptr_pthread_mutex_init = __pthread_mutex_init,
- .ptr_pthread_mutex_lock = __pthread_mutex_lock,
- .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
.ptr__nptl_setxid = __nptl_setxid,
};
# define ptr_pthread_functions &pthread_functions
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 5cd5d69..332744e 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -395,9 +395,12 @@ extern int __pthread_setschedparam (pthread_t thread_id, int policy,
const struct sched_param *param);
extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
const pthread_mutexattr_t *__mutexattr);
+libc_hidden_proto (__pthread_mutex_init)
extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
+libc_hidden_proto (__pthread_mutex_destroy)
extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex);
extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
+libc_hidden_proto (__pthread_mutex_lock)
extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
const struct timespec *__abstime);
extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex)
@@ -405,8 +408,10 @@ extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex)
extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex)
attribute_hidden;
extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
+libc_hidden_proto (__pthread_mutex_unlock)
extern int __pthread_mutex_unlock_usercnt (pthread_mutex_t *__mutex,
- int __decr) attribute_hidden;
+ int __decr);
+libc_hidden_proto (__pthread_mutex_unlock_usercnt)
extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr);
extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *attr);
extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind);
@@ -560,11 +565,7 @@ libc_hidden_proto (__pthread_sigmask);
#if IS_IN (libpthread)
-hidden_proto (__pthread_mutex_init)
-hidden_proto (__pthread_mutex_destroy)
-hidden_proto (__pthread_mutex_lock)
hidden_proto (__pthread_mutex_trylock)
-hidden_proto (__pthread_mutex_unlock)
hidden_proto (__pthread_rwlock_unlock)
hidden_proto (__pthread_testcancel)
hidden_proto (__pthread_mutexattr_init)
diff --git a/nptl/pthread_mutex_cond_lock.c b/nptl/pthread_mutex_cond_lock.c
index 3386bd6..f3af514 100644
--- a/nptl/pthread_mutex_cond_lock.c
+++ b/nptl/pthread_mutex_cond_lock.c
@@ -15,8 +15,9 @@
/* We need to assume that there are other threads blocked on the futex.
See __pthread_mutex_lock_full for further details. */
#define LLL_ROBUST_MUTEX_LOCK_MODIFIER FUTEX_WAITERS
-#define __pthread_mutex_lock __pthread_mutex_cond_lock
+#define PTHREAD_MUTEX_LOCK __pthread_mutex_cond_lock
#define __pthread_mutex_lock_full __pthread_mutex_cond_lock_full
#define NO_INCR
+#define PTHREAD_MUTEX_VERSIONS 0
#include <nptl/pthread_mutex_lock.c>
diff --git a/nptl/pthread_mutex_destroy.c b/nptl/pthread_mutex_destroy.c
index d2fb816..89825d4 100644
--- a/nptl/pthread_mutex_destroy.c
+++ b/nptl/pthread_mutex_destroy.c
@@ -18,12 +18,12 @@
#include <errno.h>
#include "pthreadP.h"
-
+#include <shlib-compat.h>
#include <stap-probe.h>
int
-__pthread_mutex_destroy (pthread_mutex_t *mutex)
+___pthread_mutex_destroy (pthread_mutex_t *mutex)
{
LIBC_PROBE (mutex_destroy, 1, mutex);
@@ -41,5 +41,13 @@ __pthread_mutex_destroy (pthread_mutex_t *mutex)
return 0;
}
-weak_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
-hidden_def (__pthread_mutex_destroy)
+versioned_symbol (libc, ___pthread_mutex_destroy, __pthread_mutex_destroy,
+ GLIBC_2_34);
+libc_hidden_ver (___pthread_mutex_destroy, __pthread_mutex_destroy)
+versioned_symbol (libc, ___pthread_mutex_destroy, pthread_mutex_destroy,
+ GLIBC_2_0);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_mutex_destroy, __pthread_mutex_destroy,
+ GLIBC_2_0);
+#endif
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index f5c3a4b..328f7b0 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -25,6 +25,7 @@
#include <atomic.h>
#include <pthread-offsets.h>
#include <futex-internal.h>
+#include <shlib-compat.h>
#include <stap-probe.h>
@@ -48,7 +49,7 @@ prio_inherit_missing (void)
}
int
-__pthread_mutex_init (pthread_mutex_t *mutex,
+___pthread_mutex_init (pthread_mutex_t *mutex,
const pthread_mutexattr_t *mutexattr)
{
const struct pthread_mutexattr *imutexattr;
@@ -150,5 +151,12 @@ __pthread_mutex_init (pthread_mutex_t *mutex,
return 0;
}
-weak_alias (__pthread_mutex_init, pthread_mutex_init)
-hidden_def (__pthread_mutex_init)
+versioned_symbol (libpthread, ___pthread_mutex_init, __pthread_mutex_init,
+ GLIBC_2_34);
+libc_hidden_ver (___pthread_mutex_init, __pthread_mutex_init)
+versioned_symbol (libpthread, ___pthread_mutex_init, pthread_mutex_init,
+ GLIBC_2_0);
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_mutex_init, __pthread_mutex_init,
+ GLIBC_2_0);
+#endif
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 8649a92..c9e438e 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -26,6 +26,7 @@
#include <atomic.h>
#include <futex-internal.h>
#include <stap-probe.h>
+#include <shlib-compat.h>
/* Some of the following definitions differ when pthread_mutex_cond_lock.c
includes this file. */
@@ -60,13 +61,15 @@ lll_mutex_lock_optimized (pthread_mutex_t *mutex)
# define LLL_MUTEX_TRYLOCK_ELISION(mutex) \
lll_trylock_elision((mutex)->__data.__lock, (mutex)->__data.__elision, \
PTHREAD_MUTEX_PSHARED (mutex))
+# define PTHREAD_MUTEX_LOCK ___pthread_mutex_lock
+# define PTHREAD_MUTEX_VERSIONS 1
#endif
static int __pthread_mutex_lock_full (pthread_mutex_t *mutex)
__attribute_noinline__;
int
-__pthread_mutex_lock (pthread_mutex_t *mutex)
+PTHREAD_MUTEX_LOCK (pthread_mutex_t *mutex)
{
/* See concurrency notes regarding mutex type which is loaded from __kind
in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */
@@ -604,10 +607,19 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
return 0;
}
-#ifndef __pthread_mutex_lock
-weak_alias (__pthread_mutex_lock, pthread_mutex_lock)
-hidden_def (__pthread_mutex_lock)
-#endif
+
+#if PTHREAD_MUTEX_VERSIONS
+versioned_symbol (libpthread, ___pthread_mutex_lock, __pthread_mutex_lock,
+ GLIBC_2_34);
+libc_hidden_ver (___pthread_mutex_lock, __pthread_mutex_lock)
+versioned_symbol (libpthread, ___pthread_mutex_lock, pthread_mutex_lock,
+ GLIBC_2_0);
+
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_mutex_lock, __pthread_mutex_lock,
+ GLIBC_2_0);
+# endif
+#endif /* PTHREAD_MUTEX_VERSIONS */
#ifdef NO_INCR
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index 655093e..ea88ba2 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -23,6 +23,7 @@
#include <lowlevellock.h>
#include <stap-probe.h>
#include <futex-internal.h>
+#include <shlib-compat.h>
static int
__pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
@@ -44,7 +45,6 @@ lll_mutex_unlock_optimized (pthread_mutex_t *mutex)
}
int
-attribute_hidden
__pthread_mutex_unlock_usercnt (pthread_mutex_t *mutex, int decr)
{
/* See concurrency notes regarding mutex type which is loaded from __kind
@@ -103,6 +103,7 @@ __pthread_mutex_unlock_usercnt (pthread_mutex_t *mutex, int decr)
goto normal;
}
}
+libc_hidden_def (__pthread_mutex_unlock_usercnt)
static int
@@ -363,9 +364,17 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
int
-__pthread_mutex_unlock (pthread_mutex_t *mutex)
+___pthread_mutex_unlock (pthread_mutex_t *mutex)
{
return __pthread_mutex_unlock_usercnt (mutex, 1);
}
-weak_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
-hidden_def (__pthread_mutex_unlock)
+versioned_symbol (libpthread, ___pthread_mutex_unlock, __pthread_mutex_unlock,
+ GLIBC_2_34);
+libc_hidden_ver (___pthread_mutex_unlock, __pthread_mutex_unlock)
+versioned_symbol (libpthread, ___pthread_mutex_unlock, pthread_mutex_unlock,
+ GLIBC_2_0);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_mutex_unlock, __pthread_mutex_unlock,
+ GLIBC_2_0);
+#endif