From 97458258b8e196f88ba17d4ed985aece3ec5675c Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 4 Feb 2001 08:35:11 +0000 Subject: cp-tree.h (CLASSTYPE_INTERFACE_UNKNOWN): Fix formatting. * cp-tree.h (CLASSTYPE_INTERFACE_UNKNOWN): Fix formatting. Document. (CLASSTYPE_INTERFACE_KNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise. (SET_CLASSTYPE_INTERFACE_UNKNOWN): Likewise. (SET_CLASSTYPE_INTERFACE_KNOWN): Likewise. * decl.c (maybe_commonize_var): Use the new name-mangling where appropriate. * decl2.c (comdat_linkage): Enhance comments. Make all compiler-generated things static, if COMDAT is not available. (get_tinfo_decl): Do not make typeinfo objects that belong in the library COMDAT. (tinfo_base_init): Use the correct mangled name for typeinfo strings, and push them into the global scope. (typeinfo_in_lib_p): New function. (synthesize_tinfo_var): Use it. (create_real_tinfo_var): Likewise. From-SVN: r39437 --- gcc/cp/decl2.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'gcc/cp/decl2.c') diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 6088e10..2c3dbc7 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2396,14 +2396,24 @@ comdat_linkage (decl) { if (flag_weak) make_decl_one_only (decl); - else if (TREE_CODE (decl) == FUNCTION_DECL || DECL_VIRTUAL_P (decl)) - /* We can just emit functions and vtables statically; having - multiple copies is (for the most part) only a waste of space. - There is at least one correctness issue, however: the address - of a template instantiation with external linkage should be the + else if (TREE_CODE (decl) == FUNCTION_DECL + || (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl))) + /* We can just emit function and compiler-generated variables + statically; having multiple copies is (for the most part) only + a waste of space. + + There are two correctness issues, however: the address of a + template instantiation with external linkage should be the same, independent of what translation unit asks for the address, and this will not hold when we emit multiple copies of - the function. However, there's little else we can do. */ + the function. However, there's little else we can do. + + Also, by default, the typeinfo implementation for the new ABI + assumes that there will be only one copy of the string used as + the name for each type. Therefore, if weak symbols are + unavailable, the run-time library should perform a more + conservative check; it should perform a string comparison, + rather than an address comparison. */ TREE_PUBLIC (decl) = 0; else { -- cgit v1.1