2004-09-14 Jeff Johnston <jjohnstn@redhat.com>

* configure.host: Add Cygwin sys directory.
        * configure.in: Do not set CRT0 for cygwin.
        * libc/configure.in: Ditto.
        * libc/sys/configure.in: Ditto.
        * configure: Regenerated.
        * libc/configure: Ditto.
        * libc/sys/configure: Ditto.
        * libc/include/sys/reent.h: Add __REENT_HAS_CXA_SUPPORT flag.
        * libc/stdlib/__atexit.c: Keep cxa support protected by new
        __REENT_HAS_CXA_SUPPORT flag.
        * libc/stdlib/__call_atexit.c: Ditto.
        * libc/stdlib/cxa_atexit.c: Ditto.
        * libc/stdlib/cxa_finalize.c: Ditto.
        * libc/sys/cygwin/Makefile.am: New file.
        * libc/sys/cygwin/Makefile.in: Ditto.
        * libc/sys/cygwin/aclocal.m4: Ditto.
        * libc/sys/cygwin/configure: Ditto.
        * libc/sys/cygwin/configure.in: Ditto.
        * libc/sys/cygwin/dummy.c: Ditto.
        * libc/sys/cygwin/sys/reent.h: Ditto.  This file is stabilized
        version of reent.h.
This commit is contained in:
Jeff Johnston
2004-09-14 18:12:53 +00:00
parent 272871abe4
commit 98650d2fa2
20 changed files with 3463 additions and 7 deletions

View File

@ -8,6 +8,7 @@
#include <sys/lock.h>
#include "atexit.h"
/*
* Register a function to be performed at exit or on shared library unload.
*/
@ -47,7 +48,9 @@ _DEFUN (__register_exitproc,
_GLOBAL_REENT->_atexit = p;
#ifndef _REENT_SMALL
p->_on_exit_args._fntypes = 0;
#ifdef __REENT_HAS_CXA_SUPPORT
p->_on_exit_args._is_cxa = 0;
#endif
#endif
}
@ -67,16 +70,20 @@ _DEFUN (__register_exitproc,
}
args->_fntypes = 0;
args->_is_cxa = 0;
#ifdef __REENT_HAS_CXA_SUPPORT
p->_on_exit_args_ptr = args;
#endif
}
#else
args = &p->_on_exit_args;
#endif
args->_fnargs[p->_ind] = arg;
args->_dso_handle[p->_ind] = d;
args->_fntypes |= (1 << p->_ind);
#ifdef __REENT_HAS_CXA_SUPPORT
args->_dso_handle[p->_ind] = d;
if (type == __et_cxa)
args->_is_cxa |= (1 << p->_ind);
#endif
}
p->_fns[p->_ind++] = fn;
#ifndef __SINGLE_THREAD__

View File

@ -36,9 +36,11 @@ _DEFUN (__call_exitprocs, (code, d),
{
i = 1 << n;
#ifdef __REENT_HAS_CXA_SUPPORT
/* Skip functions not from this dso. */
if (d && (!args || args->_dso_handle[n] != d))
continue;
#endif
/* Remove the function now to protect against the
function calling exit recursively. */
@ -55,8 +57,10 @@ _DEFUN (__call_exitprocs, (code, d),
/* Call the function. */
if (!args || (args->_fntypes & i) == 0)
fn ();
#ifdef __REENT_HAS_CXA_SUPPORT
else if ((args->_is_cxa & i) == 0)
(*((void (*)(int, _PTR)) fn))(code, args->_fnargs[n]);
#endif
else
(*((void (*)(_PTR)) fn))(args->_fnargs[n]);
}

View File

@ -8,6 +8,7 @@
#include <sys/lock.h>
#include "atexit.h"
#ifdef __REENT_HAS_CXA_SUPPORT
/*
* Register a function to be performed at exit or DSO unload.
*/
@ -21,3 +22,5 @@ _DEFUN (__cxa_atexit,
{
return __register_exitproc (__et_cxa, (void (*)(void)) fn, arg, d);
}
#endif /* __REENT_HAS_CXA_SUPPORT */

View File

@ -7,6 +7,8 @@
#include <reent.h>
#include "atexit.h"
#ifdef __REENT_HAS_CXA_SUPPORT
/*
* Call registered exit handlers. If D is null then all handlers are called,
* otherwise only the handlers from that DSO are called.
@ -18,3 +20,5 @@ _DEFUN (__cxa_finalize, (d),
{
__call_exitprocs (0, d);
}
#endif /* __REENT_HAS_CXA_SUPPORT */