http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59469
--- Comment #29 from Jan Hubicka <hubicka at ucw dot cz> --- > > That optimization seems invalid. There is a explicit template instantiation > definition, so it is valid for other dsos to have an undefined reference. Can I see the cgraph dump of the unreduced source file containing the explicit instantiation? In this case C++ FE should set forced_by_abi flag and that should prevent us from bringing comdat local in: /* A helper for comdat_can_be_unshared_p. */ static bool comdat_can_be_unshared_p_1 (symtab_node *node) { /* When address is taken, we don't know if equality comparison won't break eventually. Exception are virutal functions, C++ constructors/destructors and vtables, where this is not possible by language standard. */ if (!DECL_VIRTUAL_P (node->decl) && (TREE_CODE (node->decl) != FUNCTION_DECL || (!DECL_CXX_CONSTRUCTOR_P (node->decl) && !DECL_CXX_DESTRUCTOR_P (node->decl))) && address_taken_from_non_vtable_p (node)) return false; /* If the symbol is used in some weird way, better to not touch it. */ if (node->force_output) return false; /* Explicit instantiations needs to be output when possibly used externally. */ if (node->forced_by_abi && TREE_PUBLIC (node->decl) && (node->resolution != LDPR_PREVAILING_DEF_IRONLY && !flag_whole_program)) return false; Perhaps we forget about the flag, or perhaps the symbol is hidden by the default visibility overrride? Honza