This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Patch: syscalls with 5+ args on arm architecture
- From: Ralph Siemsen <ralphs at netwinder dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Thu, 5 Jun 2003 10:13:46 -0400
- Subject: Patch: syscalls with 5+ args on arm architecture
The following fairly trivial patch is necessary to properly compile
sycalls with 5 arguments on arm architecture in glibc-2.3.2. The
existing code works correctly for the shared library, but not for
the static library, which is not compiled PIC.
Without this patch, the fifth argument gets fetched (incorrectly) from
offset #8 from sp, where it should offset #4 since only register r4 has
has been pushed (and not lr as well). The problem was observed when
running "rpm", which is a static binary, and it would segfault upon
the first or second call to select().
Thanks to Daniel Jacobowitz, Phil Blundell, and Russell King for helping
me sort out this problem :)
--- linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h.orig 2003-05-27 20:25:22.000000000 -0400
+++ linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h 2003-05-27 20:07:12.000000000 -0400
@@ -26,12 +26,14 @@
/* We push lr onto the stack, so we have to use ldmib instead of ldmia
to find the saved arguments. */
+#ifdef PIC
#undef DOARGS_5
#undef DOARGS_6
#undef DOARGS_7
#define DOARGS_5 str r4, [sp, $-4]!; ldr r4, [sp, $8];
#define DOARGS_6 mov ip, sp; stmfd sp!, {r4, r5}; ldmib ip, {r4, r5};
#define DOARGS_7 mov ip, sp; stmfd sp!, {r4, r5, r6}; ldmib ip, {r4, r5, r6};
+#endif /* PIC */
# undef PSEUDO_RET
# define PSEUDO_RET \
--
Ralph Siemsen
www.netwinder.org