From 50bcce79ff3918bdda9520e0ad631d80df66bbb0 Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Fri, 19 Dec 2003 17:11:21 +0000 Subject: [PATCH] =?UTF-8?q?Implement=20=5F=5Fcxa=5Fatexit/=5F=5Fcxa=5Ffina?= =?UTF-8?q?lize=20as=20specified=20by=20the=20cross-vendor=20=C3=B3++=20AB?= =?UTF-8?q?I=20document=20at=20http://www.codesourcery.com/cxx-abi/abi.htm?= =?UTF-8?q?l#dso-dtor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- lib/libc/stdlib/atexit.h | 8 +------- lib/libc/stdlib/exit.c | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/libc/stdlib/atexit.h b/lib/libc/stdlib/atexit.h index 96ef95f8bb02..704c2e168939 100644 --- a/lib/libc/stdlib/atexit.h +++ b/lib/libc/stdlib/atexit.h @@ -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); diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c index 78c5f36c29e5..83abdbd5d506 100644 --- a/lib/libc/stdlib/exit.c +++ b/lib/libc/stdlib/exit.c @@ -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);