[git commit master 1/1] mips/syscall-error: Choose the correct version for setting up errno.

Khem Raj raj.khem at gmail.com
Wed Jun 30 11:10:37 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=8b48f745be1e086d6e486bbb8167e770f3d1fbc5
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

* Current function is a C protype and PSEUDO macro does not
  transfer syscall return parameters to correct argument registers
  for a C function. This causes problem with syscalls setting wrong
  value for errno when they encounter an error.

* Fixes PR/2089 for mips/nptl

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 libc/sysdeps/linux/mips/Makefile.arch      |    5 +++--
 libc/sysdeps/linux/mips/syscall_error.S    |    8 +++++---
 libpthread/nptl/sysdeps/mips/Makefile.arch |    1 +
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch
index e8925e4..8bbc0bc 100644
--- a/libc/sysdeps/linux/mips/Makefile.arch
+++ b/libc/sysdeps/linux/mips/Makefile.arch
@@ -6,11 +6,11 @@
 #
 
 CSRC := \
-	__longjmp.c  brk.c setjmp_aux.c mmap.c __syscall_error.c \
+	__longjmp.c  brk.c setjmp_aux.c mmap.c \
 	cacheflush.c pread_write.c sysmips.c _test_and_set.c \
 	readahead.c
 
-SSRC := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S
+SSRC := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S
 
 ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
 CSRC += posix_fadvise.c posix_fadvise64.c
@@ -21,6 +21,7 @@ CSRC += sigaction.c
 SSRC += vfork.S clone.S
 endif
 
+ASFLAGS-syscall_error.S += -D_LIBC_REENTRANT
 
 ARCH_HEADERS := sgidefs.h
 # regdef.h
diff --git a/libc/sysdeps/linux/mips/syscall_error.S b/libc/sysdeps/linux/mips/syscall_error.S
index 1e348ad..51a8efa 100644
--- a/libc/sysdeps/linux/mips/syscall_error.S
+++ b/libc/sysdeps/linux/mips/syscall_error.S
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <bits/errno.h>
 
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef _LIBC_REENTRANT
 
 LOCALSZ= 3
 FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
@@ -61,12 +61,14 @@ ENTRY(__syscall_error)
 	j	ra
 	END(__syscall_error)
 
-#else /* __UCLIBC_HAS_THREADS__ */
+#else /* __LIBC_REENTRANT */
 
 
 ENTRY(__syscall_error)
 #ifdef __PIC__
+	.set noat
 	SETUP_GPX (AT)
+	.set at
 #endif
 	SETUP_GPX64 (t9, AT)
 
@@ -79,4 +81,4 @@ ENTRY(__syscall_error)
 	RESTORE_GP64
 	j ra
 	END(__syscall_error)
-#endif  /* __UCLIBC_HAS_THREADS__ */
+#endif  /* _LIBC_REENTRANT*/
diff --git a/libpthread/nptl/sysdeps/mips/Makefile.arch b/libpthread/nptl/sysdeps/mips/Makefile.arch
index 7a922b6..2992f35 100644
--- a/libpthread/nptl/sysdeps/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/mips/Makefile.arch
@@ -15,6 +15,7 @@ CFLAGS-pt-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 ASFLAGS-pthread_spin_lock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 ASFLAGS-pthread_spin_trylock.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 ASFLAGS-nptl-sysdep.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1	\
+			-D_LIBC_REENTRANT \
 		        -I$(top_srcdir)libc/sysdeps/linux/mips
 
 CFLAGS-mips = $(SSP_ALL_CFLAGS)
-- 
1.7.1



More information about the uClibc-cvs mailing list