[git commit future] hide locking related pthread functions in libc.so.

Peter S. Mazinger ps.m at gmx.net
Wed Apr 27 07:29:44 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=85b7344ab62f463a173dfcfa4a2766e05d3cc814
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Make these functions hidden in libc.so, but keep them visible in libc.a.
Use a hidden version of _pthread_cleanup_push_defer/pop_restore for locking.
No need for a visible __pthread_exit function in libc, adapt forward.c for this.
Cleanup forward.c removing all unneeded headers (LT versions).

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 include/libc-symbols.h                             |    6 ++
 libc/misc/internals/__uClibc_main.c                |    4 +-
 libc/sysdeps/linux/common/bits/uClibc_mutex.h      |    4 +-
 libc/sysdeps/linux/common/bits/uClibc_pthread.h    |   16 +++---
 libpthread/linuxthreads.old/Makefile.in            |    4 +-
 libpthread/linuxthreads.old/forward.c              |   55 +++++++------------
 libpthread/linuxthreads.old/internals.h            |    2 +
 libpthread/linuxthreads.old/pthread.c              |    2 +-
 .../sysdeps/pthread/pthread-functions.h            |    2 +-
 .../linuxthreads.old/sysdeps/pthread/pthread.h     |    5 --
 libpthread/linuxthreads/cancel.c                   |    2 +
 libpthread/linuxthreads/forward.c                  |   28 +++++++---
 libpthread/linuxthreads/pthread.c                  |    6 +-
 .../sysdeps/pthread/pthread-functions.h            |    2 +-
 libpthread/nptl/forward.c                          |   17 +++++-
 libpthread/nptl/init.c                             |    6 +-
 libpthread/nptl/pthreadP.h                         |    6 +-
 .../nptl/sysdeps/pthread/pthread-functions.h       |    2 +-
 18 files changed, 91 insertions(+), 78 deletions(-)

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index da9445f..64fb14d 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -480,6 +480,12 @@ FIXME! - ?
 # define __hidden_proto_hiddenattr(attrs...)
 #endif
 
+#ifdef SHARED
+# define attribute_shared_hidden attribute_hidden
+#else
+# define attribute_shared_hidden
+#endif
+
 #if /*!defined STATIC &&*/ !defined __BCC__
 
 # ifndef __ASSEMBLER__
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index fbb25ab..3c254bb 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -84,7 +84,7 @@ __pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
 }
 
 void weak_function
-_pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer,
+__pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer,
                             void (*__routine) (void *), void *__arg)
 {
         __buffer->__routine = __routine;
@@ -92,7 +92,7 @@ _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer *__buffer,
 }
 
 void weak_function
