aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--FAQ9
-rw-r--r--FAQ.in9
-rw-r--r--include/stdlib.h1
-rw-r--r--linuxthreads/ChangeLog12
-rw-r--r--linuxthreads/Makefile3
-rw-r--r--linuxthreads/pthread.c38
-rw-r--r--stdlib/Makefile4
-rw-r--r--stdlib/Versions4
-rw-r--r--stdlib/cxa_atexit.c4
-rw-r--r--stdlib/cxa_finalize.c4
-rw-r--r--stdlib/cxa_on_exit.c38
-rw-r--r--stdlib/exit.c5
-rw-r--r--stdlib/exit.h11
14 files changed, 76 insertions, 79 deletions
diff --git a/ChangeLog b/ChangeLog
index 366482af62..e43678d171 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+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.
+
2001-01-11 H.J. Lu <hjl@gnu.org>
* elf/dl-libc.c (do_dlopen): Move DL_STATIC_INIT to ...
diff --git a/FAQ b/FAQ
index 696d65715c..2680773a08 100644
--- a/FAQ
+++ b/FAQ
@@ -827,7 +827,7 @@ you got with your distribution.
glibc 2.x?
{AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3 or later.
-But you should get at least gcc 2.95.2 (or later versions) instead.
+But you should get at least gcc 2.95.2.1 (or later versions) instead.
2.10. The `gencat' utility cannot process the catalog sources which
@@ -1245,10 +1245,9 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
2.35. When recompiling GCC, I get compilation errors in libio.
-{BH} You are trying to recompile gcc 2.95.2? After upgrading to glibc 2.2,
-you need to apply a patch to the gcc sources, because the fpos_t type and
-a few libio internals have changed in glibc 2.2. T he patch is at
-http://clisp.cons.org/~haible/gcc-glibc-2.2-compat.diff
+{BH} You are trying to recompile gcc 2.95.2? Use gcc 2.95.2.1 instead.
+This version is needed because the fpos_t type and a few libio internals
+have changed in glibc 2.2, and gcc 2.95.2.1 contains a corresponding patch.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
diff --git a/FAQ.in b/FAQ.in
index 51b7d53a86..7bc22de1cc 100644
--- a/FAQ.in
+++ b/FAQ.in
@@ -626,7 +626,7 @@ you got with your distribution.
glibc 2.x?
{AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3 or later.
-But you should get at least gcc 2.95.2 (or later versions) instead.
+But you should get at least gcc 2.95.2.1 (or later versions) instead.
?? The `gencat' utility cannot process the catalog sources which
were used on my Linux libc5 based system. Why?
@@ -1020,10 +1020,9 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff
?? When recompiling GCC, I get compilation errors in libio.
-{BH} You are trying to recompile gcc 2.95.2? After upgrading to glibc 2.2,
-you need to apply a patch to the gcc sources, because the fpos_t type and
-a few libio internals have changed in glibc 2.2. T he patch is at
-http://clisp.cons.org/~haible/gcc-glibc-2.2-compat.diff
+{BH} You are trying to recompile gcc 2.95.2? Use gcc 2.95.2.1 instead.
+This version is needed because the fpos_t type and a few libio internals
+have changed in glibc 2.2, and gcc 2.95.2.1 contains a corresponding patch.
? Source and binary incompatibilities, and what to do about them
diff --git a/include/stdlib.h b/include/stdlib.h
index 9f68d4d631..d3c8779fcd 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -55,7 +55,6 @@ extern void _quicksort (void *const pbase, size_t total_elems,
size_t size, __compar_fn_t cmp);
extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
-extern int __cxa_on_exit (void (*func) (int, void *), void *arg, void *d);
extern void __cxa_finalize (void *d);
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();
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 61d2059e55..a20a30768f 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999, 2000 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
@@ -29,7 +29,7 @@ routines := \
abort \
bsearch qsort msort \
getenv putenv setenv secure-getenv \
- exit on_exit atexit cxa_atexit cxa_on_exit cxa_finalize \
+ exit on_exit atexit cxa_atexit cxa_finalize \
abs labs llabs \
div ldiv lldiv \
mblen mbstowcs mbtowc wcstombs wctomb \
diff --git a/stdlib/Versions b/stdlib/Versions
index d189f4bdbd..034125a200 100644
--- a/stdlib/Versions
+++ b/stdlib/Versions
@@ -94,8 +94,4 @@ libc {
# used by new G++ ABI
__cxa_atexit; __cxa_finalize;
}
- GLIBC_2.2.1 {
- # used in the thread library
- __cxa_on_exit;
- }
}
diff --git a/stdlib/cxa_atexit.c b/stdlib/cxa_atexit.c
index 180d74a54d..e07d0eda35 100644
--- a/stdlib/cxa_atexit.c
+++ b/stdlib/cxa_atexit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001 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
@@ -31,7 +31,7 @@ __cxa_atexit (void (*func) (void *), void *arg, void *d)
return -1;
new->flavor = ef_cxa;
- new->func.cxa.fn = func;
+ new->func.cxa.fn = (void (*) (void *, int)) func;
new->func.cxa.arg = arg;
new->func.cxa.dso_handle = d;
return 0;
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index da2d91512e..ad69d5c9ff 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001 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
@@ -39,6 +39,6 @@ __cxa_finalize (void *d)
if (d == f->func.cxa.dso_handle
/* We don't want to run this cleanup more than once. */
&& compare_and_swap (&f->flavor, ef_cxa, ef_free))
- (*f->func.cxa.fn) (f->func.cxa.arg);
+ (*f->func.cxa.fn) (f->func.cxa.arg, 0);
}
}
diff --git a/stdlib/cxa_on_exit.c b/stdlib/cxa_on_exit.c
deleted file mode 100644
index c24fa1e983..0000000000
--- a/stdlib/cxa_on_exit.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2001 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <stdlib.h>
-#include "exit.h"
-
-/* Register a function to be called by exit or when a shared library
- is unloaded. This function is only called from code generated by
- the C++ compiler. */
-int
-__cxa_on_exit (void (*func) (int, void *), void *arg, void *d)
-{
- struct exit_function *new = __new_exitfn ();
-
- if (new == NULL)
- return -1;
-
- new->flavor = ef_cxa2;
- new->func.cxa2.fn = func;
- new->func.cxa2.arg = arg;
- new->func.cxa2.dso_handle = d;
- return 0;
-}
diff --git a/stdlib/exit.c b/stdlib/exit.c
index 5714999117..b2ebe5ff85 100644
--- a/stdlib/exit.c
+++ b/stdlib/exit.c
@@ -57,10 +57,7 @@ exit (int status)
(*f->func.at) ();
break;
case ef_cxa:
- (*f->func.cxa.fn) (f->func.cxa.arg);
- break;
- case ef_cxa2:
- (*f->func.cxa2.fn) (status, f->func.cxa2.arg);
+ (*f->func.cxa.fn) (f->func.cxa.arg, status);
break;
}
}
diff --git a/stdlib/exit.h b/stdlib/exit.h
index 66819dd045..2b52dc5f7e 100644
--- a/stdlib/exit.h
+++ b/stdlib/exit.h
@@ -26,8 +26,7 @@ enum
ef_us,
ef_on,
ef_at,
- ef_cxa,
- ef_cxa2
+ ef_cxa
};
struct exit_function
@@ -45,16 +44,10 @@ struct exit_function
} on;
struct
{
- void (*fn) (void *arg);
+ void (*fn) (void *arg, int status);
void *arg;
void *dso_handle;
} cxa;
- struct
- {
- void (*fn) (int status, void *arg);
- void *arg;
- void *dso_handle;
- } cxa2;
} func;
};
struct exit_function_list