From: Nathan Sidwell Date: Fri, 5 Jul 2002 10:40:47 +0000 (+0000) Subject: Repair damage on weak-impared targets caused by my previous patch. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6f553d129c88f17810c2aba03b372bf6bc7f218;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bc42127bd89..a29f9baac81 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2002-07-05 Nathan Sidwell + + 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 PR c++/6944 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 80b0f4378d8..6ce769db74c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index b37dc8cec57..7099fc25d95 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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; } diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 3be44c5cdaa..676725027cd 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -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;