From: Evgeny Karpov <Evgeny.Karpov@microsoft.com>
To: Evgeny Karpov <Evgeny.Karpov@microsoft.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "richard.sandiford@arm.com" <richard.sandiford@arm.com>,
"Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>,
"Andrew Pinski (QUIC)" <quic_apinski@quicinc.com>,
Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
Radek Barton <radek.barton@microsoft.com>
Subject: [PATCH v2 07/13] Exclude i386 functionality from aarch64 build
Date: Mon, 4 Mar 2024 17:43:29 +0000 [thread overview]
Message-ID: <VI1PR83MB0431D36BEE8511071CEF9B87F8232@VI1PR83MB0431.EURPRD83.prod.outlook.com> (raw)
In-Reply-To: <VI1PR83MB0431419E005585F08F7EB445F8232@VI1PR83MB0431.EURPRD83.prod.outlook.com>
From: Zac Walker <zacwalker@microsoft.com>
Date: Fri, 1 Mar 2024 02:35:40 +0100
Subject: [PATCH v2 07/13] Exclude i386 functionality from aarch64 build
This patch defines TARGET_AARCH64_MS_ABI in config.gcc and uses it to
exclude i386 functionality from aarch64 build and adjust MinGW headers
for AArch64 MS ABI.
gcc/ChangeLog:
* config.gcc: Define TARGET_AARCH64_MS_ABI.
* config/mingw/mingw-stdint.h (INTPTR_TYPE): Use
TARGET_AARCH64_MS_ABI to adjust MinGW headers for
AArch64 MS ABI.
(UINTPTR_TYPE): Likewise.
(defined): Likewise.
* config/mingw/mingw32.h (DEFAULT_ABI): Likewise.
(defined): Likewise.
* config/mingw/winnt.cc (defined): Use TARGET_ARM64_MS_ABI to
exclude ix86_get_callcvt.
(i386_pe_maybe_mangle_decl_assembler_name): Likewise.
(i386_pe_mangle_decl_assembler_name): Likewise.
---
gcc/config.gcc | 1 +
gcc/config/mingw/mingw-stdint.h | 9 +++++++--
gcc/config/mingw/mingw32.h | 6 +++++-
gcc/config/mingw/winnt.cc | 8 ++++++++
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 26564ead079..3aca257c322 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1278,6 +1278,7 @@ aarch64-*-mingw*)
esac
default_use_cxa_atexit=yes
user_headers_inc_next_post="${user_headers_inc_next_post} float.h"
+ tm_defines="${tm_defines} TARGET_AARCH64_MS_ABI=1"
;;
aarch64*-wrs-vxworks*)
tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h"
diff --git a/gcc/config/mingw/mingw-stdint.h b/gcc/config/mingw/mingw-stdint.h
index c0feade76e9..debbe829bdf 100644
--- a/gcc/config/mingw/mingw-stdint.h
+++ b/gcc/config/mingw/mingw-stdint.h
@@ -46,5 +46,10 @@ along with GCC; see the file COPYING3. If not see
#define UINT_FAST32_TYPE "unsigned int"
#define UINT_FAST64_TYPE "long long unsigned int"
-#define INTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")
-#define UINTPTR_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#if defined (TARGET_AARCH64_MS_ABI)
+# define INTPTR_TYPE "long long int"
+# define UINTPTR_TYPE "long long unsigned int"
+#else
+# define INTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")
+# define UINTPTR_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#endif
\ No newline at end of file
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 58304fc55f6..040c3e1e521 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -19,7 +19,11 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#undef DEFAULT_ABI
-#define DEFAULT_ABI MS_ABI
+#if defined (TARGET_AARCH64_MS_ABI)
+# define DEFAULT_ABI AARCH64_CALLING_ABI_MS
+#else
+# define DEFAULT_ABI MS_ABI
+#endif
/* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes.
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 1ed383155d0..2a4fc03fc56 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -224,6 +224,8 @@ gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall)
return get_identifier (new_str);
}
+#if !defined (TARGET_AARCH64_MS_ABI)
+
/* Maybe decorate and get a new identifier for the DECL of a stdcall or
fastcall function. The original identifier is supplied in ID. */
@@ -250,6 +252,8 @@ i386_pe_maybe_mangle_decl_assembler_name (tree decl, tree id)
return new_id;
}
+#endif
+
/* Emit an assembler directive to set symbol for DECL visibility to
the visibility type VIS, which must not be VISIBILITY_DEFAULT.
As for PE there is no hidden support in gas, we just warn for
@@ -266,6 +270,8 @@ i386_pe_assemble_visibility (tree decl, int)
"in this configuration; ignored");
}
+#if !defined (TARGET_AARCH64_MS_ABI)
+
/* This is used as a target hook to modify the DECL_ASSEMBLER_NAME
in the language-independent default hook
langhooks,c:lhd_set_decl_assembler_name ()
@@ -278,6 +284,8 @@ i386_pe_mangle_decl_assembler_name (tree decl, tree id)
return (new_id ? new_id : id);
}
+#endif
+
/* This hook behaves the same as varasm.cc/assemble_name(), but
generates the name into memory rather than outputting it to
a file stream. */
--
2.25.1
next prev parent reply other threads:[~2024-03-04 17:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 17:24 [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
2024-03-04 17:30 ` [PATCH v2 01/13] Introduce " Evgeny Karpov
2024-03-04 17:33 ` [PATCH v2 02/13] aarch64: The aarch64-w64-mingw32 target implements Evgeny Karpov
2024-04-10 18:17 ` Richard Sandiford
2024-03-04 17:36 ` [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
2024-04-10 18:25 ` Richard Sandiford
2024-03-04 17:39 ` [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
2024-04-10 18:31 ` Richard Sandiford
2024-03-04 17:39 ` [PATCH v2 05/13] Reuse MinGW from i386 for AArch64 Evgeny Karpov
2024-03-04 17:41 ` [PATCH v2 06/13] Rename section and encoding functions from i386 which will be used in aarch64 Evgeny Karpov
2024-03-04 17:43 ` Evgeny Karpov [this message]
2024-03-04 17:44 ` [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
2024-03-18 13:26 ` Christophe Lyon
2024-03-18 21:35 ` Evgeny Karpov
2024-03-19 13:40 ` Christophe Lyon
2024-03-20 21:53 ` rep.dot.nop
2024-04-10 18:34 ` Richard Sandiford
2024-03-04 17:45 ` [PATCH v2 09/13] aarch64: Add SEH to machine_function Evgeny Karpov
2024-03-04 17:46 ` [PATCH v2 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
2024-04-10 18:35 ` Richard Sandiford
2024-03-04 17:49 ` [PATCH v2 11/13] aarch64: Build and add objects for Cygwin and MinGW for AArch64 Evgeny Karpov
2024-03-04 17:50 ` [PATCH v2 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic Evgeny Karpov
2024-03-04 17:51 ` [PATCH v2 13/13] Add aarch64-w64-mingw32 target to libgcc Evgeny Karpov
2024-03-04 17:55 ` [PATCH v2 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
2024-03-04 19:25 ` Evgeny Karpov
2024-03-07 20:47 ` Evgeny Karpov
2024-03-18 13:33 ` Christophe Lyon
2024-03-18 22:10 ` Evgeny Karpov
2024-03-18 22:58 ` Fangrui Song
2024-03-18 23:22 ` Andrew Pinski
2024-03-19 7:50 ` Martin Storsjö
2024-03-21 10:28 ` [PING][PATCH " Evgeny Karpov
2024-03-18 21:05 ` [PATCH " Radek Barton
2024-03-20 11:50 ` Radek Barton
2024-03-20 19:37 ` NightStrike
2024-04-10 18:40 ` Richard Sandiford
2024-04-11 14:14 ` Evgeny Karpov
2024-04-11 14:34 ` Richard Sandiford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=VI1PR83MB0431D36BEE8511071CEF9B87F8232@VI1PR83MB0431.EURPRD83.prod.outlook.com \
--to=evgeny.karpov@microsoft.com \
--cc=Richard.Earnshaw@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=maxim.kuvyrkov@linaro.org \
--cc=quic_apinski@quicinc.com \
--cc=radek.barton@microsoft.com \
--cc=richard.sandiford@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).