Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ulrich Drepper committed Jan 12, 2001
1 parent 7e36861 commit 5ef50d0
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 79 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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 ...
Expand Down
9 changes: 4 additions & 5 deletions FAQ
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Expand Down
9 changes: 4 additions & 5 deletions FAQ.in
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 12 additions & 0 deletions linuxthreads/ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion linuxthreads/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)\"
Expand Down
38 changes: 32 additions & 6 deletions linuxthreads/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ();
}
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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). */
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions stdlib/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 0 additions & 4 deletions stdlib/Versions
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 2 additions & 2 deletions stdlib/cxa_atexit.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions stdlib/cxa_finalize.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
}
38 changes: 0 additions & 38 deletions stdlib/cxa_on_exit.c

This file was deleted.

5 changes: 1 addition & 4 deletions stdlib/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
11 changes: 2 additions & 9 deletions stdlib/exit.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ enum
ef_us,
ef_on,
ef_at,
ef_cxa,
ef_cxa2
ef_cxa
};

struct exit_function
Expand All @@ -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
Expand Down

0 comments on commit 5ef50d0

Please sign in to comment.