-_pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *__buffer,
+__pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer *__buffer,
                              int __execute)
 {
         if (__execute)
diff --git a/libc/sysdeps/linux/common/bits/uClibc_mutex.h b/libc/sysdeps/linux/common/bits/uClibc_mutex.h
index 94597e8..946dcd0 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_mutex.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_mutex.h
@@ -41,7 +41,7 @@
 		struct _pthread_cleanup_buffer __infunc_pthread_cleanup_buffer;				\
 		int __infunc_need_locking = (C);							\
 		if (__infunc_need_locking) {								\
-			_pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer,			\
+			__pthread_cleanup_push_defer(&__infunc_pthread_cleanup_buffer,			\
 					   (void (*) (void *))__pthread_mutex_unlock,			\
 										&(M));			\
 			__pthread_mutex_lock(&(M));							\
@@ -50,7 +50,7 @@
 
 #define __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M,C)								\
 		if (__infunc_need_locking) {								\
-			_pthread_cleanup_pop_restore(&__infunc_pthread_cleanup_buffer,1);		\
+			__pthread_cleanup_pop_restore(&__infunc_pthread_cleanup_buffer,1);		\
 		}											\
 	} while (0)
 
diff --git a/libc/sysdeps/linux/common/bits/uClibc_pthread.h b/libc/sysdeps/linux/common/bits/uClibc_pthread.h
index c8750c8..f35b8f1 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_pthread.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_pthread.h
@@ -32,15 +32,15 @@ struct _pthread_cleanup_buffer;
 /* Threading functions internal to uClibc.  Make these thread functions
  * weak so that we can elide them from single-threaded processes.  */
 extern int weak_function __pthread_mutex_init (pthread_mutex_t *__mutex,
-		__const pthread_mutexattr_t *__mutex_attr);
-extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex);
-extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex);
-extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex);
-extern void weak_function _pthread_cleanup_push_defer (
+		__const pthread_mutexattr_t *__mutex_attr) attribute_shared_hidden;
+extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex) attribute_shared_hidden;
+extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex) attribute_shared_hidden;
+extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex) attribute_shared_hidden;
+extern void weak_function __pthread_cleanup_push_defer (
 		struct _pthread_cleanup_buffer *__buffer,
-		void (*__routine) (void *), void *__arg);
-extern void weak_function _pthread_cleanup_pop_restore (
+		void (*__routine) (void *), void *__arg) attribute_shared_hidden;
+extern void weak_function __pthread_cleanup_pop_restore (
 		struct _pthread_cleanup_buffer *__buffer,
-		int __execute);
+		int __execute) attribute_shared_hidden;
 
 #endif
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in
index 7ef6218..ffb26ea 100644
--- a/libpthread/linuxthreads.old/Makefile.in
+++ b/libpthread/linuxthreads.old/Makefile.in
@@ -33,14 +33,14 @@ libpthread_OUT := $(top_builddir)libpthread/linuxthreads.old
 -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
 
 libpthread_SRC := \
-	attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
+	attr.c condvar.c errno.c events.c join.c lockfile.c manager.c \
 	mutex.c pt-machine.c ptfork.c ptlongjmp.c \
 	rwlock.c semaphore.c signals.c specific.c spinlock.c wrapsyscall.c
 ifeq ($(UCLIBC_HAS_XLOCALE),y)
 libpthread_SRC += locale.c
 endif
 
-libpthread_SPEC_SRC := pthread.c
+libpthread_SPEC_SRC := pthread.c cancel.c
 libpthread_SPEC_SRC := $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_SPEC_SRC))
 
 # remove generic sources, if arch specific version is present
diff --git a/libpthread/linuxthreads.old/forward.c b/libpthread/linuxthreads.old/forward.c
index e35da69..903d859 100644
--- a/libpthread/linuxthreads.old/forward.c
+++ b/libpthread/linuxthreads.old/forward.c
@@ -17,41 +17,14 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
-#include <stdlib.h>
-#include <dlfcn.h>
-
-/* psm: keep this before internals.h */
-#if 0
-vda: here is why:
-headers contain libc_hidden_proto(foo).
-In libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h
-adding libc_hidden_proto(foo) just before weak_extern (__pthread_initialize)
-will not warn:
-    /* libc_hidden_proto(foo) */
-    weak_extern (__pthread_initialize)
-    /* libc_hidden_proto(foo) */
-but adding after will! Which is extremely strange -
-weak_extern expands into just "#pragma weak __pthread_initialize".
-TODO: determine whether it is a gcc bug or what
-(see gcc.gnu.org/PR36282).
-For now, just include all headers before internals.h
-(they are again included in internals.h - maybe remove them there later)
-#endif
-
-#include <string.h>
-#include <limits.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-
-#include "internals.h"
+#include <pthread.h>
+#include <stdlib.h>	/* EXIT_SUCCESS */
+#include <linuxthreads.old/sysdeps/pthread/pthread-functions.h>
+/* for hidden __pthread_mutex_X */
+#include <bits/uClibc_mutex.h>
 
 /* Pointers to the libc functions.  */
-struct pthread_functions __libc_pthread_functions attribute_hidden;
+struct pthread_functions __libc_pthread_functions;
 
 
 # define FORWARD2(name, rettype, decl, params, defaction) \
