Evgeny Karpov <[email protected]> writes:
> The calling ABI enum definition has been done following a similar convention
> in
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/i386/i386-opts.h;h=ef2825803b32001b9632769bdff196d1e43d27ba;hb=refs/heads/master#l41
>
> MS_ABI is used in gcc/config/i386/mingw32.h and gcc/config/i386/winnt-d.cc
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/i386/mingw32.h;h=58304fc55f629648e47490fd3c0f3db3858e4fd8;hb=refs/heads/master#l22
>
> These files are moved to the mingw folder in the patch series.
> https://gcc.gnu.org/pipermail/gcc-patches/attachments/20240221/5e75c464/attachment.txt
>
> What do you think about this change for v2?
>
> +/* Available call ABIs. */
> +enum aarch64_calling_abi
> +{
> + AARCH64_CALLING_ABI_EABI,
> + AARCH64_CALLING_ABI_MS,
> + MS_ABI = AARCH64_CALLING_ABI_MS
> +};
> +
How is MS_ABI used in practice? When I apply locally, it looks like
the two non-x86 uses are in:
gcc/config/mingw/mingw32.h: if (TARGET_64BIT && ix86_abi == MS_ABI)
\
gcc/config/mingw/winnt-d.cc: if (TARGET_64BIT && ix86_abi == MS_ABI)
But these should fail to build if used, because AFAICT there's no
definition of ix86_abi on aarch64.
The first match is in EXTRA_OS_CPP_BUILTINS, but I couldn't see any uses
of that in aarch64 code, which would explain why everything builds OK.
The winnt-d.cc occurence looks like it would break the build with the
D frontend enabled though.
Are there two distinct ABIs for aarch64-*-mingw*? Or are these
distinctions ignored on aarch64 and just retained for compatibility?
If there are two distinct ABIs then we should probably add them to
aarch64_arm_pcs. But if there is only a single ABI, we should probably
avoid adding calling_abi altogether and instead provide a macro like
TARGET_IS_MS_ABI that aarch64 and x86 can define differently.
(To be clear, I don't think the different handling of x18 matters
for the PCS classification. That's an orthogonal platform property
that applies to all PCS variants equally. No-one had suggested
otherwise, just wanted to say in case. :-) )
Thanks,
Richard
>
> Regards,
> Evgeny
>
>
> Thursday, February 22, 2024 12:40 PM
> Richard Earnshaw (lists) wrote:
>
>>
> +/* Available call ABIs. */
> +enum calling_abi
> +{
> + AARCH64_EABI = 0,
> + MS_ABI = 1
> +};
> +
>
> The convention in this file seems to be that all enum types to start with
> aarch64. Also, the enumeration values should start with the name of the
> enumeration type in upper case, so:
>
> enum aarch64_calling_abi
> {
> AARCH64_CALLING_ABI_EABI,
> AARCH64_CALLING_ABI_MS
> };
>
> or something very much like that.
>
> R.