aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorRafael Avila de Espindola <espindola@google.com>2009-06-15 14:25:50 +0000
committerRafael Espindola <espindola@gcc.gnu.org>2009-06-15 14:25:50 +0000
commitfc26fae3db8a2eacc73224e2b3e0ab2aa3201eeb (patch)
tree8a727e22a197bff442c7fa013b41c3b723b12ef4 /gcc/cp
parent144c91756250b14fb70ed94e72952868d2d6e84e (diff)
downloadgcc-fc26fae3db8a2eacc73224e2b3e0ab2aa3201eeb.zip
gcc-fc26fae3db8a2eacc73224e2b3e0ab2aa3201eeb.tar.gz
gcc-fc26fae3db8a2eacc73224e2b3e0ab2aa3201eeb.tar.bz2
cgraphunit.c (cgraph_function_versioning,save_inline_function_body): Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
2009-06-15 Rafael Avila de Espindola <espindola@google.com> * cgraphunit.c (cgraph_function_versioning,save_inline_function_body): Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY. * cgraph.c (cgraph_create_virtual_clone): Use DECL_COMDAT_GROUP. * config/i386/i386.c (ix86_file_end): Compute DECL_COMDAT_GROUP. * dwarf2asm.c(dw2_force_const_mem): Update call to make_decl_one_only. * langhooks-def.h (lhd_comdat_group, LANG_HOOKS_COMDAT_GROUP): Remove. (LANG_HOOKS_DECLS): Remove LANG_HOOKS_COMDAT_GROUP. * langhooks.c (lhd_comdat_group): Remove. * langhooks.h (lang_hooks_for_decls): Remove comdat_group. * tree.h (DECL_COMDAT_GROUP): New. (DECL_ONE_ONLY): Use DECL_COMDAT_GROUP. (tree_decl_with_vis): Add comdat_group. Remove one_only. (make_decl_one_only): Change signature. * varasm.c (get_emutls_init_templ_addr, emutls_decl): Update call to make_decl_one_only. (make_decl_one_only): Change signature. (default_elf_asm_named_section): Use DECL_COMDAT_GROUP. 2009-06-15 Rafael Avila de Espindola <espindola@google.com> * cp-objcp-common.h (LANG_HOOKS_COMDAT_GROUP): Remove. * cp-tree.h (cxx_comdat_group): Change signature. * decl.c (duplicate_decls): Use DECL_COMDAT_GROUP. (cxx_comdat_group): Change signature. * decl2.c (comdat_linkage, maybe_make_one_only): Update call to make_decl_one_only. (constrain_visibility, get_guard): Use DECL_COMDAT_GROUP. * method.c (use_thunk): Update call to make_decl_one_only. * optimize.c (maybe_clone_body): Use DECL_COMDAT_GROUP 2009-06-15 Rafael Avila de Espindola <espindola@google.com> * g++.dg/abi/mangle11.C: Update warning line. * g++.dg/abi/mangle12.C: Update warning line. * g++.dg/abi/mangle17.C: Update warning line. * g++.dg/abi/mangle20-2.C: Update warning line. From-SVN: r148492
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/cp-objcp-common.h2
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/cp/decl2.c8
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/cp/optimize.c7
7 files changed, 29 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ec8cef0..1a0e935 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+2009-06-15 Rafael Avila de Espindola <espindola@google.com>
+
+ * cp-objcp-common.h (LANG_HOOKS_COMDAT_GROUP): Remove.
+ * cp-tree.h (cxx_comdat_group): Change signature.
+ * decl.c (duplicate_decls): Use DECL_COMDAT_GROUP.
+ (cxx_comdat_group): Change signature.
+ * decl2.c (comdat_linkage, maybe_make_one_only): Update call to
+ make_decl_one_only.
+ (constrain_visibility, get_guard): Use DECL_COMDAT_GROUP.
+ * method.c (use_thunk): Update call to make_decl_one_only.
+ * optimize.c (maybe_clone_body): Use DECL_COMDAT_GROUP
+
2009-06-12 Aldy Hernandez <aldyh@redhat.com>
* typeck.c (cp_build_binary_op): Pass location to overflow_warning.
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 1ce9d36..6723a85 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -78,8 +78,6 @@ extern bool cp_function_decl_explicit_p (tree decl);
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
#undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS cp_write_global_declarations
-#undef LANG_HOOKS_COMDAT_GROUP
-#define LANG_HOOKS_COMDAT_GROUP cxx_comdat_group
#undef LANG_HOOKS_BUILTIN_FUNCTION
#define LANG_HOOKS_BUILTIN_FUNCTION cxx_builtin_function
#undef LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 19d61bf..4cb34f5 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4372,7 +4372,7 @@ extern tree cxx_builtin_function (tree decl);
extern tree cxx_builtin_function_ext_scope (tree decl);
extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
extern void warn_extern_redeclared_static (tree, tree);
-extern const char *cxx_comdat_group (tree);
+extern tree cxx_comdat_group (tree);
extern bool cp_missing_noreturn_ok_p (tree);
extern void initialize_artificial_var (tree, tree);
extern tree check_var_type (tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 22c426b..296d143 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1835,7 +1835,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Merge the storage class information. */
merge_weak (newdecl, olddecl);
- DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl);
+ if (DECL_ONE_ONLY (olddecl))
+ DECL_COMDAT_GROUP (newdecl) = DECL_COMDAT_GROUP (olddecl);
+
DECL_DEFER_OUTPUT (newdecl) |= DECL_DEFER_OUTPUT (olddecl);
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
TREE_STATIC (olddecl) = TREE_STATIC (newdecl) |= TREE_STATIC (olddecl);
@@ -12792,7 +12794,7 @@ cp_missing_noreturn_ok_p (tree decl)
/* Return the COMDAT group into which DECL should be placed. */
-const char *
+tree
cxx_comdat_group (tree decl)
{
tree name;
@@ -12822,7 +12824,7 @@ cxx_comdat_group (tree decl)
name = DECL_ASSEMBLER_NAME (decl);
}
- return IDENTIFIER_POINTER (name);
+ return name;
}
#include "gt-cp-decl.h"
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index c540c08..495c8e7 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1510,7 +1510,7 @@ void
comdat_linkage (tree decl)
{
if (flag_weak)
- make_decl_one_only (decl);
+ make_decl_one_only (decl, cxx_comdat_group (decl));
else if (TREE_CODE (decl) == FUNCTION_DECL
|| (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)))
/* We can just emit function and compiler-generated variables
@@ -1582,7 +1582,7 @@ maybe_make_one_only (tree decl)
|| (! DECL_EXPLICIT_INSTANTIATION (decl)
&& ! DECL_TEMPLATE_SPECIALIZATION (decl)))
{
- make_decl_one_only (decl);
+ make_decl_one_only (decl, cxx_comdat_group (decl));
if (TREE_CODE (decl) == VAR_DECL)
{
@@ -1845,7 +1845,7 @@ constrain_visibility (tree decl, int visibility)
if (!DECL_EXTERN_C_P (decl))
{
TREE_PUBLIC (decl) = 0;
- DECL_ONE_ONLY (decl) = 0;
+ DECL_COMDAT_GROUP (decl) = NULL_TREE;
DECL_INTERFACE_KNOWN (decl) = 1;
if (DECL_LANG_SPECIFIC (decl))
DECL_NOT_REALLY_EXTERN (decl) = 1;
@@ -2504,7 +2504,7 @@ get_guard (tree decl)
TREE_PUBLIC (guard) = TREE_PUBLIC (decl);
TREE_STATIC (guard) = TREE_STATIC (decl);
DECL_COMMON (guard) = DECL_COMMON (decl);
- DECL_ONE_ONLY (guard) = DECL_ONE_ONLY (decl);
+ DECL_COMDAT_GROUP (guard) = DECL_COMDAT_GROUP (decl);
if (TREE_PUBLIC (decl))
DECL_WEAK (guard) = DECL_WEAK (decl);
DECL_VISIBILITY (guard) = DECL_VISIBILITY (decl);
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 0ceff66..af58afe 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -383,7 +383,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
DECL_VISIBILITY_SPECIFIED (thunk_fndecl)
= DECL_VISIBILITY_SPECIFIED (function);
if (DECL_ONE_ONLY (function))
- make_decl_one_only (thunk_fndecl);
+ make_decl_one_only (thunk_fndecl, cxx_comdat_group (thunk_fndecl));
if (flag_syntax_only)
{
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 8c7b9e8..9d4a8c5 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -141,7 +141,12 @@ maybe_clone_body (tree fn)
DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
DECL_COMDAT (clone) = DECL_COMDAT (fn);
DECL_WEAK (clone) = DECL_WEAK (fn);
- DECL_ONE_ONLY (clone) = DECL_ONE_ONLY (fn);
+
+ /* We don't copy the comdat group from fn to clone because the assembler
+ name of fn was corrupted by write_mangled_name by adding *INTERNAL*
+ to it. By doing so, it also corrupted the comdat group. */
+ if (DECL_ONE_ONLY (fn))
+ DECL_COMDAT_GROUP (clone) = cxx_comdat_group (clone);
DECL_SECTION_NAME (clone) = DECL_SECTION_NAME (fn);
DECL_USE_TEMPLATE (clone) = DECL_USE_TEMPLATE (fn);
DECL_EXTERNAL (clone) = DECL_EXTERNAL (fn);