public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v1 0/6] Add DLL import/export implementation to AArch64
@ 2024-04-18 21:35 Evgeny Karpov
  2024-04-18 21:41 ` [PATCH v1 1/6] Move mingw_* declarations to the mingw folder Evgeny Karpov
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:35 UTC (permalink / raw)
  To: gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

Hello,

This is the second patch series, following the first patch series which
introduced the aarch64-w64-mingw32 target.
https://gcc.gnu.org/pipermail/gcc-patches/2024-February/thread.html#646203
https://gcc.gnu.org/pipermail/gcc-patches/2024-March/thread.html#647128
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/thread.html#649261

The patch series aims at the goal:
Extend the aarch64-w64-mingw32 C implementation to
cross-compile OpenSSL, OpenBLAS, FFmpeg, and libjpeg-turbo. All
packages successfully pass tests.

The changes in this patch series are focused on reusing functionality
for DLL import/export from ix86 in aarch64. The ix86 implementation
for expanding a SYMBOL into its corresponding dllimport symbol has
been moved to the mingw folder. Functions related to
dllimport/dllexport functionality have been renamed for reuse in the
AArch64 target.

This patch series is implemented on top of the first patch series which
has not been merged yet. It is currently awaiting the opening of GCC Stage1.
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/thread.html#649261

Patchwork cannot verify this patch series. However, a link to Linaro CI will
be provided once the testing is complete.
A minimal regression test for building main targets can be found here:
https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/actions/runs/8739609732

Regression test for all languages on x86_86-w64-mingw32 is in progress and 
will be also provided.

Known issues:
In order to compile FFmpeg, the optimization level should be reduced
from -O3 to -O2. The fix for this issue is planned to be delivered
in the third patch series.

Thank you for your review!

Coauthors: Zac Walker <zacwalker@microsoft.com>,
Mark Harmstone <mark@harmstone.com>  and
Ron Riddle <ron.riddle@microsoft.com>

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

Regards,
Evgeny


Evgeny Karpov (6):
  Move mingw_* declarations to the mingw folder
  Extract ix86 dllimport implementation to mingw
  Rename functions for reuse in AArch64
  aarch64: Add selectany attribute handling
  Adjust DLL import/export implementation for AArch64
  aarch64: Add DLL import/export to AArch64 target

 gcc/config.gcc                      |   8 +-
 gcc/config/aarch64/aarch64-protos.h |   7 +-
 gcc/config/aarch64/aarch64.cc       |  42 ++++-
 gcc/config/aarch64/cygming.h        |  26 +++-
 gcc/config/i386/cygming.h           |   8 +-
 gcc/config/i386/i386-expand.cc      |   2 +-
 gcc/config/i386/i386-expand.h       |   2 +-
 gcc/config/i386/i386-protos.h       |  13 +-
 gcc/config/i386/i386.cc             | 211 +++----------------------
 gcc/config/mingw/mingw32.h          |   2 +-
 gcc/config/mingw/t-cygming          |   6 +
 gcc/config/mingw/winnt-dll.cc       | 233 ++++++++++++++++++++++++++++
 gcc/config/mingw/winnt-dll.h        |  26 ++++
 gcc/config/mingw/winnt.cc           |   8 +-
 gcc/config/mingw/winnt.h            |  34 ++++
 15 files changed, 402 insertions(+), 226 deletions(-)
 create mode 100644 gcc/config/mingw/winnt-dll.cc
 create mode 100644 gcc/config/mingw/winnt-dll.h
 create mode 100644 gcc/config/mingw/winnt.h

-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 1/6] Move mingw_* declarations to the mingw folder
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
@ 2024-04-18 21:41 ` Evgeny Karpov
  2024-04-18 21:43 ` [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw Evgeny Karpov
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:41 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

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 <zacwalker@microsoft.com>,
Mark Harmstone <mark@harmstone.com>  and
Ron Riddle <ron.riddle@microsoft.com>

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

gcc/ChangeLog:

	* config/aarch64/aarch64-protos.h
	(mingw_pe_maybe_record_exported_symbol): Move mingw_*
	declarations to mingw.
	(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/aarch64/aarch64-protos.h |  6 +-----
 gcc/config/aarch64/cygming.h        |  4 ----
 gcc/config/i386/i386-protos.h       |  8 ++------
 gcc/config/mingw/winnt.h            | 29 +++++++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 15 deletions(-)
 create mode 100644 gcc/config/mingw/winnt.h

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 1d3f94c813e..95972556c56 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -24,6 +24,7 @@
 
 #include "input.h"
 #include "config/arm/aarch-common.h"
+#include "config/mingw/winnt.h"
 
 /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through
    high and lo relocs that calculate the base address using a PC
@@ -1110,11 +1111,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 dbc861fb1ea..96368521380 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -17,6 +17,8 @@ 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/>.  */
 
+#include "config/mingw/winnt.h"
+
 /* In i386-common.cc.  */
 extern bool ix86_handle_option (struct gcc_options *opts,
 				struct gcc_options *opts_set ATTRIBUTE_UNUSED,
@@ -295,16 +297,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..da8445904ce
--- /dev/null
+++ b/gcc/config/mingw/winnt.h
@@ -0,0 +1,29 @@
+/* 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
+
+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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
  2024-04-18 21:41 ` [PATCH v1 1/6] Move mingw_* declarations to the mingw folder Evgeny Karpov
@ 2024-04-18 21:43 ` Evgeny Karpov
  2024-05-22 11:05   ` Richard Sandiford
  2024-04-18 21:45 ` [PATCH v1 3/6] Rename functions for reuse in AArch64 Evgeny Karpov
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:43 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

This patch extracts the ix86 implementation for expanding a SYMBOL
into its corresponding dllimport, far-address, or refptr symbol.
It will be reused in the aarch64-w64-mingw32 target.
The implementation is copied as is from i386/i386.cc with
minor changes to follow to the code style.

Also this patch replaces the original DLL import/export
implementation in ix86 with mingw.

gcc/ChangeLog:

	* config.gcc: Add winnt-dll.o, which contains the DLL
	import/export implementation.
	* config/i386/cygming.h (SUB_TARGET_RECORD_STUB): Remove the
	old implementation. Rename the required function to MinGW.
	Rename it to a conditional function that will reuse the
	MinGW implementation for COFF and nothing otherwise.
	* config/i386/i386-expand.cc (ix86_expand_move): Likewise.
	* config/i386/i386-expand.h (is_imported_p): Likewise.
	(mingw_GOT_alias_set): Likewise.
	(ix86_legitimize_pe_coff_symbol): Likewise.
	* config/i386/i386-protos.h: Likewise.
	* config/i386/i386.cc (is_imported_p): Likewise.
	(ix86_legitimize_pe_coff_symbol): Likewise.
	(ix86_GOT_alias_set): Likewise.
	(legitimize_pic_address): Likewise.
	(struct dllimport_hasher):
	(GTY): Likewise.
	(get_dllimport_decl): Likewise.
	(legitimize_pe_coff_extern_decl): Likewise.
	(legitimize_dllimport_symbol): Likewise.
	(legitimize_pe_coff_symbol): Likewise.
	(ix86_legitimize_address): Likewise.
	* config/mingw/winnt.h (mingw_pe_record_stub): Likewise.
	* config/mingw/winnt.cc (i386_pe_record_stub): Likewise.
	(mingw_pe_record_stub): Likewise.
	* config/mingw/t-cygming: Add the winnt-dll.o compilation.
	* config/mingw/winnt-dll.cc: New file.
---
 gcc/config.gcc                 |   6 +-
 gcc/config/i386/cygming.h      |   2 +-
 gcc/config/i386/i386-expand.cc |   2 +-
 gcc/config/i386/i386-expand.h  |   2 +-
 gcc/config/i386/i386-protos.h  |   2 +-
 gcc/config/i386/i386.cc        | 211 ++++--------------------------
 gcc/config/mingw/t-cygming     |   6 +
 gcc/config/mingw/winnt-dll.cc  | 229 +++++++++++++++++++++++++++++++++
 gcc/config/mingw/winnt-dll.h   |  26 ++++
 gcc/config/mingw/winnt.cc      |   2 +-
 gcc/config/mingw/winnt.h       |   1 +
 11 files changed, 292 insertions(+), 197 deletions(-)
 create mode 100644 gcc/config/mingw/winnt-dll.cc
 create mode 100644 gcc/config/mingw/winnt-dll.h

diff --git a/gcc/config.gcc b/gcc/config.gcc
index ef7f854735a..be2b20a155c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2181,7 +2181,7 @@ i[34567]86-*-cygwin*)
 	tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
 	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
 	extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
-	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
+	extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
 	d_target_objs="${d_target_objs} cygwin-d.o"
@@ -2199,7 +2199,7 @@ x86_64-*-cygwin*)
 	tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
 	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
 	extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
-	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
+	extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
 	d_target_objs="${d_target_objs} cygwin-d.o"
@@ -2283,7 +2283,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 		*)
 			;;
 	esac
-	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
+	extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
 	gas=yes
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index beedf7c398a..4110ceab824 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -459,7 +459,7 @@ do {						\
 #define TARGET_ASM_ASSEMBLE_VISIBILITY i386_pe_assemble_visibility
 
 #undef SUB_TARGET_RECORD_STUB
-#define SUB_TARGET_RECORD_STUB i386_pe_record_stub
+#define SUB_TARGET_RECORD_STUB mingw_pe_record_stub
 
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 8bb8f21e686..77bf4433aa8 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -412,7 +412,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
 	}
       else
 	{
-	  tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
+	  tmp = ix86_legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
 	  if (tmp)
 	    {
 	      op1 = tmp;
diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
index 65cb49c921c..a8c20993954 100644
--- a/gcc/config/i386/i386-expand.h
+++ b/gcc/config/i386/i386-expand.h
@@ -36,7 +36,7 @@ struct expand_vec_perm_d
 rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
 alias_set_type ix86_GOT_alias_set (void);
 rtx legitimize_pic_address (rtx orig, rtx reg);
-rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
+rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg);
 
 bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
 		       rtx_insn *insn);
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 96368521380..dbced12f8d4 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -18,6 +18,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config/mingw/winnt.h"
+#include "config/mingw/winnt-dll.h"
 
 /* In i386-common.cc.  */
 extern bool ix86_handle_option (struct gcc_options *opts,
@@ -314,7 +315,6 @@ 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_record_stub (const char *);
 
 extern void i386_pe_seh_init (FILE *);
 extern void i386_pe_seh_end_prologue (FILE *);
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 4d6b2b98761..a17e819602a 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -11230,20 +11230,6 @@ ix86_cannot_force_const_mem (machine_mode mode, rtx x)
   return !ix86_legitimate_constant_p (mode, x);
 }
 
-/*  Nonzero if the symbol is marked as dllimport, or as stub-variable,
-    otherwise zero.  */
-
-static bool
-is_imported_p (rtx x)
-{
-  if (!TARGET_DLLIMPORT_DECL_ATTRIBUTES
-      || GET_CODE (x) != SYMBOL_REF)
-    return false;
-
-  return SYMBOL_REF_DLLIMPORT_P (x) || SYMBOL_REF_STUBVAR_P (x);
-}
-
-
 /* Nonzero if the constant value X is a legitimate general operand
    when generating PIC code.  It is given that flag_pic is on and
    that X satisfies CONSTANT_P.  */
@@ -11822,17 +11808,31 @@ constant_address_p (rtx x)
   return CONSTANT_P (x) && ix86_legitimate_address_p (Pmode, x, 1);
 }
 

-/* Return a unique alias set for the GOT.  */
+
+#if TARGET_PECOFF
+rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
+{
+  return legitimize_pe_coff_symbol (addr, inreg);
+}
 
 alias_set_type
 ix86_GOT_alias_set (void)
 {
-  static alias_set_type set = -1;
-  if (set == -1)
-    set = new_alias_set ();
-  return set;
+  return mingw_GOT_alias_set ();
+}
+#else
+rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
+{
+  return NULL_RTX;
 }
 
+alias_set_type
+ix86_GOT_alias_set (void)
+{
+  return -1;
+}
+#endif
+
 /* Return a legitimate reference for ORIG (an address) using the
    register REG.  If REG is 0, a new pseudo is generated.
 
@@ -11869,7 +11869,7 @@ legitimize_pic_address (rtx orig, rtx reg)
 
   if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES)
     {
-      rtx tmp = legitimize_pe_coff_symbol (addr, true);
+      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
       if (tmp)
         return tmp;
     }
@@ -11914,7 +11914,7 @@ legitimize_pic_address (rtx orig, rtx reg)
 	      on VxWorks, see gotoff_operand.  */
 	   || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
     {
-      rtx tmp = legitimize_pe_coff_symbol (addr, true);
+      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
       if (tmp)
         return tmp;
 
@@ -12489,173 +12489,6 @@ ix86_rewrite_tls_address (rtx pattern)
   return pattern;
 }
 
-/* Create or return the unique __imp_DECL dllimport symbol corresponding
-   to symbol DECL if BEIMPORT is true.  Otherwise create or return the
-   unique refptr-DECL symbol corresponding to symbol DECL.  */
-
-struct dllimport_hasher : ggc_cache_ptr_hash<tree_map>
-{
-  static inline hashval_t hash (tree_map *m) { return m->hash; }
-  static inline bool
-  equal (tree_map *a, tree_map *b)
-  {
-    return a->base.from == b->base.from;
-  }
-
-  static int
-  keep_cache_entry (tree_map *&m)
-  {
-    return ggc_marked_p (m->base.from);
-  }
-};
-
-static GTY((cache)) hash_table<dllimport_hasher> *dllimport_map;
-
-static tree
-get_dllimport_decl (tree decl, bool beimport)
-{
-  struct tree_map *h, in;
-  const char *name;
-  const char *prefix;
-  size_t namelen, prefixlen;
-  char *imp_name;
-  tree to;
-  rtx rtl;
-
-  if (!dllimport_map)
-    dllimport_map = hash_table<dllimport_hasher>::create_ggc (512);
-
-  in.hash = htab_hash_pointer (decl);
-  in.base.from = decl;
-  tree_map **loc = dllimport_map->find_slot_with_hash (&in, in.hash, INSERT);
-  h = *loc;
-  if (h)
-    return h->to;
-
-  *loc = h = ggc_alloc<tree_map> ();
-  h->hash = in.hash;
-  h->base.from = decl;
-  h->to = to = build_decl (DECL_SOURCE_LOCATION (decl),
-			   VAR_DECL, NULL, ptr_type_node);
-  DECL_ARTIFICIAL (to) = 1;
-  DECL_IGNORED_P (to) = 1;
-  DECL_EXTERNAL (to) = 1;
-  TREE_READONLY (to) = 1;
-
-  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  name = targetm.strip_name_encoding (name);
-  if (beimport)
-    prefix = name[0] == FASTCALL_PREFIX || user_label_prefix[0] == 0
-      ? "*__imp_" : "*__imp__";
-  else
-    prefix = user_label_prefix[0] == 0 ? "*.refptr." : "*refptr.";
-  namelen = strlen (name);
-  prefixlen = strlen (prefix);
-  imp_name = (char *) alloca (namelen + prefixlen + 1);
-  memcpy (imp_name, prefix, prefixlen);
-  memcpy (imp_name + prefixlen, name, namelen + 1);
-
-  name = ggc_alloc_string (imp_name, namelen + prefixlen);
-  rtl = gen_rtx_SYMBOL_REF (Pmode, name);
-  SET_SYMBOL_REF_DECL (rtl, to);
-  SYMBOL_REF_FLAGS (rtl) = SYMBOL_FLAG_LOCAL | SYMBOL_FLAG_STUBVAR;
-  if (!beimport)
-    {
-      SYMBOL_REF_FLAGS (rtl) |= SYMBOL_FLAG_EXTERNAL;
-#ifdef SUB_TARGET_RECORD_STUB
-      SUB_TARGET_RECORD_STUB (name);
-#endif
-    }      
-
-  rtl = gen_const_mem (Pmode, rtl);
-  set_mem_alias_set (rtl, ix86_GOT_alias_set ());
-
-  SET_DECL_RTL (to, rtl);
-  SET_DECL_ASSEMBLER_NAME (to, get_identifier (name));
-
-  return to;
-}
-
-/* Expand SYMBOL into its corresponding far-address symbol.
-   WANT_REG is true if we require the result be a register.  */
-
-static rtx
-legitimize_pe_coff_extern_decl (rtx symbol, bool want_reg)
-{
-  tree imp_decl;
-  rtx x;
-
-  gcc_assert (SYMBOL_REF_DECL (symbol));
-  imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), false);
-
-  x = DECL_RTL (imp_decl);
-  if (want_reg)
-    x = force_reg (Pmode, x);
-  return x;
-}
-
-/* Expand SYMBOL into its corresponding dllimport symbol.  WANT_REG is
-   true if we require the result be a register.  */
-
-static rtx
-legitimize_dllimport_symbol (rtx symbol, bool want_reg)
-{
-  tree imp_decl;
-  rtx x;
-
-  gcc_assert (SYMBOL_REF_DECL (symbol));
-  imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), true);
-
-  x = DECL_RTL (imp_decl);
-  if (want_reg)
-    x = force_reg (Pmode, x);
-  return x;
-}
-
-/* Expand SYMBOL into its corresponding dllimport or refptr symbol.  WANT_REG 
-   is true if we require the result be a register.  */
-
-rtx
-legitimize_pe_coff_symbol (rtx addr, bool inreg)
-{
-  if (!TARGET_PECOFF)
-    return NULL_RTX;
-
-  if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
-    {
-      if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DLLIMPORT_P (addr))
-	return legitimize_dllimport_symbol (addr, inreg);
-      if (GET_CODE (addr) == CONST
-	  && GET_CODE (XEXP (addr, 0)) == PLUS
-	  && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF
-	  && SYMBOL_REF_DLLIMPORT_P (XEXP (XEXP (addr, 0), 0)))
-	{
-	  rtx t = legitimize_dllimport_symbol (XEXP (XEXP (addr, 0), 0), inreg);
-	  return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1));
-	}
-    }
-
-  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
-    return NULL_RTX;
-  if (GET_CODE (addr) == SYMBOL_REF
-      && !is_imported_p (addr)
-      && SYMBOL_REF_EXTERNAL_P (addr)
-      && SYMBOL_REF_DECL (addr))
-    return legitimize_pe_coff_extern_decl (addr, inreg);
-
-  if (GET_CODE (addr) == CONST
-      && GET_CODE (XEXP (addr, 0)) == PLUS
-      && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF
-      && !is_imported_p (XEXP (XEXP (addr, 0), 0))
-      && SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (addr, 0), 0))
-      && SYMBOL_REF_DECL (XEXP (XEXP (addr, 0), 0)))
-    {
-      rtx t = legitimize_pe_coff_extern_decl (XEXP (XEXP (addr, 0), 0), inreg);
-      return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1));
-    }
-  return NULL_RTX;
-}
-
 /* Try machine-dependent ways of modifying an illegitimate address
    to be legitimate.  If we find one, return the new, valid address.
    This macro is used in only one place: `memory_address' in explow.cc.
