tree.h (DECL_ONE_ONLY): Return true only for externally visible symbols.

* tree.h (DECL_ONE_ONLY): Return true only for externally visible
	symbols.
	* except.c (switch_to_exception_section, resolve_unique_section,
	get_named_text_section, default_function_rodata_section, 
	align_variable, get_block_for_decl, default_section_type_flags):
	Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
	* symtab.c (symtab_add_to_same_comdat_group,
	symtab_make_decl_local, fixup_same_cpp_alias_visibility,
	symtab_nonoverwritable_alias, symtab_get_symbol_partitioning_class):
	Likewise.
	* cgraphclones.c (cgraph_create_virtual_clone): Likewise.
	* bb-reorder.c (pass_partition_blocks::gate): Likewise.
	* config/c6x/c6x.c (c6x_elf_unique_section): Likewise.
	(c6x_function_in_section_p): Likewise.
	* config/darwin.c (machopic_select_section): Likewise.
	* config/arm/arm.c (arm_function_in_section_p): Likewise.
	* config/mips/mips.c (mips_function_rodata_section): Likewise.
	* config/mep/mep.c (mep_select_section): LIkewise.
	* config/i386/i386.c (x86_64_elf_unique_section): Likewise.

From-SVN: r210654
This commit is contained in:
Jan Hubicka 2014-05-20 21:57:45 +02:00 committed by Jan Hubicka
parent f4cd9c518b
commit cf288ed3b8
13 changed files with 51 additions and 28 deletions

View File

@ -1,3 +1,25 @@
2014-05-20 Jan Hubicka <hubicka@ucw.cz>
* tree.h (DECL_ONE_ONLY): Return true only for externally visible
symbols.
* except.c (switch_to_exception_section, resolve_unique_section,
get_named_text_section, default_function_rodata_section,
align_variable, get_block_for_decl, default_section_type_flags):
Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
* symtab.c (symtab_add_to_same_comdat_group,
symtab_make_decl_local, fixup_same_cpp_alias_visibility,
symtab_nonoverwritable_alias, symtab_get_symbol_partitioning_class):
Likewise.
* cgraphclones.c (cgraph_create_virtual_clone): Likewise.
* bb-reorder.c (pass_partition_blocks::gate): Likewise.
* config/c6x/c6x.c (c6x_elf_unique_section): Likewise.
(c6x_function_in_section_p): Likewise.
* config/darwin.c (machopic_select_section): Likewise.
* config/arm/arm.c (arm_function_in_section_p): Likewise.
* config/mips/mips.c (mips_function_rodata_section): Likewise.
* config/mep/mep.c (mep_select_section): LIkewise.
* config/i386/i386.c (x86_64_elf_unique_section): Likewise.
2014-05-20 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-dom.c (hashable_expr_equal_p) <EXPR_CALL>: Also compare the

View File

@ -2669,7 +2669,7 @@ pass_partition_blocks::gate (function *fun)
/* See gate_handle_reorder_blocks. We should not partition if
we are going to omit the reordering. */
&& optimize_function_for_speed_p (fun)
&& !DECL_ONE_ONLY (current_function_decl)
&& !DECL_COMDAT_GROUP (current_function_decl)
&& !user_defined_section_attribute);
}

View File

@ -558,7 +558,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
that is not weak also.
??? We cannot use COMDAT linkage because there is no
ABI support for this. */
if (DECL_ONE_ONLY (old_decl))
if (DECL_COMDAT_GROUP (old_decl))
DECL_SECTION_NAME (new_node->decl) = NULL;
set_new_clone_decl_and_node_flags (new_node);
new_node->clone.tree_map = tree_map;

View File

@ -6154,7 +6154,7 @@ arm_function_in_section_p (tree decl, section *section)
if (!DECL_SECTION_NAME (decl))
{
/* Make sure that we will not create a unique section for DECL. */
if (flag_function_sections || DECL_ONE_ONLY (decl))
if (flag_function_sections || DECL_COMDAT_GROUP (decl))
return false;
}

View File

