decl2.c (import_export_vtable): If we support one_only but not weak symbols...
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 27 Nov 1997 07:31:02 +0000 (07:31 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 27 Nov 1997 07:31:02 +0000 (02:31 -0500)
* 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
gcc/cp/decl2.c
gcc/cp/pt.c

index 0a34b48801ddc83f66dfce4088fef5e5ef410d32..02eeb27f78ccab38404b64580e2128caa5670c1a 100644 (file)
@@ -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>
index 7f207d6381684d2c37cc50477239e77ce9840783..a2821eeb375ef46603b6ee120f6537a5a2bad297 100644 (file)
@@ -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;
index 9e4512821fcdf1cba89988157323d9889932a68a..370c9e2a5279dbc8918140be745cdb9f5098e69f 100644 (file)
@@ -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)