This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Use MIPS jal instruction instead of jalr
- From: Ranjani Murthy <ranmur at gmail dot com>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Fri, 29 Apr 2005 17:37:25 -0700
- Subject: [PATCH] Use MIPS jal instruction instead of jalr
- Reply-to: Ranjani Murthy <ranmur at gmail dot com>
A similar problem to the fix in
http://sources.redhat.com/ml/libc-alpha/2003-03/msg00106.html.
The MIPS jalr instructions could cause a crash in CENABLE/CDISABLE.
The jalr instruction needs to be replaced with jal instruction.
--- libc.orig/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h
@@ -114,17 +114,19 @@
# define RESTORESTK addu sp, STKSPACE
+/* We must use jal rather than jalr so that the assembler will restore $gp
+ for us - in case libc has multiple GOTs. */
# ifdef IS_IN_libpthread
-# define CENABLE la t9, __pthread_enable_asynccancel; jalr t9;
-# define CDISABLE la t9, __pthread_disable_asynccancel; jalr t9;
+# define CENABLE la t9, __pthread_enable_asynccancel; jal t9;
+# define CDISABLE la t9, __pthread_disable_asynccancel; jal t9;
# define __local_multiple_threads __pthread_multiple_threads
# elif defined IS_IN_librt
-# define CENABLE la t9, __librt_enable_asynccancel; jalr t9;
-# define CDISABLE la t9, __librt_disable_asynccancel; jalr t9;
+# define CENABLE la t9, __librt_enable_asynccancel; jal t9;
+# define CDISABLE la t9, __librt_disable_asynccancel; jal t9;
# define __local_multiple_threads __librt_multiple_threads
# else
-# define CENABLE la t9, __libc_enable_asynccancel; jalr t9;
-# define CDISABLE la t9, __libc_disable_asynccancel; jalr t9;
+# define CENABLE la t9, __libc_enable_asynccancel; jal t9;
+# define CDISABLE la t9, __libc_disable_asynccancel; jal t9;
# define __local_multiple_threads __libc_multiple_threads
# endif