From: Keith Packard <keithp@keithp.com>
To: Joel Sherrill <joel.sherrill@gmail.com>,
Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: AArch64 ILP32 strcmp bug
Date: Thu, 26 Nov 2020 10:41:15 -0800 [thread overview]
Message-ID: <87pn40vu44.fsf@keithp.com> (raw)
In-Reply-To: <CAF9ehCVHdXPAcxqYYwSgpXos5Ur5oz--=67u8u_yNkn6LaXM0w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Joel Sherrill via Newlib <newlib@sourceware.org> 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/aarch64/setjmp.S
index 0856145bf..df94eebd1 100644
--- 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
+
#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS]
#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS]
GPR_LAYOUT
--
-keith
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2020-11-26 18:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 13:52 Kinsey Moore
2020-11-25 11:28 ` Richard Earnshaw
2020-11-25 14:11 ` Joel Sherrill
2020-11-26 18:41 ` Keith Packard [this message]
2020-11-26 19:02 ` Richard Earnshaw
2020-11-27 5:35 ` Keith Packard
2020-11-25 17:31 ` Kinsey Moore
2020-11-26 17:46 ` Richard Earnshaw
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pn40vu44.fsf@keithp.com \
--to=keithp@keithp.com \
--cc=Richard.Earnshaw@foss.arm.com \
--cc=joel.sherrill@gmail.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).