View | Details | Return to bug 40068
Collapse All | Expand All

(-)gcc/config/i386/winnt-cxx.c (-3 / +22 lines)
Lines 104-112 i386_pe_adjust_class_at_definition (tree t) Link Here
104
104
105
  gcc_assert (CLASS_TYPE_P (t));
105
  gcc_assert (CLASS_TYPE_P (t));
106
106
107
 /* We only look at dllimport.  The only thing that dllexport does is
107
 /* The only thing that dllexport does is add stuff to a '.drectiv' 
108
    add stuff to a '.drectiv' section at end-of-file, so no need to do
108
    section at end-of-file, so there is little to do for dllexported
109
    anything for dllexport'd classes until we generate RTL. */  
109
    classes until we generate RTL.  However we must find their typeinfo
110
    structs now, as they are not class members and would fail to be
111
    exported if we do not propagate the dllexport attribute (if any)
112
    from the class to which it refers.  This is more easier now than
113
    at RTL time, when we'd have to track back to the related class
114
    through the DECL_ASSEMBLER_NAME.  */  
115
  if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (t)) != NULL_TREE)
116
    {
117
      if (TYPE_MAIN_VARIANT (t) != NULL_TREE
118
	  && CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (t)) != NULL_TREE)
119
	{
120
	  tree newattr = NULL_TREE;
121
	  tree tinfo_decl = CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (t));
122
	  /* Should now add attribute to it! */
123
	  newattr = tree_cons (get_identifier("dllexport"), NULL_TREE, NULL_TREE);
124
	  (void) decl_attributes (&tinfo_decl, newattr, 0);
125
	}
126
    }
127
128
 /* Apart from that, we only look at dllimported classes.  */  
110
  if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (t)) == NULL_TREE)
129
  if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (t)) == NULL_TREE)
111
    return;
130
    return;
112
131

Return to bug 40068