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]
Other format: [Raw text]

[patch windows]: PR target/40068


Hi,

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.

ChangeLog

2012-02-02  Kai Tietz  <ktietz@redhat.com>
                  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.

Regards,
Kai

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
+	  && CLASS_TYPE_TYPEINFO_VAR (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]