diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-12-17 07:39:13 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-12-17 07:39:13 +0000 |
commit | 39b6af4bd61b81231f365c25fcfa58a27b000f85 (patch) | |
tree | d54c407a6af521d26af28babaad7f943f2b5c8f1 /gcc/crtstuff.c | |
parent | 3fc738ce002368b603beb198183b46ee61a42697 (diff) | |
download | gcc-39b6af4bd61b81231f365c25fcfa58a27b000f85.tar.gz |
* 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
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r-- | gcc/crtstuff.c | 16 |
1 files changed, 16 insertions, 0 deletions
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++; |