This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] hppa: Fix stack alignment passed to clone
- From: John David Anglin <dave dot anglin at bell dot net>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Cc: Carlos O'Donell <carlos at redhat dot com>
- Date: Sat, 19 Oct 2019 14:33:59 -0400
- Subject: [PATCH] hppa: Fix stack alignment passed to clone
The hppa architecture requires strict alignment for loads and stores. As a result, the
minimum stack alignment that will work is 8 bytes. This patch adjust __clone() to align
the stack argument passed to it. It also adjusts slightly some formatting.
This fixes the nptl/tst-tls1 test.
Okay?
Dave
sysdeps/unix/sysv/linux/hppa/clone.S | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S
index 6db2cb5dd5..372d29a838 100644
--- a/sysdeps/unix/sysv/linux/hppa/clone.S
+++ b/sysdeps/unix/sysv/linux/hppa/clone.S
@@ -73,13 +73,18 @@ ENTRY(__clone)
#endif
/* Sanity check arguments. */
- comib,=,n 0, %arg0, .LerrorSanity /* no NULL function pointers */
- comib,=,n 0, %arg1, .LerrorSanity /* no NULL stack pointers */
+ comib,=,n 0,%arg0,.LerrorSanity /* no NULL function pointers */
+ comib,=,n 0,%arg1,.LerrorSanity /* no NULL stack pointers */
+
+ /* Ensure stack argument is 8-byte aligned. */
+ ldo 7(%r25),%r25
+ depi 0,31,3,%r25
/* Save the function pointer, arg, and flags on the new stack. */
stwm %r26, 64(%r25)
stw %r23, -60(%r25)
stw %r24, -56(%r25)
+
/* Clone arguments are (int flags, void * child_stack) */
copy %r24, %r26 /* flags are first */
/* User stack pointer is in the correct register already */