Hello,

On Wed, 4 Nov 2026, Iain Sandoe wrote:

> >> At -Os, -fdeclone-ctor-dtor is enabled, which splits a cdtor into a unified
> >> body (C4) plus C1/C2 thunks.
> >> 
> >> A TU that inlines a thunk therefore materialises a call to a C4 whose 
> >> own offline body is DECL_EXTERNAL (but emitted by nobody), and the 
> >> link fails with an undefined reference.

And if the C1/2 thunks are not inlined: which entity emits their body?  
And why is that entity then not also the responsible one for emitting the 
C4 body?  This all sounds rather like a problem in setting up the 
properties of the C1/2/4 symbols and not in the inliner?

> The `extern template` markup says: “this function is going to be 
> available externally so do not emit its body; however do materialise 
> it’s body for the purposes of inlining”
> 
> So the build must provide one TU that overrides the `extern template` to 
> provide the function impl. for cases that do not inline (in the case of 
> the std::string fns. that TU is part of libstc++).
> 
> This is fine for C1/2 where they are emitted according to the ABI, but 
> it does not work for C4 which is an internal implementation detail and 
> is not emitted (and we do not want to emit it).

And why not?  It seems to me that when (a) C1/2 are emitted for other TUs 
use, and (b) -fdeclone-ctor-dtor says "but please commonize their body 
into a C4 helper" that then it follows that C4 should be emitted at the 
place where C1/2 are.


Ciao,
Michael.

Reply via email to