On Wed, Sep 28, 2011 at 5:29 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > Hi, > this patch adds support for V2 plugin API (thanks, Cary) that adds > LDPR_PREVAILING_DEF_IRONLY_EXP. > The reoslution is like LDPR_PREVAILING_DEF_IRONLY but the symbol is exported > out of DSO. It is up to the compiler to optimize it out or keep it based on > the knowledge whether the symbol can be optimized out at all (i.e. most > COMDATs > can, other types can't). > > This solve quite few problems with building C++ APPS, see the PR log. > > I was originally wrong about gold implementation being buggy. The problem > turned > out to be subtle lto-symtab bug that was mostly latent because of the COMDAT > hack > we use. lto_symtab_resolve_symbols is supposed to honor plugin decision when > it is > available but it doesn't when resolution of very first entry in the list is > UNKNOWN. > This can happen because we add into symtab also declarations that are not in > varpool (i.e. they are neither defined or used by the object file), but they > are > used otherwise, i.e. referred from stuff used for debug info or TB > devirtualization. > > To ensure backward compatibility I am keeping the COMDAT hack in place. It > won't help > letting compiler know the plugin API version, since we decide on that at a > time > we output object files and thus we are not called from plugin. I suppose we > could > keep the hack in place for next release and remove it afterwards penalizing > builds > with old binutils? Or perhaps even in GCC 4.7 if GNU LD gets updated in time. > > Bootstrapped/regtested x86_64-linux, built Mozilla and lto-bootstrap in > progress. > OK if it passes? > > Honza > > PR lto/47247 > * lto-plugin.c (get_symbols_v2): New variable. > (write_resolution): Use V2 API when available. > (onload): Handle LDPT_GET_SYMBOLS_V2. > > * lto-symtab.c (lto_symtab_resolve_symbols): Do not resolve > when resolution is already availbale from plugin. > (lto_symtab_merge_decls_1): Handle LDPR_PREVAILING_DEF_IRONLY_EXP. > * cgraph.c (ld_plugin_symbol_resolution): Add > prevailing_def_ironly_exp. > * lto-cgraph.c (LDPR_NUM_KNOWN): Update. > * ipa.c (varpool_externally_visible_p): IRONLY variables are never > externally visible. > * varasm.c (resolution_to_local_definition_p): Add > LDPR_PREVAILING_DEF_IRONLY_EXP. > (resolution_local_p): Likewise. > > * common.c (lto_resolution_str): Add new resolution. > * common.h (lto_resolution_str): Likewise.
This caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50601 -- H.J.