From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by sourceware.org (Postfix) with ESMTPS id 8D5FF3851C19 for ; Thu, 26 Nov 2020 18:41:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8D5FF3851C19 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 678F33F2E272; Thu, 26 Nov 2020 10:41:17 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id JHByExwn--ZL; Thu, 26 Nov 2020 10:41:16 -0800 (PST) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 3E9543F2E206; Thu, 26 Nov 2020 10:41:16 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id DD5D515821B9; Thu, 26 Nov 2020 10:41:15 -0800 (PST) From: Keith Packard To: Joel Sherrill , Richard Earnshaw Cc: "newlib@sourceware.org" Subject: Re: AArch64 ILP32 strcmp bug In-Reply-To: References: <58625577-97a0-80eb-2d1f-626d5f89abf9@foss.arm.com> Date: Thu, 26 Nov 2020 10:41:15 -0800 Message-ID: <87pn40vu44.fsf@keithp.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2020 18:41:19 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Joel Sherrill via Newlib writes: > In the meantime, would you think a patch to disable the optimized > method when ilp32 is appropriate for newlib? There is still the risk of > other methods having bugs. The alternative I see is to completely > PREFER_SIZE_OVER_SPEED for aarch64 and disable all of the > aarch64 assembly which seems worse. There's also setjmp/longjmp, which are only available in assembly form. Here's a completely untested patch (I'm afraid I don't have an ilp32 aarch64 compiler available today) which may help with that: diff --git a/newlib/libc/machine/aarch64/setjmp.S b/newlib/libc/machine/aar= ch64/setjmp.S index 0856145bf..df94eebd1 100644 =2D-- a/newlib/libc/machine/aarch64/setjmp.S +++ b/newlib/libc/machine/aarch64/setjmp.S @@ -45,6 +45,9 @@ .global setjmp .type setjmp, %function setjmp: +#ifndef __LP64__ + mov w0, w0 +#endif mov x16, sp #define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] #define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] @@ -60,6 +63,10 @@ setjmp: .global longjmp .type longjmp, %function longjmp: +#ifndef __LP64__ + mov w0, w0 +#endif +=09 #define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] #define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] GPR_LAYOUT =2D-=20 =2Dkeith --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl+/9ssACgkQ2yIaaQAA ABHjEBAAplsLv2K0uWRTCNjQqM0q/lVXxAzoKFeIz0bBI3ut+xRhXWoSTaEsz5GD CiULhL3Iob0jE1RgvJgDThJ1JHz5t9slEtAkyi0LV2FqD9OscqgtvPaS+QedKTsZ a6VYPuJ4cvLJvtVkANBNv49Xw05IsDTJpv1pQOWRnMHrdilpsIwlce8lMQg/krG3 PlEDNKhwsrv580pl2l3ZuGceegXMLo9n8MaSSJvOJ88RMe9ZBNjjtbdfZPsIW0Pd zqxHFHVkhGe3z+E/uzUDQHJuMG+5jmXqQnkDvm4MGq5ElB6LoI/J9l2KbzQAcP+p QiEZG/etBWmXOitQwC7YjwtmWZkh5o+tiKcmSrrJi7+cw22obYea++4yIvcgfYsc O83qkecdCINm1KAsljH9NZqk7o1u10CXI60xwUsRP5i0UQ93XoJOGgW1Dzg8sGuL /c+DoksvDqPebbh6dG3a1XVrDseN7x4cH79elu0212+c15JOhixblTsNYLypawyG diwIGLI5HdgFJjFi+4unB2vHSnwOjeUtdLJvgpBu0hvKGc5leIlqd639s+znjyjZ +Lz05dFwxfFUw1uzOZTXn4HozXab90cv1uOJqPihk//yQR1ZsfidLBlCGkOdQ/rA thEpBa4MO7EINuPUfqWFLFWq3+Hhh4HwloWCXHoOjnzon6b7Y5I= =f8QB -----END PGP SIGNATURE----- --=-=-=--