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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Niels Möller from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > The ABI dictates the calling conventions and there's certainly nothing that
> > libstdc++ can do about it.
> 
> My impression was that C++ ABI is under the control of compiler and C++
> standard library, and that there is no such thing as a standard C++ ABI.

Most compilers (not all, in particular not Microsoft) use the strangely named
Itanium C++ ABI.

> As evidenced by the (rare) ABI breaks in libstdc++, and the difficulty of
> linking C++ objects compiled with different C++ compilers (e.g, g++ and
> clang++).

It is an ABI for the language, not the library. g++ and clang++ are supposed to
be compatible, as long as you use the same standard library for both.

> So if
> it's really not feasible to improve the situation at all for gnu/linux
> x86_64 elf targets, *please* try to keep std::unique_ptr in mind when
> involved in ABI design for other targets.

There are indeed sometimes discussions about a V2 of the ABI, for new targets
or those that can afford to break ABI compatibility.

> For specific types defined by the GNU standard C++ library, it may also be
> possible to add any needed G++ specific attributes in library headers to
> tell the compiler to depart from the "standard" ABI.

clang has such an attribute [[clang::trivial_abi]], p1029 is trying to
standardize it. But adding it in the library now would be an ABI break, which
the maintainers are strongly opposed to :-(

> In my experience (mainly from working on the webrtc.org code, where
> implementation inheritance is discouraged), it's common with implementations
> of interface classes consisting of almost trivial implementations of the
> interface's virtual functions, which only setup the correct arguments for
> calling a non-inlined (and possibly virtual) method on some member to do the
> real work.

virtual doesn't always prevent inlining (but it often does indeed).

Reply via email to