From 0c8593cf11a16ca75c72977a6f5e3983896940c4 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 9 Sep 2004 19:46:54 +0000 Subject: 2004-09-09 Paul Brook * libc/include/sys/reent.h (struct _on_exit_args): Add _dso_handle and _is_cxa. (struct _atexit): Add _next when _REENT_SMALL. (struct _reent): Add _atexit0 when _REENT_SMALL. (_REENT_INIT_PTR): Adjust. * libc/stdlib/Makefile.am (GENERAL_SOURCES): Add __atexit.c and __call_exit.c. (EXTENDED_SOURCES): Add cxa_atexit.c and cxa_finalize.c. * libc/stdlib/Makefile.in: Regenerate. * libc/stdlib/__atexit.c: New file. * libc/stdlib/__call_atexit.c: New file. * libc/stdlib/atexit.h: Remove old definitions. Add new. * libc/stdlib/atexit.c (atexit): Use __register_exitproc. * libc/stdlib/cxa_atexit.c: New file. * libc/stdlib/cxa_finalize.c: New file. * libc/stdlib/exit.c (exit): Use __call_exitprocs. * libc/stdlib/on_exit.c (on_exit): Use __register_exitproc. 2004-09-09 Jeff Johnston * libc/reent/reent.c [_REENT_SMALL]: Fix reference to _on_exit_args_ptr. --- newlib/libc/include/sys/reent.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'newlib/libc/include/sys/reent.h') diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index a216c2434..54f5d8efe 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -59,19 +59,24 @@ struct __tm }; /* - * atexit() support. For _REENT_SMALL, we limit to 32 max. + * atexit() support. */ #define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */ struct _on_exit_args { - void * _fnargs[_ATEXIT_SIZE]; /* fn args for on_exit */ + void * _fnargs[_ATEXIT_SIZE]; /* user fn args */ + void * _dso_handle[_ATEXIT_SIZE]; + /* Bitmask is set if user function takes arguments. */ __ULong _fntypes; /* type of exit routine - - Must have at least _ATEXIT_SIZE bits */ + Must have at least _ATEXIT_SIZE bits */ + /* Bitmask is set if function was registered via __cxa_atexit. */ + __ULong _is_cxa; }; #ifdef _REENT_SMALL struct _atexit { + struct _atexit *_next; /* next in list */ int _ind; /* next index in this table */ void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ struct _on_exit_args * _on_exit_args_ptr; @@ -80,6 +85,7 @@ struct _atexit { struct _atexit { struct _atexit *_next; /* next in list */ int _ind; /* next index in this table */ + /* Some entries may already have been called, and will be NULL. */ void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */ struct _on_exit_args _on_exit_args; }; @@ -371,7 +377,8 @@ struct _reent void (**(_sig_func))(int); /* atexit stuff */ - struct _atexit _atexit; + struct _atexit *_atexit; + struct _atexit _atexit0; struct _glue __sglue; /* root of glue chain */ __FILE *__sf; /* file descriptors */ @@ -399,7 +406,8 @@ struct _reent _NULL, \ _NULL, \ _NULL, \ - {0, {_NULL}, _NULL}, \ + _NULL, \ + {_NULL, 0, {_NULL}, _NULL}, \ {_NULL, 0, _NULL}, \ _NULL, \ {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL}, \ @@ -426,9 +434,11 @@ struct _reent var->_localtime_buf = _NULL; \ var->_asctime_buf = _NULL; \ var->_sig_func = _NULL; \ - var->_atexit._ind = 0; \ - var->_atexit._fns[0] = _NULL; \ - var->_atexit._on_exit_args = _NULL; \ + var->_atexit = _NULL; \ + var->_atexit0._next = _NULL; \ + var->_atexit0._ind = 0; \ + var->_atexit0._fns[0] = _NULL; \ + var->_atexit0._on_exit_args_ptr = _NULL; \ var->__sglue._next = _NULL; \ var->__sglue._niobs = 0; \ var->__sglue._iobs = _NULL; \ @@ -673,7 +683,7 @@ struct _reent } \ }, \ _NULL, \ - {_NULL, 0, {_NULL}, {{_NULL}, 0}}, \ + {_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}, \ _NULL, \ {_NULL, 0, _NULL} \ } -- cgit v1.2.3