@@ -12695,7 +12528,7 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode)
 
   if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
     {
-      rtx tmp = legitimize_pe_coff_symbol (x, true);
+      rtx tmp = ix86_legitimize_pe_coff_symbol (x, true);
       if (tmp)
         return tmp;
     }
diff --git a/gcc/config/mingw/t-cygming b/gcc/config/mingw/t-cygming
index f5de941c8e5..73679a9d6c0 100644
--- a/gcc/config/mingw/t-cygming
+++ b/gcc/config/mingw/t-cygming
@@ -33,6 +33,12 @@ winnt-cxx.o: $(srcdir)/config/mingw/winnt-cxx.cc $(CONFIG_H) $(SYSTEM_H) \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 	$(srcdir)/config/mingw/winnt-cxx.cc
 
+winnt-dll.o: $(srcdir)/config/mingw/winnt-dll.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
+  $(TM_H) $(TREE_H) flags.h \
+  $(TM_P_H) $(HASHTAB_H) $(GGC_H)
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+	$(srcdir)/config/mingw/winnt-dll.cc
 
 winnt-stubs.o: $(srcdir)/config/mingw/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) \
   coretypes.h \
diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
new file mode 100644
index 00000000000..349ade6f5c0
--- /dev/null
+++ b/gcc/config/mingw/winnt-dll.cc
@@ -0,0 +1,229 @@
+/* Expand a SYMBOL into its corresponding dllimport, far-address,
+or refptr symbol.
+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/.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "target.h"
+#include "rtl.h"
+#include "tree.h"
+#include "memmodel.h"
+#include "stringpool.h"
+#include "emit-rtl.h"
+#include "alias.h"
+#include "varasm.h"
+#include "output.h"
+#include "explow.h"
+#include "winnt.h"
+
+/* Create or return the unique __imp_DECL dllimport symbol corresponding
+   to symbol DECL if BEIMPORT is true.  Otherwise create or return the
+   unique refptr-DECL symbol corresponding to symbol DECL.  */
+
+struct dllimport_hasher : ggc_cache_ptr_hash<tree_map>
+{
+  static inline hashval_t hash (tree_map *m)
+  {
+    return m->hash;
+  }
+
+  static inline bool
+  equal (tree_map *a, tree_map *b)
+  {
+    return a->base.from == b->base.from;
+  }
+
+  static int
+  keep_cache_entry (tree_map *&m)
+  {
+    return ggc_marked_p (m->base.from);
+  }
+};
+
+static GTY ((cache)) hash_table<dllimport_hasher> *dllimport_map;
+
+/*  Nonzero if the symbol is marked as dllimport, or as stub-variable,
+    otherwise zero.  */
+
+bool
+is_imported_p (rtx x)
+{
+  if (!TARGET_DLLIMPORT_DECL_ATTRIBUTES
+      || GET_CODE (x) != SYMBOL_REF)
+    return false;
+
+  return SYMBOL_REF_DLLIMPORT_P (x) || SYMBOL_REF_STUBVAR_P (x);
+}
+
+/* Return a unique alias set for the GOT.  */
+
+alias_set_type
+mingw_GOT_alias_set (void)
+{
+  static alias_set_type set = -1;
+  if (set == -1)
+    set = new_alias_set ();
+  return set;
+}
+
+static tree
+get_dllimport_decl (tree decl, bool beimport)
+{
+  struct tree_map *h, in;
+  const char *name;
+  const char *prefix;
+  size_t namelen, prefixlen;
+  char *imp_name;
+  tree to;
+  rtx rtl;
+
+  if (!dllimport_map)
+    dllimport_map = hash_table<dllimport_hasher>::create_ggc (512);
+
+  in.hash = htab_hash_pointer (decl);
+  in.base.from = decl;
+  tree_map **loc = dllimport_map->find_slot_with_hash (&in, in.hash, INSERT);
+  h = *loc;
+  if (h)
+    return h->to;
+
+  *loc = h = ggc_alloc<tree_map> ();
+  h->hash = in.hash;
+  h->base.from = decl;
+  h->to = to = build_decl (DECL_SOURCE_LOCATION (decl),
+			   VAR_DECL, NULL, ptr_type_node);
+  DECL_ARTIFICIAL (to) = 1;
+  DECL_IGNORED_P (to) = 1;
+  DECL_EXTERNAL (to) = 1;
+  TREE_READONLY (to) = 1;
+
+  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+  name = targetm.strip_name_encoding (name);
+  if (beimport)
+    prefix = name[0] == FASTCALL_PREFIX || user_label_prefix[0] == 0
+      ? "*__imp_" : "*__imp__";
+  else
+    prefix = user_label_prefix[0] == 0 ? "*.refptr." : "*refptr.";
+  namelen = strlen (name);
+  prefixlen = strlen (prefix);
+  imp_name = (char *) alloca (namelen + prefixlen + 1);
+  memcpy (imp_name, prefix, prefixlen);
+  memcpy (imp_name + prefixlen, name, namelen + 1);
+
+  name = ggc_alloc_string (imp_name, namelen + prefixlen);
+  rtl = gen_rtx_SYMBOL_REF (Pmode, name);
+  SET_SYMBOL_REF_DECL (rtl, to);
+  SYMBOL_REF_FLAGS (rtl) = SYMBOL_FLAG_LOCAL | SYMBOL_FLAG_STUBVAR;
+  if (!beimport)
+    {
+      SYMBOL_REF_FLAGS (rtl) |= SYMBOL_FLAG_EXTERNAL;
+#ifdef SUB_TARGET_RECORD_STUB
+      SUB_TARGET_RECORD_STUB (name);
+#endif
+    }
+
+  rtl = gen_const_mem (Pmode, rtl);
+  set_mem_alias_set (rtl, mingw_GOT_alias_set ());
+
+  SET_DECL_RTL (to, rtl);
+  SET_DECL_ASSEMBLER_NAME (to, get_identifier (name));
+
+  return to;
+}
+
+/* Expand SYMBOL into its corresponding far-address symbol.
+   WANT_REG is true if we require the result be a register.  */
+
+static rtx
+legitimize_pe_coff_extern_decl (rtx symbol, bool want_reg)
+{
+  tree imp_decl;
+  rtx x;
+
+  gcc_assert (SYMBOL_REF_DECL (symbol));
+  imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), false);
+
+  x = DECL_RTL (imp_decl);
+  if (want_reg)
+    x = force_reg (Pmode, x);
+  return x;
+}
+
+/* Expand SYMBOL into its corresponding dllimport symbol.  WANT_REG is
+   true if we require the result be a register.  */
+
+static rtx
+legitimize_dllimport_symbol (rtx symbol, bool want_reg)
+{
+  tree imp_decl;
+  rtx x;
+
+  gcc_assert (SYMBOL_REF_DECL (symbol));
+  imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), true);
+
+  x = DECL_RTL (imp_decl);
+  if (want_reg)
+    x = force_reg (Pmode, x);
+  return x;
+}
+
+/* Expand SYMBOL into its corresponding dllimport or refptr symbol.  WANT_REG
+   is true if we require the result be a register.  */
+
+rtx
+legitimize_pe_coff_symbol (rtx addr, bool inreg)
+{
+  if (!TARGET_PECOFF)
+    return NULL_RTX;
+
+  if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
+    {
+      if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DLLIMPORT_P (addr))
+	return legitimize_dllimport_symbol (addr, inreg);
+      if (GET_CODE (addr) == CONST
+	  && GET_CODE (XEXP (addr, 0)) == PLUS
+	  && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF
+	  && SYMBOL_REF_DLLIMPORT_P (XEXP (XEXP (addr, 0), 0)))
+	{
+	  rtx t = legitimize_dllimport_symbol (XEXP (XEXP (addr, 0), 0), inreg);
+	  return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1));
+	}
+    }
+
+  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
+    return NULL_RTX;
+
+  if (GET_CODE (addr) == SYMBOL_REF
+      && !is_imported_p (addr)
+      && SYMBOL_REF_EXTERNAL_P (addr)
+      && SYMBOL_REF_DECL (addr))
+    return legitimize_pe_coff_extern_decl (addr, inreg);
+
+  if (GET_CODE (addr) == CONST
+      && GET_CODE (XEXP (addr, 0)) == PLUS
+      && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF
+      && !is_imported_p (XEXP (XEXP (addr, 0), 0))
+      && SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (addr, 0), 0))
+      && SYMBOL_REF_DECL (XEXP (XEXP (addr, 0), 0)))
+    {
+      rtx t = legitimize_pe_coff_extern_decl (XEXP (XEXP (addr, 0), 0), inreg);
+      return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1));
+    }
+  return NULL_RTX;
+}
diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h
new file mode 100644
index 00000000000..19c16e747a2
--- /dev/null
+++ b/gcc/config/mingw/winnt-dll.h
@@ -0,0 +1,26 @@
+/* Expand a SYMBOL into its corresponding dllimport, far-address,
+or refptr symbol.
+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_DLL_H
+#define GCC_MINGW_WINNT_DLL_H
+
+extern bool is_imported_p (rtx x);
+extern alias_set_type mingw_GOT_alias_set (void);
+extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
+
+#endif
\ No newline at end of file
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 2a4fc03fc56..9901576ade0 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -672,7 +672,7 @@ mingw_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
 }
 
 void
-i386_pe_record_stub (const char *name)
+mingw_pe_record_stub (const char *name)
 {
   struct stub_list *p;
 
diff --git a/gcc/config/mingw/winnt.h b/gcc/config/mingw/winnt.h
index da8445904ce..646654e872d 100644
--- a/gcc/config/mingw/winnt.h
+++ b/gcc/config/mingw/winnt.h
@@ -23,6 +23,7 @@ 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 void mingw_pe_record_stub (const char *name);
 extern unsigned int mingw_pe_section_type_flags (tree, const char *, int);
 extern void mingw_pe_unique_section (tree, int);
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 3/6] Rename functions for reuse in AArch64
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
  2024-04-18 21:41 ` [PATCH v1 1/6] Move mingw_* declarations to the mingw folder Evgeny Karpov
  2024-04-18 21:43 ` [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw Evgeny Karpov
@ 2024-04-18 21:45 ` Evgeny Karpov
  2024-05-22 11:46   ` Richard Sandiford
  2024-04-18 21:46 ` [PATCH v1 4/6] aarch64: Add selectany attribute handling Evgeny Karpov
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:45 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

This patch renames functions related to dllimport/dllexport
and selectany functionality. These functions will be reused
in the aarch64-w64-mingw32 target.

gcc/ChangeLog:

	* config/i386/cygming.h (mingw_pe_record_stub):
	Rename functions in mingw folder which will be reused for
	aarch64.
	(TARGET_ASM_FILE_END): Update to new target-independent name.
	(SUBTARGET_ATTRIBUTE_TABLE): Likewise.
	(TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise.
	(SUB_TARGET_RECORD_STUB): Likewise.
	* config/i386/i386-protos.h (ix86_handle_selectany_attribute): Likewise.
	(mingw_handle_selectany_attribute): Likewise.
	(i386_pe_valid_dllimport_attribute_p): Likewise.
	(mingw_pe_valid_dllimport_attribute_p): Likewise.
	(i386_pe_file_end): Likewise.
	(mingw_pe_file_end): Likewise.
	(i386_pe_record_stub): Likewise.
	(mingw_pe_record_stub): Likewise.
	* config/mingw/winnt.cc (ix86_handle_selectany_attribute): Likewise.
	(mingw_handle_selectany_attribute): Likewise.
	(i386_pe_valid_dllimport_attribute_p): Likewise.
	(mingw_pe_valid_dllimport_attribute_p): Likewise.
	(i386_pe_record_stub): Likewise.
	(mingw_pe_record_stub): Likewise.
	(i386_pe_file_end): Likewise.
	(mingw_pe_file_end): Likewise.
	* config/mingw/winnt.h (mingw_handle_selectany_attribute):
	Declate functionality that will be reused by multiple targets.
	(mingw_pe_file_end): Likewise.
	(mingw_pe_record_stub): Likewise.
	(mingw_pe_valid_dllimport_attribute_p): Likewise.
---
 gcc/config/i386/cygming.h     | 6 +++---
 gcc/config/i386/i386-protos.h | 3 ---
 gcc/config/mingw/winnt.cc     | 6 +++---
 gcc/config/mingw/winnt.h      | 6 +++++-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 4110ceab824..061136efa0a 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -342,7 +342,7 @@ do {						\
 
 /* Output function declarations at the end of the file.  */
 #undef TARGET_ASM_FILE_END
