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 2/6] Extract ix86 dllimport implementation to mingw
Date: Wed, 22 May 2024 12:05:46 +0100	[thread overview]
Message-ID: <mpty182jed1.fsf@arm.com> (raw)
In-Reply-To: <PR3PR83MB0425CF54E7A1BA0A96BE1A10F80E2@PR3PR83MB0425.EURPRD83.prod.outlook.com> (Evgeny Karpov's message of "Thu, 18 Apr 2024 21:43:37 +0000")

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

  reply	other threads:[~2024-05-22 11:05 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 [this message]
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

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