Repair damage on weak-impared targets caused by my previous patch.

* cp-tree.h (import_export_tinfo): Add parameter.
	* decl2.c (import_export_tinfo): Add parameter, post adjust
	DECL_COMDAT.
	* rtti.c (emit_tinfo_decl): DECL_COMDAT is (nearly) always setup by
	import_export_tinfo.

From-SVN: r55257
This commit is contained in:
Nathan Sidwell 2002-07-05 10:40:47 +00:00 committed by Nathan Sidwell
parent 3aa0aa2966
commit c6f553d129
4 changed files with 29 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2002-07-05 Nathan Sidwell <nathan@codesourcery.com>
Repair damage on weak-impared targets caused by my previous patch.
* cp-tree.h (import_export_tinfo): Add parameter.
* decl2.c (import_export_tinfo): Add parameter, post adjust
DECL_COMDAT.
* rtti.c (emit_tinfo_decl): DECL_COMDAT is (nearly) always setup by
import_export_tinfo.
2002-07-03 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/6944

View File

@ -3935,7 +3935,7 @@ extern tree coerce_delete_type PARAMS ((tree));
extern void comdat_linkage PARAMS ((tree));
extern void import_export_vtable PARAMS ((tree, tree, int));
extern void import_export_decl PARAMS ((tree));
extern void import_export_tinfo PARAMS ((tree, tree));
extern void import_export_tinfo PARAMS ((tree, tree, int));
extern tree build_cleanup PARAMS ((tree));
extern void finish_file PARAMS ((void));
extern tree reparse_absdcl_as_expr PARAMS ((tree, tree));

View File

@ -2516,12 +2516,14 @@ import_export_decl (decl)
}
/* Here, we only decide whether or not the tinfo node should be
emitted with the vtable. */
emitted with the vtable. IS_IN_LIBRARY is non-zero iff the
typeinfo for TYPE should be in the runtime library. */
void
import_export_tinfo (decl, type)
import_export_tinfo (decl, type, is_in_library)
tree decl;
tree type;
int is_in_library;
{
if (DECL_INTERFACE_KNOWN (decl))
return;
@ -2544,6 +2546,13 @@ import_export_tinfo (decl, type)
DECL_NOT_REALLY_EXTERN (decl) = 1;
DECL_COMDAT (decl) = 1;
}
/* Now override some cases. */
if (flag_weak)
DECL_COMDAT (decl) = 1;
else if (is_in_library)
DECL_COMDAT (decl) = 0;
DECL_INTERFACE_KNOWN (decl) = 1;
}

View File

@ -1439,26 +1439,28 @@ emit_tinfo_decl (decl_ptr, data)
tree decl = *decl_ptr;
tree type = TREE_TYPE (DECL_NAME (decl));
int non_public;
int in_library = typeinfo_in_lib_p (type);
tree var_desc, var_init;
import_export_tinfo (decl, type);
import_export_tinfo (decl, type, in_library);
if (DECL_REALLY_EXTERN (decl) || !DECL_NEEDED_P (decl))
return 0;
if (!doing_runtime && typeinfo_in_lib_p (type))
if (!doing_runtime && in_library)
return 0;
non_public = 0;
var_desc = get_pseudo_ti_desc (type);
var_init = get_pseudo_ti_init (type, var_desc, &non_public);
DECL_EXTERNAL (decl) = 0;
TREE_PUBLIC (decl) = !non_public;
if (!non_public
&& (flag_weak || (DECL_COMDAT (decl) && !typeinfo_in_lib_p (type))))
comdat_linkage (decl);
if (non_public)
DECL_COMDAT (decl) = 0;
DECL_INITIAL (decl) = var_init;
cp_finish_decl (decl, var_init, NULL_TREE, 0);
/* cp_finish_decl will have dealt with linkage. */
/* Say we've dealt with it. */
TREE_TYPE (DECL_NAME (decl)) = NULL_TREE;