summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-12-17 07:39:13 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-12-17 07:39:13 +0000
commit39b6af4bd61b81231f365c25fcfa58a27b000f85 (patch)
treed54c407a6af521d26af28babaad7f943f2b5c8f1 /gcc
parent3fc738ce002368b603beb198183b46ee61a42697 (diff)
downloadgcc-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')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/crtstuff.c16
-rw-r--r--gcc/invoke.texi9
-rw-r--r--gcc/tree.h2
4 files changed, 38 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c201dd2558..2f486f7769d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+1999-12-16 Mark Mitchell <mark@codesourcery.com>
+
+ * 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.
+
Fri Dec 17 01:32:38 MET 1999 Jan Hubicka <hubicka@freesoft.cz>
* regmove.c (optimize_reg_copy_1): Ignore LOOP notes.
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++;
diff --git a/gcc/invoke.texi b/gcc/invoke.texi
index 6f5185acc26..3fbcba6ab85 100644
--- a/gcc/invoke.texi
+++ b/gcc/invoke.texi
@@ -109,7 +109,7 @@ in the following sections.
-fhonor-std -fhuge-objects -fno-implicit-templates -finit-priority
-fno-implement-inlines -fname-mangling-version-@var{n} -fno-default-inline
-foperator-names -fno-optional-diags -fpermissive -frepo -fstrict-prototype
--fsquangle -ftemplate-depth-@var{n} -fvtable-thunks
+-fsquangle -ftemplate-depth-@var{n} -fuse-cxa-atexit -fvtable-thunks
-nostdinc++ -Wctor-dtor-privacy -Wno-deprecated -Weffc++
-Wno-non-template-friend
-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual
@@ -1217,6 +1217,13 @@ A limit on the template instantiation depth is needed to detect
endless recursions during template class instantiation. ANSI/ISO C++
conforming programs must not rely on a maximum depth greater than 17.
+@item -fuse-cxa-atexit
+Register destructors for objects with static storage duration with the
+@code{__cxa_atexit} function rather than the @code{atexit} function.
+This option is required for fully standards-compliant handling of static
+destructors, but will only work if your C library supports
+@code{__cxa_atexit}.
+
@item -fvtable-thunks
Use @samp{thunks} to implement the virtual function dispatch table
(@samp{vtable}). The traditional (cfront-style) approach to
diff --git a/gcc/tree.h b/gcc/tree.h
index e802e0ccc04..2703e80b77e 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1542,7 +1542,9 @@ extern tree global_trees[TI_MAX];
#define complex_long_double_type_node global_trees[TI_COMPLEX_LONG_DOUBLE_TYPE]
#define void_type_node global_trees[TI_VOID_TYPE]
+/* The C type `void *'. */
#define ptr_type_node global_trees[TI_PTR_TYPE]
+/* The C type `const void *'. */
#define const_ptr_type_node global_trees[TI_CONST_PTR_TYPE]
#define ptrdiff_type_node global_trees[TI_PTRDIFF_TYPE]
#define va_list_type_node global_trees[TI_VA_LIST_TYPE]