This patch refactors recent changes to move mingw-related
functionality to the mingw folder. More renamings to the mingw_
prefix will be done in follow-up commits.

This is the first commit in the second patch series to add DLL
import/export implementation to AArch64.

Coauthors: Zac Walker <zacwal...@microsoft.com>,
Mark Harmstone <m...@harmstone.com>  and
Ron Riddle <ron.rid...@microsoft.com>

Refactored, prepared, and validated by
Radek Barton <radek.bar...@microsoft.com> and
Evgeny Karpov <evgeny.kar...@microsoft.com>

gcc/ChangeLog:

        * config.gcc: Move mingw_* declations to mingw.
        * config/aarch64/aarch64-protos.h
        (mingw_pe_maybe_record_exported_symbol): Likewise.
        (mingw_pe_section_type_flags): Likewise.
        (mingw_pe_unique_section): Likewise.
        (mingw_pe_encode_section_info): Likewise.
        * config/aarch64/cygming.h
        (mingw_pe_asm_named_section): Likewise.
        (mingw_pe_declare_function_type): Likewise.
        * config/i386/i386-protos.h
        (mingw_pe_unique_section): Likewise.
        (mingw_pe_declare_function_type): Likewise.
        (mingw_pe_maybe_record_exported_symbol): Likewise.
        (mingw_pe_encode_section_info): Likewise.
        (mingw_pe_section_type_flags): Likewise.
        (mingw_pe_asm_named_section): Likewise.
        * config/mingw/winnt.h: New file.
---
 gcc/config.gcc                      |  4 ++++
 gcc/config/aarch64/aarch64-protos.h |  5 -----
 gcc/config/aarch64/cygming.h        |  4 ----
 gcc/config/i386/i386-protos.h       |  6 ------
 gcc/config/mingw/winnt.h            | 33 +++++++++++++++++++++++++++++
 5 files changed, 37 insertions(+), 15 deletions(-)
 create mode 100644 gcc/config/mingw/winnt.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index e500ba63e32..553a310f4bd 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1275,6 +1275,7 @@ aarch64-*-mingw*)
        tm_file="${tm_file} aarch64/cygming.h"
        tm_file="${tm_file} mingw/mingw32.h"
        tm_file="${tm_file} mingw/mingw-stdint.h"
+       tm_file="${tm_file} mingw/winnt.h"
        tmake_file="${tmake_file} aarch64/t-aarch64"
        target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
        extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
@@ -2175,6 +2176,7 @@ i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
        ;;
 i[34567]86-*-cygwin*)
        tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h 
i386/cygwin.h i386/cygwin-stdint.h"
+       tm_file="${tm_file} mingw/winnt.h"
        xm_file=i386/xm-cygwin.h
        tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
        target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
@@ -2193,6 +2195,7 @@ i[34567]86-*-cygwin*)
 x86_64-*-cygwin*)
        need_64bit_isa=yes
        tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h 
i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h"
+       tm_file="${tm_file} mingw/winnt.h"
        xm_file=i386/xm-cygwin.h
        tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
        target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
@@ -2262,6 +2265,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
                        ;;
        esac
        tm_file="${tm_file} mingw/mingw-stdint.h"
+       tm_file="${tm_file} mingw/winnt.h"
        tmake_file="${tmake_file} t-winnt mingw/t-cygming t-slibgcc"
         case ${target} in
                x86_64-w64-*)
diff --git a/gcc/config/aarch64/aarch64-protos.h 
b/gcc/config/aarch64/aarch64-protos.h
index 1d3f94c813e..42639e9efcf 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -1110,11 +1110,6 @@ extern void aarch64_output_patchable_area (unsigned int, 
bool);
 
 extern void aarch64_adjust_reg_alloc_order ();
 
-extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
-extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
-extern void mingw_pe_unique_section (tree, int);
-extern void mingw_pe_encode_section_info (tree, rtx, int);
-
 bool aarch64_optimize_mode_switching (aarch64_mode_entity);
 void aarch64_restore_za (rtx);
 
diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 2e7b01feb76..0d048879311 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -51,10 +51,6 @@ still needed for compilation.  */
 #include <stdio.h>
 #endif
 
-extern void mingw_pe_asm_named_section (const char *, unsigned int, tree);
-extern void mingw_pe_declare_function_type (FILE *file, const char *name,
-       int pub);
-
 #define TARGET_ASM_NAMED_SECTION  mingw_pe_asm_named_section
 
 /* Select attributes for named sections.  */
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index aa50b897b2b..65ef3d77c3a 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -301,16 +301,10 @@ extern void ix86_target_macros (void);
 extern void ix86_register_pragmas (void);
 
 /* In winnt.cc  */
-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 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 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.h b/gcc/config/mingw/winnt.h
new file mode 100644
index 00000000000..d6202816e8f
--- /dev/null
+++ b/gcc/config/mingw/winnt.h
@@ -0,0 +1,33 @@
+/* Subroutines for targets on Windows.
+Copyright (C) 2024 Free Software Foundation, Inc.
+
+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_MINGW_WINNT_H
+#define GCC_MINGW_WINNT_H
+
+#ifndef USED_FOR_TARGET
+
+extern void mingw_pe_asm_named_section (const char *, unsigned int, tree);
+extern void mingw_pe_declare_function_type (FILE *file, const char *name,
+       int pub);
+extern void mingw_pe_encode_section_info (tree, rtx, int);
+extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
+extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
+extern void mingw_pe_unique_section (tree, int);
+
+#endif /* not USED_FOR_TARGET.  */
+
+#endif /* GCC_MINGW_WINNT_H.  */
-- 
2.25.1

Reply via email to