-#define TARGET_ASM_FILE_END i386_pe_file_end
+#define TARGET_ASM_FILE_END mingw_pe_file_end
 
 /* Kludge because of missing PE-COFF support for early LTO debug.  */
 #undef  TARGET_ASM_LTO_START
@@ -443,7 +443,7 @@ do {						\
 
 #define SUBTARGET_ATTRIBUTE_TABLE \
   { "selectany", 0, 0, true, false, false, false, \
-    ix86_handle_selectany_attribute, NULL }
+    mingw_handle_selectany_attribute, NULL }
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
        affects_type_identity, handler, exclude } */
 
@@ -451,7 +451,7 @@ do {						\
 #undef NO_PROFILE_COUNTERS
 #define NO_PROFILE_COUNTERS 1
 
-#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p
+#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p
 #define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition
 #define SUBTARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name
 
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index dbced12f8d4..4dc90179b9b 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -261,7 +261,6 @@ extern unsigned int ix86_local_alignment (tree, machine_mode,
 extern unsigned int ix86_minimum_alignment (tree, machine_mode,
 					    unsigned int);
 extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);
-extern tree ix86_handle_selectany_attribute (tree *, tree, tree, int, bool *);
 extern int x86_field_alignment (tree, int);
 extern tree ix86_valid_target_attribute_tree (tree, tree,
 					      struct gcc_options *,
@@ -301,12 +300,10 @@ extern void ix86_register_pragmas (void);
 extern void i386_pe_record_external_function (tree, const char *);
 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 void i386_pe_asm_output_aligned_decl_common (FILE *, tree,
 						    const char *,
 						    HOST_WIDE_INT,
 						    HOST_WIDE_INT);
-extern void i386_pe_file_end (void);
 extern void i386_pe_asm_lto_start (void);
 extern void i386_pe_asm_lto_end (void);
 extern void i386_pe_start_function (FILE *, const char *, tree);
diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index 9901576ade0..a0b5950be2e 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -71,7 +71,7 @@ ix86_handle_shared_attribute (tree *node, tree name, tree, int,
 /* Handle a "selectany" attribute;
    arguments as in struct attribute_spec.handler.  */
 tree
-ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
+mingw_handle_selectany_attribute (tree *node, tree name, tree, int,
 				 bool *no_add_attrs)
 {
   tree decl = *node;
@@ -162,7 +162,7 @@ i386_pe_determine_dllimport_p (tree decl)
 /* Handle the -mno-fun-dllimport target switch.  */
 
 bool
-i386_pe_valid_dllimport_attribute_p (const_tree decl)
+mingw_pe_valid_dllimport_attribute_p (const_tree decl)
 {
    if (TARGET_NOP_FUN_DLLIMPORT && TREE_CODE (decl) == FUNCTION_DECL)
      return false;
@@ -749,7 +749,7 @@ i386_find_on_wrapper_list (const char *target)
    output the .drectve section.  */
 
 void
-i386_pe_file_end (void)
+mingw_pe_file_end (void)
 {
   struct extern_list *p;
 
diff --git a/gcc/config/mingw/winnt.h b/gcc/config/mingw/winnt.h
index 646654e872d..e02546e8ac2 100644
--- a/gcc/config/mingw/winnt.h
+++ b/gcc/config/mingw/winnt.h
@@ -18,13 +18,17 @@ http://www.gnu.org/licenses/.  */
 #ifndef GCC_MINGW_WINNT_H
 #define GCC_MINGW_WINNT_H
 
+extern tree mingw_handle_selectany_attribute (tree *, tree, tree, int, bool *);
+
 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_file_end (void);
 extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int);
-extern void mingw_pe_record_stub (const char *name);
+extern void mingw_pe_record_stub (const char *);
 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);
 
 #endif
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 4/6] aarch64: Add selectany attribute handling
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
                   ` (2 preceding siblings ...)
  2024-04-18 21:45 ` [PATCH v1 3/6] Rename functions for reuse in AArch64 Evgeny Karpov
@ 2024-04-18 21:46 ` Evgeny Karpov
  2024-05-22 11:57   ` Richard Sandiford
  2024-04-18 21:48 ` [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64 Evgeny Karpov
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:46 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

This patch extends the aarch64 attributes list with the selectany
attribute for the aarch64-w64-mingw32 target and reuses the mingw
implementation to handle it.

	* config/aarch64/aarch64.cc:
	Extend the aarch64 attributes list.
	* config/aarch64/cygming.h (SUBTARGET_ATTRIBUTE_TABLE):
	Define the selectany attribute.
---
 gcc/config/aarch64/aarch64.cc | 5 ++++-
 gcc/config/aarch64/cygming.h  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index c763a8a6298..19205927430 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -855,7 +855,10 @@ static const attribute_spec aarch64_gnu_attributes[] =
 			  NULL },
   { "Advanced SIMD type", 1, 1, false, true,  false, true,  NULL, NULL },
   { "SVE type",		  3, 3, false, true,  false, true,  NULL, NULL },
-  { "SVE sizeless type",  0, 0, false, true,  false, true,  NULL, NULL }
+  { "SVE sizeless type",  0, 0, false, true,  false, true,  NULL, NULL },
+#ifdef SUBTARGET_ATTRIBUTE_TABLE
+  SUBTARGET_ATTRIBUTE_TABLE
+#endif
 };
 
 static const scoped_attribute_specs aarch64_gnu_attribute_table =
diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 0d048879311..76623153080 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -154,6 +154,9 @@ still needed for compilation.  */
     flag_stack_check = STATIC_BUILTIN_STACK_CHECK;	\
   } while (0)
 
+#define SUBTARGET_ATTRIBUTE_TABLE \
+  { "selectany", 0, 0, true, false, false, false, \
+    mingw_handle_selectany_attribute, NULL }
 
 #define SUPPORTS_ONE_ONLY 1
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
                   ` (3 preceding siblings ...)
  2024-04-18 21:46 ` [PATCH v1 4/6] aarch64: Add selectany attribute handling Evgeny Karpov
@ 2024-04-18 21:48 ` Evgeny Karpov
  2024-05-22 12:07   ` Richard Sandiford
  2024-04-18 21:49 ` [PATCH v1 6/6] aarch64: Add DLL import/export to AArch64 target Evgeny Karpov
  2024-06-04 20:10 ` [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
  6 siblings, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:48 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

The DLL import/export mingw implementation, originally from ix86, requires
minor adjustments to be compatible with AArch64.

gcc/ChangeLog:

	* config/mingw/mingw32.h (defined): Use the correct DllMainCRTStartup
	entry function.
	* config/mingw/winnt-dll.cc (defined): Exclude ix86-related code.
---
 gcc/config/mingw/mingw32.h    | 2 +-
 gcc/config/mingw/winnt-dll.cc | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 08f1b5f0696..efe777051b4 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -79,7 +79,7 @@ along with GCC; see the file COPYING3.  If not see
 #endif
 
 #undef SUB_LINK_ENTRY
-#if TARGET_64BIT_DEFAULT
+#if TARGET_64BIT_DEFAULT || defined (TARGET_AARCH64_MS_ABI)
 #define SUB_LINK_ENTRY SUB_LINK_ENTRY64
 #else
 #define SUB_LINK_ENTRY SUB_LINK_ENTRY32
diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
index 349ade6f5c0..294361fab4c 100644
--- a/gcc/config/mingw/winnt-dll.cc
+++ b/gcc/config/mingw/winnt-dll.cc
@@ -206,9 +206,13 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
 	}
     }
 
+#if !defined (TARGET_AARCH64_MS_ABI)
+
   if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
     return NULL_RTX;
 
+#endif
+
   if (GET_CODE (addr) == SYMBOL_REF
       && !is_imported_p (addr)
       && SYMBOL_REF_EXTERNAL_P (addr)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 6/6] aarch64: Add DLL import/export to AArch64 target
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
                   ` (4 preceding siblings ...)
  2024-04-18 21:48 ` [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64 Evgeny Karpov
@ 2024-04-18 21:49 ` Evgeny Karpov
  2024-06-04 20:10 ` [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
  6 siblings, 0 replies; 22+ messages in thread
From: Evgeny Karpov @ 2024-04-18 21:49 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

This patch reuses the MinGW implementation to enable DLL import/export
functionality for the aarch64-w64-mingw32 target. It also modifies
environment configurations for MinGW.

gcc/ChangeLog:

	* config.gcc: Add winnt-dll.o, which contains the DLL
	import/export implementation.
	* config/aarch64/aarch64-protos.h (legitimize_pe_coff_symbol):
	Declare a MinGW function for expanding a symbol for COFF.
	* config/aarch64/aarch64.cc (aarch64_legitimize_pe_coff_symbol):
	Add a conditional function that reuses the MinGW implementation
	for COFF and does nothing otherwise.
	(aarch64_load_symref_appropriately): Add dllimport
	implementation.
	(aarch64_expand_call): Likewise.
	(aarch64_legitimize_address): Likewise.
	* config/aarch64/cygming.h (SYMBOL_FLAG_DLLIMPORT): Modify MinGW
	environment to support DLL import/export.
	(SYMBOL_FLAG_DLLEXPORT): Likewise.
	(SYMBOL_REF_DLLIMPORT_P): Likewise.
	(SYMBOL_FLAG_STUBVAR): Likewise.
	(SYMBOL_REF_STUBVAR_P): Likewise.
	(mingw_pe_valid_dllimport_attribute_p): Likewise.
	(mingw_pe_file_end): Likewise.
	(mingw_pe_record_stub): Likewise.
	(TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise.
	(TARGET_ASM_FILE_END): Likewise.
	(SUB_TARGET_RECORD_STUB): Likewise.
---
 gcc/config.gcc                      |  2 +-
 gcc/config/aarch64/aarch64-protos.h |  1 +
 gcc/config/aarch64/aarch64.cc       | 37 +++++++++++++++++++++++++++++
 gcc/config/aarch64/cygming.h        | 19 +++++++++++++--
 4 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index be2b20a155c..dce3a422daf 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1280,7 +1280,7 @@ aarch64-*-mingw*)
 	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"
-	extra_objs="${extra_objs} winnt.o"
+	extra_objs="${extra_objs} winnt.o winnt-dll.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	d_target_objs="${d_target_objs} winnt-d.o"
 	tmake_file="${tmake_file} mingw/t-cygming"
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 95972556c56..996acb60d61 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -25,6 +25,7 @@
 #include "input.h"
 #include "config/arm/aarch-common.h"
 #include "config/mingw/winnt.h"
+#include "config/mingw/winnt-dll.h"
 
 /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through
    high and lo relocs that calculate the base address using a PC
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 19205927430..7e28b5f0c08 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -856,6 +856,10 @@ static const attribute_spec aarch64_gnu_attributes[] =
   { "Advanced SIMD type", 1, 1, false, true,  false, true,  NULL, NULL },
   { "SVE type",		  3, 3, false, true,  false, true,  NULL, NULL },
   { "SVE sizeless type",  0, 0, false, true,  false, true,  NULL, NULL },
+#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
+  { "dllimport", 0, 0, false, false, false, false, handle_dll_attribute, NULL },
+  { "dllexport", 0, 0, false, false, false, false, handle_dll_attribute, NULL },
+#endif
 #ifdef SUBTARGET_ATTRIBUTE_TABLE
   SUBTARGET_ATTRIBUTE_TABLE
 #endif
@@ -2815,6 +2819,15 @@ tls_symbolic_operand_type (rtx addr)
   return tls_kind;
 }
 
+rtx aarch64_legitimize_pe_coff_symbol (rtx addr, bool inreg)
+{
+#if TARGET_PECOFF
+  return legitimize_pe_coff_symbol (addr, inreg);
+#else
+  return NULL_RTX;
+#endif
+}
+
 /* We'll allow lo_sum's in addresses in our legitimate addresses
    so that combine would take care of combining addresses where
    necessary, but for generation purposes, we'll generate the address
@@ -2861,6 +2874,17 @@ static void
 aarch64_load_symref_appropriately (rtx dest, rtx imm,
 				   enum aarch64_symbol_type type)
 {
+  /* If legitimize returns a value
+     copy it directly to the destination and return.  */
+
+  rtx tmp = aarch64_legitimize_pe_coff_symbol (imm, true);
+
+  if (tmp)
+    {
+       emit_insn (gen_rtx_SET (dest, tmp));
+       return;
+    }
+
   switch (type)
     {
     case SYMBOL_SMALL_ABSOLUTE:
@@ -11231,6 +11255,12 @@ aarch64_expand_call (rtx result, rtx mem, rtx cookie, bool sibcall)
 
   gcc_assert (MEM_P (mem));
   callee = XEXP (mem, 0);
+
+  tmp = aarch64_legitimize_pe_coff_symbol (callee, false);
+
+  if (tmp)
+    callee = tmp;
+
   mode = GET_MODE (callee);
   gcc_assert (mode == Pmode);
 
@@ -12707,6 +12737,13 @@ aarch64_anchor_offset (HOST_WIDE_INT offset, HOST_WIDE_INT size,
 static rtx
 aarch64_legitimize_address (rtx x, rtx /* orig_x  */, machine_mode mode)
 {
+  if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
+    {
+      rtx tmp = aarch64_legitimize_pe_coff_symbol (x, true);
+      if (tmp)
+	return tmp;
+    }
+
   /* Try to split X+CONST into Y=X+(CONST & ~mask), Y+(CONST&mask),
      where mask is selected by alignment and size of the offset.
      We try to pick as large a range for the offset as possible to
diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 76623153080..4beebf9e093 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -28,12 +28,18 @@ along with GCC; see the file COPYING3.  If not see
 
 #define print_reg(rtx, code, file) (gcc_unreachable ())
 
-#define SYMBOL_FLAG_DLLIMPORT 0
-#define SYMBOL_FLAG_DLLEXPORT 0
+#define SYMBOL_FLAG_DLLIMPORT		(SYMBOL_FLAG_MACH_DEP << 0)
+#define SYMBOL_REF_DLLIMPORT_P(X) \
+	((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLIMPORT) != 0)
 
+#define SYMBOL_FLAG_DLLEXPORT		(SYMBOL_FLAG_MACH_DEP << 1)
 #define SYMBOL_REF_DLLEXPORT_P(X) \
 	((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
 
+#define SYMBOL_FLAG_STUBVAR	(SYMBOL_FLAG_MACH_DEP << 2)
+#define SYMBOL_REF_STUBVAR_P(X) \
+	((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_STUBVAR) != 0)
+
 /* Disable SEH and declare the required SEH-related macros that are
 still needed for compilation.  */
 #undef TARGET_SEH
@@ -59,6 +65,12 @@ still needed for compilation.  */
 #define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section
 #define TARGET_ENCODE_SECTION_INFO  mingw_pe_encode_section_info
 
+#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p
+
+/* Output function declarations at the end of the file.  */
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END mingw_pe_file_end
+
 /* 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)
@@ -158,6 +170,9 @@ still needed for compilation.  */
   { "selectany", 0, 0, true, false, false, false, \
     mingw_handle_selectany_attribute, NULL }
 
+#undef SUB_TARGET_RECORD_STUB
+#define SUB_TARGET_RECORD_STUB mingw_pe_record_stub
+
 #define SUPPORTS_ONE_ONLY 1
 
 /* Define this to be nonzero if static stack checking is supported.  */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-04-18 21:43 ` [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw Evgeny Karpov
@ 2024-05-22 11:05   ` Richard Sandiford
  2024-05-22 14:32     ` Evgeny Karpov
  0 siblings, 1 reply; 22+ messages in thread
From: Richard Sandiford @ 2024-05-22 11:05 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> This patch extracts the ix86 implementation for expanding a SYMBOL
> into its corresponding dllimport, far-address, or refptr symbol.
> It will be reused in the aarch64-w64-mingw32 target.
> The implementation is copied as is from i386/i386.cc with
> minor changes to follow to the code style.
>
> Also this patch replaces the original DLL import/export
> implementation in ix86 with mingw.
>
> gcc/ChangeLog:
>
> 	* config.gcc: Add winnt-dll.o, which contains the DLL
> 	import/export implementation.
> 	* config/i386/cygming.h (SUB_TARGET_RECORD_STUB): Remove the
> 	old implementation. Rename the required function to MinGW.
> 	Rename it to a conditional function that will reuse the
> 	MinGW implementation for COFF and nothing otherwise.
> 	* config/i386/i386-expand.cc (ix86_expand_move): Likewise.
> 	* config/i386/i386-expand.h (is_imported_p): Likewise.
> 	(mingw_GOT_alias_set): Likewise.
> 	(ix86_legitimize_pe_coff_symbol): Likewise.
> 	* config/i386/i386-protos.h: Likewise.
> 	* config/i386/i386.cc (is_imported_p): Likewise.
> 	(ix86_legitimize_pe_coff_symbol): Likewise.
> 	(ix86_GOT_alias_set): Likewise.
> 	(legitimize_pic_address): Likewise.
> 	(struct dllimport_hasher):
> 	(GTY): Likewise.
> 	(get_dllimport_decl): Likewise.
> 	(legitimize_pe_coff_extern_decl): Likewise.
> 	(legitimize_dllimport_symbol): Likewise.
> 	(legitimize_pe_coff_symbol): Likewise.
> 	(ix86_legitimize_address): Likewise.
> 	* config/mingw/winnt.h (mingw_pe_record_stub): Likewise.
> 	* config/mingw/winnt.cc (i386_pe_record_stub): Likewise.
> 	(mingw_pe_record_stub): Likewise.
> 	* config/mingw/t-cygming: Add the winnt-dll.o compilation.
> 	* config/mingw/winnt-dll.cc: New file.

This looks good to me apart from a couple of very minor comments below,
but please get approval from the x86 maintainers as well.  In particular,
they might prefer to handle ix86_legitimize_pe_coff_symbol in some other way.

> [...]
> diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
> new file mode 100644
> index 00000000000..349ade6f5c0
> --- /dev/null
> +++ b/gcc/config/mingw/winnt-dll.cc
> @@ -0,0 +1,229 @@
> +/* Expand a SYMBOL into its corresponding dllimport, far-address,
> +or refptr symbol.
> +Copyright (C) 2024 Free Software Foundation, Inc.

I suppose this should retain the range from the i386 file that the
code is moving from:

   Copyright (C) 1988-2024 Free Software Foundation, Inc.

> [...]
> diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h
> new file mode 100644
> index 00000000000..19c16e747a2
> --- /dev/null
> +++ b/gcc/config/mingw/winnt-dll.h
> @@ -0,0 +1,26 @@
> +/* Expand a SYMBOL into its corresponding dllimport, far-address,
> +or refptr symbol.
> +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_DLL_H
> +#define GCC_MINGW_WINNT_DLL_H
> +
> +extern bool is_imported_p (rtx x);
> +extern alias_set_type mingw_GOT_alias_set (void);
> +extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
> +
> +#endif
> \ No newline at end of file

Would be good to add the newlihe.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 3/6] Rename functions for reuse in AArch64
  2024-04-18 21:45 ` [PATCH v1 3/6] Rename functions for reuse in AArch64 Evgeny Karpov
@ 2024-05-22 11:46   ` Richard Sandiford
  0 siblings, 0 replies; 22+ messages in thread
From: Richard Sandiford @ 2024-05-22 11:46 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> This patch renames functions related to dllimport/dllexport
> and selectany functionality. These functions will be reused
> in the aarch64-w64-mingw32 target.
>
> gcc/ChangeLog:
>
> 	* config/i386/cygming.h (mingw_pe_record_stub):
> 	Rename functions in mingw folder which will be reused for
> 	aarch64.
> 	(TARGET_ASM_FILE_END): Update to new target-independent name.
> 	(SUBTARGET_ATTRIBUTE_TABLE): Likewise.
> 	(TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise.
> 	(SUB_TARGET_RECORD_STUB): Likewise.
> 	* config/i386/i386-protos.h (ix86_handle_selectany_attribute): Likewise.
> 	(mingw_handle_selectany_attribute): Likewise.
> 	(i386_pe_valid_dllimport_attribute_p): Likewise.
> 	(mingw_pe_valid_dllimport_attribute_p): Likewise.
> 	(i386_pe_file_end): Likewise.
> 	(mingw_pe_file_end): Likewise.
> 	(i386_pe_record_stub): Likewise.
> 	(mingw_pe_record_stub): Likewise.
> 	* config/mingw/winnt.cc (ix86_handle_selectany_attribute): Likewise.
> 	(mingw_handle_selectany_attribute): Likewise.
> 	(i386_pe_valid_dllimport_attribute_p): Likewise.
> 	(mingw_pe_valid_dllimport_attribute_p): Likewise.
> 	(i386_pe_record_stub): Likewise.
> 	(mingw_pe_record_stub): Likewise.
> 	(i386_pe_file_end): Likewise.
> 	(mingw_pe_file_end): Likewise.
> 	* config/mingw/winnt.h (mingw_handle_selectany_attribute):
> 	Declate functionality that will be reused by multiple targets.
> 	(mingw_pe_file_end): Likewise.
> 	(mingw_pe_record_stub): Likewise.
> 	(mingw_pe_valid_dllimport_attribute_p): Likewise.

Ok, but...

> [...]
> diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
> index 9901576ade0..a0b5950be2e 100644
> --- a/gcc/config/mingw/winnt.cc
> +++ b/gcc/config/mingw/winnt.cc
> @@ -71,7 +71,7 @@ ix86_handle_shared_attribute (tree *node, tree name, tree, int,
>  /* Handle a "selectany" attribute;
>     arguments as in struct attribute_spec.handler.  */
>  tree
> -ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
> +mingw_handle_selectany_attribute (tree *node, tree name, tree, int,
>  				 bool *no_add_attrs)

please reindent the parameters for the new name length.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 4/6] aarch64: Add selectany attribute handling
  2024-04-18 21:46 ` [PATCH v1 4/6] aarch64: Add selectany attribute handling Evgeny Karpov
@ 2024-05-22 11:57   ` Richard Sandiford
  0 siblings, 0 replies; 22+ messages in thread
From: Richard Sandiford @ 2024-05-22 11:57 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> This patch extends the aarch64 attributes list with the selectany
> attribute for the aarch64-w64-mingw32 target and reuses the mingw
> implementation to handle it.
>
> 	* config/aarch64/aarch64.cc:
> 	Extend the aarch64 attributes list.
> 	* config/aarch64/cygming.h (SUBTARGET_ATTRIBUTE_TABLE):
> 	Define the selectany attribute.

Now that TARGET_ATTRIBUTE_TABLE is an array, it should in principle
be possible to define the attribute in winnt.cc and so avoid
duplicating the table entry.  That'd be a separate clean-up though.
I agree that for this series we should stick with the current approach.

So the patch is ok, thanks.

Richard

> ---
>  gcc/config/aarch64/aarch64.cc | 5 ++++-
>  gcc/config/aarch64/cygming.h  | 3 +++
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index c763a8a6298..19205927430 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -855,7 +855,10 @@ static const attribute_spec aarch64_gnu_attributes[] =
>  			  NULL },
>    { "Advanced SIMD type", 1, 1, false, true,  false, true,  NULL, NULL },
>    { "SVE type",		  3, 3, false, true,  false, true,  NULL, NULL },
> -  { "SVE sizeless type",  0, 0, false, true,  false, true,  NULL, NULL }
> +  { "SVE sizeless type",  0, 0, false, true,  false, true,  NULL, NULL },
> +#ifdef SUBTARGET_ATTRIBUTE_TABLE
> +  SUBTARGET_ATTRIBUTE_TABLE
> +#endif
>  };
>  
>  static const scoped_attribute_specs aarch64_gnu_attribute_table =
> diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
> index 0d048879311..76623153080 100644
> --- a/gcc/config/aarch64/cygming.h
> +++ b/gcc/config/aarch64/cygming.h
> @@ -154,6 +154,9 @@ still needed for compilation.  */
>      flag_stack_check = STATIC_BUILTIN_STACK_CHECK;	\
>    } while (0)
>  
> +#define SUBTARGET_ATTRIBUTE_TABLE \
> +  { "selectany", 0, 0, true, false, false, false, \
> +    mingw_handle_selectany_attribute, NULL }
>  
>  #define SUPPORTS_ONE_ONLY 1

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64
  2024-04-18 21:48 ` [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64 Evgeny Karpov
@ 2024-05-22 12:07   ` Richard Sandiford
  0 siblings, 0 replies; 22+ messages in thread
