Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor

ó++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor

The ABI was initially defined for ia64, but GCC3 and Intel compilers
have adopted it on other platforms.

This is the patch from PR bin/59552 with a number of changes by
me.

PR:		bin/59552
Submitted by:	Bradley T Hughes (bhughes at trolltech dot com)
This commit is contained in:
kan 2003-12-19 17:11:21 +00:00
parent caabe90547
commit 09cff15526
2 changed files with 2 additions and 13 deletions

View File

@ -37,10 +37,4 @@
/* must be at least 32 to guarantee ANSI conformance */
#define ATEXIT_SIZE 32
struct atexit {
struct atexit *next; /* next in list */
int ind; /* next index in this table */
void (*fns[ATEXIT_SIZE])(); /* the table itself */
};
extern struct atexit *__atexit; /* points to head of LIFO stack */
void __cxa_finalize(void *dso);

View File

@ -61,17 +61,12 @@ void
exit(status)
int status;
{
struct atexit *p;
int n;
/* Ensure that the auto-initialization routine is linked in: */
extern int _thread_autoinit_dummy_decl;
_thread_autoinit_dummy_decl = 1;
for (p = __atexit; p; p = p->next)
for (n = p->ind; --n >= 0;)
(*p->fns[n])();
__cxa_finalize(NULL);
if (__cleanup)
(*__cleanup)();
_exit(status);