summaryrefslogtreecommitdiff
path: root/gcc/crtstuff.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-12-17 07:39:13 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-12-17 07:39:13 +0000
commitfc69382254fcf45ced69a604adea5b6123c3c1c8 (patch)
treed54c407a6af521d26af28babaad7f943f2b5c8f1 /gcc/crtstuff.c
parent5ac99d9adcd93a27006a6ac8d9b7006e65f7aaa8 (diff)
downloadgcc-fc69382254fcf45ced69a604adea5b6123c3c1c8.tar.gz
crtstuff.c (__dso_handle): Declare.
* 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. From-SVN: r30989
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r--gcc/crtstuff.c16
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++;