public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Evgeny Karpov <Evgeny.Karpov@microsoft.com>
Cc: "gcc-patches\@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	 "Richard Earnshaw \(lists\)" <Richard.Earnshaw@arm.com>,
	 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
	 Radek Barton <radek.barton@microsoft.com>
Subject: Re: [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64
Date: Wed, 22 May 2024 13:07:10 +0100	[thread overview]
Message-ID: <mptv836hwy9.fsf@arm.com> (raw)
In-Reply-To: <PR3PR83MB0425819A14FFAEDB88418473F80E2@PR3PR83MB0425.EURPRD83.prod.outlook.com> (Evgeny Karpov's message of "Thu, 18 Apr 2024 21:48:06 +0000")

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)

  reply	other threads:[~2024-05-22 12:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mptv836hwy9.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Evgeny.Karpov@microsoft.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=maxim.kuvyrkov@linaro.org \
    --cc=radek.barton@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).