From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 9095038053D8 for ; Wed, 5 Jun 2024 06:02:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9095038053D8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9095038053D8 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717567325; cv=none; b=i7vCAP5mbEVnsfboDEaDNPG6vs7zsBgKKnPLmuQIBDA5y7cyS5uASW84CZqnIA407uB5AQ2g9kWiixBarcM11MibbY/GNH0hUitn98huNc/KT9rCTtmkFVm+dQvwDCleXmfC8Eg4Uy6qiTI1rbAhGMZhPyLe9DCUxvPOCRbXDPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717567325; c=relaxed/simple; bh=cHDvhOha4cFiD+bMynDyua0Z4f2fxQvCveXqTz0bT6A=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=aXN4DBIOPrrM0zOqll+Drf8xVUUjPdaeWgcG+GZ5wodpCEu3qsZCzp6HUJa2F+yWZm21Epb0LFB9InRAsl6YDYaweP60rvS81Dzm4FFIlY3OQhHgMO+GtqL8R1GPocCYMSXnQLnikOvjA9pZIvHGok19gx4EZpuMuyZI7MoUXQA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2e73359b8fbso88304491fa.2 for ; Tue, 04 Jun 2024 23:02:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717567321; x=1718172121; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pGhN3axyPzG6yFtiAtaTwpFu7Qs0tGlOlj8O8RiVsCo=; b=jlJjLehGEyzjjU3J5dkKkRp2J+AOvYHMZQO4yfmp/NdiPc3NvZoStnQxjA8qYiVzIZ XrUjiDm9mRCnrlXbSa0HUNkLBLSay7mMXjUXmH/OEtiJJAjP7kShVQB975hItkP+ZcuM BtU1vMx9xlgJFSRyxnxcHZf2BtELcPKlUdsuhJ735gmtP/aDEzkvPLBAwgZjLobILpcv wHn6q1OK+qSPqZkDEttYnqvgHlmz5TIMxhEZKJIxJbne1HK8kaE2dMUbW1IUqc4r4LE8 bQnrsSOrsy7wr96MdkfQcpXWL779tP4dGB56CxwH2kMdmgB6mzTNLgxHJLm4RyaGsmXb fgyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717567321; x=1718172121; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pGhN3axyPzG6yFtiAtaTwpFu7Qs0tGlOlj8O8RiVsCo=; b=okTxlNzE2CH92deyI+0HT7vmWieXEDI3sG1aJyfqvE01XfSB3cYvGqgG0DZEQHTeho nrfw7MdNC7gV41BRjPhAhbII7W3qEXjDo0wEEfgWeyQmjBJo27HoOXXt8ZME6VLP7PBX OLMA9R8iBVwuLlavAKw0sPXKK3UPwyb2dbf5+BTvJ+BZoccMvTU8/igu16dp1M5Dp7tW CezozfI90IXu5l2QH7hF8qd+JbrLiqP0lq9BUpvOagThHijMsy81WAUgm47SW3njPdr1 iuRqDRvVJQwkPoJ2S5x2iPr1WSNFZ1Ee79YBDTlqHTjzpCrFxRbdfoSHmic8vm0G/Cpz JKIw== X-Gm-Message-State: AOJu0YxcFMny8XMf/GxMi2rfLfNeARFGsy8JjpHwvYQCti82hJptU7as sUTmL3Ww5vANDAAdTEYrJxmrACWH/S5F7VkoA1oZfnDUVSqEe9Gl4AYFt7+KTlT9+xnJPSXk+Vd Lkdu02TAIN8WZLYZjn7yknV3LuWo= X-Google-Smtp-Source: AGHT+IG13g6gag0y8PW6lBdqGJdmNtOEiQCU9kVFf4AtgETSmrk/cC7VJxRn7BpZLVHEiGxRror7XV+jIT3lP/m64zg= X-Received: by 2002:a2e:b16e:0:b0:2ea:ad2c:45bb with SMTP id 38308e7fff4ca-2eac7a91330mr8447761fa.46.1717567320640; Tue, 04 Jun 2024 23:02:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Uros Bizjak Date: Wed, 5 Jun 2024 08:01:49 +0200 Message-ID: Subject: Re: [PATCH v1 0/6] Add DLL import/export implementation to AArch64 To: Evgeny Karpov Cc: "gcc-patches@gcc.gnu.org" , "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton , Jonathan Yong <10walls@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On Tue, Jun 4, 2024 at 10:10=E2=80=AFPM Evgeny Karpov wrote: > > Richard and Uros, could you please review the changes for v2? LGTM for the generic x86 part, OS-specific part (cygming) should also be reviewed by OS port maintainer (CC'd). Thanks, Uros. > Additionally, we have detected an issue with GCC GC in winnt-dll.cc. The = fix will be included in v2. > > >> -ix86_handle_selectany_attribute (tree *node, tree name, tree, int, > >> +mingw_handle_selectany_attribute (tree *node, tree name, tree, int, > >> bool *no_add_attrs) > > > please reindent the parameters for the new name length. > > Richard, could you please clarify how it should be done? > Thanks! > > Regards, > Evgeny > > > --- > gcc/config/aarch64/cygming.h | 6 +++++ > gcc/config/i386/cygming.h | 6 +++++ > gcc/config/i386/i386-expand.cc | 6 +++-- > gcc/config/i386/i386-expand.h | 2 -- > gcc/config/i386/i386.cc | 42 ++++++++++------------------------ > gcc/config/i386/i386.h | 2 ++ > gcc/config/mingw/winnt-dll.cc | 8 ++----- > gcc/config/mingw/winnt-dll.h | 2 +- > 8 files changed, 33 insertions(+), 41 deletions(-) > > diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h > index 4beebf9e093..0ff475754e0 100644 > --- a/gcc/config/aarch64/cygming.h > +++ b/gcc/config/aarch64/cygming.h > @@ -183,4 +183,10 @@ still needed for compilation. */ > #undef MAX_OFILE_ALIGNMENT > #define MAX_OFILE_ALIGNMENT (8192 * 8) > > +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC 0 > + > +#define HAVE_64BIT_POINTERS 1 > + > +#define GOT_ALIAS_SET mingw_GOT_alias_set () > + > #endif > diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h > index ee01e6bb6ce..cd240533dbc 100644 > --- a/gcc/config/i386/cygming.h > +++ b/gcc/config/i386/cygming.h > @@ -469,3 +469,9 @@ do { \ > #ifndef HAVE_GAS_ALIGNED_COMM > # define HAVE_GAS_ALIGNED_COMM 0 > #endif > + > +#define CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC ix86_cmodel !=3D CM_LARGE_PIC = && ix86_cmodel !=3D CM_MEDIUM_PIC > + > +#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT > + > +#define GOT_ALIAS_SET mingw_GOT_alias_set () > diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand= .cc > index fb460e30d0a..267d0ba257b 100644 > --- a/gcc/config/i386/i386-expand.cc > +++ b/gcc/config/i386/i386-expand.cc > @@ -408,11 +408,12 @@ ix86_expand_move (machine_mode mode, rtx operands[]= ) > : UNSPEC_GOT)); > op1 =3D gen_rtx_CONST (Pmode, op1); > op1 =3D gen_const_mem (Pmode, op1); > - set_mem_alias_set (op1, ix86_GOT_alias_set ()); > + set_mem_alias_set (op1, GOT_ALIAS_SET); > } > else > { > - tmp =3D ix86_legitimize_pe_coff_symbol (op1, addend !=3D NULL_R= TX); > +#if TARGET_PECOFF > + tmp =3D legitimize_pe_coff_symbol (op1, addend !=3D NULL_RTX); > if (tmp) > { > op1 =3D tmp; > @@ -424,6 +425,7 @@ ix86_expand_move (machine_mode mode, rtx operands[]) > op1 =3D operands[1]; > break; > } > +#endif > } > > if (addend) > diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.= h > index a8c20993954..5e02df1706d 100644 > --- a/gcc/config/i386/i386-expand.h > +++ b/gcc/config/i386/i386-expand.h > @@ -34,9 +34,7 @@ struct expand_vec_perm_d > }; > > rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov); > -alias_set_type ix86_GOT_alias_set (void); > rtx legitimize_pic_address (rtx orig, rtx reg); > -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg); > > bool insn_defines_reg (unsigned int regno1, unsigned int regno2, > rtx_insn *insn); > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc > index 66845b30446..ee3a59ed498 100644 > --- a/gcc/config/i386/i386.cc > +++ b/gcc/config/i386/i386.cc > @@ -11807,30 +11807,6 @@ constant_address_p (rtx x) > } > > > > -#if TARGET_PECOFF > -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg) > -{ > - return legitimize_pe_coff_symbol (addr, inreg); > -} > - > -alias_set_type > -ix86_GOT_alias_set (void) > -{ > - return mingw_GOT_alias_set (); > -} > -#else > -rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg) > -{ > - return NULL_RTX; > -} > - > -alias_set_type > -ix86_GOT_alias_set (void) > -{ > - return -1; > -} > -#endif > - > /* Return a legitimate reference for ORIG (an address) using the > register REG. If REG is 0, a new pseudo is generated. > > @@ -11867,9 +11843,11 @@ legitimize_pic_address (rtx orig, rtx reg) > > if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES) > { > - rtx tmp =3D ix86_legitimize_pe_coff_symbol (addr, true); > +#if TARGET_PECOFF > + rtx tmp =3D legitimize_pe_coff_symbol (addr, true); > if (tmp) > return tmp; > +#endif > } > > if (TARGET_64BIT && legitimate_pic_address_disp_p (addr)) > @@ -11912,9 +11890,11 @@ legitimize_pic_address (rtx orig, rtx reg) > on VxWorks, see gotoff_operand. */ > || (TARGET_VXWORKS_RTP && GET_CODE (addr) =3D=3D LABEL_REF)) > { > - rtx tmp =3D ix86_legitimize_pe_coff_symbol (addr, true); > +#if TARGET_PECOFF > + rtx tmp =3D legitimize_pe_coff_symbol (addr, true); > if (tmp) > return tmp; > +#endif > > /* For x64 PE-COFF there is no GOT table, > so we use address directly. */ > @@ -11929,7 +11909,7 @@ legitimize_pic_address (rtx orig, rtx reg) > UNSPEC_GOTPCREL); > new_rtx =3D gen_rtx_CONST (Pmode, new_rtx); > new_rtx =3D gen_const_mem (Pmode, new_rtx); > - set_mem_alias_set (new_rtx, ix86_GOT_alias_set ()); > + set_mem_alias_set (new_rtx, GOT_ALIAS_SET); > } > else > { > @@ -11951,7 +11931,7 @@ legitimize_pic_address (rtx orig, rtx reg) > new_rtx =3D gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rt= x); > > new_rtx =3D gen_const_mem (Pmode, new_rtx); > - set_mem_alias_set (new_rtx, ix86_GOT_alias_set ()); > + set_mem_alias_set (new_rtx, GOT_ALIAS_SET); > } > > new_rtx =3D copy_to_suggested_reg (new_rtx, reg, Pmode); > @@ -12328,7 +12308,7 @@ legitimize_tls_address (rtx x, enum tls_model mod= el, bool for_mov) > if (pic) > off =3D gen_rtx_PLUS (tp_mode, pic, off); > off =3D gen_const_mem (tp_mode, off); > - set_mem_alias_set (off, ix86_GOT_alias_set ()); > + set_mem_alias_set (off, GOT_ALIAS_SET); > > if (TARGET_64BIT || TARGET_ANY_GNU_TLS) > { > @@ -12526,9 +12506,11 @@ ix86_legitimize_address (rtx x, rtx, machine_mod= e mode) > > if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) > { > - rtx tmp =3D ix86_legitimize_pe_coff_symbol (x, true); > +#if TARGET_PECOFF > + rtx tmp =3D legitimize_pe_coff_symbol (x, true); > if (tmp) > return tmp; > +#endif > } > > if (flag_pic && SYMBOLIC_CONST (x)) > diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h > index 969391d3013..2b3d0c8db75 100644 > --- a/gcc/config/i386/i386.h > +++ b/gcc/config/i386/i386.h > @@ -2261,6 +2261,8 @@ extern int const svr4_debugger_register_map[FIRST_P= SEUDO_REGISTER]; > /* Which processor to tune code generation for. These must be in sync > with processor_cost_table in i386-options.cc. */ > > +#define GOT_ALIAS_SET -1 > + > enum processor_type > { > PROCESSOR_GENERIC =3D 0, > diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.c= c > index 591e89cb5c9..c91e95225d3 100644 > --- a/gcc/config/mingw/winnt-dll.cc > +++ b/gcc/config/mingw/winnt-dll.cc > @@ -1,6 +1,6 @@ > /* Expand a SYMBOL into its corresponding dllimport, far-address, > or refptr symbol. > -Copyright (C) 2024 Free Software Foundation, Inc. > +Copyright (C) 1988-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 > @@ -206,13 +206,9 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg) > } > } > > -#if !defined (TARGET_AARCH64_MS_ABI) > - > - if (ix86_cmodel !=3D CM_LARGE_PIC && ix86_cmodel !=3D CM_MEDIUM_PIC) > + if (CMODEL_IS_NOT_LARGE_OR_MEDIUM_PIC) > return NULL_RTX; > > -#endif > - > if (GET_CODE (addr) =3D=3D SYMBOL_REF > && !is_imported_p (addr) > && SYMBOL_REF_EXTERNAL_P (addr) > diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h > index 19c16e747a2..0877f10d67e 100644 > --- a/gcc/config/mingw/winnt-dll.h > +++ b/gcc/config/mingw/winnt-dll.h > @@ -23,4 +23,4 @@ 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 > +#endif > -- > 2.25.1