From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id B09783858D26 for ; Wed, 22 May 2024 11:05:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B09783858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B09783858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716375950; cv=none; b=ak9yOhHcJ0MIbTrpfJHSmLGvHYq8fOL+w+M0WNS9EJzktl6nDMSMjS3hFKJn1XugR3P8MgN/d9ErEXmTHaiTcq4RaMclIjIPGeEmeRYGtKEtRlztDSWBkOI+/p2hY+dTdnqB6FMcrYIGlkl420GSj6rzxxSyBYxNGLYZogfqrhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716375950; c=relaxed/simple; bh=zVfwbhr8JYGL+Fn8g18p5jcWIsBfzyFUve6wT87FAw4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=fFgcMAQorkoeB7b3gRBWOXPPrU0zzbhEOb77HSUIErJAoO7X9afTZenoKzKeFuIqJ9UgCDc43CUvkv17U5UCqPL/oBFDHYK7KdjWhmJjY61/6XpFL2r5j7s1Lyh92tt4DHWIATdEDxfrQE1ZfMhfCYDSWXkoatnD1hHmPL72S0Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 82B2C339; Wed, 22 May 2024 04:06:12 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABDFB3F641; Wed, 22 May 2024 04:05:47 -0700 (PDT) From: Richard Sandiford To: Evgeny Karpov Mail-Followup-To: Evgeny Karpov ,"gcc-patches\@gcc.gnu.org" , "Richard Earnshaw \(lists\)" , Maxim Kuvyrkov , Radek Barton , richard.sandiford@arm.com Cc: "gcc-patches\@gcc.gnu.org" , "Richard Earnshaw \(lists\)" , Maxim Kuvyrkov , Radek Barton Subject: Re: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw References: Date: Wed, 22 May 2024 12:05:46 +0100 In-Reply-To: (Evgeny Karpov's message of "Thu, 18 Apr 2024 21:43:37 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-20.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Evgeny Karpov 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