> >> 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. > > Yes, setting the DECL_COMDAT flag is supposed to do the right thing. > That is what the C++ frontend does; see comdat_linkage.
Yeah, it always seemed to me that COMDAT should be handled same way as INLINE in cgraph_function_body_availability. It did not make much practical difference for C++, but I would be fine with that change. My understanding of C++ one-decl-rule is however bit stronger than this. When we make COMDATs non-overwritable by semantically different implementations, does it make sense to make that for keyed methods and public methods in PIC libraries? Honza