This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Use MIPS jal instruction instead of jalr


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]