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 04/13] aarch64: Add aarch64-w64-mingw32 COFF
Date: Mon, 4 Mar 2024 17:39:08 +0000 [thread overview]
Message-ID: <VI1PR83MB04318480E53E2642867884C8F8232@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 01:55:47 +0100
Subject: [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF
Define ASM specific for COFF format on AArch64.
gcc/ChangeLog:
* config.gcc: Add COFF format support definitions.
* config/aarch64/aarch64-coff.h: New file.
---
gcc/config.gcc | 1 +
gcc/config/aarch64/aarch64-coff.h | 91 +++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+)
create mode 100644 gcc/config/aarch64/aarch64-coff.h
diff --git a/gcc/config.gcc b/gcc/config.gcc
index b762393b64c..cb6661f44ef 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1266,6 +1266,7 @@ aarch64*-*-linux*)
;;
aarch64-*-mingw*)
tm_file="${tm_file} aarch64/aarch64-abi-ms.h"
+ tm_file="${tm_file} aarch64/aarch64-coff.h"
tmake_file="${tmake_file} aarch64/t-aarch64"
case ${enable_threads} in
"" | yes | win32)
diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h
new file mode 100644
index 00000000000..79c5a43b970
--- /dev/null
+++ b/gcc/config/aarch64/aarch64-coff.h
@@ -0,0 +1,91 @@
+/* Machine description for AArch64 architecture.
+ Copyright (C) 2024 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_AARCH64_COFF_H
+#define GCC_AARCH64_COFF_H
+
+#include "aarch64.h"
+
+#ifndef LOCAL_LABEL_PREFIX
+# define LOCAL_LABEL_PREFIX ""
+#endif
+
+/* Using long long breaks -ansi and -std=c90, so these will need to be
+ made conditional for an LLP64 ABI. */
+#undef SIZE_TYPE
+#define SIZE_TYPE "long long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long long int"
+
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+
+#ifndef ASM_GENERATE_INTERNAL_LABEL
+# define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
+ sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
+#endif
+
+#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
+ fprintf (STREAM, "\t.align\t%d\n", (int)POWER)
+
+/* Output a common block. */
+#ifndef ASM_OUTPUT_COMMON
+# define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
+ { \
+ fprintf (STREAM, "\t.comm\t"); \
+ assemble_name (STREAM, NAME); \
+ asm_fprintf (STREAM, ", %d, %d\n", \
+ (int)(ROUNDED), (int)(SIZE)); \
+ }
+#endif
+
+/* Output a local common block. /bin/as can't do this, so hack a
+ `.space' into the bss segment. Note that this is *bad* practice,
+ which is guaranteed NOT to work since it doesn't define STATIC
+ COMMON space but merely STATIC BSS space. */
+#ifndef ASM_OUTPUT_ALIGNED_LOCAL
+# define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
+ { \
+ switch_to_section (bss_section); \
+ ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
+ ASM_OUTPUT_LABEL (STREAM, NAME); \
+ fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE)); \
+ }
+#endif
+
+#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
+ fprintf (STREAM, "\t.space\t%d // skip\n", (int) (NBYTES))
+
+#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)
+
+#define TEXT_SECTION_ASM_OP "\t.text"
+#define DATA_SECTION_ASM_OP "\t.data"
+#define BSS_SECTION_ASM_OP "\t.bss"
+
+#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
+#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
+
+#define GLOBAL_ASM_OP "\t.global\t"
+
+#undef SUPPORTS_INIT_PRIORITY
+#define SUPPORTS_INIT_PRIORITY 0
+
+#endif
--
2.25.1
next prev parent reply other threads:[~2024-03-04 17:39 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 ` Evgeny Karpov [this message]
2024-04-10 18:31 ` [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF 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 ` [PATCH v2 07/13] Exclude i386 functionality from aarch64 build Evgeny Karpov
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=VI1PR83MB04318480E53E2642867884C8F8232@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).