From d665f8dde6f4d6c68635cbef972ef7ce085a359b Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 5 Feb 2014 00:26:36 +0100 Subject: ipa.c (function_and_variable_visibility): Decompose DECL_ONE_ONLY groups when we know they are controlled by LTO. * 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. From-SVN: r207489 --- gcc/ipa.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'gcc/ipa.c') diff --git a/gcc/ipa.c b/gcc/ipa.c index a7e4d76..be75cba 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) { -- cgit v1.1