about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile3
-rw-r--r--nptl/Versions28
-rw-r--r--nptl/cleanup_defer_compat.c20
-rw-r--r--nptl/forward.c34
-rw-r--r--nptl/libc-pthread-secondary.c132
-rw-r--r--nptl/nptl-init.c12
-rw-r--r--nptl/pthreadP.h5
-rw-r--r--nptl/pthread_getspecific.c10
-rw-r--r--nptl/pthread_key_create.c10
-rw-r--r--nptl/pthread_mutex_lock.c10
-rw-r--r--nptl/pthread_mutex_unlock.c10
-rw-r--r--nptl/pthread_once.c10
-rw-r--r--nptl/pthread_rwlock_rdlock.c10
-rw-r--r--nptl/pthread_rwlock_unlock.c10
-rw-r--r--nptl/pthread_rwlock_wrlock.c10
-rw-r--r--nptl/pthread_setspecific.c10
16 files changed, 313 insertions, 11 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index faf2c192d5..3a4970e135 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -30,7 +30,7 @@ install-lib-ldscripts := libpthread.so
 
 routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
 	   libc-cleanup libc_pthread_init libc_multiple_threads \
-	   register-atfork unregister-atfork
+	   register-atfork unregister-atfork libc-pthread-secondary
 shared-only-routines = forward
 
 libpthread-routines = nptl-init vars events version pt-interp \
@@ -170,6 +170,7 @@ CFLAGS-pthread_exit.c = -fexceptions
 # Among others, __pthread_unwind is forwarded.  This function must handle
 # exceptions.
 CFLAGS-forward.c = -fexceptions
+CFLAGS-libc-pthread-secondary.c = -fexceptions
 
 # The following are cancellation points.  Some of the functions can
 # block and therefore temporarily enable asynchronous cancellation.
diff --git a/nptl/Versions b/nptl/Versions
index 34e4b464ed..804fd947a1 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -16,6 +16,10 @@ libc {
     pthread_mutex_lock; pthread_mutex_unlock;
     pthread_self;
     pthread_setcancelstate; pthread_setcanceltype;
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+    # Provide additional secondary pthread functions.
+    pthread_once;
+#endif
   }
   GLIBC_2.1 {
     pthread_attr_init;
@@ -36,6 +40,18 @@ libc {
     __libc_pthread_init;
     __libc_current_sigrtmin_private; __libc_current_sigrtmax_private;
     __libc_allocate_rtsig_private;
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+    # Provide additional secondary pthread functions.
+    _pthread_cleanup_pop_restore; _pthread_cleanup_push_defer;
+    __pthread_getspecific; __pthread_setspecific;
+    __pthread_key_create;
+    __pthread_mutex_lock; __pthread_mutex_unlock;
+    __pthread_once;
+    __pthread_rwlock_rdlock; __pthread_rwlock_wrlock;
+    __pthread_rwlock_unlock;
+    __pthread_setcancelstate;
+    __pthread_unwind;
+#endif
   }
 }
 
@@ -274,6 +290,18 @@ libpthread {
     __pthread_clock_gettime; __pthread_clock_settime;
     __pthread_unwind; __pthread_get_minstack;
     __pthread_barrier_init; __pthread_barrier_wait;
+#if HAVE_ASM_SECONDARY_DIRECTIVE
+    # Provide additional secondary pthread functions.
+    _pthread_cleanup_pop_restore; _pthread_cleanup_push_defer;
+    __pthread_getspecific; __pthread_setspecific;
+    __pthread_key_create;
+    __pthread_mutex_lock; __pthread_mutex_unlock;
+    __pthread_once;
+    __pthread_rwlock_rdlock; __pthread_rwlock_wrlock;
+    __pthread_rwlock_unlock;
+    __pthread_setcancelstate;
+    __pthread_unwind;
+#endif
     __shm_directory;
   }
 }
