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

Dennis Handly dhandly at cup.hp.com
Thu Nov 19 02:15:13 UTC 2009


>From: Jason Merrill <jason at redhat.com>
>As I recall, the ABI was intended to allow the various [cd]tor variants 
>to be implemented either as separate functions or multiple entry points 
>to the same function. ...
>each in their own COMDAT group.

We have implemented it both ways, now with separate functions.  But we only
have one group for all of them.

And there was a change from a common C9/D9 function to calling one of the
others (base).

>From: Mark Mitchell <mark at codesourcery.com>
>My recollection is that they were all supposed to be emitted in a single
>COMDAT group, and that if you provided a definition of any one, you had
>to provide all of them.

Right.

>From: Lawrence Crowl <crowl at google.com>
>I don't see any execution problem, but the change would adversely affect the
>debugging experience and programmers would see themselves calling the base
>constructor rather than the outer constructor.

We had that problem with the "common" function having debug info and the
intermediates having none.  I'm not sure if it was that confusing.

>From: Jason Merrill <jason at redhat.com>
>That was my recollection as well, but the document doesn't actually seem 
>to say that.

It probably takes N logical inferences to read that into it.  :-)
And have worked with comdats enough to realize that they must define
the same symbols everywhere.

And it doesn't help to have a linker that turns deleted definitions of
symbols in one comdat into unsats to another.  And if they don't match,
you'll automatically get cases of definitions turned into unsats.

>From: Jason Merrill <jason at redhat.com>
>from a language perspective there's only one constructor anyway.

Unless they know the mangling rules.



More information about the cxx-abi-dev mailing list