From: Richard Sandiford @ 2024-05-22 12:07 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, Richard Earnshaw (lists), Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> The DLL import/export mingw implementation, originally from ix86, requires
> minor adjustments to be compatible with AArch64.
>
> gcc/ChangeLog:
>
> 	* config/mingw/mingw32.h (defined): Use the correct DllMainCRTStartup
> 	entry function.
> 	* config/mingw/winnt-dll.cc (defined): Exclude ix86-related code.
> ---
>  gcc/config/mingw/mingw32.h    | 2 +-
>  gcc/config/mingw/winnt-dll.cc | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)

Could we provide some abstractions here, rather than testing
CPU-specific macros directly?  E.g.:

>
> diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
> index 08f1b5f0696..efe777051b4 100644
> --- a/gcc/config/mingw/mingw32.h
> +++ b/gcc/config/mingw/mingw32.h
> @@ -79,7 +79,7 @@ along with GCC; see the file COPYING3.  If not see
>  #endif
>  
>  #undef SUB_LINK_ENTRY
> -#if TARGET_64BIT_DEFAULT
> +#if TARGET_64BIT_DEFAULT || defined (TARGET_AARCH64_MS_ABI)

it looks like this is equivalent to something like "HAVE_64BIT_POINTERS"
or something, which aarch64 could define to 1 and x86 could define
to TARGET_64BIT_DEFAULT.

