https://gcc.gnu.org/g:ed20feebd9ea31d58861f61205bd412b0c3febd0
commit r15-1602-ged20feebd9ea31d58861f61205bd412b0c3febd0 Author: Evgeny Karpov <evgeny.kar...@microsoft.com> Date: Mon Jun 24 12:46:54 2024 +0000 Adjust DLL import/export implementation for AArch64 The DLL import/export mingw implementation, originally from ix86, requires minor adjustments to be compatible with AArch64. 2024-06-08 Evgeny Karpov <evgeny.kar...@microsoft.com> 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. Diff: --- 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 --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 da8e1e8949e..0dfe8e995b6 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