Ian Lance Taylor <iant <at> google.com> writes:

> 
> Why is that?  decl_replaceable_p is supposed to be true for a function
> that may be replaced by an entirely different function at runtime.
> This is mainly to implement the correct semantics for weak functions.
> You can't inline a weak function, but at runtime the runtime linker
> might have resolved the weak function to something completely
> different.

AFAICS make_decl_one_only also sets DECL_WEAK which ultimately
causes decl_replaceable_p to return false. I understand why weak
functions are replaceable but is this also true for DECL_ONE_ONLY
functions? Couldn'tdecl_replaceable_p check for DECL_ONE_ONLY in
addition to DECL_COMDAT?

> 
> Set DECL_COMDAT.  You said that didn't work but you didn't fully
> explain why.  A DECL_COMDAT function should be output in every object
> file in which it is referenced.

I wasn't sure if that's the correct approach. If it is, some
further investigation will be necessary why it doesn't work. We
should of course find the places where template instances are
used in the frontend and not put out, but that's too much effort
right now only to make inlining work.

How does this approach work for explicitly instantiated templates?
Those might seem to be not referenced but they should still be always put
out?

Reply via email to