From 39b6af4bd61b81231f365c25fcfa58a27b000f85 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Fri, 17 Dec 1999 07:39:13 +0000 Subject: * crtstuff.c (__dso_handle): Declare. (__cxa_finalize): Likewise. (do_global_dtors_aux): Call __cxa_finalize if __dso_handle is non-NULL. * invoke.texi: Document -fuse-cxa-atexit. * tree.h (ptr_type_node): Document. (const_ptr_type_node): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30989 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/crtstuff.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gcc/crtstuff.c') diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index a17433a0c43..53dae7cddc2 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -129,6 +129,19 @@ typedef void (*func_ptr) (void); #ifdef OBJECT_FORMAT_ELF +/* Declare the __dso_handle variable. It should have a unique value + in every shared-object; in a main program its value is zero. */ + +#ifdef CRTSTUFFS_O +void *__dso_handle = &__dso_handle; +#else +void *__dso_handle = 0; +#endif + +/* The __cxa_finalize function may not be available so we use only a + weak declaration. */ +extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK; + /* Run all the global destructors on exit from the program. */ /* Some systems place the number of pointers in the first word of the @@ -159,6 +172,9 @@ __do_global_dtors_aux (void) if (completed) return; + if (__dso_handle && __cxa_finalize) + __cxa_finalize (__dso_handle); + while (*p) { p++; -- cgit v1.2.3