Repair damage on weak-impared targets caused by my previous patch.
authorNathan Sidwell <nathan@codesourcery.com>
Fri, 5 Jul 2002 10:40:47 +0000 (10:40 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 5 Jul 2002 10:40:47 +0000 (10:40 +0000)
* cp-tree.h (import_export_tinfo): Add parameter.
* decl2.c (import_export_tinfo): Add parameter, post adjust
DECL_COMDAT.
* rtti.c (emit_tinfo_decl): DECL_COMDAT is (nearly) always setup by
import_export_tinfo.

From-SVN: r55257

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/rtti.c

index bc42127bd89a71b2060d9cf74d34e3944d2f2ec4..a29f9baac8143c8351609ed6b6123a865ba639e8 100644 (file)
@@ -1,3 +1,12 @@
+2002-07-05  Nathan Sidwell  <nathan@codesourcery.com>
+
+       Repair damage on weak-impared targets caused by my previous patch.
+       * cp-tree.h (import_export_tinfo): Add parameter.
+       * decl2.c (import_export_tinfo): Add parameter, post adjust
+       DECL_COMDAT.
+       * rtti.c (emit_tinfo_decl): DECL_COMDAT is (nearly) always setup by
+       import_export_tinfo.
+
 2002-07-03  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/6944
index 80b0f4378d8ddc94e0d39313b6aa100baf55124b..6ce769db74c1053e6f3e22b87276e8de8bd37a79 100644 (file)
@@ -3935,7 +3935,7 @@ extern tree coerce_delete_type                    PARAMS ((tree));
 extern void comdat_linkage                     PARAMS ((tree));
 extern void import_export_vtable               PARAMS ((tree, tree, int));
 extern void import_export_decl                 PARAMS ((tree));
-extern void import_export_tinfo                        PARAMS ((tree, tree));
+extern void import_export_tinfo                        PARAMS ((tree, tree, int));
 extern tree build_cleanup                      PARAMS ((tree));
 extern void finish_file                                PARAMS ((void));
 extern tree reparse_absdcl_as_expr             PARAMS ((tree, tree));
index b37dc8cec57727e1aa9018d7f3620a2c7489d22a..7099fc25d9567989ba5b35b32d78953688bfbf3b 100644 (file)
@@ -2516,12 +2516,14 @@ import_export_decl (decl)
 }
 
 /* Here, we only decide whether or not the tinfo node should be
-   emitted with the vtable.  */
+   emitted with the vtable.  IS_IN_LIBRARY is non-zero iff the
+   typeinfo for TYPE should be in the runtime library.  */
 
 void
-import_export_tinfo (decl, type)
+import_export_tinfo (decl, type, is_in_library)
      tree decl;
      tree type;
+     int is_in_library;
 {
   if (DECL_INTERFACE_KNOWN (decl))
     return;
@@ -2544,6 +2546,13 @@ import_export_tinfo (decl, type)
       DECL_NOT_REALLY_EXTERN (decl) = 1;
       DECL_COMDAT (decl) = 1;
     }
+
+  /* Now override some cases. */
+  if (flag_weak)
+    DECL_COMDAT (decl) = 1;
+  else if (is_in_library)
+    DECL_COMDAT (decl) = 0;
+  
   DECL_INTERFACE_KNOWN (decl) = 1;
 }
 
index 3be44c5cdaa6f67f4ebe63e21c6f76267e3adf09..676725027cdb957e6ba62d84f43b148c1e0280b0 100644 (file)
@@ -1439,26 +1439,28 @@ emit_tinfo_decl (decl_ptr, data)
   tree decl = *decl_ptr;
   tree type = TREE_TYPE (DECL_NAME (decl));
   int non_public;
+  int in_library = typeinfo_in_lib_p (type);
   tree var_desc, var_init;
   
-  import_export_tinfo (decl, type);
+  import_export_tinfo (decl, type, in_library);
   if (DECL_REALLY_EXTERN (decl) || !DECL_NEEDED_P (decl))
     return 0;
 
-  if (!doing_runtime && typeinfo_in_lib_p (type))
+  if (!doing_runtime && in_library)
     return 0;
 
   non_public = 0;
   var_desc = get_pseudo_ti_desc (type);
   var_init = get_pseudo_ti_init (type, var_desc, &non_public);
+  
   DECL_EXTERNAL (decl) = 0;
   TREE_PUBLIC (decl) = !non_public;
-  if (!non_public
-      && (flag_weak || (DECL_COMDAT (decl) && !typeinfo_in_lib_p (type))))
-    comdat_linkage (decl);
-  
+  if (non_public)
+    DECL_COMDAT (decl) = 0;
+
   DECL_INITIAL (decl) = var_init;
   cp_finish_decl (decl, var_init, NULL_TREE, 0);
+  /* cp_finish_decl will have dealt with linkage. */
   
   /* Say we've dealt with it.  */
   TREE_TYPE (DECL_NAME (decl)) = NULL_TREE;