The name is just a suggestion, based on not really knowing what the
macro selects.  Please use whatever makes most sense :)

>  #define SUB_LINK_ENTRY SUB_LINK_ENTRY64
>  #else
>  #define SUB_LINK_ENTRY SUB_LINK_ENTRY32
> diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
> index 349ade6f5c0..294361fab4c 100644
> --- a/gcc/config/mingw/winnt-dll.cc
> +++ b/gcc/config/mingw/winnt-dll.cc
> @@ -206,9 +206,13 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
>  	}
>      }
>  
> +#if !defined (TARGET_AARCH64_MS_ABI)
> +
>    if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
>      return NULL_RTX;
>  
> +#endif
> +

Similarly here, it feels like there is a concept underlying this check.
Could we just use:

  if (!NEW_MACRO)
    return NULL_RTX;

with NEW_MACRO describing the underlying property that is common to
medium x86 PIC, large x86 PIC, and aarch64.

Thanks,
Richard

>    if (GET_CODE (addr) == SYMBOL_REF
>        && !is_imported_p (addr)
>        && SYMBOL_REF_EXTERNAL_P (addr)

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-05-22 11:05   ` Richard Sandiford
@ 2024-05-22 14:32     ` Evgeny Karpov
  2024-05-23  8:35       ` Uros Bizjak
  0 siblings, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-05-22 14:32 UTC (permalink / raw)
  To: hubicka, Richard Sandiford, ubizjak
  Cc: gcc-patches, Richard Earnshaw (lists), Maxim Kuvyrkov, Radek Barton

Wednesday, May 22, 2024 1:06 PM
Richard Sandiford <richard.sandiford@arm.com> wrote:

> This looks good to me apart from a couple of very minor comments below, but
> please get approval from the x86 maintainers as well.  In particular, they might
> prefer to handle ix86_legitimize_pe_coff_symbol in some other way.

Thanks, Richard, for the review!
The suggestions will be addressed in the next version.

Jan and Uros, could you please review x86 refactoring for mingw part? Thanks.

Regards,
Evgeny


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-05-22 14:32     ` Evgeny Karpov
@ 2024-05-23  8:35       ` Uros Bizjak
  2024-05-23  8:41         ` Uros Bizjak
  2024-05-23 17:53         ` Evgeny Karpov
  0 siblings, 2 replies; 22+ messages in thread
From: Uros Bizjak @ 2024-05-23  8:35 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: hubicka, Richard Sandiford, gcc-patches, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

On Wed, May 22, 2024 at 4:32 PM Evgeny Karpov
<Evgeny.Karpov@microsoft.com> wrote:
>
> Wednesday, May 22, 2024 1:06 PM
> Richard Sandiford <richard.sandiford@arm.com> wrote:
>
> > This looks good to me apart from a couple of very minor comments below, but
> > please get approval from the x86 maintainers as well.  In particular, they might
> > prefer to handle ix86_legitimize_pe_coff_symbol in some other way.
>
> Thanks, Richard, for the review!
> The suggestions will be addressed in the next version.
>
> Jan and Uros, could you please review x86 refactoring for mingw part? Thanks.

Yes, perhaps legitimize_pe_coff_symbol should be handled similar to
how machopic_legitimize_pic_address is handled.and just use "#if
TARGET_PECOFF" at call sites when calling functions from the new
winnt-dll.h. This would also allow us to remove  the early check for
!TARGET_PECOFF in legitimize_pe_coff_symbol.

Uros.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-05-23  8:35       ` Uros Bizjak
@ 2024-05-23  8:41         ` Uros Bizjak
  2024-05-23 17:53         ` Evgeny Karpov
  1 sibling, 0 replies; 22+ messages in thread
From: Uros Bizjak @ 2024-05-23  8:41 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: hubicka, Richard Sandiford, gcc-patches, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

On Thu, May 23, 2024 at 10:35 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Wed, May 22, 2024 at 4:32 PM Evgeny Karpov
> <Evgeny.Karpov@microsoft.com> wrote:
> >
> > Wednesday, May 22, 2024 1:06 PM
> > Richard Sandiford <richard.sandiford@arm.com> wrote:
> >
> > > This looks good to me apart from a couple of very minor comments below, but
> > > please get approval from the x86 maintainers as well.  In particular, they might
> > > prefer to handle ix86_legitimize_pe_coff_symbol in some other way.
> >
> > Thanks, Richard, for the review!
> > The suggestions will be addressed in the next version.
> >
> > Jan and Uros, could you please review x86 refactoring for mingw part? Thanks.
>
> Yes, perhaps legitimize_pe_coff_symbol should be handled similar to
> how machopic_legitimize_pic_address is handled.and just use "#if
> TARGET_PECOFF" at call sites when calling functions from the new
> winnt-dll.h. This would also allow us to remove  the early check for
> !TARGET_PECOFF in legitimize_pe_coff_symbol.

Maybe you should look how TARGET_MACHO is handled in config/i386/* files.

Uros.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-05-23  8:35       ` Uros Bizjak
  2024-05-23  8:41         ` Uros Bizjak
@ 2024-05-23 17:53         ` Evgeny Karpov
  2024-05-23 19:37           ` Uros Bizjak
  1 sibling, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-05-23 17:53 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: hubicka, Richard Sandiford, gcc-patches, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton


Thursday, May 23, 2024 10:35 AM
Uros Bizjak <ubizjak@gmail.com> wrote:

> Richard Sandiford <richard.sandiford@arm.com> wrote:
> >
> > > This looks good to me apart from a couple of very minor comments
> > > below, but please get approval from the x86 maintainers as well.  In
> > > particular, they might prefer to handle ix86_legitimize_pe_coff_symbol in
> some other way.
> >
> > Jan and Uros, could you please review x86 refactoring for mingw part?
> 
> Yes, perhaps legitimize_pe_coff_symbol should be handled similar to how
> machopic_legitimize_pic_address is handled.and just use "#if TARGET_PECOFF"
> at call sites when calling functions from the new winnt-dll.h. This would also
> allow us to remove  the early check for !TARGET_PECOFF in
> legitimize_pe_coff_symbol.
> 
> Uros.


The function legitimize_pe_coff_symbol is now part of mingw and will not be used for linux targets. 
This is why ix86_legitimize_pe_coff_symbol has been introduced, to be available for all platforms.

Regards,
Evgeny

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw
  2024-05-23 17:53         ` Evgeny Karpov
@ 2024-05-23 19:37           ` Uros Bizjak
  0 siblings, 0 replies; 22+ messages in thread
From: Uros Bizjak @ 2024-05-23 19:37 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: hubicka, Richard Sandiford, gcc-patches, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

On Thu, May 23, 2024 at 7:53 PM Evgeny Karpov
<Evgeny.Karpov@microsoft.com> wrote:
>
>
> Thursday, May 23, 2024 10:35 AM
> Uros Bizjak <ubizjak@gmail.com> wrote:
>
> > Richard Sandiford <richard.sandiford@arm.com> wrote:
> > >
> > > > This looks good to me apart from a couple of very minor comments
> > > > below, but please get approval from the x86 maintainers as well.  In
> > > > particular, they might prefer to handle ix86_legitimize_pe_coff_symbol in
> > some other way.
> > >
> > > Jan and Uros, could you please review x86 refactoring for mingw part?
> >
> > Yes, perhaps legitimize_pe_coff_symbol should be handled similar to how
> > machopic_legitimize_pic_address is handled.and just use "#if TARGET_PECOFF"
> > at call sites when calling functions from the new winnt-dll.h. This would also
> > allow us to remove  the early check for !TARGET_PECOFF in
> > legitimize_pe_coff_symbol.
> >
> > Uros.
>
>
> The function legitimize_pe_coff_symbol is now part of mingw and will not be used for linux targets.
> This is why ix86_legitimize_pe_coff_symbol has been introduced, to be available for all platforms.

There is no need for a ix86_legitimize_pe_coff_symbol. This function
is now defined in a header that is not included by default, so the
call sites should use #if TARGET_PECOFF to isolate its use. Please see
how "#if TARGET_MACHO" is used in config/i386/* files for the similar
issue. I think that TARGET_PECOFF should follow this example.

Uros.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v1 0/6] Add DLL import/export implementation to AArch64
  2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
                   ` (5 preceding siblings ...)
  2024-04-18 21:49 ` [PATCH v1 6/6] aarch64: Add DLL import/export to AArch64 target Evgeny Karpov
@ 2024-06-04 20:10 ` Evgeny Karpov
  2024-06-05  6:01   ` Uros Bizjak
  2024-06-05  8:13   ` Richard Sandiford
  6 siblings, 2 replies; 22+ messages in thread
From: Evgeny Karpov @ 2024-06-04 20:10 UTC (permalink / raw)
  To: Evgeny Karpov, gcc-patches, richard.sandiford, ubizjak
  Cc: richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

Richard and Uros, could you please review the changes for v2?
Additionally, we have detected an issue with GCC GC in winnt-dll.cc. The fix will be included in v2.

>> -ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
>> +mingw_handle_selectany_attribute (tree *node, tree name, tree, int,
>>  				 bool *no_add_attrs)

> please reindent the parameters for the new name length.

Richard, could you please clarify how it should be done?
Thanks!

Regards,
Evgeny


---
 gcc/config/aarch64/cygming.h   |  6 +++++
 gcc/config/i386/cygming.h      |  6 +++++
 gcc/config/i386/i386-expand.cc |  6 +++--
 gcc/config/i386/i386-expand.h  |  2 --
 gcc/config/i386/i386.cc        | 42 ++++++++++------------------------
 gcc/config/i386/i386.h         |  2 ++
 gcc/config/mingw/winnt-dll.cc  |  8 ++-----
 gcc/config/mingw/winnt-dll.h   |  2 +-
 8 files changed, 33 insertions(+), 41 deletions(-)

diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
index 4beebf9e093..0ff475754e0 100644
--- a/gcc/config/aarch64/cygming.h
+++ b/gcc/config/aarch64/cygming.h
@@ -183,4 +183,10 @@ still needed for compilation.  */
 #undef MAX_OFILE_ALIGNMENT
 #define MAX_OFILE_ALIGNMENT (8192 * 8)
 
+#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC 0
+
+#define HAVE_64BIT_POINTERS 1
+
+#define GOT_ALIAS_SET mingw_GOT_alias_set ()
+
 #endif
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index ee01e6bb6ce..cd240533dbc 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -469,3 +469,9 @@ do {						\
 #ifndef HAVE_GAS_ALIGNED_COMM
 # define HAVE_GAS_ALIGNED_COMM 0
 #endif
+
+#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC
+
+#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT
+
+#define GOT_ALIAS_SET mingw_GOT_alias_set ()
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index fb460e30d0a..267d0ba257b 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -408,11 +408,12 @@ ix86_expand_move (machine_mode mode, rtx operands[])
 				 : UNSPEC_GOT));
 	  op1 = gen_rtx_CONST (Pmode, op1);
 	  op1 = gen_const_mem (Pmode, op1);
