[cxx-abi-dev] Deleted virtual functions

Jason Merrill jason at redhat.com
Tue Jun 2 19:45:15 UTC 2009


Dennis Handly wrote:
>> From: Mark Mitchell <mark at codesourcery.com>
>> other people don't.  For example, when building plugins, you often want
>> each shared library to be completely independent; if my plugin's "class
>> Plugin" is the same as your plugin's "class Plugin", very bad things happen.
> 
> We had to tell another important customer over and over this violated the
> ODR rule.  And our above changes making it hard to hide these classes
> caused them issues.  They didn't want to use the mangled name for many
> classes.  They finally accepted our reasoning, since other vendors had
> to use kludges too.  :-)

Talking about plugins reminds me of a different problem we've run into 
on Linux: you have two plugins A and B that both link against the same 
shared library C.  A and B are loaded with RTLD_LOCAL to avoid symbol 
conflicts.  If there are symbols defined in all three of A B and C, 
references in A and C are bound to the definition in A, while references 
in B are bound to the definition in B.  If the symbol is a typeid, and B 
calls a C function which throws an exception of that type, B can't catch 
it because the symbols don't match.

The same issue can come up with static data in inlines or templates, 
either data members or function local statics; this case can't be worked 
around with string comparison, though it's also less likely to be 
encountered.

I've been talking to Ulrich Drepper about ways to deal with this, and 
we've decided to go ahead with a solution that makes affected objects 
unique through the whole loaded program regardless of RTLD_LOCAL; we 
have namespaces to deal with name collisions.  I'm not sure if we 
actually want to use this for typeinfos, but I don't see a better 
solution for r/w data.

Sorry I didn't mention this to the list sooner.

Jason



More information about the cxx-abi-dev mailing list