Approved on forge https://forge.sourceware.org/gcc/gcc-TEST/pulls/144#issuecomment-5317https://forge.sourceware.org/gcc/gcc-TEST/pulls/144#issuecomment-5317 so committing now.

On 3/13/2026 1:58 PM, Saurabh Jha via Sourceware Forge wrote:
From: Saurabh Jha <[email protected]>

Windows platforms do not support the default procedure calling standard,
AAPCS64. So _ARM_PCS_AAPCS64 should not be set for Windows targets.

This fixes the setting of __ARM_PCS_AAPCS64 by making it conditional on
non-Windows targets.

        PR target/122953

gcc/ChangeLog:

        * config/aarch64/aarch64-c.cc
        (TARGET_AARCH64_MS_ABI): Explicitly set it to 0 if not on mingw.
        (aarch64_define_unconditional_macros): Remove __ARM_PCS_AAPCS64
        from here.
        (aarch64_update_cpp_builtins): Define __ARM_PCS_AAPCS64 if not
        on Windows ABI.

        ---
        Hey,

        Regression tested on aarch64-linux-gnu and found no regressions.
        Built for arch64-w64-mingw32, ran target dependent tests, and
        found no regressions.

        Ok for master?

        Thanks,
        Saurabh
---
  gcc/config/aarch64/aarch64-c.cc | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc
index a355cfdd1698..b2cc3e67f6da 100644
--- a/gcc/config/aarch64/aarch64-c.cc
+++ b/gcc/config/aarch64/aarch64-c.cc
@@ -37,6 +37,10 @@
  #define builtin_define(TXT) cpp_define (pfile, TXT)
  #define builtin_assert(TXT) cpp_assert (pfile, TXT)
+/* Not on Windows ABI unless explicitly set. */
+#ifndef TARGET_AARCH64_MS_ABI
+#define TARGET_AARCH64_MS_ABI 0
+#endif
static void
  aarch64_def_or_undef (bool def_p, const char *macro, cpp_reader *pfile)
@@ -73,7 +77,6 @@ aarch64_define_unconditional_macros (cpp_reader *pfile)
    builtin_define ("__ARM_FEATURE_CLZ");
    builtin_define ("__ARM_FEATURE_IDIV");
    builtin_define ("__ARM_FEATURE_UNALIGNED");
-  builtin_define ("__ARM_PCS_AAPCS64");
    builtin_define_with_int_value ("__ARM_SIZEOF_WCHAR_T", WCHAR_TYPE_SIZE / 8);
builtin_define ("__GCC_ASM_FLAG_OUTPUTS__");
@@ -147,6 +150,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
aarch64_def_or_undef (TARGET_FLOAT, "__ARM_FEATURE_FMA", pfile); + aarch64_def_or_undef (!TARGET_AARCH64_MS_ABI, "__ARM_PCS_AAPCS64", pfile);
    if (TARGET_FLOAT)
      {
        builtin_define_with_int_value ("__ARM_FP", 0x0E);

Reply via email to