summaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-01-12 07:29:55 +0000
committerUlrich Drepper <drepper@redhat.com>2001-01-12 07:29:55 +0000
commit5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7 (patch)
tree20f76d7169cf0550d4224e7a2b62aba4943bc4c1 /linuxthreads
parent7e36861e77d7edde557ebf1172271e922c9a51ff (diff)
Update.
2001-01-11 Jakub Jelinek <jakub@redhat.com> * stdlib/cxa_atexit.c (__cxa_atexit): Cast to (void *, int) func. * stdlib/cxa_finalize.c (__cxa_finalize): Add hidden second argument. * stdlib/cxa_on_exit.c: Remove. * stdlib/Makefile: Revert last patch. * stdlib/Versions: Likewise. * include/stdlib.h: Likewise. * stdlib/exit.h: Revert last patch. (struct exit_function): Add second argument to cxa fn. * stdlib/exit.c: Revert last patch. (exit): Add hidden second argument.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog12
-rw-r--r--linuxthreads/Makefile3
-rw-r--r--linuxthreads/pthread.c38
3 files changed, 46 insertions, 7 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 36ad0c6628..a56b99ce85 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,15 @@
+2001-01-11 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile (CFLAGS-pthread.c): Pass -DHAVE_Z_NODELETE if ld supports
+ -z nodelete.
+ * pthread.c (pthread_exit_process): Rename to...
+ (pthread_onexit_process): ...this.
+ (pthread_atexit_process, pthread_atexit_retcode): New.
+ (pthread_initialize): Call __cxa_atexit instead of __cxa_on_exit
+ and only if HAVE_Z_NODELETE is not defined.
+ (__pthread_initialize_manager): Register pthread_atexit_retcode
+ with __cxa_atexit.
+
2001-01-11 Ulrich Drepper <drepper@redhat.com>
* pthread.c (pthread_initialize): Use __cxs_on_exit not __cxa_atexit.
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index ce7c5dd437..da3c3d22f7 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -54,9 +54,10 @@ endif
include ../Rules
+znodelete-yes = -DHAVE_Z_NODELETE
CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-specific.c += -D__NO_WEAK_PTHREAD_ALIASES
-CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES
+CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES $(znodelete-$(have-z-nodelete))
CFLAGS-ptfork.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\"
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 8221787a30..df1d00b05a 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -216,7 +216,11 @@ const int __linuxthread_pthread_sizeof_descr
/* Forward declarations */
-static void pthread_exit_process(int retcode, void *arg);
+static void pthread_onexit_process(int retcode, void *arg);
+#ifndef HAVE_Z_NODELETE
+static void pthread_atexit_process(void *arg, int retcode);
+static void pthread_atexit_retcode(void *arg, int retcode);
+#endif
static void pthread_handle_sigcancel(int sig);
static void pthread_handle_sigrestart(int sig);
static void pthread_handle_sigdebug(int sig);
@@ -433,12 +437,14 @@ static void pthread_initialize(void)
sigprocmask(SIG_BLOCK, &mask, NULL);
/* Register an exit function to kill all other threads. */
/* Do it early so that user-registered atexit functions are called
- before pthread_exit_process. */
+ before pthread_*exit_process. */
+#ifndef HAVE_Z_NODELETE
if (__builtin_expect (&__dso_handle != NULL, 1))
- __cxa_on_exit((void (*) (void *)) pthread_exit_process, NULL,
+ __cxa_atexit ((void (*) (void *)) pthread_atexit_process, NULL,
__dso_handle);
else
- __on_exit (pthread_exit_process, NULL);
+#endif
+ __on_exit (pthread_onexit_process, NULL);
/* How many processors. */
__pthread_smp_kernel = is_smp_system ();
}
@@ -456,6 +462,12 @@ int __pthread_initialize_manager(void)
struct rlimit limit;
int max_stack;
+#ifndef HAVE_Z_NODELETE
+ if (__builtin_expect (&__dso_handle != NULL, 1))
+ __cxa_atexit ((void (*) (void *)) pthread_atexit_retcode, NULL,
+ __dso_handle);
+#endif
+
getrlimit(RLIMIT_STACK, &limit);
#ifdef FLOATING_STACKS
if (limit.rlim_cur == RLIM_INFINITY)
@@ -723,7 +735,7 @@ weak_alias (__pthread_yield, pthread_yield)
/* Process-wide exit() request */
-static void pthread_exit_process(int retcode, void *arg)
+static void pthread_onexit_process(int retcode, void *arg)
{
if (__builtin_expect (__pthread_manager_request, 0) >= 0) {
struct pthread_request request;
@@ -745,6 +757,20 @@ static void pthread_exit_process(int retcode, void *arg)
}
}
+#ifndef HAVE_Z_NODELETE
+static int __pthread_atexit_retcode;
+
+static void pthread_atexit_process(void *arg, int retcode)
+{
+ pthread_onexit_process (retcode ?: __pthread_atexit_retcode, arg);
+}
+
+static void pthread_atexit_retcode(void *arg, int retcode)
+{
+ __pthread_atexit_retcode = retcode;
+}
+#endif
+
/* The handler for the RESTART signal just records the signal received
in the thread descriptor, and optionally performs a siglongjmp
(for pthread_cond_timedwait). */
@@ -851,7 +877,7 @@ void __pthread_kill_other_threads_np(void)
{
struct sigaction sa;
/* Terminate all other threads and thread manager */
- pthread_exit_process(0, NULL);
+ pthread_onexit_process(0, NULL);
/* Make current thread the main thread in case the calling thread
changes its mind, does not exec(), and creates new threads instead. */
__pthread_reset_main_thread();