This is the mail archive of the 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]

[patch windows]: PR target/40068


the following patch -  Dave it is a derived variant from on of your
patches for a similar issue - takes care that for dllexport'ed classes
the typeinfo base declaration gets the dllexport-attribute, too.


2012-02-02  Kai Tietz  <>
                  Dave Korn

	* config/i386/winnt-cxx.c (i386_pe_adjust_class_at_definition):
	Take care that typinfo gets dllexport-attribute.

Regression tested for i686-w64-mingw32, and x86_64-w64-mingw32.  If
there is no objection within next 4 days, I will apply this patch.


Index: gcc/gcc/config/i386/winnt-cxx.c
--- gcc.orig/gcc/config/i386/winnt-cxx.c
+++ gcc/gcc/config/i386/winnt-cxx.c
@@ -97,6 +97,20 @@ i386_pe_adjust_class_at_definition (tree

   if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (t)) != NULL_TREE)
+      tree tmv = TYPE_MAIN_VARIANT (t);
+      /* Make sure that we set dllexport attribute to typeinfo's
+	 base declaration, as otherwise it would fail to be exported as
+	 it isn't a class-member.  */
+      if (tmv != NULL_TREE
+	{
+	  tree na, ti_decl = CLASSTYPE_TYPEINFO_VAR (tmv);
+	  na = tree_cons (get_identifier ("dllexport"), NULL_TREE,
+			  NULL_TREE);
+	  decl_attributes (&ti_decl, na, 0);
+	}
       /* Check static VAR_DECL's.  */
       for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member))
 	if (TREE_CODE (member) == VAR_DECL)

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