From eb773359de0a4c56846d6ce1d79e1360f83f73e6 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 27 Nov 1997 07:31:02 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl2.c | 14 ++++++++++++++ gcc/cp/pt.c | 12 ++---------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0a34b48801d..02eeb27f78c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ Wed Nov 26 20:28:49 1997 Jason Merrill + * 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 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7f207d63816..a2821eeb375 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 @@ -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 9e4512821fc..370c9e2a527 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) -- 2.30.2