diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:51 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:51 +0200 |
commit | 27a448223cb2d3bab191c61303db48cee66f871c (patch) | |
tree | e9cb7ab65f5efb5d486c79ee58b4ccadfbe7896c /nptl/pthread_mutex_lock.c | |
parent | 60d5e40ab200033a982a9fd7594a1f83dcdb94a0 (diff) | |
download | glibc-27a448223cb2d3bab191c61303db48cee66f871c.tar.gz glibc-27a448223cb2d3bab191c61303db48cee66f871c.tar.xz glibc-27a448223cb2d3bab191c61303db48cee66f871c.zip |
nptl: Move core mutex functions into libc
This is complicated because of a second compilation of nptl/pthread_mutex_lock.c via nptl/pthread_mutex_cond_lock.c. PTHREAD_MUTEX_VERSIONS is introduced to suppress symbol versions in that case. The symbols __pthread_mutex_lock, __pthread_mutex_unlock, __pthread_mutex_init, __pthread_mutex_destroy, pthread_mutex_lock, pthread_mutex_unlock, pthread_mutex_init, pthread_mutex_destroy have been moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl/pthread_mutex_lock.c')
-rw-r--r-- | nptl/pthread_mutex_lock.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c index 8649a92ffb..c9e438ef37 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 |