@@ -64,6 +37,16 @@ name decl								      \
   return __libc_pthread_functions.ptr_##name params;			      \
 }
 
+# define FORWARD3(name, rettype, decl, params, defaction) \
+rettype									      \
+name decl								      \
+{									      \
+  if (__libc_pthread_functions.ptr_##name == NULL)			      \
+    defaction;								      \
+  while(1)								      \
+    __libc_pthread_functions.ptr_##name params;				      \
+}
+
 # define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, int, decl, params, return defretval)
 
@@ -127,8 +110,8 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
 
 
 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
-FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
-strong_alias (__pthread_exit, pthread_exit)
+/* Comment not valid on uClibc, FORWARD3 added to handle this */
+FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
 
 
 FORWARD (pthread_getschedparam,
@@ -167,8 +150,10 @@ FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
 #endif
 FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
+strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
 #if 0
 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
 #endif
 FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
+strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore)
diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h
index 6da7e45..0e4f75c 100644
--- a/libpthread/linuxthreads.old/internals.h
+++ b/libpthread/linuxthreads.old/internals.h
@@ -465,11 +465,13 @@ void __fresetlockfiles(void);
 void __pthread_manager_adjust_prio(int thread_prio);
 void __pthread_initialize_minimal (void);
 
+#if 0
 extern void __pthread_exit (void *retval)
 #if defined NOT_IN_libc && defined IS_IN_libpthread
 	attribute_noreturn
 #endif
 	;
+#endif
 
 extern int __pthread_attr_setguardsize __P ((pthread_attr_t *__attr,
 					     size_t __guardsize));
diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c
index 054a4ae..232716b 100644
--- a/libpthread/linuxthreads.old/pthread.c
+++ b/libpthread/linuxthreads.old/pthread.c
@@ -346,7 +346,7 @@ struct pthread_functions __pthread_functions =
     .ptr_pthread_cond_wait = pthread_cond_wait,
     .ptr_pthread_cond_timedwait = pthread_cond_timedwait,
     .ptr_pthread_equal = pthread_equal,
-    .ptr___pthread_exit = pthread_exit,
+    .ptr_pthread_exit = pthread_exit,
     .ptr_pthread_getschedparam = pthread_getschedparam,
     .ptr_pthread_setschedparam = pthread_setschedparam,
     .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h
index ab5f767..9ee6b6d 100644
--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h
+++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread-functions.h
@@ -59,7 +59,7 @@ struct pthread_functions
   int (*ptr_pthread_cond_signal) (pthread_cond_t *);
   int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
   int (*ptr_pthread_equal) (pthread_t, pthread_t);
-  void (*ptr___pthread_exit) (void *);
+  void (*ptr_pthread_exit) (void *);
   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
   int (*ptr_pthread_setschedparam) (pthread_t, int,
 				    const struct sched_param *);
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
index 38d5667..61000ed 100644
--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
@@ -642,9 +642,6 @@ extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
 extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
 					 void (*__routine) (void *),
 					 void *__arg) __THROW;
-extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buffer,
-					  void (*__routine) (void *),
-					  void *__arg) __THROW;
 
 /* Remove a cleanup handler as pthread_cleanup_pop does, but also
    restores the cancellation type that was in effect when the matching
@@ -655,8 +652,6 @@ extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *__buff
 
 extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
 					  int __execute) __THROW;
-extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *__buffer,
-					   int __execute) __THROW;
 #endif
 
 
diff --git a/libpthread/linuxthreads/cancel.c b/libpthread/linuxthreads/cancel.c
index 21b8d90..70a4af6 100644
--- a/libpthread/linuxthreads/cancel.c
+++ b/libpthread/linuxthreads/cancel.c
@@ -184,6 +184,7 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
   THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
   THREAD_SETMEM(self, p_cleanup, buffer);
 }
+strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
 void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
 				  int execute)
@@ -197,6 +198,7 @@ void _pthread_cleanup_pop_restore(struct _pthread_cleanup_buffer * buffer,
       THREAD_GETMEM(self, p_canceltype) == PTHREAD_CANCEL_ASYNCHRONOUS)
     __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
 }
+strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore)
 
 extern void __rpc_thread_destroy(void);
 void __pthread_perform_cleanup(char *currentframe)
diff --git a/libpthread/linuxthreads/forward.c b/libpthread/linuxthreads/forward.c
index 9d25d9a..0ecd0e6 100644
--- a/libpthread/linuxthreads/forward.c
+++ b/libpthread/linuxthreads/forward.c
@@ -17,13 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
-#include <stdlib.h>
-#include <dlfcn.h>
-
-/* psm: keep this before internals.h */
-
-#include "internals.h"
+#include <pthread.h>
+#include <stdlib.h>	/* EXIT_SUCCESS */
+#include <linuxthreads/sysdeps/pthread/pthread-functions.h>
+/* for hidden __pthread_mutex_X */
+#include <bits/uClibc_mutex.h>
 
 /* Pointers to the libc functions.  */
 struct pthread_functions __libc_pthread_functions attribute_hidden;
@@ -39,6 +37,16 @@ name decl								      \
   return __libc_pthread_functions.ptr_##name params;			      \
 }
 
+# define FORWARD3(name, rettype, decl, params, defaction) \
+rettype									      \
+name decl								      \
+{									      \
+  if (__libc_pthread_functions.ptr_##name == NULL)			      \
+    defaction;								      \
+  while(1)								      \
+    __libc_pthread_functions.ptr_##name params;				      \
+}
+
 # define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, int, decl, params, return defretval)
 
@@ -102,8 +110,8 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
 
 
 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
-FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
-strong_alias (__pthread_exit, pthread_exit)
+/* Comment does not apply on uClibc, added FORWARD3 to handle this */
+FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
 
 
 FORWARD (pthread_getschedparam,
@@ -140,6 +148,8 @@ FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
 
 FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
 FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return)
+strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
 FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
 FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return)
+strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore)
diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index 0c50760..d8daa17 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -257,7 +257,7 @@ struct pthread_functions __pthread_functions =
     .ptr_pthread_cond_wait = __pthread_cond_wait,
     .ptr_pthread_cond_timedwait = __pthread_cond_timedwait,
     .ptr_pthread_equal = __pthread_equal,
-    .ptr___pthread_exit = __pthread_exit,
+    .ptr_pthread_exit = __pthread_exit,
     .ptr_pthread_getschedparam = __pthread_getschedparam,
     .ptr_pthread_setschedparam = __pthread_setschedparam,
     .ptr_pthread_mutex_destroy = __pthread_mutex_destroy,
@@ -275,9 +275,9 @@ struct pthread_functions __pthread_functions =
     .ptr_pthread_sigwait = __pthread_sigwait,
     .ptr_pthread_raise = __pthread_raise,
     .ptr__pthread_cleanup_push = _pthread_cleanup_push,
-    .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer,
+    .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
     .ptr__pthread_cleanup_pop = _pthread_cleanup_pop,
-    .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore,
+    .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
   };
 #ifdef SHARED
 # define ptr_pthread_functions &__pthread_functions
diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h
index 258e1fc..9984877 100644
--- a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h
+++ b/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h
@@ -55,7 +55,7 @@ struct pthread_functions
   int (*ptr_pthread_cond_signal) (pthread_cond_t *);
   int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
   int (*ptr_pthread_equal) (pthread_t, pthread_t);
-  void (*ptr___pthread_exit) (void *);
+  void (*ptr_pthread_exit) (void *);
   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
   int (*ptr_pthread_setschedparam) (pthread_t, int,
 				    const struct sched_param *);
diff --git a/libpthread/nptl/forward.c b/libpthread/nptl/forward.c
index 7878334..7926e1d 100644
--- a/libpthread/nptl/forward.c
+++ b/libpthread/nptl/forward.c
@@ -42,6 +42,18 @@ name decl								      \
   }									      \
 }
 