diff --git a/nptl/cleanup_defer_compat.c b/nptl/cleanup_defer_compat.c
index bd70b89556..2c2b0bd5d5 100644
--- a/nptl/cleanup_defer_compat.c
+++ b/nptl/cleanup_defer_compat.c
@@ -95,3 +95,23 @@ _pthread_cleanup_pop_restore (buffer, execute)
     buffer->__routine (buffer->__arg);
 }
 strong_alias (_pthread_cleanup_pop_restore, __pthread_cleanup_pop_restore)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (_pthread_cleanup_push_defer,
+	      _pthread_cleanup_push_defer_2_0)
+strong_alias (_pthread_cleanup_push_defer,
+	      _pthread_cleanup_push_defer_private)
+strong_alias (_pthread_cleanup_pop_restore,
+	      _pthread_cleanup_pop_restore_2_0)
+strong_alias (_pthread_cleanup_pop_restore,
+	      _pthread_cleanup_pop_restore_private)
+compat_symbol (libpthread, _pthread_cleanup_push_defer_2_0,
+	       _pthread_cleanup_push_defer, GLIBC_2_0);
+compat_symbol (libpthread, _pthread_cleanup_push_defer_private,
+	       _pthread_cleanup_push_defer, GLIBC_PRIVATE);
+compat_symbol (libpthread, _pthread_cleanup_pop_restore_2_0,
+	       _pthread_cleanup_pop_restore, GLIBC_2_0);
+compat_symbol (libpthread, _pthread_cleanup_pop_restore_private,
+	       _pthread_cleanup_pop_restore, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/forward.c b/nptl/forward.c
index db74f8df92..2a358055e2 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -31,7 +31,26 @@ struct pthread_functions __libc_pthread_functions attribute_hidden;
 int __libc_pthread_functions_init attribute_hidden;
 
 
-#define FORWARD2(name, rettype, decl, params, defaction) \
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+/* Make sure that it is used only when libpthread is not used.  */
+# define FORWARD2(name, rettype, decl, params, defaction) \
+asm (".secondary "#name);						      \
+rettype									      \
+name decl								      \
+{									      \
+  defaction;								      \
+}
+
+/* Same as FORWARD2, only without return.  */
+# define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
+asm (".secondary "#name);						      \
+rettype									      \
+name decl								      \
+{									      \
+  defaction;								      \
+}
+#else
+# define FORWARD2(name, rettype, decl, params, defaction) \
 rettype									      \
 name decl								      \
 {									      \
@@ -42,7 +61,7 @@ name decl								      \
 }
 
 /* Same as FORWARD2, only without return.  */
-#define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
+# define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
 rettype									      \
 name decl								      \
 {									      \
@@ -51,6 +70,7 @@ name decl								      \
 									      \
   PTHFCT_CALL (ptr_##name, params);					      \
 }
+#endif
 
 #define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, int, decl, params, return defretval)
@@ -197,13 +217,19 @@ FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
 FORWARD2 (pthread_self, pthread_t, (void), (), return 0)
 
 
-FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
-	 0)
+FORWARD (__pthread_setcancelstate, (int state, int *oldstate),
+	 (state, oldstate), 0)
+strong_alias (__pthread_setcancelstate, pthread_setcancelstate)
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+asm (".secondary pthread_setcancelstate");
+#endif
 
 FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
+#ifndef HAVE_ASM_SECONDARY_DIRECTIVE
 FORWARD_NORETURN (__pthread_unwind,
                   void attribute_hidden __attribute ((noreturn))
                   __cleanup_fct_attribute attribute_compat_text_section,
                   (__pthread_unwind_buf_t *buf), (buf),
                   __safe_fatal ())
+#endif
diff --git a/nptl/libc-pthread-secondary.c b/nptl/libc-pthread-secondary.c
new file mode 100644
index 0000000000..71ceea2036
--- /dev/null
+++ b/nptl/libc-pthread-secondary.c
@@ -0,0 +1,132 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_ASM_SECONDARY_DIRECTIVE
+# define pthread_mutex_lock __rename_pthread_mutex_lock
+# define pthread_mutex_unlock __rename_pthread_mutex_unlock
+# include <safe-fatal.h>
+# include <errno.h>
+# undef pthread_mutex_lock
+# undef pthread_mutex_unlock
+
+static void __attribute__ ((unused))
+pthread_secondary_void (void)
+{
+}
+
+static int __attribute__ ((unused))
+pthread_secondary_zero (void)
+{
+  return 0;
+}
+
+static int __attribute__ ((unused))
+pthread_secondary_einval (void)
+{
+  return EINVAL;
+}
+
+/* Use STB_SECONDARY on pthread functions in libc so that they are used
+   only when libpthread is not used.  */
+
+asm (".secondary _pthread_cleanup_push_defer");
+strong_alias (pthread_secondary_void, _pthread_cleanup_push_defer)
+
+asm (".secondary _pthread_cleanup_pop_restore");
+
+void
+_pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
+			      int execute)
+{
+  if (execute)
+    buffer->__routine (buffer->__arg);
+}
+
+asm (".secondary __pthread_cleanup_upto");
+strong_alias (pthread_secondary_void, __pthread_cleanup_upto)
+
+asm (".secondary __pthread_getspecific");
+strong_alias (pthread_secondary_zero, __pthread_getspecific)
+
+asm (".secondary __pthread_setspecific");
+strong_alias (pthread_secondary_einval, __pthread_setspecific)
+
+asm (".secondary __pthread_key_create");
+strong_alias (pthread_secondary_einval, __pthread_key_create)
+
+asm (".secondary __pthread_mutex_lock");
+strong_alias (pthread_secondary_zero, __pthread_mutex_lock)
+
+asm (".secondary __pthread_mutex_unlock");
+strong_alias (pthread_secondary_zero, __pthread_mutex_unlock)
+
+asm (".secondary __pthread_once");
+asm (".secondary pthread_once");
+
+int
+__pthread_once (pthread_once_t *once_control,
+		void (*init_routine) (void))
+{
+  if (*once_control == PTHREAD_ONCE_INIT)
+    {
+      init_routine ();
+      *once_control |= 2;
+    }
+  return 0;
+}
+strong_alias (__pthread_once, pthread_once)
+
+asm (".secondary __pthread_rwlock_rdlock");
+strong_alias (pthread_secondary_zero, __pthread_rwlock_rdlock)
+
+asm (".secondary __pthread_rwlock_unlock");
+strong_alias (pthread_secondary_zero, __pthread_rwlock_unlock)
+
+asm (".secondary __pthread_rwlock_wrlock");
+strong_alias (pthread_secondary_zero, __pthread_rwlock_wrlock)
+
+asm (".secondary __pthread_unwind");
+
+void
+__attribute ((noreturn))
+__cleanup_fct_attribute
+attribute_compat_text_section
+__pthread_unwind (__pthread_unwind_buf_t *buf)
+{
+  /* We cannot call abort() here.  */
+  typedef __typeof (__safe_fatal) *fn_noreturn __attribute ((noreturn));
+  fn_noreturn fn = (fn_noreturn) __safe_fatal;
+  fn ();
+}
+
+# ifndef SHARED
+asm (".secondary __pthread_setcancelstate");
+strong_alias (pthread_secondary_zero, __pthread_setcancelstate)
+
+asm (".secondary pthread_mutex_lock");
+strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
+
+asm (".secondary pthread_mutex_unlock");
+strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
+
+asm (".secondary __pthread_rwlock_destroy");
+strong_alias (pthread_secondary_zero, __pthread_rwlock_destroy)
+
+asm (".secondary __pthread_rwlock_init");
+strong_alias (pthread_secondary_zero, __pthread_rwlock_init)
+# endif
+#endif
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index c043fb50ab..bda1df236d 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -87,10 +87,11 @@ static void nptl_freeres (void);
 
 static const struct pthread_functions pthread_functions =
   {
+# ifndef HAVE_ASM_SECONDARY_DIRECTIVE
     .ptr_pthread_attr_destroy = __pthread_attr_destroy,
-# if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
+#  if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
     .ptr___pthread_attr_init_2_0 = __pthread_attr_init_2_0,
-# endif
+#  endif
     .ptr___pthread_attr_init_2_1 = __pthread_attr_init_2_1,
     .ptr_pthread_attr_getdetachstate = __pthread_attr_getdetachstate,
     .ptr_pthread_attr_setdetachstate = __pthread_attr_setdetachstate,
@@ -127,9 +128,8 @@ static const struct pthread_functions pthread_functions =
     .ptr_pthread_mutex_lock = __pthread_mutex_lock,
     .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
     .ptr_pthread_self = __pthread_self,
-    .ptr_pthread_setcancelstate = __pthread_setcancelstate,
+    .ptr___pthread_setcancelstate = __pthread_setcancelstate,
     .ptr_pthread_setcanceltype = __pthread_setcanceltype,
-    .ptr___pthread_cleanup_upto = __pthread_cleanup_upto,
     .ptr___pthread_once = __pthread_once,
     .ptr___pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
     .ptr___pthread_rwlock_wrlock = __pthread_rwlock_wrlock,
@@ -139,8 +139,10 @@ static const struct pthread_functions pthread_functions =
     .ptr___pthread_setspecific = __pthread_setspecific,
     .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
     .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
-    .ptr_nthreads = &__nptl_nthreads,
     .ptr___pthread_unwind = &__pthread_unwind,
+# endif
+    .ptr___pthread_cleanup_upto = __pthread_cleanup_upto,
+    .ptr_nthreads = &__nptl_nthreads,
     .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
 # ifdef SIGSETXID
     .ptr__nptl_setxid = __nptl_setxid,
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 8cd51c65ad..d3e09651b9 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -244,7 +244,8 @@ extern int __pthread_debug attribute_hidden;
 
 extern void __pthread_unwind (__pthread_unwind_buf_t *__buf)
      __cleanup_fct_attribute __attribute ((__noreturn__))
-#if !defined SHARED && !IS_IN (libpthread)
+#if !defined SHARED && !IS_IN (libpthread) \
+    && !defined HAVE_ASM_SECONDARY_DIRECTIVE
      weak_function
 #endif
      ;
@@ -506,6 +507,7 @@ hidden_proto (__pthread_setspecific)
 hidden_proto (__pthread_once)
 #endif
 
+#if !IS_IN (libc)
 extern int __pthread_cond_broadcast_2_0 (pthread_cond_2_0_t *cond);
 extern int __pthread_cond_destroy_2_0 (pthread_cond_2_0_t *cond);
 extern int __pthread_cond_init_2_0 (pthread_cond_2_0_t *cond,
@@ -516,6 +518,7 @@ extern int __pthread_cond_timedwait_2_0 (pthread_cond_2_0_t *cond,
 					 const struct timespec *abstime);
 extern int __pthread_cond_wait_2_0 (pthread_cond_2_0_t *cond,
 				    pthread_mutex_t *mutex);
+#endif
 
 extern int __pthread_getaffinity_np (pthread_t th, size_t cpusetsize,
 				     cpu_set_t *cpuset);
diff --git a/nptl/pthread_getspecific.c b/nptl/pthread_getspecific.c
index 0bee354817..b68395f86f 100644
--- a/nptl/pthread_getspecific.c
+++ b/nptl/pthread_getspecific.c
@@ -66,3 +66,13 @@ __pthread_getspecific (key)
 }
 strong_alias (__pthread_getspecific, pthread_getspecific)
 hidden_def (__pthread_getspecific)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_getspecific, __pthread_getspecific_2_0)
+strong_alias (__pthread_getspecific, __pthread_getspecific_private)
+compat_symbol (libpthread, __pthread_getspecific_2_0,
+	       __pthread_getspecific, GLIBC_2_0);
+compat_symbol (libpthread, __pthread_getspecific_private,
+	       __pthread_getspecific, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_key_create.c b/nptl/pthread_key_create.c
index a642c6929f..3f0071a4aa 100644
--- a/nptl/pthread_key_create.c
+++ b/nptl/pthread_key_create.c
@@ -51,3 +51,13 @@ __pthread_key_create (key, destr)
 }
 strong_alias (__pthread_key_create, pthread_key_create)
 hidden_def (__pthread_key_create)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_key_create, __pthread_key_create_2_0)
+strong_alias (__pthread_key_create, __pthread_key_create_private)
+compat_symbol (libpthread, __pthread_key_create_2_0,
+	       __pthread_key_create, GLIBC_2_0);
+compat_symbol (libpthread, __pthread_key_create_private,
+	       __pthread_key_create, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 9a3b46624d..9ebc9f4566 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -516,6 +516,16 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
 #ifndef __pthread_mutex_lock
 strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
 hidden_def (__pthread_mutex_lock)
+
+# ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_mutex_lock, __pthread_mutex_lock_2_0)
+strong_alias (__pthread_mutex_lock, __pthread_mutex_lock_private)
+compat_symbol (libpthread, __pthread_mutex_lock_2_0,
+	       __pthread_mutex_lock, GLIBC_2_0);
+compat_symbol (libpthread, __pthread_mutex_lock_private,
+	       __pthread_mutex_lock, GLIBC_PRIVATE);
+# endif
 #endif
 
 
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index 80939ba8b0..bcb92b18e2 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -316,3 +316,13 @@ __pthread_mutex_unlock (mutex)
 }
 strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
 hidden_def (__pthread_mutex_unlock)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_mutex_unlock, __pthread_mutex_unlock_2_0)
