http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47247
--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-01-10 17:54:51 UTC --- The plugin specification says that once the COMDAT is marked PREVAILING, it has to be output. "Any symbol marked PREVAILING_DEF must be defined in one object file added to the link after WPA is done, or an undefined symbol error will result. Any symbol marked PREVAILING_DEF_IRONLY may be left undefined (provided all references to the symbol have been removed), and the linker will not issue an error." GCC will optimize it out only if it is set PREVAILING_IRONLY, but I think we conlcuded earlier that this can not be used for symbols visible to dynamic linking (and GCC would use this info to bring the COMDAT symbol static). So I am convinced that with current API it is impossible and we need something like PREVAILING_IRONLY_EXPORTED or so for the case of symbol that is not used in current DSO but is exported. GCC can then use the knowledge of what COMDATs can be taken away.