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 BA9DB3858CD1 for ; Wed, 22 May 2024 12:07:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA9DB3858CD1 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 BA9DB3858CD1 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=1716379634; cv=none; b=pFpqksHJzdYSRbEoQetOyyK5y+Sf/npO9FAPKBa6CZusNSChmgL4r58Q/Hs7wI9CdDL1QNarnCH+lXafUYd0tUFUc6KnYcUQSogqa7FeaWBfC69cpG1p0XlP+GRhf426H5OVFXOV/YtyNw7Cs9J0NcRf+xPjK7Vanug5Cxg9484= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716379634; c=relaxed/simple; bh=hoaczQpaQEcrVLOSpfJsCU4C1bW3gaFfwDcqALkA7v8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=nPo3+NIY8/N5arKSgNs5lyaC5JTAavMMAM5wtPLKu0rvgeotItDx7vH4mNybENd+xKuQLrwnXZy8PkNhnShjtv+BMWvh5kCS0E5TfqZzPB6jySxKLVfSLcg86L+mga29OlPs6AfYHtMFL7V9/hMe7VoCj3Xe+3rsUe6SfjQFwIM= 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 7C3B3339; Wed, 22 May 2024 05:07:36 -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 A353C3F641; Wed, 22 May 2024 05:07:11 -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 5/6] Adjust DLL import/export implementation for AArch64 References: Date: Wed, 22 May 2024 13:07:10 +0100 In-Reply-To: (Evgeny Karpov's message of "Thu, 18 Apr 2024 21:48:06 +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=-19.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_NUMSUBJECT,KAM_STOCKGEN,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: > 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)