diff mbox series

[v3,5/6] Adjust DLL import/export implementation for AArch64

Message ID DBBPR83MB0613BD5C1327062C9D71181DF8C42@DBBPR83MB0613.EURPRD83.prod.outlook.com
State New
Headers show
Series Add DLL import/export implementation to AArch64 | expand

Commit Message

Evgeny Karpov June 8, 2024, 1:48 p.m. UTC
The DLL import/export mingw implementation, originally from ix86, requires
minor adjustments to be compatible with AArch64.

gcc/ChangeLog:

	* config/i386/cygming.h (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED):
	Declare whether an external declaration should be legitimized.
	(HAVE_64BIT_POINTERS): Define whether the target supports 64-bit
	pointers.
	* config/mingw/mingw32.h (defined): Use the correct DllMainCRTStartup
	entry function.
	* config/mingw/winnt-dll.cc (defined): Exclude ix86-related code.
---
 gcc/config/i386/cygming.h     | 5 +++++
 gcc/config/mingw/mingw32.h    | 2 +-
 gcc/config/mingw/winnt-dll.cc | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 4bb8d7f920c..0493b3be875 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -472,3 +472,8 @@  do {						\
 
 #undef GOT_ALIAS_SET
 #define GOT_ALIAS_SET mingw_GOT_alias_set ()
+
+#define PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED \
+  ix86_cmodel == CM_LARGE_PIC || ix86_cmodel == CM_MEDIUM_PIC
+
+#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index fa6e307476c..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
+#if HAVE_64BIT_POINTERS
 #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 1354402a959..66c445cba77 100644
--- a/gcc/config/mingw/winnt-dll.cc
+++ b/gcc/config/mingw/winnt-dll.cc
@@ -206,7 +206,7 @@  legitimize_pe_coff_symbol (rtx addr, bool inreg)
 	}
     }
 
-  if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC)
+  if (!PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED)
     return NULL_RTX;
 
   if (GET_CODE (addr) == SYMBOL_REF