This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

Re: other/4878: gcc 3.0.2 output crashes HP-UX linker

[Get raw message]
> Unlike the example program my project doesn't seem to have any of these
> obvious defects.
> 
> >    non-virtual thunk to W::foo()(data)
> 
> But dozens of those. Might be related to #4135. No idea.

Yup, there is a missing `.IMPORT' for this symbol in the assembler
output.  It should in fact be a CODE symbol.  I believe that that 
ld dumps core because a P fixup is being used with a DATA symbol
(the default when no .IMPORT statement is provided).

There are also missing imports for the typeinfo symbols but these
don't hurt unless you use the HP assembler.  The following patch
was posted a long time ago but never reviewed.  It fixes the problem
for the typeinfo symbols.

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]