[PATCH] Use MIPS jal instruction instead of jalr
Ranjani Murthy
ranmur@gmail.com
Sat Apr 30 00:37:00 GMT 2005
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
More information about the Libc-alpha
mailing list