work around problems with the libpthread onexit() handler
[openwrt.git] / toolchain / uClibc / patches / 200-libpthread_fix.patch
1 --- a/libpthread/linuxthreads/libc-cancellation.c
2 +++ b/libpthread/linuxthreads/libc-cancellation.c
3 @@ -31,9 +31,6 @@
4  weak_extern (__pthread_do_exit)
5  # endif
6  
7 -int __libc_multiple_threads attribute_hidden __attribute__((nocommon));
8 -strong_alias (__libc_multiple_threads, __librt_multiple_threads)
9 -
10  /* The next two functions are similar to pthread_setcanceltype() but
11     more specialized for the use in the cancelable functions like write().
12     They do not need to check parameters etc.  */
13 --- a/libpthread/linuxthreads/libc_pthread_init.c
14 +++ b/libpthread/linuxthreads/libc_pthread_init.c
15 @@ -33,6 +33,9 @@ libc_hidden_proto(memcpy)
16  libc_hidden_proto(uselocale)
17  #endif
18  
19 +int __libc_multiple_threads attribute_hidden __attribute__((nocommon));
20 +strong_alias (__libc_multiple_threads, __librt_multiple_threads)
21 +
22  int *
23  __libc_pthread_init (functions)
24       const struct pthread_functions *functions;
25 --- a/libpthread/linuxthreads/Makefile.in
26 +++ b/libpthread/linuxthreads/Makefile.in
27 @@ -77,7 +77,7 @@ libpthread-a-y  += $(libpthread_OBJ:.o=.
28  else
29  libpthread-a-y  += $(libpthread_OBJ) $(libpthread-static-y)
30  endif
31 -libpthread-so-y += $(libpthread_OBJ:.o=.os)
32 +libpthread-so-y += $(libpthread_OBJ:.o=.oS)
33  
34  lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
35  lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
36 --- a/libpthread/linuxthreads/pthread.c
37 +++ b/libpthread/linuxthreads/pthread.c
38 @@ -32,6 +32,8 @@
39  #include "smp.h"
40  #include <not-cancel.h>
41  
42 +#define HAVE_Z_NODELETE
43 +
44  /* Sanity check.  */
45  #if !defined __SIGRTMIN || (__SIGRTMAX - __SIGRTMIN) < 3
46  # error "This must not happen"
47 @@ -976,7 +978,9 @@ static void pthread_onexit_process(int r
48      request.req_args.exit.code = retcode;
49      TEMP_FAILURE_RETRY(write_not_cancel(__pthread_manager_request,
50                                         (char *) &request, sizeof(request)));
51 +#ifdef notyet
52      suspend(self);
53 +#endif
54      /* Main thread should accumulate times for thread manager and its
55         children, so that timings for main thread account for all threads. */
56      if (self == __pthread_main_thread)