This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: make type info nodes external


The HP assembler needs .IMPORT statements for all symbols that are
external.  Type info node symbols need to be external but currently
we use comdat linkage for them.  This patch modifies import_export_vtable
to check for tinfo types and set TREE_PUBLIC and DECL_EXTERNAL when
found.

Bootstrap checked on hppa1.1-hp-hpux10.20 with a large reduction in
g++ testsuite failures with the HP assembler.  OK?

Dave
--
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-08-29  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* cp-tree.h (tinfo_node_p): Add prototype.
	* decl2.c (import_export_vtable): Use external linkage for tinfo types.
	* rtti.c (tinfo_node_p): Add new function to test for tinfo node.

--- cp-tree.h.orig	Wed Aug 15 12:09:52 2001
+++ cp-tree.h	Wed Aug 29 13:18:38 2001
@@ -3984,6 +3984,7 @@
 extern tree get_typeid				PARAMS((tree));
 extern tree build_dynamic_cast			PARAMS((tree, tree));
 extern void emit_support_tinfos                 PARAMS((void));
+extern int tinfo_node_p                         PARAMS((tree));
 extern int tinfo_decl_p                         PARAMS((tree, void *));
 extern int emit_tinfo_decl                      PARAMS((tree *, void *));
 
--- decl2.c.orig	Mon Aug 13 13:36:35 2001
+++ decl2.c	Wed Aug 29 13:19:11 2001
@@ -2366,15 +2366,15 @@
       int found = (CLASSTYPE_TEMPLATE_INSTANTIATION (type)
 		   || key_method (type));
 
-      if (final || ! found)
+      if ((! final && found) || tinfo_node_p (type))
 	{
-	  comdat_linkage (decl);
-	  DECL_EXTERNAL (decl) = 0;
+	  TREE_PUBLIC (decl) = 1;
+	  DECL_EXTERNAL (decl) = 1;
 	}
       else
 	{
-	  TREE_PUBLIC (decl) = 1;
-	  DECL_EXTERNAL (decl) = 1;
+	  comdat_linkage (decl);
+	  DECL_EXTERNAL (decl) = 0;
 	}
     }
 }
--- rtti.c.orig	Wed Aug 15 12:09:52 2001
+++ rtti.c	Wed Aug 29 13:17:55 2001
@@ -1408,6 +1408,35 @@
     }
 }
 
+/* Return non-zero, iff NODE is a type_info node.  */
+
+int
+tinfo_node_p (node)
+     tree node;
+{
+  char *name;
+
+  if (! TYPE_P (node)
+      || ! TYPE_NAME (node)
+      || ! DECL_NAME (TYPE_NAME (node))
+      || TREE_CODE (TYPE_NAME (node)) != TYPE_DECL)
+    return 0;
+
+  name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+
+  return (! strcmp (name, "__type_info_pseudo")
+	  || ! strcmp (name, "__fundamental_type_info")
+	  || ! strcmp (name, "__array_type_info")
+	  || ! strcmp (name, "__function_type_info")
+	  || ! strcmp (name, "__enum_type_info")
+	  || ! strcmp (name, "__class_type_info")
+	  || ! strcmp (name, "__si_class_type_info")
+	  || ! strcmp (name, "__base_class_type_info_pseudo")
+	  || ! strcmp (name, "__vmi_class_type_info")
+	  || ! strcmp (name, "__pointer_type_info")
+	  || ! strcmp (name, "__pointer_to_member_type_info"));
+}
+
 /* Return non-zero, iff T is a type_info variable which has not had a
    definition emitted for it.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]