This is the mail archive of the
mailing list for the GCC project.
[patch windows]: PR target/40068
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Date: Thu, 2 Feb 2012 21:46:32 +0100
- Subject: [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 <firstname.lastname@example.org>
* 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.
@@ -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,
+ 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)