[Bug c++/23628] Typeinfo comparison code easily breaks shared libs
mmarcus at emarcus dot org
gcc-bugzilla@gcc.gnu.org
Mon Aug 29 22:14:00 GMT 2005
------- Additional Comments From mmarcus at emarcus dot org 2005-08-29 21:57 -------
Maybe I should rephrase my concern as the following question. Suppose a gcc
user is building an application and some shared libraries that depend on third
party libraries. Under what circumstances can he safely set visibility to
someting other than default, for any types? My current understanding is that
it is only safe to do so for types whose typeinfo will he can guarantee will
never be shared. This is not always an easy guarantee to make, and so, if my
undersatanding is correct, makes hidden visibility much less useful than it
first appears.
If typeinfo equality was based on string comparison instead of address
comparison, the usefuleness of hidden visibility would be greatly increased.
This would also address another important use case. There is often a desire to
produce a shared library with only an extern "C" ABI, especially when building
artifacts designed for long-term binary compatibility. That is, the only
visible symbols should be extern "C" functions. To write such a shared library
in C++, while depending upon a shared libstdc++ or other shared C++ libraries
is not possible if one most make typeinfo visible just to share it with the
libraries upon which our library depends.
Address-only typeinfo equality comparison has a high usability cost. Would it
be possible to first check for address equality, falling back to a string
comparison upon failure?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23628
More information about the Gcc-bugs
mailing list