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.
This commit is contained in:
parent
7e36861e77
commit
5ef50d00de
13
ChangeLog
13
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>
|
2001-01-11 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
* elf/dl-libc.c (do_dlopen): Move DL_STATIC_INIT to ...
|
* elf/dl-libc.c (do_dlopen): Move DL_STATIC_INIT to ...
|
||||||
|
9
FAQ
9
FAQ
@ -827,7 +827,7 @@ you got with your distribution.
|
|||||||
glibc 2.x?
|
glibc 2.x?
|
||||||
|
|
||||||
{AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3 or later.
|
{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
|
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.
|
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,
|
{BH} You are trying to recompile gcc 2.95.2? Use gcc 2.95.2.1 instead.
|
||||||
you need to apply a patch to the gcc sources, because the fpos_t type and
|
This version is needed because the fpos_t type and a few libio internals
|
||||||
a few libio internals have changed in glibc 2.2. T he patch is at
|
have changed in glibc 2.2, and gcc 2.95.2.1 contains a corresponding patch.
|
||||||
http://clisp.cons.org/~haible/gcc-glibc-2.2-compat.diff
|
|
||||||
|
|
||||||
|
|
||||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
|
9
FAQ.in
9
FAQ.in
@ -626,7 +626,7 @@ you got with your distribution.
|
|||||||
glibc 2.x?
|
glibc 2.x?
|
||||||
|
|
||||||
{AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3 or later.
|
{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
|
?? The `gencat' utility cannot process the catalog sources which
|
||||||
were used on my Linux libc5 based system. Why?
|
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.
|
?? 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,
|
{BH} You are trying to recompile gcc 2.95.2? Use gcc 2.95.2.1 instead.
|
||||||
you need to apply a patch to the gcc sources, because the fpos_t type and
|
This version is needed because the fpos_t type and a few libio internals
|
||||||
a few libio internals have changed in glibc 2.2. T he patch is at
|
have changed in glibc 2.2, and gcc 2.95.2.1 contains a corresponding patch.
|
||||||
http://clisp.cons.org/~haible/gcc-glibc-2.2-compat.diff
|
|
||||||
|
|
||||||
|
|
||||||
? Source and binary incompatibilities, and what to do about them
|
? Source and binary incompatibilities, and what to do about them
|
||||||
|
@ -55,7 +55,6 @@ extern void _quicksort (void *const pbase, size_t total_elems,
|
|||||||
size_t size, __compar_fn_t cmp);
|
size_t size, __compar_fn_t cmp);
|
||||||
|
|
||||||
extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
|
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);
|
extern void __cxa_finalize (void *d);
|
||||||
|
|
||||||
|
@ -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>
|
2001-01-11 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* pthread.c (pthread_initialize): Use __cxs_on_exit not __cxa_atexit.
|
* pthread.c (pthread_initialize): Use __cxs_on_exit not __cxa_atexit.
|
||||||
|
@ -54,9 +54,10 @@ endif
|
|||||||
|
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
|
znodelete-yes = -DHAVE_Z_NODELETE
|
||||||
CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
|
CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
|
||||||
CFLAGS-specific.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-ptfork.c += -D__NO_WEAK_PTHREAD_ALIASES
|
||||||
CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES
|
CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES
|
||||||
CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\"
|
CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\"
|
||||||
|
@ -216,7 +216,11 @@ const int __linuxthread_pthread_sizeof_descr
|
|||||||
|
|
||||||
/* Forward declarations */
|
/* 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_sigcancel(int sig);
|
||||||
static void pthread_handle_sigrestart(int sig);
|
static void pthread_handle_sigrestart(int sig);
|
||||||
static void pthread_handle_sigdebug(int sig);
|
static void pthread_handle_sigdebug(int sig);
|
||||||
@ -433,12 +437,14 @@ static void pthread_initialize(void)
|
|||||||
sigprocmask(SIG_BLOCK, &mask, NULL);
|
sigprocmask(SIG_BLOCK, &mask, NULL);
|
||||||
/* Register an exit function to kill all other threads. */
|
/* Register an exit function to kill all other threads. */
|
||||||
/* Do it early so that user-registered atexit functions are called
|
/* 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))
|
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);
|
__dso_handle);
|
||||||
else
|
else
|
||||||
__on_exit (pthread_exit_process, NULL);
|
#endif
|
||||||
|
__on_exit (pthread_onexit_process, NULL);
|
||||||
/* How many processors. */
|
/* How many processors. */
|
||||||
__pthread_smp_kernel = is_smp_system ();
|
__pthread_smp_kernel = is_smp_system ();
|
||||||
}
|
}
|
||||||
@ -456,6 +462,12 @@ int __pthread_initialize_manager(void)
|
|||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
int max_stack;
|
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);
|
getrlimit(RLIMIT_STACK, &limit);
|
||||||
#ifdef FLOATING_STACKS
|
#ifdef FLOATING_STACKS
|
||||||
if (limit.rlim_cur == RLIM_INFINITY)
|
if (limit.rlim_cur == RLIM_INFINITY)
|
||||||
@ -723,7 +735,7 @@ weak_alias (__pthread_yield, pthread_yield)
|
|||||||
|
|
||||||
/* Process-wide exit() request */
|
/* 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) {
|
if (__builtin_expect (__pthread_manager_request, 0) >= 0) {
|
||||||
struct pthread_request request;
|
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
|
/* The handler for the RESTART signal just records the signal received
|
||||||
in the thread descriptor, and optionally performs a siglongjmp
|
in the thread descriptor, and optionally performs a siglongjmp
|
||||||
(for pthread_cond_timedwait). */
|
(for pthread_cond_timedwait). */
|
||||||
@ -851,7 +877,7 @@ void __pthread_kill_other_threads_np(void)
|
|||||||
{
|
{
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
/* Terminate all other threads and thread manager */
|
/* 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
|
/* Make current thread the main thread in case the calling thread
|
||||||
changes its mind, does not exec(), and creates new threads instead. */
|
changes its mind, does not exec(), and creates new threads instead. */
|
||||||
__pthread_reset_main_thread();
|
__pthread_reset_main_thread();
|
||||||
|
@ -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.
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
# The GNU C Library is free software; you can redistribute it and/or
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -29,7 +29,7 @@ routines := \
|
|||||||
abort \
|
abort \
|
||||||
bsearch qsort msort \
|
bsearch qsort msort \
|
||||||
getenv putenv setenv secure-getenv \
|
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 \
|
abs labs llabs \
|
||||||
div ldiv lldiv \
|
div ldiv lldiv \
|
||||||
mblen mbstowcs mbtowc wcstombs wctomb \
|
mblen mbstowcs mbtowc wcstombs wctomb \
|
||||||
|
@ -94,8 +94,4 @@ libc {
|
|||||||
# used by new G++ ABI
|
# used by new G++ ABI
|
||||||
__cxa_atexit; __cxa_finalize;
|
__cxa_atexit; __cxa_finalize;
|
||||||
}
|
}
|
||||||
GLIBC_2.2.1 {
|
|
||||||
# used in the thread library
|
|
||||||
__cxa_on_exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
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;
|
return -1;
|
||||||
|
|
||||||
new->flavor = ef_cxa;
|
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.arg = arg;
|
||||||
new->func.cxa.dso_handle = d;
|
new->func.cxa.dso_handle = d;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
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
|
if (d == f->func.cxa.dso_handle
|
||||||
/* We don't want to run this cleanup more than once. */
|
/* We don't want to run this cleanup more than once. */
|
||||||
&& compare_and_swap (&f->flavor, ef_cxa, ef_free))
|
&& 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -57,10 +57,7 @@ exit (int status)
|
|||||||
(*f->func.at) ();
|
(*f->func.at) ();
|
||||||
break;
|
break;
|
||||||
case ef_cxa:
|
case ef_cxa:
|
||||||
(*f->func.cxa.fn) (f->func.cxa.arg);
|
(*f->func.cxa.fn) (f->func.cxa.arg, status);
|
||||||
break;
|
|
||||||
case ef_cxa2:
|
|
||||||
(*f->func.cxa2.fn) (status, f->func.cxa2.arg);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,7 @@ enum
|
|||||||
ef_us,
|
ef_us,
|
||||||
ef_on,
|
ef_on,
|
||||||
ef_at,
|
ef_at,
|
||||||
ef_cxa,
|
ef_cxa
|
||||||
ef_cxa2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct exit_function
|
struct exit_function
|
||||||
@ -45,16 +44,10 @@ struct exit_function
|
|||||||
} on;
|
} on;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
void (*fn) (void *arg);
|
void (*fn) (void *arg, int status);
|
||||||
void *arg;
|
void *arg;
|
||||||
void *dso_handle;
|
void *dso_handle;
|
||||||
} cxa;
|
} cxa;
|
||||||
struct
|
|
||||||
{
|
|
||||||
void (*fn) (int status, void *arg);
|
|
||||||
void *arg;
|
|
||||||
void *dso_handle;
|
|
||||||
} cxa2;
|
|
||||||
} func;
|
} func;
|
||||||
};
|
};
|
||||||
struct exit_function_list
|
struct exit_function_list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user