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 4156D3858025 for ; Fri, 27 Nov 2020 05:35:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4156D3858025 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id C199E3F2E299; Thu, 26 Nov 2020 21:35:20 -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 g1LAS1daUQ8X; Thu, 26 Nov 2020 21:35:20 -0800 (PST) Received: from keithp.com (koto.keithp.com [10.0.0.2]) by elaine.keithp.com (Postfix) with ESMTPSA id 3EA7A3F2E298; Thu, 26 Nov 2020 21:35:20 -0800 (PST) Received: by keithp.com (Postfix, from userid 1000) id 0C37215821B9; Thu, 26 Nov 2020 21:35:20 -0800 (PST) From: Keith Packard To: Richard Earnshaw , Joel Sherrill Cc: "newlib@sourceware.org" Subject: Re: AArch64 ILP32 strcmp bug In-Reply-To: <875238d8-613c-2d8e-6498-df1ead351b99@foss.arm.com> References: <58625577-97a0-80eb-2d1f-626d5f89abf9@foss.arm.com> <87pn40vu44.fsf@keithp.com> <875238d8-613c-2d8e-6498-df1ead351b99@foss.arm.com> Date: Thu, 26 Nov 2020 21:35:19 -0800 Message-ID: <87eekfweeg.fsf@keithp.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: Fri, 27 Nov 2020 05:35:23 -0000 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Richard Earnshaw writes: > AFAICT gcc doesn't define __LP64__, so I don't think this will work; > it's also backwards - you shouldn't assume that because __LP64__ isn't > defined that we have a 32-bit pointer. GCC does, however, define > __ILP32__ when building for that ABI. I borrowed that symbol from glibc; figuring it was better to use a mechanism already in use elsewhere. > The right way to do this is to create a new header file, > machine/aarch64/machine/asm.h, which contains a gas macro called, lets > say `ptr_param', that takes the *number* of register argument and is > then conditionally defined to either nothing or an assembly statement > that narrows the register with that number. In the main function code > you can then write simply > > ptr_param 0 > > and avoid all conditional assembly in the main source files. Yes, it would be good to see all of the asm code fixed up to work on ilp32. For now, just getting setjmp/longjmp working and bypassing all of the other aarch64 asm code on ilp32 will suffice to make the library work. I've got an aarch64 toolchain with ilp32 support built. Figuring out how to catch errors of this particular sort seems challenging though; the bug report makes it clear that even the incorrect functions work most of the time. =2D-=20 =2Dkeith --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl/AkBcACgkQ2yIaaQAA ABEoMw/7B9uW/fONDpcuS1QKh/ZKENAhWLtN7IAyVjze9t4P8uWn1+APlC1phTpf vvc44EUtAOdh0veYJ6LzDpV2BN9LDCcJE5wzS4eDNcwuwEQ696FXEt0rv3BU5oVZ ZBUh7ZhKfCUrba5q2/IFZrixo0U5DQnSNF9OsDLnYVyWpV2O0eiALX3dleCZiW09 ZfznK1Ge6pUoOtR3qPCBANmONxdjPAKySp7dbt7Yoh94nfK1ewSRLQX0G98epYiK setXlPiOLxsrOe7M+EvXarq3BMJtx459B3IBfGy/frazlzJheAtxC6+FCO5I5zVP aS8qtDIXXyOxxOqzTDf4xg9bY5GTgQBchhR287PWpWzVtrL1cgCKnGU81+ICEpRI h3my1YM4oDMYm+2IXC4mr6djtaIVCXogISWJ8GV0L/tjG6fZbxJT+/M5AtqiKsQ4 xJC0vYZaeKAVxlxcnWlv2F9nogzDvHDtpajBTm0FoUUKX0wYTJaLxHAEvEfGp2C5 VCAqIKC9ko6yG+299bPMX+hSewmLQrDqBVB2HvMfGd2hx17uF+hyZQw1n/xQ4d5R NcaFG1sK1o5woTYGolS8uJe3+9zdcHBhNnVoWn8HbEeOKWDAh39CDTKWiWkh0JPU 4TNYdRr2uSUdtJzh19F4a6P9Uk5+JIXDuIb1ykArjWRTbd9lOr8= =zwQY -----END PGP SIGNATURE----- --=-=-=--