C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Common ABI specification

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Fri, 27 Jan 2023 23:51:45 +0100
On 27/01/2023 22.11, samuel ammonius via Std-Proposals wrote:
> GCC and IBM's C++ compilers use the same system for name
> mangling, which uses valid identifiers. It's documented here:
> https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
> <https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling>
> Would that work?
>
> <https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling>
>> And doing that would not be a pure extension with no impact on the current language, because it would require incompatible changes from at least one
>> existing, widely-used compiler.
>
> What about something similar to /extern "C"/ for telling compilers
> that the symbols are stored this way? (extern "cpp_common_abi")

Could you remind me what the purpose of your proposal is?

There is the Itanium ABI for those C++ implementations that
choose to use it, and those C++ implementations are link-
compatible, meaning that object files produced by different
compilers can be linked together (if the same standard
library is used).

Other programming languages are certainly welcome to use that
ABI if it fits their needs, but as-is, it's a C++ ABI, and
thus is tailored to C++ and evolves as new features are added
to C++ that need ABI consideration.

I'd also like to point out that the C++ standard has traditionally
refrained from specifying an ABI, as it is at a different level
of abstraction than the source code. It seems the existing
cross-vendor efforts to define ABIs work quite nicely, so I'm
not seeing an imminent need for WG21 to get involved here.

Jens

Received on 2023-01-27 22:51:51