https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117010

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
C++ Itanium ABI has several types of constructors and destructors:
  <ctor-dtor-name> ::= C1                       # complete object constructor
                   ::= C2                       # base object constructor
                   ::= C3                       # complete object allocating
constructor
                   ::= CI1 <base class type>    # complete object inheriting
constructor
                   ::= CI2 <base class type>    # base object inheriting
constructor
                   ::= D0                       # deleting destructor
                   ::= D1                       # complete object destructor
                   ::= D2                       # base object destructor
In many classes, the complete and base object ctors are actually the same and
similarly for complete and base destructors, so the C++ FE attempts to use
aliases for those if possible.  See cp/optimize.cc (maybe_clone_body) etc.
Now, if the ctor is from a template, it should be weak and comdat as well
because
several different compilation units could have the definition.
While if it is a non-inline function, it should be non-weak and alias as well.
E.g. in the
struct T {
  T ();
  ~T ();
};
T::T () {}
T::~T () {}
case.
Now, all these optimizations are done in the FE, checking (host) backend
properties.

So, if some offloading target like NVPTX lacks alias support or lacks weak
alias support, I'm afraid we need to tweak it; add thunks like IPA ICF uses
etc.

Reply via email to