+strong_alias (__pthread_mutex_unlock, __pthread_mutex_unlock_private)
+compat_symbol (libpthread, __pthread_mutex_unlock_2_0,
+	       __pthread_mutex_unlock, GLIBC_2_0);
+compat_symbol (libpthread, __pthread_mutex_unlock_private,
+	       __pthread_mutex_unlock, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_once.c b/nptl/pthread_once.c
index 3c5bc33622..81d3f25848 100644
--- a/nptl/pthread_once.c
+++ b/nptl/pthread_once.c
@@ -144,3 +144,13 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
 }
 weak_alias (__pthread_once, pthread_once)
 hidden_def (__pthread_once)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_once, __pthread_once_2_0)
+strong_alias (__pthread_once, __pthread_once_private)
+compat_symbol (libpthread, __pthread_once_2_0,
+	       __pthread_once, GLIBC_2_0);
+compat_symbol (libpthread, __pthread_once_private,
+	       __pthread_once, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_rwlock_rdlock.c b/nptl/pthread_rwlock_rdlock.c
index eb7ac8d226..f81097627f 100644
--- a/nptl/pthread_rwlock_rdlock.c
+++ b/nptl/pthread_rwlock_rdlock.c
@@ -179,3 +179,13 @@ __pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
 
 weak_alias (__pthread_rwlock_rdlock, pthread_rwlock_rdlock)
 hidden_def (__pthread_rwlock_rdlock)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_rwlock_rdlock, __pthread_rwlock_rdlock_2_2)
