public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
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>,
	Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
	Radek Barton <radek.barton@microsoft.com>
Subject: [PATCH v3 05/12] Rename section and encoding functions from i386 which will be used in aarch64
Date: Thu, 11 Apr 2024 13:53:12 +0000	[thread overview]
Message-ID: <VI1PR83MB0431392C4E933A365DB9E650F8052@VI1PR83MB0431.EURPRD83.prod.outlook.com> (raw)
In-Reply-To: <VI1PR83MB0431D9D41D59FC495D4E7CA0F8052@VI1PR83MB0431.EURPRD83.prod.outlook.com>

From: Zac Walker <zacwalker@microsoft.com>
Date: Tue, 20 Feb 2024 17:22:31 +0100
Subject: [PATCH v3 05/12] Rename section and encoding functions from i386
 which will be used in aarch64

gcc/ChangeLog:

	* config/i386/cygming.h (SUBTARGET_ENCODE_SECTION_INFO):
	Rename functions in mingw folder which will be reused for
	aarch64.
	(TARGET_ASM_UNIQUE_SECTION): Likewise.
	(TARGET_ASM_NAMED_SECTION): Likewise.
	(TARGET_SECTION_TYPE_FLAGS): Likewise.
	(ASM_DECLARE_COLD_FUNCTION_NAME): Likewise.
	(ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise.
	* config/i386/i386-protos.h (i386_pe_unique_section):
	Rename into ...
	(mingw_pe_unique_section): ... this.
	(i386_pe_declare_function_type): Rename into ...
	(mingw_pe_declare_function_type): ... this.
	(i386_pe_encode_section_info): Rename into ...
	(mingw_pe_encode_section_info): ... this.
	(i386_pe_maybe_record_exported_symbol): Rename into ...
	(mingw_pe_maybe_record_exported_symbol): ... this.
	(i386_pe_section_type_flags): Rename into ...
	(mingw_pe_section_type_flags): ... this.
	(i386_pe_asm_named_section): Rename into ...
	(mingw_pe_asm_named_section): ... this.
	* config/mingw/winnt.cc (i386_pe_encode_section_info):
	Rename into ...
	(mingw_pe_encode_section_info): ... this.
	(i386_pe_unique_section): Rename into ...
	(mingw_pe_unique_section): ... this.
	(i386_pe_section_type_flags): Rename into ...
	(mingw_pe_section_type_flags): ... this.
	(i386_pe_asm_named_section): Rename into ...
	(mingw_pe_asm_named_section): ... this.
	(i386_pe_asm_output_aligned_decl_common): Likewise.
	(i386_pe_declare_function_type): Rename into ...
	(mingw_pe_declare_function_type): ... this.
	(i386_pe_maybe_record_exported_symbol): Rename into ...
	(mingw_pe_maybe_record_exported_symbol): ... this.
	(i386_pe_start_function): Likewise.
	* varasm.cc (switch_to_comdat_section): Likewise.
---
 gcc/config/i386/cygming.h     | 18 +++++++++---------
 gcc/config/i386/i386-protos.h | 12 ++++++------
 gcc/config/mingw/winnt.cc     | 22 +++++++++++-----------
 gcc/varasm.cc                 |  2 +-
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 1af5bc380a5..beedf7c398a 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -219,7 +219,7 @@ do {									\
    section and we need to set DECL_SECTION_NAME so we do that here.
    Note that we can be called twice on the same decl.  */
 
-#define SUBTARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
+#define SUBTARGET_ENCODE_SECTION_INFO  mingw_pe_encode_section_info
 
 /* Local and global relocs can be placed always into readonly memory
    for PE-COFF targets.  */
@@ -235,7 +235,7 @@ do {									\
 #undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)	\
 do {							\
-  i386_pe_maybe_record_exported_symbol (DECL, NAME, 1);	\
+  mingw_pe_maybe_record_exported_symbol (DECL, NAME, 1);	\
   ASM_OUTPUT_LABEL ((STREAM), (NAME));			\
 } while (0)
 
@@ -283,16 +283,16 @@ do {						\
 /* Windows uses explicit import from shared libraries.  */
 #define MULTIPLE_SYMBOL_SPACES 1
 
-#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
+#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section
 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
 
 #define SUPPORTS_ONE_ONLY 1
 
 /* Switch into a generic section.  */
-#define TARGET_ASM_NAMED_SECTION  i386_pe_asm_named_section
+#define TARGET_ASM_NAMED_SECTION  mingw_pe_asm_named_section
 
 /* Select attributes for named sections.  */
-#define TARGET_SECTION_TYPE_FLAGS  i386_pe_section_type_flags
+#define TARGET_SECTION_TYPE_FLAGS  mingw_pe_section_type_flags
 
 /* Write the extra assembler code needed to declare a function
    properly.  */
@@ -307,7 +307,7 @@ do {						\
 #define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL)	\
   do								\
     {								\
-      i386_pe_declare_function_type (FILE, NAME, 0);		\
+      mingw_pe_declare_function_type (FILE, NAME, 0);		\
       i386_pe_seh_cold_init (FILE, NAME);			\
       ASM_OUTPUT_LABEL (FILE, NAME);				\
     }								\
@@ -333,7 +333,7 @@ do {						\
 
 /* Declare the type properly for any external libcall.  */
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-  i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
+  mingw_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
 
 /* This says out to put a global symbol in the BSS section.  */
 #undef ASM_OUTPUT_ALIGNED_BSS
@@ -416,9 +416,9 @@ do {						\
     {									\
       const char *alias							\
 	= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));		\
-      i386_pe_maybe_record_exported_symbol (DECL, alias, 0);		\
+      mingw_pe_maybe_record_exported_symbol (DECL, alias, 0);		\
       if (TREE_CODE (DECL) == FUNCTION_DECL)				\
-	i386_pe_declare_function_type (STREAM, alias,			\
+	mingw_pe_declare_function_type (STREAM, alias,			\
 				       TREE_PUBLIC (DECL));		\
       ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET));	\
     } while (0)
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 46214a63974..dbc861fb1ea 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -295,16 +295,16 @@ extern void ix86_target_macros (void);
 extern void ix86_register_pragmas (void);
 
 /* In winnt.cc  */
-extern void i386_pe_unique_section (tree, int);
-extern void i386_pe_declare_function_type (FILE *, const char *, int);
+extern void mingw_pe_unique_section (tree, int);
+extern void mingw_pe_declare_function_type (FILE *, const char *, int);
 extern void i386_pe_record_external_function (tree, const char *);
-extern void i386_pe_maybe_record_exported_symbol (tree, const char *, int);
-extern void i386_pe_encode_section_info (tree, rtx, int);
+extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
+extern void mingw_pe_encode_section_info (tree, rtx, int);
 extern bool i386_pe_binds_local_p (const_tree);
 extern const char *i386_pe_strip_name_encoding_full (const char *);
 extern bool i386_pe_valid_dllimport_attribute_p (const_tree);
-extern unsigned int i386_pe_section_type_flags (tree, const char *, int);
-extern void i386_pe_asm_named_section (const char *, unsigned int, tree);
+extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
+extern void mingw_pe_asm_named_section (const char *, unsigned int, tree);
 extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree,
 						    const char *,
 						    HOST_WIDE_INT,
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 9b315898fca..1ed383155d0 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -293,7 +293,7 @@ i386_pe_mangle_assembler_name (const char *name)
 }
 
 void
-i386_pe_encode_section_info (tree decl, rtx rtl, int first)
+mingw_pe_encode_section_info (tree decl, rtx rtl, int first)
 {
   rtx symbol;
   int flags;
@@ -384,7 +384,7 @@ i386_pe_strip_name_encoding_full (const char *str)
 }
 
 void
-i386_pe_unique_section (tree decl, int reloc)
+mingw_pe_unique_section (tree decl, int reloc)
 {
   int len;
   const char *name, *prefix;
@@ -442,7 +442,7 @@ i386_pe_reloc_rw_mask (void)
 #define SECTION_PE_SHARED	SECTION_MACH_DEP
 
 unsigned int
-i386_pe_section_type_flags (tree decl, const char *, int reloc)
+mingw_pe_section_type_flags (tree decl, const char *, int reloc)
 {
   unsigned int flags;
 
@@ -471,7 +471,7 @@ i386_pe_section_type_flags (tree decl, const char *, int reloc)
 }
 
 void
-i386_pe_asm_named_section (const char *name, unsigned int flags, 
+mingw_pe_asm_named_section (const char *name, unsigned int flags,
 			   tree decl)
 {
   char flagchars[8], *f = flagchars;
@@ -548,7 +548,7 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
   rounded = (rounded / (BIGGEST_ALIGNMENT / BITS_PER_UNIT)
 	     * (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
   
-  i386_pe_maybe_record_exported_symbol (decl, name, 1);
+  mingw_pe_maybe_record_exported_symbol (decl, name, 1);
 
   fprintf (stream, "\t.comm\t");
   assemble_name (stream, name);
@@ -574,7 +574,7 @@ i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
    visible.  */
 
 void
-i386_pe_declare_function_type (FILE *file, const char *name, int pub)
+mingw_pe_declare_function_type (FILE *file, const char *name, int pub)
 {
   fprintf (file, "\t.def\t");
   assemble_name (file, name);
@@ -641,7 +641,7 @@ static GTY(()) struct stub_list *stub_head;
    the LTO marker.  */
 
 void
-i386_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
+mingw_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
 {
   rtx symbol;
   struct export_list *p;
@@ -761,11 +761,11 @@ i386_pe_file_end (void)
 	     the real function so that an (unused) import is created.  */
 	  const char *realsym = i386_find_on_wrapper_list (p->name);
 	  if (realsym)
-	    i386_pe_declare_function_type (asm_out_file,
+	    mingw_pe_declare_function_type (asm_out_file,
 		concat ("__real_", realsym, NULL), TREE_PUBLIC (decl));
 #endif /* CXX_WRAP_SPEC_LIST */
 	  TREE_ASM_WRITTEN (decl) = 1;
-	  i386_pe_declare_function_type (asm_out_file, p->name,
+	  mingw_pe_declare_function_type (asm_out_file, p->name,
 					 TREE_PUBLIC (decl));
 	}
     }
@@ -1354,8 +1354,8 @@ i386_pe_seh_init_sections (void)
 void
 i386_pe_start_function (FILE *f, const char *name, tree decl)
 {
-  i386_pe_maybe_record_exported_symbol (decl, name, 0);
-  i386_pe_declare_function_type (f, name, TREE_PUBLIC (decl));
+  mingw_pe_maybe_record_exported_symbol (decl, name, 0);
+  mingw_pe_declare_function_type (f, name, TREE_PUBLIC (decl));
   /* In case section was altered by debugging output.  */
   if (decl != NULL_TREE)
     switch_to_section (function_section (decl));
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 747f74ba1c0..2ab9e096853 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -8672,7 +8672,7 @@ switch_to_comdat_section (section *sect, tree decl)
      everything in .vtable_map_vars at the end.
 
      A fix could be made in
-     gcc/config/i386/winnt.cc: i386_pe_unique_section.  */
+     gcc/config/i386/winnt.cc: mingw_pe_unique_section.  */
   if (TARGET_PECOFF)
     {
       char *name;
-- 
2.25.1


  parent reply	other threads:[~2024-04-11 13:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 13:38 [PATCH v3 00/12] Add aarch64-w64-mingw32 target Evgeny Karpov
2024-04-11 13:45 ` [PATCH v3 01/12] Introduce " Evgeny Karpov
2024-04-11 13:48 ` [PATCH v3 02/12] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
2024-04-11 13:50 ` [PATCH v3 03/12] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
2024-04-11 13:51 ` [PATCH v3 04/12] Reuse MinGW from i386 for AArch64 Evgeny Karpov
2024-04-11 13:53 ` Evgeny Karpov [this message]
2024-04-11 13:54 ` [PATCH v3 06/12] Exclude i386 functionality from aarch64 build Evgeny Karpov
2024-04-11 13:56 ` [PATCH v3 07/12] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
2024-04-11 13:58 ` [PATCH v3 08/12] aarch64: Add SEH to machine_function Evgeny Karpov
2024-04-11 13:59 ` [PATCH v3 09/12] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
2024-04-11 14:00 ` [PATCH v3 10/12] aarch64: Build and add objects for Cygwin and MinGW for AArch64 Evgeny Karpov
2024-04-11 14:01 ` [PATCH v3 11/12] aarch64: Add aarch64-w64-mingw32 target to libatomic Evgeny Karpov
2024-04-11 14:03 ` [PATCH v3 12/12] Add aarch64-w64-mingw32 target to libgcc Evgeny Karpov
2024-05-07 16:05 ` [PATCH v3 00/12] Add aarch64-w64-mingw32 target Christophe Lyon
2024-05-07 16:31   ` [EXTERNAL] " Zac Walker

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=VI1PR83MB0431392C4E933A365DB9E650F8052@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=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).