From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by sourceware.org (Postfix) with ESMTPS id 6E85E3858C52 for ; Mon, 10 Apr 2023 06:48:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E85E3858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1a649d03360so251825ad.2 for ; Sun, 09 Apr 2023 23:48:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681109306; h=content-transfer-encoding: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=taao3eAML5C+XudhgjMJ0wJXqRj/KyNkmWAxZh3bmXY=; b=ANq/augAKhGc7H//hJBp1K0mBggodKStjV+lpfjZSIdefBpr/kKGLe2xI37WoXp9tP vFTtaP/ZwTUQxX2fEjusOWVIDhIpRojrKJfgj9rGy3C/vKClnLwvL2XNnC2AT+5HtVtw rTUwHyC4O/5kX8n2PDTFdwch4rn8K38Mo4wdWyFQo+12QEYmeV5FmVOFmqCYXxi/WWFD KPfAXWMKtKXE6ItRulq1mECxj+RftUKh2sw4+s86s/M/DgLGAb0aRylMVlSNrgD8/EX/ oahkUiB9Dk/aZrmvofURXsErgAtrXcTUMkU++Z2QdPxz8k1Tfd4kqvjssuBRKLi8PeBK zCGg== X-Gm-Message-State: AAQBX9e1EPTVeCM3FnN2K8/CCoCa4LtTE79eX1o1ia0bim2mawzNmzZv jDuwj56rMqBXs26P+n2BAq2NqNoQfefsEgF1rfs= X-Google-Smtp-Source: AKy350bihnok0hJZdei9s2WuxRBeIXyOqd56NI+CseeNcbrPAJ4zgfH7y9mjvqkDLJbgG0eZz/AsKr3x0oNXjoiY4U4= X-Received: by 2002:a05:6a00:2d9c:b0:625:dac0:5263 with SMTP id fb28-20020a056a002d9c00b00625dac05263mr4462736pfb.0.1681109306113; Sun, 09 Apr 2023 23:48:26 -0700 (PDT) MIME-Version: 1.0 References: <20230221040650.2337395-1-yunqiang.su@cipunited.com> <20230302015222.291088-1-yunqiang.su@cipunited.com> In-Reply-To: From: YunQiang Su Date: Mon, 10 Apr 2023 14:48:14 +0800 Message-ID: Subject: Re: [PATCH v2] MIPS: make mipsisa32 and mipsisa64 link more systematic To: YunQiang Su , binutils@sourceware.org, syq@debian.org, macro@orcam.me.uk, xry111@xry111.site, jiaxun.yang@flygoat.com, richard.sandiford@arm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,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: Richard Sandiford =E4=BA=8E2023=E5=B9=B44=E6=9C= =883=E6=97=A5=E5=91=A8=E4=B8=80 22:03=E5=86=99=E9=81=93=EF=BC=9A > > YunQiang Su writes: > > Introduce `static const struct mips_mach_extension mips_mach_32_64[]` > > and `mips_mach_extends_32_64 (unsigned long base, unsigned long extensi= on)`, > > to make mipsisa32 and mipsisa64 interlink more systemtic. > > > > Normally, the ISA mipsisa64rN has two subset: mipsisa64r(N-1) and > > mipsisa32rN. `mips_mach_extensions` can hold only mipsisa64r(N-1), > > so we need to introduce a new instruction `mips_mach_32_64`, which hold= s the pair 32vs64. > > > > Note: R6 is not compatible with pre-R6. > > > > bfd/ChangeLog: > > > > * elfxx-mips.c (mips_mach_extends_p): make mipsisa32 and > > mipsisa64 interlink more systematic. > > (mips_mach_32_64): new struct added. > > (mips_mach_extends_32_64): new function added. > > Sorry for the delay in pushing this. Could you check whether it's > the right version though? When I build locally I get: > > > --- > > bfd/elfxx-mips.c | 40 +++++++++++++++++++++++++++++----------- > > 1 file changed, 29 insertions(+), 11 deletions(-) > > > > diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c > > index 35bbd86044b..21e6396609b 100644 > > --- a/bfd/elfxx-mips.c > > +++ b/bfd/elfxx-mips.c > > @@ -14524,6 +14524,16 @@ struct mips_mach_extension > > unsigned long extension, base; > > }; > > > > +/* An array that maps 64-bit architectures to the corresponding 32-bit > > + architectures. */ > > +static const struct mips_mach_extension mips_mach_32_64[] =3D > > +{ > > + { bfd_mach_mipsisa64r6, bfd_mach_mipsisa32r6 }, > > + { bfd_mach_mipsisa64r5, bfd_mach_mipsisa32r5 }, > > + { bfd_mach_mipsisa64r3, bfd_mach_mipsisa32r3 }, > > + { bfd_mach_mipsisa64r2, bfd_mach_mipsisa32r2 }, > > + { bfd_mach_mipsisa64, bfd_mach_mipsisa32 } > > +}; > > > > /* An array describing how BFD machines relate to one another. The en= tries > > are ordered topologically with MIPS I extensions listed last. */ > > @@ -14601,29 +14611,37 @@ static const struct mips_mach_extension mips_= mach_extensions[] =3D > > { bfd_mach_mips3900, bfd_mach_mips3000 } > > }; > > > > -/* Return true if bfd machine EXTENSION is an extension of machine BAS= E. */ > > +/* Return true if bfd machine EXTENSION is the same as BASE, or if > > + EXTENSION is the 64-bit equivalent of a 32-bit BASE. */ > > + > > +static bool > > +mips_mach_extends_32_64 (unsigned long base, unsigned long extension) > > +{ > > + size_t i; > > + > > + if (extension =3D=3D base) > > + return true; > > + > > + for (i =3D 0; i < ARRAY_SIZE (mips_mach_64_32); i++) > > error: =E2=80=98mips_mach_64_32=E2=80=99 undeclared (first use in this fu= nction); did you mean =E2=80=98mips_mach_32_64=E2=80=99? > > It looks like the previous patch had the same thing (sorry for not > noticing). Obviously it's a simple fix, but it would be good to have > some reassurance that the patch has been tested beyond my crude sanity > checks. > Yes, it is a typo. Sorry for it. I won't happen anymore... > Thanks, > Richard > > > + if (extension =3D=3D mips_mach_32_64[i].extension) > > + return base =3D=3D mips_mach_32_64[i].base; > > + > > + return false; > > +} > > > > static bool > > mips_mach_extends_p (unsigned long base, unsigned long extension) > > { > > size_t i; > > > > - if (extension =3D=3D base) > > - return true; > > - > > - if (base =3D=3D bfd_mach_mipsisa32 > > - && mips_mach_extends_p (bfd_mach_mipsisa64, extension)) > > - return true; > > - > > - if (base =3D=3D bfd_mach_mipsisa32r2 > > - && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension)) > > + if (mips_mach_extends_32_64 (base, extension)) > > return true; > > > > for (i =3D 0; i < ARRAY_SIZE (mips_mach_extensions); i++) > > if (extension =3D=3D mips_mach_extensions[i].extension) > > { > > extension =3D mips_mach_extensions[i].base; > > > > > - if (extension =3D=3D base) > > + if (mips_mach_extends_32_64 (base, extension)) > > return true; > > }