LTO plugin and comdat symbols

Ian Lance Taylor iant@google.com
Wed Oct 6 14:14:00 GMT 2010


Jan Hubicka <hubicka@ucw.cz> writes:

> I think in this case it would make sense to change gold's behaviour by marking
> externally visible symbol that are not explicitely used by other object files
> at PREVAILING_IRONLY instead of PREVAILING_DEF. I always assumed gold behaving
> thisw way and it would give GCC freedom to take the symbol again.
> GCC by itself has all the info it needs to know if the symbol is exported from DSO
> so it will not remove non-COMDATs. Would that be possible?

This does not make sense when using -shared.  When using -shared, any
symbol with default visibility is externally visible and should appear
in the dynamic symbol table.  That is how shared libraries work.  It
would not be appropriate for gold to change that.

It is true that inlining can change the set of visible symbols.  It
would be more robust for Mozilla to use version scripts at link time to
list which symbols should be exposed from each shared library.

It is also true that if there is no remaining definition of or reference
to the symbol that there is no need for the symbol to go into the
dynamic symbol table.  It should, I hope, be possible to change that in
gold and/or the LTO plugin, and I think that would solve your problem.

Ian



More information about the Gcc-patches mailing list