+2014-02-04 Jan Hubicka <hubicka@ucw.cz>
+
+ * 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.
+
2014-02-04 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc/config/host-linux.c (linux_gt_pch_use_address): Don't
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)
{
+2014-02-04 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto-partition.c (get_symbol_class): Only unforced DECL_ONE_ONLY
+ needs duplicating, not generic COMDAT.
+
2014-02-04 Richard Biener <rguenther@suse.de>
PR lto/59723
else if (!cgraph (node)->definition)
return SYMBOL_EXTERNAL;
- /* Comdats are duplicated to every use unless they are keyed.
- Those do not need duplication. */
- if (DECL_COMDAT (node->decl)
+ /* Linker discardable symbols are duplicated to every use unless they are
+ keyed.
+ Keyed symbols or those. */
+ if (DECL_ONE_ONLY (node->decl)
&& !node->force_output
+ && !node->forced_by_abi
&& !symtab_used_from_object_file_p (node))
return SYMBOL_DUPLICATE;
&& (TREE_STATIC (exp) || DECL_EXTERNAL (exp)))
{
varpool_node *vnode = varpool_get_node (exp);
- if (vnode && resolution_local_p (vnode->resolution))
+ if (vnode && (resolution_local_p (vnode->resolution) || vnode->in_other_partition))
resolved_locally = true;
if (vnode
&& resolution_to_local_definition_p (vnode->resolution))
{
struct cgraph_node *node = cgraph_get_node (exp);
if (node
- && resolution_local_p (node->resolution))
+ && (resolution_local_p (node->resolution) || node->in_other_partition))
resolved_locally = true;
if (node
&& resolution_to_local_definition_p (node->resolution))