-	  set_mem_alias_set (op1, ix86_GOT_alias_set ());
+	  set_mem_alias_set (op1, GOT_ALIAS_SET);
 	}
       else
 	{
-	  tmp = ix86_legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
+#if TARGET_PECOFF
+	  tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
 	  if (tmp)
 	    {
 	      op1 = tmp;
@@ -424,6 +425,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
 	      op1 = operands[1];
 	      break;
 	    }
+#endif
 	}
 
       if (addend)
diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
index a8c20993954..5e02df1706d 100644
--- a/gcc/config/i386/i386-expand.h
+++ b/gcc/config/i386/i386-expand.h
@@ -34,9 +34,7 @@ struct expand_vec_perm_d
 };
 
 rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
-alias_set_type ix86_GOT_alias_set (void);
 rtx legitimize_pic_address (rtx orig, rtx reg);
-rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg);
 
 bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
 		       rtx_insn *insn);
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 66845b30446..ee3a59ed498 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -11807,30 +11807,6 @@ constant_address_p (rtx x)
 }
 

 
-#if TARGET_PECOFF
-rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
-{
-  return legitimize_pe_coff_symbol (addr, inreg);
-}
-
-alias_set_type
-ix86_GOT_alias_set (void)
-{
-  return mingw_GOT_alias_set ();
-}
-#else
-rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
-{
-  return NULL_RTX;
-}
-
-alias_set_type
-ix86_GOT_alias_set (void)
-{
-  return -1;
-}
-#endif
-
 /* Return a legitimate reference for ORIG (an address) using the
    register REG.  If REG is 0, a new pseudo is generated.
 
@@ -11867,9 +11843,11 @@ legitimize_pic_address (rtx orig, rtx reg)
 
   if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES)
     {
-      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
+#if TARGET_PECOFF
+      rtx tmp = legitimize_pe_coff_symbol (addr, true);
       if (tmp)
         return tmp;
+#endif
     }
 
   if (TARGET_64BIT && legitimate_pic_address_disp_p (addr))
@@ -11912,9 +11890,11 @@ legitimize_pic_address (rtx orig, rtx reg)
 	      on VxWorks, see gotoff_operand.  */
 	   || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
     {
-      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
+#if TARGET_PECOFF
+      rtx tmp = legitimize_pe_coff_symbol (addr, true);
       if (tmp)
         return tmp;
+#endif
 
       /* For x64 PE-COFF there is no GOT table,
 	 so we use address directly.  */
@@ -11929,7 +11909,7 @@ legitimize_pic_address (rtx orig, rtx reg)
 				    UNSPEC_GOTPCREL);
 	  new_rtx = gen_rtx_CONST (Pmode, new_rtx);
 	  new_rtx = gen_const_mem (Pmode, new_rtx);
-	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
+	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
 	}
       else
 	{
@@ -11951,7 +11931,7 @@ legitimize_pic_address (rtx orig, rtx reg)
 	    new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
 
 	  new_rtx = gen_const_mem (Pmode, new_rtx);
-	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
+	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
 	}
 
       new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode);
@@ -12328,7 +12308,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
       if (pic)
 	off = gen_rtx_PLUS (tp_mode, pic, off);
       off = gen_const_mem (tp_mode, off);
-      set_mem_alias_set (off, ix86_GOT_alias_set ());
+      set_mem_alias_set (off, GOT_ALIAS_SET);
 
       if (TARGET_64BIT || TARGET_ANY_GNU_TLS)
 	{
@@ -12526,9 +12506,11 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode)
 
   if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
     {
-      rtx tmp = ix86_legitimize_pe_coff_symbol (x, true);
+#if TARGET_PECOFF
+      rtx tmp = legitimize_pe_coff_symbol (x, true);
       if (tmp)
         return tmp;
+#endif
     }
 
   if (flag_pic && SYMBOLIC_CONST (x))
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 969391d3013..2b3d0c8db75 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2261,6 +2261,8 @@ extern int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
 /* Which processor to tune code generation for.  These must be in sync
    with processor_cost_table in i386-options.cc.  */
 