+strong_alias (__pthread_rwlock_rdlock, __pthread_rwlock_rdlock_private)
+compat_symbol (libpthread, __pthread_rwlock_rdlock_2_2,
+	       __pthread_rwlock_rdlock, GLIBC_2_2);
+compat_symbol (libpthread, __pthread_rwlock_rdlock_private,
+	       __pthread_rwlock_rdlock, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_rwlock_unlock.c b/nptl/pthread_rwlock_unlock.c
index bdd115d6bd..240dd495a5 100644
--- a/nptl/pthread_rwlock_unlock.c
+++ b/nptl/pthread_rwlock_unlock.c
@@ -73,3 +73,13 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
 
 weak_alias (__pthread_rwlock_unlock, pthread_rwlock_unlock)
 hidden_def (__pthread_rwlock_unlock)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_rwlock_unlock, __pthread_rwlock_unlock_2_2)
+strong_alias (__pthread_rwlock_unlock, __pthread_rwlock_unlock_private)
+compat_symbol (libpthread, __pthread_rwlock_unlock_2_2,
+	       __pthread_rwlock_unlock, GLIBC_2_2);
+compat_symbol (libpthread, __pthread_rwlock_unlock_private,
+	       __pthread_rwlock_unlock, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_rwlock_wrlock.c b/nptl/pthread_rwlock_wrlock.c
index 60fa909340..5167f136be 100644
--- a/nptl/pthread_rwlock_wrlock.c
+++ b/nptl/pthread_rwlock_wrlock.c
@@ -127,3 +127,13 @@ __pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
 
 weak_alias (__pthread_rwlock_wrlock, pthread_rwlock_wrlock)
 hidden_def (__pthread_rwlock_wrlock)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_rwlock_wrlock, __pthread_rwlock_wrlock_2_2)
