[cfe-commits] [patch][pr13124] Use strong symbols for functions that go in a strong vtables

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jun 27 10:24:36 PDT 2012


The tests in pr13124 shows a case where both gcc 4.7 and clang produce
an undefined reference to a destructor that we currently output (in
another TU) as linkonce_odr.

This works 99.9% of the time because we output a strong vtable that
references that destructor, preventing any of the existing
optimizations from dropping it, but there is no guarantee that that
cannot happen. For example, function merging could merge that
destructor with another one since they are unnamed_addr.

This also causes problems when globalopt marks linkonce_odr
unnamed_addr functions hidden and we are using the symbol across
shared libraries.

The attached patch ensures that we produce a strong symbol for
functions that go in an strong vtable. This in turn ensure that it is
safe to output those vtables as available_externally in other TUs (and
use clang compiled libraries with gcc 4.7 compiled programs).

Cheers,
Rafael



More information about the cfe-commits mailing list