+#define GOT_ALIAS_SET -1
+
 enum processor_type
 {
   PROCESSOR_GENERIC = 0,
diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
index 591e89cb5c9..c91e95225d3 100644
--- a/gcc/config/mingw/winnt-dll.cc
+++ b/gcc/config/mingw/winnt-dll.cc
@@ -1,6 +1,6 @@
 /* Expand a SYMBOL into its corresponding dllimport, far-address,
 or refptr symbol.
-Copyright (C) 2024 Free Software Foundation, Inc.
+Copyright (C) 1988-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
@@ -206,13 +206,9 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
 	}
     }
 
-#if !defined (TARGET_AARCH64_MS_ABI)
-
-  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
+  if (CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC)
     return NULL_RTX;
 
-#endif
-
   if (GET_CODE (addr) == SYMBOL_REF
       && !is_imported_p (addr)
       && SYMBOL_REF_EXTERNAL_P (addr)
diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h
index 19c16e747a2..0877f10d67e 100644
--- a/gcc/config/mingw/winnt-dll.h
+++ b/gcc/config/mingw/winnt-dll.h
@@ -23,4 +23,4 @@ extern bool is_imported_p (rtx x);
 extern alias_set_type mingw_GOT_alias_set (void);
 extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
 
-#endif
\ No newline at end of file
+#endif
-- 
2.25.1

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 0/6] Add DLL import/export implementation to AArch64
  2024-06-04 20:10 ` [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
@ 2024-06-05  6:01   ` Uros Bizjak
  2024-06-05 23:41     ` Jonathan Yong
  2024-06-05  8:13   ` Richard Sandiford
  1 sibling, 1 reply; 22+ messages in thread
From: Uros Bizjak @ 2024-06-05  6:01 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton, Jonathan Yong

On Tue, Jun 4, 2024 at 10:10 PM Evgeny Karpov
<Evgeny.Karpov@microsoft.com> wrote:
>
> Richard and Uros, could you please review the changes for v2?

LGTM for the generic x86 part, OS-specific part (cygming) should also
be reviewed by OS port maintainer (CC'd).

Thanks,
Uros.

> Additionally, we have detected an issue with GCC GC in winnt-dll.cc. The fix will be included in v2.
>
> >> -ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
> >> +mingw_handle_selectany_attribute (tree *node, tree name, tree, int,
> >>                               bool *no_add_attrs)
>
> > please reindent the parameters for the new name length.
>
> Richard, could you please clarify how it should be done?
> Thanks!
>
> Regards,
> Evgeny
>
>
> ---
>  gcc/config/aarch64/cygming.h   |  6 +++++
>  gcc/config/i386/cygming.h      |  6 +++++
>  gcc/config/i386/i386-expand.cc |  6 +++--
>  gcc/config/i386/i386-expand.h  |  2 --
>  gcc/config/i386/i386.cc        | 42 ++++++++++------------------------
>  gcc/config/i386/i386.h         |  2 ++
>  gcc/config/mingw/winnt-dll.cc  |  8 ++-----
>  gcc/config/mingw/winnt-dll.h   |  2 +-
>  8 files changed, 33 insertions(+), 41 deletions(-)
>
> diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
> index 4beebf9e093..0ff475754e0 100644
> --- a/gcc/config/aarch64/cygming.h
> +++ b/gcc/config/aarch64/cygming.h
> @@ -183,4 +183,10 @@ still needed for compilation.  */
>  #undef MAX_OFILE_ALIGNMENT
>  #define MAX_OFILE_ALIGNMENT (8192 * 8)
>
> +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC 0
> +
> +#define HAVE_64BIT_POINTERS 1
> +
> +#define GOT_ALIAS_SET mingw_GOT_alias_set ()
> +
>  #endif
> diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
> index ee01e6bb6ce..cd240533dbc 100644
> --- a/gcc/config/i386/cygming.h
> +++ b/gcc/config/i386/cygming.h
> @@ -469,3 +469,9 @@ do {                                                \
>  #ifndef HAVE_GAS_ALIGNED_COMM
>  # define HAVE_GAS_ALIGNED_COMM 0
>  #endif
> +
> +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC
> +
> +#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT
> +
> +#define GOT_ALIAS_SET mingw_GOT_alias_set ()
> diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
> index fb460e30d0a..267d0ba257b 100644
> --- a/gcc/config/i386/i386-expand.cc
> +++ b/gcc/config/i386/i386-expand.cc
> @@ -408,11 +408,12 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>                                  : UNSPEC_GOT));
>           op1 = gen_rtx_CONST (Pmode, op1);
>           op1 = gen_const_mem (Pmode, op1);
> -         set_mem_alias_set (op1, ix86_GOT_alias_set ());
> +         set_mem_alias_set (op1, GOT_ALIAS_SET);
>         }
>        else
>         {
> -         tmp = ix86_legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
> +#if TARGET_PECOFF
> +         tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
>           if (tmp)
>             {
>               op1 = tmp;
> @@ -424,6 +425,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>               op1 = operands[1];
>               break;
>             }
> +#endif
>         }
>
>        if (addend)
> diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
> index a8c20993954..5e02df1706d 100644
> --- a/gcc/config/i386/i386-expand.h
> +++ b/gcc/config/i386/i386-expand.h
> @@ -34,9 +34,7 @@ struct expand_vec_perm_d
>  };
>
>  rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
> -alias_set_type ix86_GOT_alias_set (void);
>  rtx legitimize_pic_address (rtx orig, rtx reg);
> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg);
>
>  bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
>                        rtx_insn *insn);
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 66845b30446..ee3a59ed498 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -11807,30 +11807,6 @@ constant_address_p (rtx x)
>  }
>
>
>
> -#if TARGET_PECOFF
> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
> -{
> -  return legitimize_pe_coff_symbol (addr, inreg);
> -}
> -
> -alias_set_type
> -ix86_GOT_alias_set (void)
> -{
> -  return mingw_GOT_alias_set ();
> -}
> -#else
> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
> -{
> -  return NULL_RTX;
> -}
> -
> -alias_set_type
> -ix86_GOT_alias_set (void)
> -{
> -  return -1;
> -}
> -#endif
> -
>  /* Return a legitimate reference for ORIG (an address) using the
>     register REG.  If REG is 0, a new pseudo is generated.
>
> @@ -11867,9 +11843,11 @@ legitimize_pic_address (rtx orig, rtx reg)
>
>    if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES)
>      {
> -      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
> +#if TARGET_PECOFF
> +      rtx tmp = legitimize_pe_coff_symbol (addr, true);
>        if (tmp)
>          return tmp;
> +#endif
>      }
>
>    if (TARGET_64BIT && legitimate_pic_address_disp_p (addr))
> @@ -11912,9 +11890,11 @@ legitimize_pic_address (rtx orig, rtx reg)
>               on VxWorks, see gotoff_operand.  */
>            || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
>      {
> -      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
> +#if TARGET_PECOFF
> +      rtx tmp = legitimize_pe_coff_symbol (addr, true);
>        if (tmp)
>          return tmp;
> +#endif
>
>        /* For x64 PE-COFF there is no GOT table,
>          so we use address directly.  */
> @@ -11929,7 +11909,7 @@ legitimize_pic_address (rtx orig, rtx reg)
>                                     UNSPEC_GOTPCREL);
>           new_rtx = gen_rtx_CONST (Pmode, new_rtx);
>           new_rtx = gen_const_mem (Pmode, new_rtx);
> -         set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
> +         set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
>         }
>        else
>         {
> @@ -11951,7 +11931,7 @@ legitimize_pic_address (rtx orig, rtx reg)
>             new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
>
>           new_rtx = gen_const_mem (Pmode, new_rtx);
> -         set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
> +         set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
>         }
>
>        new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode);
> @@ -12328,7 +12308,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
>        if (pic)
>         off = gen_rtx_PLUS (tp_mode, pic, off);
>        off = gen_const_mem (tp_mode, off);
> -      set_mem_alias_set (off, ix86_GOT_alias_set ());
> +      set_mem_alias_set (off, GOT_ALIAS_SET);
>
>        if (TARGET_64BIT || TARGET_ANY_GNU_TLS)
>         {
> @@ -12526,9 +12506,11 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode)
>
>    if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
>      {
> -      rtx tmp = ix86_legitimize_pe_coff_symbol (x, true);
> +#if TARGET_PECOFF
> +      rtx tmp = legitimize_pe_coff_symbol (x, true);
>        if (tmp)
>          return tmp;
> +#endif
>      }
>
>    if (flag_pic && SYMBOLIC_CONST (x))
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index 969391d3013..2b3d0c8db75 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -2261,6 +2261,8 @@ extern int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
>  /* Which processor to tune code generation for.  These must be in sync
>     with processor_cost_table in i386-options.cc.  */
>
> +#define GOT_ALIAS_SET -1
> +
>  enum processor_type
>  {
>    PROCESSOR_GENERIC = 0,
> diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
> index 591e89cb5c9..c91e95225d3 100644
> --- a/gcc/config/mingw/winnt-dll.cc
> +++ b/gcc/config/mingw/winnt-dll.cc
> @@ -1,6 +1,6 @@
>  /* Expand a SYMBOL into its corresponding dllimport, far-address,
>  or refptr symbol.
> -Copyright (C) 2024 Free Software Foundation, Inc.
> +Copyright (C) 1988-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
> @@ -206,13 +206,9 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
>         }
>      }
>
> -#if !defined (TARGET_AARCH64_MS_ABI)
> -
> -  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
> +  if (CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC)
>      return NULL_RTX;
>
> -#endif
> -
>    if (GET_CODE (addr) == SYMBOL_REF
>        && !is_imported_p (addr)
>        && SYMBOL_REF_EXTERNAL_P (addr)
> diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h
> index 19c16e747a2..0877f10d67e 100644
> --- a/gcc/config/mingw/winnt-dll.h
> +++ b/gcc/config/mingw/winnt-dll.h
> @@ -23,4 +23,4 @@ extern bool is_imported_p (rtx x);
>  extern alias_set_type mingw_GOT_alias_set (void);
>  extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
>
> -#endif
> \ No newline at end of file
> +#endif
> --
> 2.25.1

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 0/6] Add DLL import/export implementation to AArch64
  2024-06-04 20:10 ` [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
  2024-06-05  6:01   ` Uros Bizjak
@ 2024-06-05  8:13   ` Richard Sandiford
  1 sibling, 0 replies; 22+ messages in thread
From: Richard Sandiford @ 2024-06-05  8:13 UTC (permalink / raw)
  To: Evgeny Karpov
  Cc: gcc-patches, ubizjak, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes:
> Richard and Uros, could you please review the changes for v2?
> Additionally, we have detected an issue with GCC GC in winnt-dll.cc. The fix will be included in v2.

Would it be possible to have a more "purposeful" name than
CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC?  What's the property of
large and medium PIC that needs to be handled differently?

It'd be good to have the macro be a positive test rather than a negative
test, so that we don't end up with !IS_NOT_FOO when testing for FOO.

Otherwise it looks good to me.

I never fully reviewed 1/6 or 6/6, sorry.  My main comment there is
that it would be good to avoid including config/mingw/winnt.h and
config/mingw/winnt-dll.h in config/aarch64/aarch64-protos.h (or in
other common AArch64 code).  It's OK for common AArch64 code to
have hooks that can be filled in by OS-specific headers, but there
shouldn't be OS-specific includes or code in the common files themselves.

>>> -ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
>>> +mingw_handle_selectany_attribute (tree *node, tree name, tree, int,
>>>  				 bool *no_add_attrs)
>
>> please reindent the parameters for the new name length.
>
> Richard, could you please clarify how it should be done?

The "bool" on the second line should be directly under the "tree"
on the first line (so one extra space before "bool").

Thanks,
Richard


> Thanks!
>
> Regards,
> Evgeny
>
>
> ---
>  gcc/config/aarch64/cygming.h   |  6 +++++
>  gcc/config/i386/cygming.h      |  6 +++++
>  gcc/config/i386/i386-expand.cc |  6 +++--
>  gcc/config/i386/i386-expand.h  |  2 --
>  gcc/config/i386/i386.cc        | 42 ++++++++++------------------------
>  gcc/config/i386/i386.h         |  2 ++
>  gcc/config/mingw/winnt-dll.cc  |  8 ++-----
>  gcc/config/mingw/winnt-dll.h   |  2 +-
>  8 files changed, 33 insertions(+), 41 deletions(-)
>
> diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
> index 4beebf9e093..0ff475754e0 100644
> --- a/gcc/config/aarch64/cygming.h
> +++ b/gcc/config/aarch64/cygming.h
> @@ -183,4 +183,10 @@ still needed for compilation.  */
>  #undef MAX_OFILE_ALIGNMENT
>  #define MAX_OFILE_ALIGNMENT (8192 * 8)
>  
> +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC 0
> +
> +#define HAVE_64BIT_POINTERS 1
> +
> +#define GOT_ALIAS_SET mingw_GOT_alias_set ()
> +
>  #endif
> diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
> index ee01e6bb6ce..cd240533dbc 100644
> --- a/gcc/config/i386/cygming.h
> +++ b/gcc/config/i386/cygming.h
> @@ -469,3 +469,9 @@ do {						\
>  #ifndef HAVE_GAS_ALIGNED_COMM
>  # define HAVE_GAS_ALIGNED_COMM 0
>  #endif
> +
> +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC
> +
> +#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT
> +
> +#define GOT_ALIAS_SET mingw_GOT_alias_set ()
> diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
> index fb460e30d0a..267d0ba257b 100644
> --- a/gcc/config/i386/i386-expand.cc
> +++ b/gcc/config/i386/i386-expand.cc
> @@ -408,11 +408,12 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>  				 : UNSPEC_GOT));
>  	  op1 = gen_rtx_CONST (Pmode, op1);
>  	  op1 = gen_const_mem (Pmode, op1);
> -	  set_mem_alias_set (op1, ix86_GOT_alias_set ());
> +	  set_mem_alias_set (op1, GOT_ALIAS_SET);
>  	}
>        else
>  	{
> -	  tmp = ix86_legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
> +#if TARGET_PECOFF
> +	  tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
>  	  if (tmp)
>  	    {
>  	      op1 = tmp;
> @@ -424,6 +425,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>  	      op1 = operands[1];
>  	      break;
>  	    }
> +#endif
>  	}
>  
>        if (addend)
> diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
> index a8c20993954..5e02df1706d 100644
> --- a/gcc/config/i386/i386-expand.h
> +++ b/gcc/config/i386/i386-expand.h
> @@ -34,9 +34,7 @@ struct expand_vec_perm_d
>  };
>  
>  rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
> -alias_set_type ix86_GOT_alias_set (void);
>  rtx legitimize_pic_address (rtx orig, rtx reg);
> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg);
>  
>  bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
>  		       rtx_insn *insn);
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 66845b30446..ee3a59ed498 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -11807,30 +11807,6 @@ constant_address_p (rtx x)
>  }
>  
>
>  
> -#if TARGET_PECOFF
> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
> -{
> -  return legitimize_pe_coff_symbol (addr, inreg);
> -}
> -
> -alias_set_type
> -ix86_GOT_alias_set (void)
> -{
> -  return mingw_GOT_alias_set ();
> -}
> -#else
> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
> -{
> -  return NULL_RTX;
> -}
> -
> -alias_set_type
> -ix86_GOT_alias_set (void)
> -{
> -  return -1;
> -}
> -#endif
> -
>  /* Return a legitimate reference for ORIG (an address) using the
>     register REG.  If REG is 0, a new pseudo is generated.
>  
> @@ -11867,9 +11843,11 @@ legitimize_pic_address (rtx orig, rtx reg)
>  
>    if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES)
>      {
> -      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
> +#if TARGET_PECOFF
> +      rtx tmp = legitimize_pe_coff_symbol (addr, true);
>        if (tmp)
>          return tmp;
> +#endif
>      }
>  
>    if (TARGET_64BIT && legitimate_pic_address_disp_p (addr))
> @@ -11912,9 +11890,11 @@ legitimize_pic_address (rtx orig, rtx reg)
>  	      on VxWorks, see gotoff_operand.  */
>  	   || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
>      {
> -      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
> +#if TARGET_PECOFF
> +      rtx tmp = legitimize_pe_coff_symbol (addr, true);
>        if (tmp)
>          return tmp;
> +#endif
>  
>        /* For x64 PE-COFF there is no GOT table,
>  	 so we use address directly.  */
> @@ -11929,7 +11909,7 @@ legitimize_pic_address (rtx orig, rtx reg)
>  				    UNSPEC_GOTPCREL);
>  	  new_rtx = gen_rtx_CONST (Pmode, new_rtx);
>  	  new_rtx = gen_const_mem (Pmode, new_rtx);
> -	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
> +	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
>  	}
>        else
>  	{
> @@ -11951,7 +11931,7 @@ legitimize_pic_address (rtx orig, rtx reg)
>  	    new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
>  
>  	  new_rtx = gen_const_mem (Pmode, new_rtx);
> -	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
> +	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
>  	}
>  
>        new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode);
> @@ -12328,7 +12308,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
>        if (pic)
>  	off = gen_rtx_PLUS (tp_mode, pic, off);
>        off = gen_const_mem (tp_mode, off);
> -      set_mem_alias_set (off, ix86_GOT_alias_set ());
> +      set_mem_alias_set (off, GOT_ALIAS_SET);
>  
>        if (TARGET_64BIT || TARGET_ANY_GNU_TLS)
>  	{
> @@ -12526,9 +12506,11 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode)
>  
>    if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
>      {
> -      rtx tmp = ix86_legitimize_pe_coff_symbol (x, true);
> +#if TARGET_PECOFF
> +      rtx tmp = legitimize_pe_coff_symbol (x, true);
>        if (tmp)
>          return tmp;
> +#endif
>      }
>  
>    if (flag_pic && SYMBOLIC_CONST (x))
> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
> index 969391d3013..2b3d0c8db75 100644
> --- a/gcc/config/i386/i386.h
> +++ b/gcc/config/i386/i386.h
> @@ -2261,6 +2261,8 @@ extern int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
>  /* Which processor to tune code generation for.  These must be in sync
>     with processor_cost_table in i386-options.cc.  */
>  
> +#define GOT_ALIAS_SET -1
> +
>  enum processor_type
>  {
>    PROCESSOR_GENERIC = 0,
> diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
> index 591e89cb5c9..c91e95225d3 100644
> --- a/gcc/config/mingw/winnt-dll.cc
> +++ b/gcc/config/mingw/winnt-dll.cc
> @@ -1,6 +1,6 @@
>  /* Expand a SYMBOL into its corresponding dllimport, far-address,
>  or refptr symbol.
> -Copyright (C) 2024 Free Software Foundation, Inc.
> +Copyright (C) 1988-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
> @@ -206,13 +206,9 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
>  	}
>      }
>  
> -#if !defined (TARGET_AARCH64_MS_ABI)
> -
> -  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
> +  if (CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC)
>      return NULL_RTX;
>  
> -#endif
> -
>    if (GET_CODE (addr) == SYMBOL_REF
>        && !is_imported_p (addr)
>        && SYMBOL_REF_EXTERNAL_P (addr)
> diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h
> index 19c16e747a2..0877f10d67e 100644
> --- a/gcc/config/mingw/winnt-dll.h
> +++ b/gcc/config/mingw/winnt-dll.h
> @@ -23,4 +23,4 @@ extern bool is_imported_p (rtx x);
>  extern alias_set_type mingw_GOT_alias_set (void);
>  extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
>  
> -#endif
> \ No newline at end of file
> +#endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 0/6] Add DLL import/export implementation to AArch64
  2024-06-05  6:01   ` Uros Bizjak
@ 2024-06-05 23:41     ` Jonathan Yong
  2024-06-06  9:23       ` Evgeny Karpov
  0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Yong @ 2024-06-05 23:41 UTC (permalink / raw)
  To: Uros Bizjak, Evgeny Karpov
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

On 6/5/24 06:01, Uros Bizjak wrote:
> On Tue, Jun 4, 2024 at 10:10 PM Evgeny Karpov
> <Evgeny.Karpov@microsoft.com> wrote:
>>
>> Richard and Uros, could you please review the changes for v2?
> 
> LGTM for the generic x86 part, OS-specific part (cygming) should also
> be reviewed by OS port maintainer (CC'd).
> 
> Thanks,
> Uros.
> 

Where is HAVE_64BIT_POINTERS used?

>> Additionally, we have detected an issue with GCC GC in winnt-dll.cc. The fix will be included in v2.
>>
>>>> -ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
>>>> +mingw_handle_selectany_attribute (tree *node, tree name, tree, int,
>>>>                                bool *no_add_attrs)
>>
>>> please reindent the parameters for the new name length.
>>
>> Richard, could you please clarify how it should be done?
>> Thanks!
>>
>> Regards,
>> Evgeny
>>
>>
>> ---
>>   gcc/config/aarch64/cygming.h   |  6 +++++
>>   gcc/config/i386/cygming.h      |  6 +++++
>>   gcc/config/i386/i386-expand.cc |  6 +++--
>>   gcc/config/i386/i386-expand.h  |  2 --
>>   gcc/config/i386/i386.cc        | 42 ++++++++++------------------------
>>   gcc/config/i386/i386.h         |  2 ++
>>   gcc/config/mingw/winnt-dll.cc  |  8 ++-----
>>   gcc/config/mingw/winnt-dll.h   |  2 +-
>>   8 files changed, 33 insertions(+), 41 deletions(-)
>>
>> diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h
>> index 4beebf9e093..0ff475754e0 100644
>> --- a/gcc/config/aarch64/cygming.h
>> +++ b/gcc/config/aarch64/cygming.h
>> @@ -183,4 +183,10 @@ still needed for compilation.  */
>>   #undef MAX_OFILE_ALIGNMENT
>>   #define MAX_OFILE_ALIGNMENT (8192 * 8)
>>
>> +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC 0
>> +
>> +#define HAVE_64BIT_POINTERS 1
>> +
>> +#define GOT_ALIAS_SET mingw_GOT_alias_set ()
>> +
>>   #endif
>> diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
>> index ee01e6bb6ce..cd240533dbc 100644
>> --- a/gcc/config/i386/cygming.h
>> +++ b/gcc/config/i386/cygming.h
>> @@ -469,3 +469,9 @@ do {                                                \
>>   #ifndef HAVE_GAS_ALIGNED_COMM
>>   # define HAVE_GAS_ALIGNED_COMM 0
>>   #endif
>> +
>> +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC
>> +
>> +#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT
>> +
>> +#define GOT_ALIAS_SET mingw_GOT_alias_set ()
>> diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
>> index fb460e30d0a..267d0ba257b 100644
>> --- a/gcc/config/i386/i386-expand.cc
>> +++ b/gcc/config/i386/i386-expand.cc
>> @@ -408,11 +408,12 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>>                                   : UNSPEC_GOT));
>>            op1 = gen_rtx_CONST (Pmode, op1);
>>            op1 = gen_const_mem (Pmode, op1);
>> -         set_mem_alias_set (op1, ix86_GOT_alias_set ());
>> +         set_mem_alias_set (op1, GOT_ALIAS_SET);
>>          }
>>         else
>>          {
>> -         tmp = ix86_legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
>> +#if TARGET_PECOFF
>> +         tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
>>            if (tmp)
>>              {
>>                op1 = tmp;
>> @@ -424,6 +425,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>>                op1 = operands[1];
>>                break;
>>              }
>> +#endif
>>          }
>>
>>         if (addend)
>> diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
>> index a8c20993954..5e02df1706d 100644
>> --- a/gcc/config/i386/i386-expand.h
>> +++ b/gcc/config/i386/i386-expand.h
>> @@ -34,9 +34,7 @@ struct expand_vec_perm_d
>>   };
>>
>>   rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
>> -alias_set_type ix86_GOT_alias_set (void);
>>   rtx legitimize_pic_address (rtx orig, rtx reg);
>> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg);
>>
>>   bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
>>                         rtx_insn *insn);
>> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
>> index 66845b30446..ee3a59ed498 100644
>> --- a/gcc/config/i386/i386.cc
>> +++ b/gcc/config/i386/i386.cc
>> @@ -11807,30 +11807,6 @@ constant_address_p (rtx x)
>>   }
>>
>>
>>
>> -#if TARGET_PECOFF
>> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
>> -{
>> -  return legitimize_pe_coff_symbol (addr, inreg);
>> -}
>> -
>> -alias_set_type
>> -ix86_GOT_alias_set (void)
>> -{
>> -  return mingw_GOT_alias_set ();
>> -}
>> -#else
>> -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg)
>> -{
>> -  return NULL_RTX;
>> -}
>> -
>> -alias_set_type
>> -ix86_GOT_alias_set (void)
>> -{
>> -  return -1;
>> -}
>> -#endif
>> -
>>   /* Return a legitimate reference for ORIG (an address) using the
>>      register REG.  If REG is 0, a new pseudo is generated.
>>
>> @@ -11867,9 +11843,11 @@ legitimize_pic_address (rtx orig, rtx reg)
>>
>>     if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES)
>>       {
>> -      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
>> +#if TARGET_PECOFF
>> +      rtx tmp = legitimize_pe_coff_symbol (addr, true);
>>         if (tmp)
>>           return tmp;
>> +#endif
>>       }
>>
>>     if (TARGET_64BIT && legitimate_pic_address_disp_p (addr))
>> @@ -11912,9 +11890,11 @@ legitimize_pic_address (rtx orig, rtx reg)
>>                on VxWorks, see gotoff_operand.  */
>>             || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
>>       {
>> -      rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true);
>> +#if TARGET_PECOFF
>> +      rtx tmp = legitimize_pe_coff_symbol (addr, true);
>>         if (tmp)
>>           return tmp;
>> +#endif
>>
>>         /* For x64 PE-COFF there is no GOT table,
>>           so we use address directly.  */
>> @@ -11929,7 +11909,7 @@ legitimize_pic_address (rtx orig, rtx reg)
>>                                      UNSPEC_GOTPCREL);
>>            new_rtx = gen_rtx_CONST (Pmode, new_rtx);
>>            new_rtx = gen_const_mem (Pmode, new_rtx);
>> -         set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
>> +         set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
>>          }
>>         else
>>          {
>> @@ -11951,7 +11931,7 @@ legitimize_pic_address (rtx orig, rtx reg)
>>              new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
>>
>>            new_rtx = gen_const_mem (Pmode, new_rtx);
>> -         set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
>> +         set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
>>          }
>>
>>         new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode);
>> @@ -12328,7 +12308,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
>>         if (pic)
>>          off = gen_rtx_PLUS (tp_mode, pic, off);
>>         off = gen_const_mem (tp_mode, off);
>> -      set_mem_alias_set (off, ix86_GOT_alias_set ());
>> +      set_mem_alias_set (off, GOT_ALIAS_SET);
>>
>>         if (TARGET_64BIT || TARGET_ANY_GNU_TLS)
>>          {
>> @@ -12526,9 +12506,11 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode)
>>
>>     if (TARGET_DLLIMPORT_DECL_ATTRIBUTES)
>>       {
>> -      rtx tmp = ix86_legitimize_pe_coff_symbol (x, true);
>> +#if TARGET_PECOFF
>> +      rtx tmp = legitimize_pe_coff_symbol (x, true);
>>         if (tmp)
>>           return tmp;
>> +#endif
>>       }
>>
>>     if (flag_pic && SYMBOLIC_CONST (x))
>> diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
>> index 969391d3013..2b3d0c8db75 100644
>> --- a/gcc/config/i386/i386.h
>> +++ b/gcc/config/i386/i386.h
>> @@ -2261,6 +2261,8 @@ extern int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
>>   /* Which processor to tune code generation for.  These must be in sync
>>      with processor_cost_table in i386-options.cc.  */
>>
>> +#define GOT_ALIAS_SET -1
>> +
>>   enum processor_type
>>   {
>>     PROCESSOR_GENERIC = 0,
>> diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc
>> index 591e89cb5c9..c91e95225d3 100644
>> --- a/gcc/config/mingw/winnt-dll.cc
>> +++ b/gcc/config/mingw/winnt-dll.cc
>> @@ -1,6 +1,6 @@
>>   /* Expand a SYMBOL into its corresponding dllimport, far-address,
>>   or refptr symbol.
>> -Copyright (C) 2024 Free Software Foundation, Inc.
>> +Copyright (C) 1988-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
>> @@ -206,13 +206,9 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
>>          }
>>       }
>>
>> -#if !defined (TARGET_AARCH64_MS_ABI)
>> -
>> -  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
>> +  if (CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC)
>>       return NULL_RTX;
>>
>> -#endif
>> -
>>     if (GET_CODE (addr) == SYMBOL_REF
>>         && !is_imported_p (addr)
>>         && SYMBOL_REF_EXTERNAL_P (addr)
>> diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h
>> index 19c16e747a2..0877f10d67e 100644
>> --- a/gcc/config/mingw/winnt-dll.h
>> +++ b/gcc/config/mingw/winnt-dll.h
>> @@ -23,4 +23,4 @@ extern bool is_imported_p (rtx x);
>>   extern alias_set_type mingw_GOT_alias_set (void);
>>   extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);
>>
>> -#endif
>> \ No newline at end of file
>> +#endif
>> --
>> 2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 0/6] Add DLL import/export implementation to AArch64
  2024-06-05 23:41     ` Jonathan Yong
@ 2024-06-06  9:23       ` Evgeny Karpov
  2024-06-08  1:59         ` Jonathan Yong
  0 siblings, 1 reply; 22+ messages in thread
From: Evgeny Karpov @ 2024-06-06  9:23 UTC (permalink / raw)
  To: Jonathan Yong, Uros Bizjak
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

Thursday, June 6, 2024 1:42 AM
Jonathan Yong <10walls@gmail.com> wrote:
>
> Where is HAVE_64BIT_POINTERS used?
> 

Sorry, it was missed in the posted changes for review.

Regards,
Evgeny

diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 8a6f0e8e8a5..0c9d5424942 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3.  If not see
 #endif

 #undef SUB_LINK_ENTRY
-#if TARGET_64BIT_DEFAULT || defined (TARGET_AARCH64_MS_ABI)
+#if HAVE_64BIT_POINTERS
 #define SUB_LINK_ENTRY SUB_LINK_ENTRY64
 #else
 #define SUB_LINK_ENTRY SUB_LINK_ENTRY32


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v1 0/6] Add DLL import/export implementation to AArch64
  2024-06-06  9:23       ` Evgeny Karpov
@ 2024-06-08  1:59         ` Jonathan Yong
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Yong @ 2024-06-08  1:59 UTC (permalink / raw)
  To: Evgeny Karpov, Uros Bizjak
  Cc: gcc-patches, richard.sandiford, Richard Earnshaw (lists),
	Maxim Kuvyrkov, Radek Barton

On 6/6/24 09:23, Evgeny Karpov wrote:
> Thursday, June 6, 2024 1:42 AM
> Jonathan Yong <10walls@gmail.com> wrote:
>>
>> Where is HAVE_64BIT_POINTERS used?
>>
> 
> Sorry, it was missed in the posted changes for review.
> 
> Regards,
> Evgeny
> 
> diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
> index 8a6f0e8e8a5..0c9d5424942 100644
> --- a/gcc/config/mingw/mingw32.h
> +++ b/gcc/config/mingw/mingw32.h
> @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3.  If not see
>   #endif
> 
>   #undef SUB_LINK_ENTRY
> -#if TARGET_64BIT_DEFAULT || defined (TARGET_AARCH64_MS_ABI)
> +#if HAVE_64BIT_POINTERS
>   #define SUB_LINK_ENTRY SUB_LINK_ENTRY64
>   #else
>   #define SUB_LINK_ENTRY SUB_LINK_ENTRY32
> 

Looks OK to me.

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-06-08  2:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 21:35 [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
2024-04-18 21:41 ` [PATCH v1 1/6] Move mingw_* declarations to the mingw folder Evgeny Karpov
2024-04-18 21:43 ` [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw Evgeny Karpov
2024-05-22 11:05   ` Richard Sandiford
2024-05-22 14:32     ` Evgeny Karpov
2024-05-23  8:35       ` Uros Bizjak
2024-05-23  8:41         ` Uros Bizjak
2024-05-23 17:53         ` Evgeny Karpov
2024-05-23 19:37           ` Uros Bizjak
2024-04-18 21:45 ` [PATCH v1 3/6] Rename functions for reuse in AArch64 Evgeny Karpov
2024-05-22 11:46   ` Richard Sandiford
2024-04-18 21:46 ` [PATCH v1 4/6] aarch64: Add selectany attribute handling Evgeny Karpov
2024-05-22 11:57   ` Richard Sandiford
2024-04-18 21:48 ` [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64 Evgeny Karpov
2024-05-22 12:07   ` Richard Sandiford
2024-04-18 21:49 ` [PATCH v1 6/6] aarch64: Add DLL import/export to AArch64 target Evgeny Karpov
2024-06-04 20:10 ` [PATCH v1 0/6] Add DLL import/export implementation to AArch64 Evgeny Karpov
2024-06-05  6:01   ` Uros Bizjak
2024-06-05 23:41     ` Jonathan Yong
2024-06-06  9:23       ` Evgeny Karpov
2024-06-08  1:59         ` Jonathan Yong
2024-06-05  8:13   ` Richard Sandiford

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).