@ -985,7 +985,7 @@ c6x_elf_unique_section (tree decl, int reloc)
{
const char *prefix = NULL;
/* We only need to use .gnu.linkonce if we don't have COMDAT groups. */
bool one_only = DECL_ONE_ONLY (decl) && !HAVE_COMDAT_GROUP;
bool one_only = DECL_COMDAT_GROUP (decl) && !HAVE_COMDAT_GROUP;
if (c6x_in_small_data_p (decl))
{
@ -1202,7 +1202,7 @@ c6x_function_in_section_p (tree decl, section *section)
if (!DECL_SECTION_NAME (decl))
{
/* Make sure that we will not create a unique section for DECL. */
if (flag_function_sections || DECL_ONE_ONLY (decl))
if (flag_function_sections || DECL_COMDAT_GROUP (decl))
return false;
}

View File

@ -1521,7 +1521,7 @@ machopic_select_section (tree decl,
one = DECL_P (decl)
&& TREE_CODE (decl) == VAR_DECL
&& DECL_ONE_ONLY (decl);
&& DECL_COMDAT_GROUP (decl);
ro = TREE_READONLY (decl) || TREE_CONSTANT (decl) ;

View File

@ -5147,7 +5147,7 @@ x86_64_elf_unique_section (tree decl, int reloc)
{
const char *prefix = NULL;
/* We only need to use .gnu.linkonce if we don't have COMDAT groups. */
bool one_only = DECL_ONE_ONLY (decl) && !HAVE_COMDAT_GROUP;
bool one_only = DECL_COMDAT_GROUP (decl) && !HAVE_COMDAT_GROUP;
switch (categorize_decl_for_section (decl, reloc))
{

View File

@ -4532,7 +4532,7 @@ mep_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
else
encoding = 0;
if (flag_function_sections || DECL_ONE_ONLY (decl))
if (flag_function_sections || DECL_COMDAT_GROUP (decl))
mep_unique_section (decl, 0);
else if (lookup_attribute ("vliw", TYPE_ATTRIBUTES (TREE_TYPE (decl))))
{
@ -4651,7 +4651,7 @@ mep_unique_section (tree decl, int reloc)
name += 3;
}
prefix = prefixes[sec][DECL_ONE_ONLY(decl)];
prefix = prefixes[sec][DECL_COMDAT_GROUP(decl) != NULL];
len = strlen (name) + strlen (prefix);
string = (char *) alloca (len + 1);

View File

@ -8469,7 +8469,7 @@ mips_function_rodata_section (tree decl)
if (decl && DECL_SECTION_NAME (decl))
{
const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
if (DECL_ONE_ONLY (decl) && strncmp (name, ".gnu.linkonce.t.", 16) == 0)
if (DECL_COMDAT_GROUP (decl) && strncmp (name, ".gnu.linkonce.t.", 16) == 0)
{
char *rname = ASTRDUP (name);
rname[14] = 'd';

View File

@ -2867,12 +2867,12 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname))
#ifdef HAVE_LD_EH_GC_SECTIONS
if (flag_function_sections
|| (DECL_ONE_ONLY (current_function_decl) && HAVE_COMDAT_GROUP))
|| (DECL_COMDAT_GROUP (current_function_decl) && HAVE_COMDAT_GROUP))
{
char *section_name = XNEWVEC (char, strlen (fnname) + 32);
/* The EH table must match the code section, so only mark
it linkonce if we have COMDAT groups to tie them together. */
if (DECL_ONE_ONLY (current_function_decl) && HAVE_COMDAT_GROUP)
if (DECL_COMDAT_GROUP (current_function_decl) && HAVE_COMDAT_GROUP)
flags |= SECTION_LINKONCE;
sprintf (section_name, ".gcc_except_table.%s", fnname);
s = get_section (section_name, flags, current_function_decl);

View File

@ -513,7 +513,7 @@ void
symtab_add_to_same_comdat_group (symtab_node *new_node,
symtab_node *old_node)
{
gcc_assert (DECL_ONE_ONLY (old_node->decl));
gcc_assert (DECL_COMDAT_GROUP (old_node->decl));
gcc_assert (!new_node->same_comdat_group);
gcc_assert (new_node != old_node);
@ -832,9 +832,9 @@ verify_symtab_base (symtab_node *node)
{
symtab_node *n = node->same_comdat_group;
if (!DECL_ONE_ONLY (n->decl))
if (!DECL_COMDAT_GROUP (n->decl))
{
error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
error ("node is in same_comdat_group list but has no DECL_COMDAT_GROUP");
error_found = true;
}
if (DECL_COMDAT_GROUP (n->decl) != DECL_COMDAT_GROUP (node->same_comdat_group->decl))
@ -958,7 +958,7 @@ symtab_make_decl_local (tree decl)
DECL_COMMON (decl) = 0;
else gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
if (DECL_ONE_ONLY (decl) || DECL_COMDAT (decl))
if (DECL_COMDAT_GROUP (decl) || DECL_COMDAT (decl))
{
DECL_SECTION_NAME (decl) = 0;
DECL_COMDAT (decl) = 0;
@ -1101,7 +1101,7 @@ fixup_same_cpp_alias_visibility (symtab_node *node, symtab_node *target)
DECL_COMDAT (node->decl) = DECL_COMDAT (target->decl);
DECL_COMDAT_GROUP (node->decl)
= DECL_COMDAT_GROUP (target->decl);
if (DECL_ONE_ONLY (target->decl)
if (DECL_COMDAT_GROUP (target->decl)
&& !node->same_comdat_group)
symtab_add_to_same_comdat_group (node, target);
}
@ -1231,7 +1231,7 @@ symtab_nonoverwritable_alias (symtab_node *node)
/* Update the properties. */
DECL_EXTERNAL (new_decl) = 0;
if (DECL_ONE_ONLY (node->decl))
if (DECL_COMDAT_GROUP (node->decl))
DECL_SECTION_NAME (new_decl) = NULL;
DECL_COMDAT_GROUP (new_decl) = 0;
TREE_PUBLIC (new_decl) = 0;
@ -1328,8 +1328,7 @@ symtab_get_symbol_partitioning_class (symtab_node *node)
return SYMBOL_EXTERNAL;
/* Linker discardable symbols are duplicated to every use unless they are
keyed.
Keyed symbols or those. */
keyed. */
if (DECL_ONE_ONLY (node->decl)
&& !node->force_output
&& !node->forced_by_abi

View File

@ -2327,7 +2327,8 @@ extern void decl_value_expr_insert (tree, tree);
/* 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_COMDAT_GROUP (NODE) != NULL_TREE)
#define DECL_ONE_ONLY(NODE) (DECL_COMDAT_GROUP (NODE) != NULL_TREE \
&& (TREE_PUBLIC (NODE) || DECL_EXTERNAL (NODE)))
/* The name of the object as the assembler will see it (but before any
translations made by ASM_OUTPUT_LABELREF). Often this is the same

View File

@ -428,7 +428,7 @@ resolve_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED,
if (DECL_SECTION_NAME (decl) == NULL_TREE
&& targetm_common.have_named_sections
&& (flag_function_or_data_sections
|| DECL_ONE_ONLY (decl)))
|| DECL_COMDAT_GROUP (decl)))
{
targetm.asm_out.unique_section (decl, reloc);
DECL_HAS_IMPLICIT_SECTION_NAME_P (decl) = true;
@ -517,7 +517,7 @@ get_named_text_section (tree decl,
/* Do not try to split gnu_linkonce functions. This gets somewhat
slipperly. */
if (DECL_ONE_ONLY (decl) && !HAVE_COMDAT_GROUP)
if (DECL_COMDAT_GROUP (decl) && !HAVE_COMDAT_GROUP)
return NULL;
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
name = targetm.strip_name_encoding (name);
@ -687,7 +687,7 @@ default_function_rodata_section (tree decl)
{
const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
if (DECL_ONE_ONLY (decl) && HAVE_COMDAT_GROUP)
if (DECL_COMDAT_GROUP (decl) && HAVE_COMDAT_GROUP)
{
const char *dot;
size_t len;
@ -704,7 +704,7 @@ default_function_rodata_section (tree decl)
return get_section (rname, SECTION_LINKONCE, decl);
}
/* For .gnu.linkonce.t.foo we want to use .gnu.linkonce.r.foo. */
else if (DECL_ONE_ONLY (decl)
else if (DECL_COMDAT_GROUP (decl)
&& strncmp (name, ".gnu.linkonce.t.", 16) == 0)
{
size_t len = strlen (name) + 1;
@ -996,7 +996,8 @@ align_variable (tree decl, bool dont_output_data)
and for code accessing the variable as guaranteed alignment, we
can only increase the alignment if it is a performance optimization
if the references to it must bind to the current definition. */
if (decl_binds_to_current_def_p (decl))
if (decl_binds_to_current_def_p (decl)
&& !DECL_VIRTUAL_P (decl))
{
#ifdef DATA_ALIGNMENT
unsigned int data_align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
@ -1142,7 +1143,7 @@ get_block_for_decl (tree decl)
/* There's no point using object blocks for something that is
isolated by definition. */
if (DECL_ONE_ONLY (decl))
if (DECL_COMDAT_GROUP (decl))
return NULL;
}
@ -6076,7 +6077,7 @@ default_section_type_flags (tree decl, const char *name, int reloc)
flags |= SECTION_RELRO;
}
if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
if (decl && DECL_P (decl) && DECL_COMDAT_GROUP (decl))
flags |= SECTION_LINKONCE;
if (strcmp (name, ".vtable_map_vars") == 0)