This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: glibc clone for linux-mips
- From: Ralf Baechle <ralf at linux-mips dot org>
- To: libc-hacker at sources dot redhat dot com, libc-alpha at sources dot redhat dot com
- Cc: Chris Dearman <chris at mips dot com>, "H. J. Lu" <hjl at lucon dot org>, Andreas Jaeger <aj at suse dot de>
- Date: Wed, 12 Mar 2003 01:29:06 +0100
- Subject: Re: glibc clone for linux-mips
- References: <3E6E4AD7.5070408@mips.com>
The MIPS jalr assembler instruction will not restore the $gp register so
if the function called by clone should return the following call to exit
might result in a crash. Below patch against glibc 2.2 and trunc will
fix the problem. Please apply,
Ralf
2003-03-11 Ralf Baechle <ralf at linux-mips dot org>
* sysdeps/unix/sysv/linux/mips/clone.S (__thread_start): Use jal
instead of jalr to invoke subroutine so restoring the $gp register
will work properly.
Index: sysdeps/unix/sysv/linux/mips/clone.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/clone.S,v
retrieving revision 1.9
diff -u -r1.9 clone.S
--- sysdeps/unix/sysv/linux/mips/clone.S 6 Jul 2001 04:56:18 -0000 1.9
+++ sysdeps/unix/sysv/linux/mips/clone.S 11 Mar 2003 23:48:18 -0000
@@ -1,6 +1,6 @@
-/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ralf Baechle <ralf at gnu dot ai dot mit dot edu>, 1996.
+ Contributed by Ralf Baechle <ralf at linux-mips dot org>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -93,7 +93,7 @@
lw a0,4(sp) /* Argument pointer. */
/* Call the user's function. */
- jalr t9
+ jal t9
/* Call _exit rather than doing it inline for breakpoint purposes. */
move a0,v0