[cxx-abi-dev] Non-cloned [cd]tors

Jason Merrill jason at redhat.com
Thu Nov 19 15:53:09 UTC 2009


On 11/19/2009 10:02 AM, Mark Mitchell wrote:
> That's my recollection of how EDG did it too, in the sense that I think
> there were fields in the IL for COMDAT group, and a COMDAT-capable
> back-end could thus emit them in the right group.

A quick check with icc 10.1 shows that they currently put them in 
separate COMDATs as well.  And they also emit a C9/D9 variant, curiously 
enough.  Anyone know what that's for?

> For G++, I believe that there was no support for actual COMDAT groups at
> the time this got implemented, and so we fell back to weak/linkonce as
> the closest equivalent.  In other words, I think this is was a
> quasi-known bug in the G++ implementation.

We could have done the right thing with linkonce sections, though.

> The decision to make now,
> then, is whether to fix G++, or change the ABI to permit the G++
> implementation.

I want to fix both G++ and the ABI, which seems to require the G++ 
implementation:

"Implicitly-defined or inline user-defined constructors and destructors 
are emitted where referenced, each in its own COMDAT group identified by 
the constructor or destructor name."

Since the symbols are weak anyway, the only negative impact of the 
change would be some redundancy when linking together code from 
different compilers: the output would have one definition of the 
complete constructor from a C1 comdat and another definition from the 
combined comdat.  I think that's an improvement over the current 
situation where we get two definitions even when everything is built 
with the same compiler.

So, what name should we give the common comdat group?  [CD]5, perhaps? 
We can't use one of the existing names, so we can't just adopt the HP 
compiler convention.

Do we want to include the deleting destructor in that group as well as 
the base/complete variants, for classes with a virtual destructor?  I 
suppose we might as well, but don't have a strong preference.

Do we want to treat inlines differently from non-inline templates?  I 
think not.

Jason



More information about the cxx-abi-dev mailing list