aboutsummaryrefslogtreecommitdiff
path: root/gcc/symtab.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-05-19 03:01:12 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-05-19 01:01:12 +0000
commit7b3376a0da3e5de61c15899e4da1fc03ef7438d0 (patch)
treeba76d5a126b19a9883d7c963376b2cffd9f0d6a1 /gcc/symtab.c
parenta04d9035ec03996fd6f96a1ece21bc8d4c54cd40 (diff)
downloadgcc-7b3376a0da3e5de61c15899e4da1fc03ef7438d0.zip
gcc-7b3376a0da3e5de61c15899e4da1fc03ef7438d0.tar.gz
gcc-7b3376a0da3e5de61c15899e4da1fc03ef7438d0.tar.bz2
ipa.c (symtab_remove_unreachable_nodes): Remove symbol from comdat group if its body was eliminated.
* ipa.c (symtab_remove_unreachable_nodes): Remove symbol from comdat group if its body was eliminated. (comdat_can_be_unshared_p_1): Static symbols can always be privatized. * symtab.c (symtab_remove_from_same_comdat_group): Break out from ... (symtab_unregister_node): ... this one. (verify_symtab_base): More strict checking of comdats. * cgraph.h (symtab_remove_from_same_comdat_group): Declare. From-SVN: r210598
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r--gcc/symtab.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c
index f948e77..6b9b77a 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -323,16 +323,11 @@ symtab_insert_node_to_hashtable (symtab_node *node)
*slot = node;
}
-/* Remove node from symbol table. This function is not used directly, but via
- cgraph/varpool node removal routines. */
+/* Remove NODE from same comdat group. */
void
-symtab_unregister_node (symtab_node *node)
+symtab_remove_from_same_comdat_group (symtab_node *node)
{
- void **slot;
- ipa_remove_all_references (&node->ref_list);
- ipa_remove_all_referring (&node->ref_list);
-
if (node->same_comdat_group)
{
symtab_node *prev;
@@ -346,6 +341,19 @@ symtab_unregister_node (symtab_node *node)
prev->same_comdat_group = node->same_comdat_group;
node->same_comdat_group = NULL;
}
+}
+
+/* Remove node from symbol table. This function is not used directly, but via
+ cgraph/varpool node removal routines. */
+
+void
+symtab_unregister_node (symtab_node *node)
+{
+ void **slot;
+ ipa_remove_all_references (&node->ref_list);
+ ipa_remove_all_referring (&node->ref_list);
+
+ symtab_remove_from_same_comdat_group (node);
if (node->previous)
node->previous->next = node->next;
@@ -829,6 +837,16 @@ verify_symtab_base (symtab_node *node)
error ("non-DECL_ONE_ONLY node in a same_comdat_group list");
error_found = true;
}
+ if (DECL_COMDAT_GROUP (n->decl) != DECL_COMDAT_GROUP (node->same_comdat_group->decl))
+ {
+ error ("same_comdat_group list across different groups");
+ error_found = true;
+ }
+ if (!n->definition)
+ {
+ error ("Node has same_comdat_group but it is not a definition");
+ error_found = true;
+ }
if (n->type != node->type)
{
error ("mixing different types of symbol in same comdat groups is not supported");