Evgeny Karpov <evgeny.kar...@microsoft.com> writes: > From 4274d1126a1aa60d16dca1cbf7dde1c5ee344bf7 Mon Sep 17 00:00:00 2001 > From: Evgeny Karpov <evgeny.kar...@microsoft.com> > Date: Fri, 15 Nov 2024 13:36:41 +0100 > Subject: [PATCH v1 3/4] Rename SEH functions for reuse in AArch64 > > This patch renames functions related to SEH functionality. These > functions will be reused in the aarch64-w64-mingw32 target. > > gcc/ChangeLog: > > * config/i386/cygming.h (TARGET_ASM_FUNCTION_END_PROLOGUE): > Rename. > (TARGET_ASM_EMIT_EXCEPT_PERSONALITY): Likewise. > (TARGET_ASM_INIT_SECTIONS): Likewise. > (SUBTARGET_ASM_UNWIND_INIT): Likewise. > (ASM_DECLARE_FUNCTION_SIZE): Likewise. > (ASM_DECLARE_COLD_FUNCTION_SIZE): Likewise. > * config/i386/i386-protos.h (i386_pe_end_function): > Remove declarations. > (i386_pe_end_cold_function): Likewise. > (i386_pe_seh_init): Likewise. > (i386_pe_seh_end_prologue): Likewise. > (i386_pe_seh_cold_init): Likewise. > (i386_pe_seh_emit_except_personality): Likewise. > (i386_pe_seh_init_sections): Likewise. > * config/mingw/winnt.cc (i386_pe_seh_init): Rename into ... > (mingw_pe_seh_init): ... this. > (i386_pe_seh_end_prologue): Rename into ... > (mingw_pe_seh_end_prologue): ... this. > (i386_pe_seh_cold_init): Rename into ... > (mingw_pe_seh_cold_init): ... this. > (i386_pe_seh_fini): Rename into ... > (mingw_pe_seh_fini): ... this. > (i386_pe_seh_emit_except_personality): Rename into ... > (mingw_pe_seh_emit_except_personality): ... this. > (i386_pe_seh_init_sections): Rename into ... > (mingw_pe_seh_init_sections): ... this. > (i386_pe_end_function): Rename into ... > (mingw_pe_end_function): ... this. > (i386_pe_end_cold_function): Rename into ... > (mingw_pe_end_cold_function): ... this. > * config/mingw/winnt.h (mingw_pe_end_cold_function): > Add declarations. > (mingw_pe_end_function): Likewise. > (mingw_pe_seh_init): Likewise. > (mingw_pe_seh_init_sections): Likewise. > (mingw_pe_seh_cold_init): Likewise. > (mingw_pe_seh_emit_except_personality): Likewise. > (mingw_pe_seh_end_prologue): Likewise. > > libgcc/ChangeLog: > > * config.host: Update. > * config/i386/t-seh-eh: Move to... > * config/mingw/t-seh-eh: ...here.
OK, thanks. (As usual, I can only comment on GCC internals, rather than mingw-specific details.) Richard > --- > gcc/config/i386/cygming.h | 14 +++++++------- > gcc/config/i386/i386-protos.h | 7 ------- > gcc/config/mingw/winnt.cc | 22 +++++++++++----------- > gcc/config/mingw/winnt.h | 8 ++++++++ > libgcc/config.host | 4 ++-- > libgcc/config/{i386 => mingw}/t-seh-eh | 0 > 6 files changed, 28 insertions(+), 27 deletions(-) > rename libgcc/config/{i386 => mingw}/t-seh-eh (100%) > > diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h > index 7a97d02b81b..a86f87a7535 100644 > --- a/gcc/config/i386/cygming.h > +++ b/gcc/config/i386/cygming.h > @@ -44,12 +44,12 @@ along with GCC; see the file COPYING3. If not see > #undef TARGET_ASM_UNWIND_EMIT_BEFORE_INSN > #define TARGET_ASM_UNWIND_EMIT_BEFORE_INSN false > #undef TARGET_ASM_FUNCTION_END_PROLOGUE > -#define TARGET_ASM_FUNCTION_END_PROLOGUE i386_pe_seh_end_prologue > +#define TARGET_ASM_FUNCTION_END_PROLOGUE mingw_pe_seh_end_prologue > #undef TARGET_ASM_EMIT_EXCEPT_PERSONALITY > -#define TARGET_ASM_EMIT_EXCEPT_PERSONALITY > i386_pe_seh_emit_except_personality > +#define TARGET_ASM_EMIT_EXCEPT_PERSONALITY > mingw_pe_seh_emit_except_personality > #undef TARGET_ASM_INIT_SECTIONS > -#define TARGET_ASM_INIT_SECTIONS i386_pe_seh_init_sections > -#define SUBTARGET_ASM_UNWIND_INIT i386_pe_seh_init > +#define TARGET_ASM_INIT_SECTIONS mingw_pe_seh_init_sections > +#define SUBTARGET_ASM_UNWIND_INIT mingw_pe_seh_init > > #undef DEFAULT_ABI > #define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI) > @@ -310,18 +310,18 @@ do { \ > do \ > { \ > mingw_pe_declare_type (FILE, NAME, 0, 1); \ > - i386_pe_seh_cold_init (FILE, NAME); \ > + mingw_pe_seh_cold_init (FILE, NAME); \ > ASM_OUTPUT_LABEL (FILE, NAME); \ > } \ > while (0) > > #undef ASM_DECLARE_FUNCTION_SIZE > #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \ > - i386_pe_end_function (FILE, NAME, DECL) > + mingw_pe_end_function (FILE, NAME, DECL) > > #undef ASM_DECLARE_COLD_FUNCTION_SIZE > #define ASM_DECLARE_COLD_FUNCTION_SIZE(FILE,NAME,DECL) \ > - i386_pe_end_cold_function (FILE, NAME, DECL) > + mingw_pe_end_cold_function (FILE, NAME, DECL) > > /* Add an external function to the list of functions to be declared at > the end of the file. */ > diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h > index 78e72c50c6d..38dff7f8675 100644 > --- a/gcc/config/i386/i386-protos.h > +++ b/gcc/config/i386/i386-protos.h > @@ -321,18 +321,11 @@ extern void i386_pe_asm_output_aligned_decl_common > (FILE *, tree, > HOST_WIDE_INT, > HOST_WIDE_INT); > extern void i386_pe_start_function (FILE *, const char *, tree); > -extern void i386_pe_end_function (FILE *, const char *, tree); > -extern void i386_pe_end_cold_function (FILE *, const char *, tree); > extern void i386_pe_assemble_visibility (tree, int); > extern tree i386_pe_mangle_decl_assembler_name (tree, tree); > extern tree i386_pe_mangle_assembler_name (const char *); > > -extern void i386_pe_seh_init (FILE *); > -extern void i386_pe_seh_end_prologue (FILE *); > -extern void i386_pe_seh_cold_init (FILE *, const char *); > extern void i386_pe_seh_unwind_emit (FILE *, rtx_insn *); > -extern void i386_pe_seh_emit_except_personality (rtx); > -extern void i386_pe_seh_init_sections (void); > > /* In winnt-cxx.cc and winnt-stubs.cc */ > extern void i386_pe_adjust_class_at_definition (tree); > diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc > index 5b9fed74ccb..ca5da652b8b 100644 > --- a/gcc/config/mingw/winnt.cc > +++ b/gcc/config/mingw/winnt.cc > @@ -882,7 +882,7 @@ struct seh_frame_state > /* Set up data structures beginning output for SEH. */ > > void > -i386_pe_seh_init (FILE *f) > +mingw_pe_seh_init (FILE *f) > { > struct seh_frame_state *seh; > > @@ -910,7 +910,7 @@ i386_pe_seh_init (FILE *f) > /* Emit an assembler directive for the end of the prologue. */ > > void > -i386_pe_seh_end_prologue (FILE *f) > +mingw_pe_seh_end_prologue (FILE *f) > { > if (!TARGET_SEH) > return; > @@ -923,7 +923,7 @@ i386_pe_seh_end_prologue (FILE *f) > /* Emit assembler directives to reconstruct the SEH state. */ > > void > -i386_pe_seh_cold_init (FILE *f, const char *name) > +mingw_pe_seh_cold_init (FILE *f, const char *name) > { > struct seh_frame_state *seh; > HOST_WIDE_INT alloc_offset, offset; > @@ -1006,7 +1006,7 @@ i386_pe_seh_cold_init (FILE *f, const char *name) > /* Emit an assembler directive for the end of the function. */ > > static void > -i386_pe_seh_fini (FILE *f, bool cold) > +mingw_pe_seh_fini (FILE *f, bool cold) > { > struct seh_frame_state *seh; > > @@ -1330,7 +1330,7 @@ i386_pe_seh_unwind_emit (FILE *out_file, rtx_insn *insn) > } > > void > -i386_pe_seh_emit_except_personality (rtx personality) > +mingw_pe_seh_emit_except_personality (rtx personality) > { > int flags = 0; > > @@ -1364,7 +1364,7 @@ i386_pe_seh_emit_except_personality (rtx personality) > } > > void > -i386_pe_seh_init_sections (void) > +mingw_pe_seh_init_sections (void) > { > if (TARGET_SEH) > exception_section = get_unnamed_section (0, output_section_asm_op, > @@ -1383,15 +1383,15 @@ i386_pe_start_function (FILE *f, const char *name, > tree decl) > } > > void > -i386_pe_end_function (FILE *f, const char *, tree) > +mingw_pe_end_function (FILE *f, const char *, tree) > { > - i386_pe_seh_fini (f, false); > + mingw_pe_seh_fini (f, false); > } > - > + > void > -i386_pe_end_cold_function (FILE *f, const char *, tree) > +mingw_pe_end_cold_function (FILE *f, const char *, tree) > { > - i386_pe_seh_fini (f, true); > + mingw_pe_seh_fini (f, true); > } > > #include "gt-winnt.h" > diff --git a/gcc/config/mingw/winnt.h b/gcc/config/mingw/winnt.h > index 1ac19fd2386..dc433538c4e 100644 > --- a/gcc/config/mingw/winnt.h > +++ b/gcc/config/mingw/winnt.h > @@ -27,6 +27,8 @@ extern void mingw_pe_asm_lto_start (void); > extern void mingw_pe_asm_lto_end (void); > extern void mingw_pe_declare_type (FILE *, const char *, bool, bool); > extern void mingw_pe_encode_section_info (tree, rtx, int); > +extern void mingw_pe_end_cold_function (FILE *, const char *, tree); > +extern void mingw_pe_end_function (FILE *, const char *, tree); > extern void mingw_pe_file_end (void); > extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int); > extern void mingw_pe_record_stub (const char *, bool); > @@ -34,6 +36,12 @@ extern unsigned int mingw_pe_section_type_flags (tree, > const char *, int); > extern void mingw_pe_unique_section (tree, int); > extern bool mingw_pe_valid_dllimport_attribute_p (const_tree); > > +extern void mingw_pe_seh_init (FILE *); > +extern void mingw_pe_seh_init_sections (void); > +extern void mingw_pe_seh_cold_init (FILE *, const char *); > +extern void mingw_pe_seh_emit_except_personality (rtx); > +extern void mingw_pe_seh_end_prologue (FILE *); > + > #endif /* not USED_FOR_TARGET. */ > > #endif /* GCC_MINGW_WINNT_H. */ > diff --git a/libgcc/config.host b/libgcc/config.host > index 51471cdd8bb..35f882d94e1 100644 > --- a/libgcc/config.host > +++ b/libgcc/config.host > @@ -883,7 +883,7 @@ x86_64-*-cygwin*) > # biarch -m32 with --disable-sjlj-exceptions > tmake_eh_file="i386/t-dw2-eh" > else > - tmake_eh_file="i386/t-seh-eh" > + tmake_eh_file="mingw/t-seh-eh" > fi > # Shared libgcc DLL install dir depends on cross/native build. > if test x${build} = x${host} ; then > @@ -945,7 +945,7 @@ x86_64-*-mingw*) > tmake_eh_file="i386/t-dw2-eh" > md_unwind_header=i386/w32-unwind.h > else > - tmake_eh_file="i386/t-seh-eh" > + tmake_eh_file="mingw/t-seh-eh" > fi > # Shared libgcc DLL install dir depends on cross/native build. > if test x${build} = x${host} ; then > diff --git a/libgcc/config/i386/t-seh-eh b/libgcc/config/mingw/t-seh-eh > similarity index 100% > rename from libgcc/config/i386/t-seh-eh > rename to libgcc/config/mingw/t-seh-eh