summaryrefslogtreecommitdiff
path: root/gcc/ipa.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-04 23:26:36 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-04 23:26:36 +0000
commit96a3dc392ed25a4ab3354b5925e06c65269b50d1 (patch)
treebbf5ad857d73a9614797d6f9dbe1e05f2d043715 /gcc/ipa.c
parentbfd545187988187e969f0648d42d5568e4bbaac9 (diff)
downloadgcc-96a3dc392ed25a4ab3354b5925e06c65269b50d1.tar.gz
* ipa.c (function_and_variable_visibility): Decompose DECL_ONE_ONLY
groups when we know they are controlled by LTO. * varasm.c (default_binds_local_p_1): If object is in other partition, it will be resolved locally. * lto-partition.c (get_symbol_class): Only unforced DECL_ONE_ONLY needs duplicating, not generic COMDAT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207489 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r--gcc/ipa.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ipa.c b/gcc/ipa.c
index a7e4d764786..be75cba2dfa 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1002,6 +1002,36 @@ function_and_variable_visibility (bool whole_program)
if (DECL_EXTERNAL (decl_node->decl))
DECL_EXTERNAL (node->decl) = 1;
}
+
+ /* If whole comdat group is used only within LTO code, we can dissolve it,
+ we handle the unification ourselves.
+ We keep COMDAT and weak so visibility out of DSO does not change.
+ Later we may bring the symbols static if they are not exported. */
+ if (DECL_ONE_ONLY (node->decl)
+ && (node->resolution == LDPR_PREVAILING_DEF_IRONLY
+ || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP))
+ {
+ symtab_node *next = node;
+
+ if (node->same_comdat_group)
+ for (next = node->same_comdat_group;
+ next != node;
+ next = next->same_comdat_group)
+ if (next->externally_visible
+ && (next->resolution != LDPR_PREVAILING_DEF_IRONLY
+ && next->resolution != LDPR_PREVAILING_DEF_IRONLY_EXP))
+ break;
+ if (node == next)
+ {
+ if (node->same_comdat_group)
+ for (next = node->same_comdat_group;
+ next != node;
+ next = next->same_comdat_group)
+ DECL_COMDAT_GROUP (next->decl) = NULL;
+ DECL_COMDAT_GROUP (node->decl) = NULL;
+ symtab_dissolve_same_comdat_group_list (node);
+ }
+ }
}
FOR_EACH_DEFINED_FUNCTION (node)
{