* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148492
138bc75d-0d04-0410-961f-
82ee72b054a4
+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 Richard Guenther <rguenther@suse.de>
PR middle-end/40439
??? We cannot use COMDAT linkage because there is no
ABI support for this. */
DECL_EXTERNAL (new_node->decl) = 0;
- DECL_ONE_ONLY (new_node->decl) = 0;
+ DECL_COMDAT_GROUP (new_node->decl) = 0;
TREE_PUBLIC (new_node->decl) = 0;
DECL_COMDAT (new_node->decl) = 0;
DECL_WEAK (new_node->decl) = 0;
??? We cannot use COMDAT linkage because there is no
ABI support for this. */
DECL_EXTERNAL (new_version_node->decl) = 0;
- DECL_ONE_ONLY (new_version_node->decl) = 0;
+ DECL_COMDAT_GROUP (new_version_node->decl) = NULL_TREE;
TREE_PUBLIC (new_version_node->decl) = 0;
DECL_COMDAT (new_version_node->decl) = 0;
DECL_WEAK (new_version_node->decl) = 0;
tree_function_versioning (node->decl, first_clone->decl, NULL, true, NULL);
DECL_EXTERNAL (first_clone->decl) = 0;
- DECL_ONE_ONLY (first_clone->decl) = 0;
+ DECL_COMDAT_GROUP (first_clone->decl) = NULL_TREE;
TREE_PUBLIC (first_clone->decl) = 0;
DECL_COMDAT (first_clone->decl) = 0;
VEC_free (ipa_opt_pass, heap,
error_mark_node);
TREE_PUBLIC (decl) = 1;
TREE_STATIC (decl) = 1;
- DECL_ONE_ONLY (decl) = 1;
+ DECL_COMDAT_GROUP (decl) = DECL_ASSEMBLER_NAME (decl);
(*targetm.asm_out.unique_section) (decl, 0);
switch_to_section (get_named_section (decl, NULL, 0));
+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.
#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
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);
/* 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);
/* Return the COMDAT group into which DECL should be placed. */
-const char *
+tree
cxx_comdat_group (tree decl)
{
tree name;
name = DECL_ASSEMBLER_NAME (decl);
}
- return IDENTIFIER_POINTER (name);
+ return name;
}
#include "gt-cp-decl.h"
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
|| (! 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)
{
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;
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);
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)
{
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);
if (TREE_PUBLIC (id))
{
TREE_PUBLIC (decl) = 1;
- make_decl_one_only (decl);
+ make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
}
else
TREE_STATIC (decl) = 1;
extern tree lhd_type_promotes_to (tree);
extern void lhd_register_builtin_type (tree, const char *);
extern bool lhd_decl_ok_for_sibcall (const_tree);
-extern const char *lhd_comdat_group (tree);
extern tree lhd_expr_size (const_tree);
extern size_t lhd_tree_size (enum tree_code);
extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
-#define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing
#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false
LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
LANG_HOOKS_WRITE_GLOBALS, \
LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
- LANG_HOOKS_COMDAT_GROUP, \
LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \
LANG_HOOKS_OMP_PREDETERMINED_SHARING, \
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, \
return true;
}
-/* Return the COMDAT group into which DECL should be placed. */
-
-const char *
-lhd_comdat_group (tree decl)
-{
- return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-}
-
/* lang_hooks.decls.final_write_globals: perform final processing on
global variables. */
void
/* True if this decl may be called via a sibcall. */
bool (*ok_for_sibcall) (const_tree);
- /* Return the COMDAT group into which this DECL should be placed.
- It is known that the DECL belongs in *some* COMDAT group when
- this hook is called. The return value will be used immediately,
- but not explicitly deallocated, so implementations should not use
- xmalloc to allocate the string returned. (Typically, the return
- value will be the string already stored in an
- IDENTIFIER_NODE.) */
- const char * (*comdat_group) (tree);
-
/* True if OpenMP should privatize what this DECL points to rather
than the DECL itself. */
bool (*omp_privatize_by_reference) (const_tree);
+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.
+
2009-06-14 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* gcc.dg/optimize-bswap-1.c: Split into these two:
// { dg-options "-Wabi -fabi-version=1" }
template <typename Q>
-void f (typename Q::X) {} // { dg-warning "mangle" }
+void f (typename Q::X) {}
struct S {
typedef int X;
};
-template void f<S> (int);
+template void f<S> (int); // { dg-warning "mangle" }
// { dg-options "-Wabi -fabi-version=1" }
template <template <typename> class Q>
-void f (typename Q<int>::X) {} // { dg-warning "mangle" }
+void f (typename Q<int>::X) {}
template <typename Q>
struct S {
typedef int X;
};
-template void f<S> (int);
+template void f<S> (int); // { dg-warning "mangle" }
template <int I> struct S {};
-template <int I> void f (S<I + e + int (3.7)>) {} // { dg-warning "mangle" }
-template void f<7>(S<7 + e + int (3.7)>);
+template <int I> void f (S<I + e + int (3.7)>) {}
+template void f<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" }
-template <int I> void g (S<I + e + int (3.7)>) {} // { dg-warning "mangle" }
-template void g<7>(S<7 + e + int (3.7)>);
+template <int I> void g (S<I + e + int (3.7)>) {}
+template void g<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" }
// PR 9043
// mangled array types in templates
-template <int I> void f(int (*)[2]) {} // { dg-warning "mangled name" }
+template <int I> void f(int (*)[2]) {}
template <int I> void g(int (*)[I+2]) {}
-template void f<1>(int (*)[2]);
+template void f<1>(int (*)[2]); // { dg-warning "mangled name" }
// { dg-final { scan-assembler "\n_?_Z1fILi1EEvPALi2E_i\[: \t\n\]" } }
template void g<1>(int (*)[3]);
// { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } }
something which is DECL_COMDAT. */
#define DECL_COMDAT(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.comdat_flag)
+#define DECL_COMDAT_GROUP(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.comdat_group)
+
/* A replaceable function is one which may be replaced at link-time
with an entirely different definition, provided that the
replacement has the same type. For example, functions declared
/* Used in TREE_PUBLIC decls to indicate that copies of this DECL in
multiple translation units should be merged. */
-#define DECL_ONE_ONLY(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.one_only)
+#define DECL_ONE_ONLY(NODE) (DECL_COMDAT_GROUP (NODE) != NULL_TREE)
struct GTY(()) tree_decl_with_vis {
struct tree_decl_with_rtl common;
tree assembler_name;
tree section_name;
+ tree comdat_group;
/* Belong to VAR_DECL exclusively. */
unsigned defer_output:1;
ENUM_BITFIELD(symbol_visibility) visibility : 2;
unsigned visibility_specified : 1;
/* Belong to FUNCTION_DECL exclusively. */
- unsigned one_only : 1;
unsigned init_priority_p:1;
/* Belongs to VAR_DECL exclusively. */
ENUM_BITFIELD(tls_model) tls_model : 3;
- /* 13 unused bits. */
+ /* 14 unused bits. */
};
/* In a VAR_DECL that's static,
unsigned int);
/* varasm.c */
extern void make_decl_rtl (tree);
-extern void make_decl_one_only (tree);
+extern void make_decl_one_only (tree, tree);
extern int supports_one_only (void);
extern void resolve_unique_section (tree, int, int);
extern void mark_referenced (tree);
DECL_WEAK (to) = DECL_WEAK (decl);
if (DECL_ONE_ONLY (decl))
{
- make_decl_one_only (to);
+ make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
TREE_STATIC (to) = TREE_STATIC (decl);
TREE_PUBLIC (to) = TREE_PUBLIC (decl);
DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);
TREE_READONLY (to) = 0;
SET_DECL_ASSEMBLER_NAME (to, DECL_NAME (to));
if (DECL_ONE_ONLY (decl))
- make_decl_one_only (to);
+ make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
DECL_CONTEXT (to) = DECL_CONTEXT (decl);
if (targetm.emutls.var_align_fixed)
/* If we're not allowed to change the proxy object's
translation units without generating a linker error. */
void
-make_decl_one_only (tree decl)
+make_decl_one_only (tree decl, tree comdat_group)
{
gcc_assert (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == FUNCTION_DECL);
#ifdef MAKE_DECL_ONE_ONLY
MAKE_DECL_ONE_ONLY (decl);
#endif
- DECL_ONE_ONLY (decl) = 1;
+ DECL_COMDAT_GROUP (decl) = comdat_group;
}
else if (TREE_CODE (decl) == VAR_DECL
&& (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
fprintf (asm_out_file, ",%s,comdat",
- lang_hooks.decls.comdat_group (decl));
+ IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl)));
}
putc ('\n', asm_out_file);