+#define FORWARD3(name, rettype, decl, params, defaction) \
+rettype									      \
+name decl								      \
+{									      \
+  if (!__libc_pthread_functions_init) {					      \
+    defaction;								      \
+  } else {								      \
+    while(1)								      \
+      PTHFCT_CALL (ptr_##name, params);					      \
+  }									      \
+}
+
 #define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, int, decl, params, return defretval)
 
@@ -112,8 +124,7 @@ FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
 
 
 /* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
-FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
-strong_alias (__pthread_exit, pthread_exit);
+FORWARD3 (pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS))
 
 
 FORWARD (pthread_getschedparam,
@@ -149,11 +160,13 @@ FORWARD2(_pthread_cleanup_push_defer,
 	 void, (struct _pthread_cleanup_buffer *buffer, void (*routine)(void *), void *arg),
 	 (buffer, routine, arg),
 	 { buffer->__routine = routine; buffer->__arg = arg; });
+strong_alias(_pthread_cleanup_push_defer,__pthread_cleanup_push_defer)
 
 FORWARD2(_pthread_cleanup_pop_restore,
 	 void, (struct _pthread_cleanup_buffer *buffer, int execute),
 	 (buffer, execute),
 	 if (execute) { buffer->__routine(buffer->__arg); });
+strong_alias(_pthread_cleanup_pop_restore,__pthread_cleanup_pop_restore)
 
 FORWARD2(__pthread_unwind,
 	 void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute,
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 379c4bb..8da86e3 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -93,7 +93,7 @@ static const struct pthread_functions pthread_functions =
     .ptr___pthread_cond_wait = __pthread_cond_wait,
     .ptr___pthread_cond_timedwait = __pthread_cond_timedwait,
     .ptr_pthread_equal = __pthread_equal,
-    .ptr___pthread_exit = __pthread_exit,
+    .ptr_pthread_exit = __pthread_exit,
     .ptr_pthread_getschedparam = __pthread_getschedparam,
     .ptr_pthread_setschedparam = __pthread_setschedparam,
     .ptr_pthread_mutex_destroy = INTUSE(__pthread_mutex_destroy),
@@ -111,8 +111,8 @@ static const struct pthread_functions pthread_functions =
     .ptr___pthread_key_create = __pthread_key_create_internal,
     .ptr___pthread_getspecific = __pthread_getspecific_internal,
     .ptr___pthread_setspecific = __pthread_setspecific_internal,
-    .ptr__pthread_cleanup_push_defer = _pthread_cleanup_push_defer,
-    .ptr__pthread_cleanup_pop_restore = _pthread_cleanup_pop_restore,
+    .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,
     .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd,
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index e740486..97a645a 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -552,12 +552,12 @@ extern void __pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer,
 # undef pthread_cleanup_pop
 # define pthread_cleanup_pop(execute) \
     __pthread_cleanup_pop (&_buffer, (execute)); }
-#endif
 
 extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
-					  void (*routine) (void *), void *arg);
+					  void (*routine) (void *), void *arg) attribute_hidden;
 extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
-					   int execute);
+					   int execute) attribute_hidden;
+#endif
 
 /* Old cleanup interfaces, still used in libc.so.  */
 extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
diff --git a/libpthread/nptl/sysdeps/pthread/pthread-functions.h b/libpthread/nptl/sysdeps/pthread/pthread-functions.h
index 0ee39e0..f36ab63 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread-functions.h
+++ b/libpthread/nptl/sysdeps/pthread/pthread-functions.h
@@ -66,7 +66,7 @@ struct pthread_functions
 					   pthread_mutex_t *,
 					   const struct timespec *);
   int (*ptr_pthread_equal) (pthread_t, pthread_t);
-  void (*ptr___pthread_exit) (void *);
+  void (*ptr_pthread_exit) (void *);
   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
   int (*ptr_pthread_setschedparam) (pthread_t, int,
 				    const struct sched_param *);
-- 
1.7.3.4



More information about the uClibc-cvs mailing list