aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-11-27 07:31:02 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-11-27 02:31:02 -0500
commiteb773359de0a4c56846d6ce1d79e1360f83f73e6 (patch)
tree2984517149959da9efd4e87022fe7281a419b243
parente872bb7a78485ad19507115d289abe61954438ca (diff)
downloadgcc-eb773359de0a4c56846d6ce1d79e1360f83f73e6.zip
gcc-eb773359de0a4c56846d6ce1d79e1360f83f73e6.tar.gz
gcc-eb773359de0a4c56846d6ce1d79e1360f83f73e6.tar.bz2
decl2.c (import_export_vtable): If we support one_only but not weak symbols...
* decl2.c (import_export_vtable): If we support one_only but not weak symbols, mark instantiated template vtables one_only. (import_export_decl): Likewise for tinfo functions. (finish_vtable_vardecl): Also write out vtables from explicitly instantiated template classes. * pt.c (mark_class_instantiated): Revert last change. From-SVN: r16779
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl2.c14
-rw-r--r--gcc/cp/pt.c12
3 files changed, 23 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0a34b48..02eeb27 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
Wed Nov 26 20:28:49 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * decl2.c (import_export_vtable): If we support one_only but not
+ weak symbols, mark instantiated template vtables one_only.
+ (import_export_decl): Likewise for tinfo functions.
+ (finish_vtable_vardecl): Also write out vtables from explicitly
+ instantiated template classes.
+ * pt.c (mark_class_instantiated): Revert last change.
+
* except.c (expand_throw): Call mark_used on the destructor.
1997-11-26 Mark Mitchell <mmitchell@usa.net>
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7f207d6..a2821ee 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#include "except.h"
#include "expr.h"
+#include "defaults.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -2527,6 +2528,12 @@ import_export_vtable (decl, type, final)
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = ! CLASSTYPE_VTABLE_NEEDS_WRITING (type);
DECL_INTERFACE_KNOWN (decl) = 1;
+
+ /* For WIN32 we also want to put explicit instantiations in
+ linkonce sections. */
+ if (CLASSTYPE_EXPLICIT_INSTANTIATION (type)
+ && supports_one_only () && ! SUPPORTS_WEAK)
+ comdat_linkage (decl);
}
else
{
@@ -2618,6 +2625,7 @@ finish_vtable_vardecl (prev, vars)
if (write_virtuals >= 0
&& ! DECL_EXTERNAL (vars)
&& ((TREE_PUBLIC (vars) && ! DECL_WEAK (vars) && ! DECL_ONE_ONLY (vars))
+ || CLASSTYPE_EXPLICIT_INSTANTIATION (DECL_CONTEXT (vars))
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))
|| (hack_decl_function_context (vars) && TREE_USED (vars)))
&& ! TREE_ASM_WRITTEN (vars))
@@ -2815,6 +2823,12 @@ import_export_decl (decl)
DECL_NOT_REALLY_EXTERN (decl)
= ! (CLASSTYPE_INTERFACE_ONLY (ctype)
|| (DECL_THIS_INLINE (decl) && ! flag_implement_inlines));
+
+ /* For WIN32 we also want to put explicit instantiations in
+ linkonce sections. */
+ if (CLASSTYPE_EXPLICIT_INSTANTIATION (ctype)
+ && supports_one_only () && ! SUPPORTS_WEAK)
+ comdat_linkage (decl);
}
else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype))
DECL_NOT_REALLY_EXTERN (decl) = 0;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9e45128..370c9e2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4327,16 +4327,8 @@ mark_class_instantiated (t, extern_p)
int extern_p;
{
SET_CLASSTYPE_EXPLICIT_INSTANTIATION (t);
-
- if (supports_one_only () && ! SUPPORTS_WEAK)
- /* For WIN32 we also want to put explicit instantiations in
- linkonce sections. */;
- else
- {
- SET_CLASSTYPE_INTERFACE_KNOWN (t);
- CLASSTYPE_INTERFACE_ONLY (t) = extern_p;
- }
-
+ SET_CLASSTYPE_INTERFACE_KNOWN (t);
+ CLASSTYPE_INTERFACE_ONLY (t) = extern_p;
CLASSTYPE_VTABLE_NEEDS_WRITING (t) = ! extern_p;
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (t)) = extern_p;
if (! extern_p)