diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2002-07-05 10:40:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2002-07-05 10:40:47 +0000 |
commit | c6f553d129c88f17810c2aba03b372bf6bc7f218 (patch) | |
tree | dfa8376cd1e966f5df13720d8cb28f93025f434c /gcc | |
parent | 3aa0aa29662c812dc5dc22d0c4879bb1df91c2b8 (diff) | |
download | gcc-c6f553d129c88f17810c2aba03b372bf6bc7f218.zip gcc-c6f553d129c88f17810c2aba03b372bf6bc7f218.tar.gz gcc-c6f553d129c88f17810c2aba03b372bf6bc7f218.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 13 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 14 |
4 files changed, 29 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bc42127..a29f9ba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 80b0f43..6ce769d 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 b37dc8c..7099fc2 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 3be44c5..6767250 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; |