Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
Evgeny Karpov writes: > From: Zac Walker > Date: Fri, 1 Mar 2024 10:49:28 +0100 > Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for > AArch64 > > Define Cygwin and MinGW environment such as types, SEH definitions, > shared libraries, etc. > > gcc/ChangeLog: > > * config.gcc: Add Cygwin and MinGW difinitions. > * config/aarch64/aarch64-protos.h > (mingw_pe_maybe_record_exported_symbol): Declare functions > which are used in Cygwin and MinGW environment. > (mingw_pe_section_type_flags): Likewise. > (mingw_pe_unique_section): Likewise. > (mingw_pe_encode_section_info): Likewise. > * config/aarch64/cygming.h: New file. > --- > gcc/config.gcc | 4 + > gcc/config/aarch64/aarch64-protos.h | 5 + > gcc/config/aarch64/cygming.h| 175 > 3 files changed, 184 insertions(+) > create mode 100644 gcc/config/aarch64/cygming.h > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index 3aca257c322..4471599454b 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -1267,7 +1267,11 @@ aarch64*-*-linux*) > aarch64-*-mingw*) > tm_file="${tm_file} aarch64/aarch64-abi-ms.h" > tm_file="${tm_file} aarch64/aarch64-coff.h" > + tm_file="${tm_file} aarch64/cygming.h" > + tm_file="${tm_file} mingw/mingw32.h" > + tm_file="${tm_file} mingw/mingw-stdint.h" > tmake_file="${tmake_file} aarch64/t-aarch64" > + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" > case ${enable_threads} in > "" | yes | win32) > thread_file='win32' > diff --git a/gcc/config/aarch64/aarch64-protos.h > b/gcc/config/aarch64/aarch64-protos.h > index bd719b992a5..759e1a0f9da 100644 > --- a/gcc/config/aarch64/aarch64-protos.h > +++ b/gcc/config/aarch64/aarch64-protos.h > @@ -1110,6 +1110,11 @@ 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 > new file mode 100644 > index 000..2f239c42a89 > --- /dev/null > +++ b/gcc/config/aarch64/cygming.h > @@ -0,0 +1,175 @@ > +/* Operating system specific defines to be used when targeting GCC for > + hosting on Windows32, using a Unix style C library and tools. > + Copyright (C) 1995-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_CYGMING_H > +#define GCC_AARCH64_CYGMING_H > + > +#undef PREFERRED_DEBUGGING_TYPE > +#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE > + > +#define FASTCALL_PREFIX '@' > + > +#define print_reg(rtx, code, file) How about: #define print_reg(rtx, code, file) (gcc_unreachable ()) so that attempts to use this are a noisy runtime failure? > +#define SYMBOL_FLAG_DLLIMPORT 0 > +#define SYMBOL_FLAG_DLLEXPORT 0 > + > +#define SYMBOL_REF_DLLEXPORT_P(X) \ > + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) > + > +/* Disable SEH and declare the required SEH-related macros that are > +still needed for compilation. */ > +#undef TARGET_SEH > +#define TARGET_SEH 0 > + > +#define SSE_REGNO_P(N) 0 > +#define GENERAL_REGNO_P(N) 0 > +#define SEH_MAX_FRAME_SIZE 0 Similarly here, how about: #define SSE_REGNO_P(N) (gcc_unreachable (), 0) #define GENERAL_REGNO_P(N) (gcc_unreachable (), 0) #define SEH_MAX_FRAME_SIZE (gcc_unreachable (), 0) Thanks, Richard
Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
On 19 March 2024 14:40:57 CET, Christophe Lyon wrote: >On Mon, 18 Mar 2024 at 22:35, Evgeny Karpov >wrote: >> >> Monday, March 18, 2024 2:27 PM >> Christophe Lyon wrote: >> >> > > +/* Disable SEH and declare the required SEH-related macros that are >> > > +still needed for compilation. */ #undef TARGET_SEH #define >> > > +TARGET_SEH 0 >> > > + >> > > +#define SSE_REGNO_P(N) 0 >> > > +#define GENERAL_REGNO_P(N) 0 >> > I think you forgot to add a comment to explain the above two lines. >> > (it was requested during v1 review) >> > >> > Thanks, >> > >> > Christophe >> >> Hi Christophe, >> >> Thank you for the review! >> The comment regarding SEH and SEH-related macros has been added two lines >> above. >> It may not be obvious, but these macros are needed to emit SEH data in >> mingw/winnt.cc. >> This group is separated by an empty line; however, it still relates to >> SEH-related macros. >> >Thanks for the clarification, I thought that comment only applied to >the two lines about TARGET_SEH. So, for avoidance of doubt, please drop the vertical space before SSE_REGNO_P to be gentle to the casual/inattentive reader? Or add /* SEH-related */ after the vertical space, to make it clear? thanks
Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
On Mon, 18 Mar 2024 at 22:35, Evgeny Karpov wrote: > > Monday, March 18, 2024 2:27 PM > Christophe Lyon wrote: > > > > +/* Disable SEH and declare the required SEH-related macros that are > > > +still needed for compilation. */ #undef TARGET_SEH #define > > > +TARGET_SEH 0 > > > + > > > +#define SSE_REGNO_P(N) 0 > > > +#define GENERAL_REGNO_P(N) 0 > > I think you forgot to add a comment to explain the above two lines. > > (it was requested during v1 review) > > > > Thanks, > > > > Christophe > > Hi Christophe, > > Thank you for the review! > The comment regarding SEH and SEH-related macros has been added two lines > above. > It may not be obvious, but these macros are needed to emit SEH data in > mingw/winnt.cc. > This group is separated by an empty line; however, it still relates to > SEH-related macros. > Thanks for the clarification, I thought that comment only applied to the two lines about TARGET_SEH. Christophe > Regards, > Evgeny
[PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
Monday, March 18, 2024 2:27 PM Christophe Lyon wrote: > > +/* Disable SEH and declare the required SEH-related macros that are > > +still needed for compilation. */ #undef TARGET_SEH #define > > +TARGET_SEH 0 > > + > > +#define SSE_REGNO_P(N) 0 > > +#define GENERAL_REGNO_P(N) 0 > I think you forgot to add a comment to explain the above two lines. > (it was requested during v1 review) > > Thanks, > > Christophe Hi Christophe, Thank you for the review! The comment regarding SEH and SEH-related macros has been added two lines above. It may not be obvious, but these macros are needed to emit SEH data in mingw/winnt.cc. This group is separated by an empty line; however, it still relates to SEH-related macros. Regards, Evgeny
Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
Hi! On Mon, 4 Mar 2024 at 18:44, Evgeny Karpov wrote: > > From: Zac Walker > Date: Fri, 1 Mar 2024 10:49:28 +0100 > Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for > AArch64 > > Define Cygwin and MinGW environment such as types, SEH definitions, > shared libraries, etc. > > gcc/ChangeLog: > > * config.gcc: Add Cygwin and MinGW difinitions. > * config/aarch64/aarch64-protos.h > (mingw_pe_maybe_record_exported_symbol): Declare functions > which are used in Cygwin and MinGW environment. > (mingw_pe_section_type_flags): Likewise. > (mingw_pe_unique_section): Likewise. > (mingw_pe_encode_section_info): Likewise. > * config/aarch64/cygming.h: New file. > --- > gcc/config.gcc | 4 + > gcc/config/aarch64/aarch64-protos.h | 5 + > gcc/config/aarch64/cygming.h| 175 > 3 files changed, 184 insertions(+) > create mode 100644 gcc/config/aarch64/cygming.h > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index 3aca257c322..4471599454b 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -1267,7 +1267,11 @@ aarch64*-*-linux*) > aarch64-*-mingw*) > tm_file="${tm_file} aarch64/aarch64-abi-ms.h" > tm_file="${tm_file} aarch64/aarch64-coff.h" > + tm_file="${tm_file} aarch64/cygming.h" > + tm_file="${tm_file} mingw/mingw32.h" > + tm_file="${tm_file} mingw/mingw-stdint.h" > tmake_file="${tmake_file} aarch64/t-aarch64" > + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" > case ${enable_threads} in > "" | yes | win32) > thread_file='win32' > diff --git a/gcc/config/aarch64/aarch64-protos.h > b/gcc/config/aarch64/aarch64-protos.h > index bd719b992a5..759e1a0f9da 100644 > --- a/gcc/config/aarch64/aarch64-protos.h > +++ b/gcc/config/aarch64/aarch64-protos.h > @@ -1110,6 +1110,11 @@ 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 > new file mode 100644 > index 000..2f239c42a89 > --- /dev/null > +++ b/gcc/config/aarch64/cygming.h > @@ -0,0 +1,175 @@ > +/* Operating system specific defines to be used when targeting GCC for > + hosting on Windows32, using a Unix style C library and tools. > + Copyright (C) 1995-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_CYGMING_H > +#define GCC_AARCH64_CYGMING_H > + > +#undef PREFERRED_DEBUGGING_TYPE > +#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE > + > +#define FASTCALL_PREFIX '@' > + > +#define print_reg(rtx, code, file) > + > +#define SYMBOL_FLAG_DLLIMPORT 0 > +#define SYMBOL_FLAG_DLLEXPORT 0 > + > +#define SYMBOL_REF_DLLEXPORT_P(X) \ > + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) > + > +/* Disable SEH and declare the required SEH-related macros that are > +still needed for compilation. */ > +#undef TARGET_SEH > +#define TARGET_SEH 0 > + > +#define SSE_REGNO_P(N) 0 > +#define GENERAL_REGNO_P(N) 0 I think you forgot to add a comment to explain the above two lines. (it was requested during v1 review) Thanks, Christophe > +#define SEH_MAX_FRAME_SIZE 0 > + > +#undef DEFAULT_ABI > +#define DEFAULT_ABI AARCH64_CALLING_ABI_MS > + > +#undef TARGET_PECOFF > +#define TARGET_PECOFF 1 > + > +#include > +#ifdef __MINGW32__ > +#include > +#endif > + > +e
[PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64
From: Zac Walker Date: Fri, 1 Mar 2024 10:49:28 +0100 Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Define Cygwin and MinGW environment such as types, SEH definitions, shared libraries, etc. gcc/ChangeLog: * config.gcc: Add Cygwin and MinGW difinitions. * config/aarch64/aarch64-protos.h (mingw_pe_maybe_record_exported_symbol): Declare functions which are used in Cygwin and MinGW environment. (mingw_pe_section_type_flags): Likewise. (mingw_pe_unique_section): Likewise. (mingw_pe_encode_section_info): Likewise. * config/aarch64/cygming.h: New file. --- gcc/config.gcc | 4 + gcc/config/aarch64/aarch64-protos.h | 5 + gcc/config/aarch64/cygming.h| 175 3 files changed, 184 insertions(+) create mode 100644 gcc/config/aarch64/cygming.h diff --git a/gcc/config.gcc b/gcc/config.gcc index 3aca257c322..4471599454b 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1267,7 +1267,11 @@ aarch64*-*-linux*) aarch64-*-mingw*) tm_file="${tm_file} aarch64/aarch64-abi-ms.h" tm_file="${tm_file} aarch64/aarch64-coff.h" + tm_file="${tm_file} aarch64/cygming.h" + tm_file="${tm_file} mingw/mingw32.h" + tm_file="${tm_file} mingw/mingw-stdint.h" tmake_file="${tmake_file} aarch64/t-aarch64" + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" case ${enable_threads} in "" | yes | win32) thread_file='win32' diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index bd719b992a5..759e1a0f9da 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -1110,6 +1110,11 @@ 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 new file mode 100644 index 000..2f239c42a89 --- /dev/null +++ b/gcc/config/aarch64/cygming.h @@ -0,0 +1,175 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on Windows32, using a Unix style C library and tools. + Copyright (C) 1995-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_CYGMING_H +#define GCC_AARCH64_CYGMING_H + +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE + +#define FASTCALL_PREFIX '@' + +#define print_reg(rtx, code, file) + +#define SYMBOL_FLAG_DLLIMPORT 0 +#define SYMBOL_FLAG_DLLEXPORT 0 + +#define SYMBOL_REF_DLLEXPORT_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) + +/* Disable SEH and declare the required SEH-related macros that are +still needed for compilation. */ +#undef TARGET_SEH +#define TARGET_SEH 0 + +#define SSE_REGNO_P(N) 0 +#define GENERAL_REGNO_P(N) 0 +#define SEH_MAX_FRAME_SIZE 0 + +#undef DEFAULT_ABI +#define DEFAULT_ABI AARCH64_CALLING_ABI_MS + +#undef TARGET_PECOFF +#define TARGET_PECOFF 1 + +#include +#ifdef __MINGW32__ +#include +#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. */ +#define TARGET_SECTION_TYPE_FLAGS mingw_pe_section_type_flags + +#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section +#define TARGET_ENCODE_SECTION_INFO mingw_pe_encode_section_info + +/* Declare the type properly for any external libcall. */ +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + mingw_pe_declare_function_type (FILE, XSTR (FUN, 0), 1) + +#define TARGET_OS_CPP_BUILTINS() \ + do \ +{