+strong_alias (__pthread_rwlock_wrlock, __pthread_rwlock_wrlock_private)
+compat_symbol (libpthread, __pthread_rwlock_wrlock_2_2,
+	       __pthread_rwlock_wrlock, GLIBC_2_2);
+compat_symbol (libpthread, __pthread_rwlock_wrlock_private,
+	       __pthread_rwlock_wrlock, GLIBC_PRIVATE);
+#endif
diff --git a/nptl/pthread_setspecific.c b/nptl/pthread_setspecific.c
index a9cf26c195..3bc64eeaf1 100644
--- a/nptl/pthread_setspecific.c
+++ b/nptl/pthread_setspecific.c
@@ -93,3 +93,13 @@ __pthread_setspecific (key, value)
 }
 strong_alias (__pthread_setspecific, pthread_setspecific)
 hidden_def (__pthread_setspecific)
+
+#ifdef SHARED
+# include <shlib-compat.h>
+strong_alias (__pthread_setspecific, __pthread_setspecific_2_0)
+strong_alias (__pthread_setspecific, __pthread_setspecific_private)
+compat_symbol (libpthread, __pthread_setspecific_2_0,
+	       __pthread_setspecific, GLIBC_2_0);
+compat_symbol (libpthread, __pthread_setspecific_private,
+	       __pthread_setspecific, GLIBC_PRIVATE);
+#endif