about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-06 11:39:36 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-06 11:39:36 +0000
commitac16e90592f0b9842e193e2ebe0b3756f0b4361d (patch)
tree0b993b3126a76f47b80cf7254916627be7b55a67
parenta788b6c2163aa8b7c526a61542d01b7cbbc8859e (diff)
downloadglibc-ac16e90592f0b9842e193e2ebe0b3756f0b4361d.tar.gz
glibc-ac16e90592f0b9842e193e2ebe0b3756f0b4361d.tar.xz
glibc-ac16e90592f0b9842e193e2ebe0b3756f0b4361d.zip
Update.
1998-03-06 11:35  Ulrich Drepper  <drepper@cygnus.com>

	* posix/wordexp-test.c: Change testsuite so that it can run even
	for ~root != /root.

1998-03-06  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* math/libm-test.c (catanh_test): Change epsilon for gcc 2.8.1.

1998-03-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER):
	Don't store into global errno if we already store through
	__errno_location.
	* sysdeps/unix/i386/sysdep.S: Likewise.
	* sysdeps/unix/alpha/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.  Add
	missing return to SYSCALL_ERROR_HANDLER for (!_LIBC_REENTRANT &&
	PIC).

1998-03-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/sysdep.h (L): Remove definition.
	* sysdeps/i386/sysdep.h (L): Define it here instead.

1998-03-05  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
	* nss/getXXbyYY_r.c: Check __nss_not_use_nscd_* variable for
	running nscd.
	* nscd/nscd_getgr_r.c: Set __nss_not_use_nscd_group variable.
	* nscd/nscd_getpw_r.c: Set __nss_not_use_nscd_passwd variable.
	* nscd/nscd_proto.h: Declare __nss_not_use_nscd_* variables.
-rw-r--r--ChangeLog41
-rw-r--r--elf/rtld.c3
-rw-r--r--math/libm-test.c2
-rw-r--r--nscd/grpcache.c4
-rw-r--r--nscd/nscd_getgr_r.c11
-rw-r--r--nscd/nscd_getpw_r.c11
-rw-r--r--nscd/nscd_proto.h4
-rw-r--r--nss/getXXbyYY_r.c16
-rw-r--r--posix/wordexp-test.c105
-rw-r--r--sysdeps/generic/sysdep.h5
-rw-r--r--sysdeps/i386/sysdep.h5
-rw-r--r--sysdeps/unix/alpha/sysdep.S3
-rw-r--r--sysdeps/unix/i386/sysdep.S6
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/brk.S6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/clone.S3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h19
17 files changed, 147 insertions, 99 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c2430d9ec..9a2e93a42e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+1998-03-06 11:35  Ulrich Drepper  <drepper@cygnus.com>
+
+	* posix/wordexp-test.c: Change testsuite so that it can run even
+	for ~root != /root.
+
+1998-03-06  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* math/libm-test.c (catanh_test): Change epsilon for gcc 2.8.1.
+
+1998-03-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_ERROR_HANDLER):
+	Don't store into global errno if we already store through
+	__errno_location.
+	* sysdeps/unix/i386/sysdep.S: Likewise.
+	* sysdeps/unix/alpha/sysdep.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.  Add
+	missing return to SYSCALL_ERROR_HANDLER for (!_LIBC_REENTRANT &&
+	PIC).
+
+1998-03-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/generic/sysdep.h (L): Remove definition.
+	* sysdeps/i386/sysdep.h (L): Define it here instead.
+
 1998-03-06  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
 
 	* nis/nis_call.c (do_ypcall, yp_all): Safe and reset errno.
@@ -64,15 +91,13 @@
 	* sysdeps/generic/dl-sysdep.c (_dl_next_ld_env_entry): New
 	function.  Used by patch above.
 
-1998-03-05 10:25  Ulrich Drepper  <drepper@cygnus.com>
+1998-03-05  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
 
-	* nss/getXXbyYY_r.c: Don't try to contact nscd every time when it
-	failed.  Only do this every NSS_NSCD_RETRY times.
-	* nss/nsswitch.c: Define __nss_nscd_not_available, used by above
-	change.
-	* nscd/nscd_getgr_r.c (__nscd_getgr_r): Return 2 if contacting the
-	daemon failed.
-	* nscd/nscd_getpw_r.c (__nscd_getpw_r): Likewise.
+	* nss/getXXbyYY_r.c: Check __nss_not_use_nscd_* variable for
+	running nscd.
+	* nscd/nscd_getgr_r.c: Set __nss_not_use_nscd_group variable.
+	* nscd/nscd_getpw_r.c: Set __nss_not_use_nscd_passwd variable.
+	* nscd/nscd_proto.h: Declare __nss_not_use_nscd_* variables.
 
 1998-03-05  Ulrich Drepper  <drepper@cygnus.com>
 
diff --git a/elf/rtld.c b/elf/rtld.c
index 233a2e2e34..fe45f1bb9b 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -806,7 +806,6 @@ of this helper program; chances are you did not intend to run this program.\n",
 
       _exit (0);
     }
-_dl_sysdep_message("start reloc\n", NULL);
 
   {
     /* Now we have all the objects loaded.  Relocate them all except for
@@ -844,7 +843,7 @@ _dl_sysdep_message("start reloc\n", NULL);
 	 Re-relocate ourselves with user-controlled symbol definitions.  */
       _dl_relocate_object (&_dl_rtld_map, &_dl_default_scope[2], 0);
   }
-_dl_sysdep_message("end reloc\n", NULL);
+
   {
     /* Initialize _r_debug.  */
     struct r_debug *r = _dl_debug_initialize (_dl_rtld_map.l_addr);
diff --git a/math/libm-test.c b/math/libm-test.c
index e51bfe3eb6..976e5e8cf1 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -4302,7 +4302,7 @@ catanh_test (void)
 
   result = FUNC(catanh) (BUILD_COMPLEX (0.7, 1.2));
   check_eps ("real(catanh(0.7 + i 1.2)) == 0.26007...", __real__ result,
-	     0.2600749516525135959L, CHOOSE (2e-18, 0, 0));
+	     0.2600749516525135959L, CHOOSE (2e-18, 6e-17, 0));
   check_eps ("imag(catanh(0.7 + i 1.2)) == 0.97024...", __imag__ result,
 	     0.9702403077950989849L, CHOOSE (3e-17, 0, 0));
 
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 2b837f8bc1..3f3f4ba0ec 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -407,7 +407,7 @@ cache_getgrgid (void *v_param)
   if (grp != NULL)
     {
       if (debug_flag)
-	dbg_log (_("Found \"%d\" in cache !\n"), gid);
+	dbg_log (_("Found \"%d\" in cache !"), gid);
 
       ++poshit;
       gr_send_answer (param->conn, grp);
@@ -422,7 +422,7 @@ cache_getgrgid (void *v_param)
       int status;
 
       if (debug_flag)
-	dbg_log (_("Doesn't found \"%d\" in cache !\n"), gid);
+	dbg_log (_("Doesn't found \"%d\" in cache !"), gid);
 
       pthread_rwlock_unlock (&grplock);
 
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index 8129d81d66..27d05e05c6 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -29,6 +29,8 @@
 #include "nscd.h"
 #include "nscd_proto.h"
 
+int __nss_not_use_nscd_group;
+
 static int __nscd_getgr_r (const char *key, request_type type,
 			   struct group *resultbuf, char *buffer,
 			   size_t buflen);
@@ -98,8 +100,11 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
   ssize_t nbytes;
 
   if (sock == -1)
-    /* Returning two signals that contacting the daemon failed.  */
-    return 2;
+    {
+      /* Returning two signals that contacting the daemon failed.  */
+      __nss_not_use_nscd_group = 1;
+      return 1;
+    }
 
   req.version = NSCD_VERSION;
   req.type = type;
@@ -127,7 +132,9 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
 
   if (gr_resp.found == -1)
     {
+      /* The daemon does not cache this database.  */
       close (sock);
+      __nss_not_use_nscd_group = 1;
       return 1;
     }
 
diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c
index 4420b80399..d9401ed3c9 100644
--- a/nscd/nscd_getpw_r.c
+++ b/nscd/nscd_getpw_r.c
@@ -29,6 +29,8 @@
 
 #include "nscd.h"
 
+int __nss_not_use_nscd_passwd;
+
 static int __nscd_getpw_r (const char *key, request_type type,
 			   struct passwd *resultbuf, char *buffer,
 			   size_t buflen);
@@ -98,8 +100,11 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
   ssize_t nbytes;
 
   if (sock == -1)
-    /* Returning two signals that contacting the daemon failed.  */
-    return 2;
+    {
+      /* Returning two signals that contacting the daemon failed.  */
+      __nss_not_use_nscd_passwd = 1;
+      return 1;
+    }
 
   req.version = NSCD_VERSION;
   req.type = type;
@@ -127,7 +132,9 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
 
   if (pw_resp.found == -1)
     {
+      /* The daemon does not cache this database.  */
       close (sock);
+      __nss_not_use_nscd_passwd = 1;
       return 1;
     }
 
diff --git a/nscd/nscd_proto.h b/nscd/nscd_proto.h
index 6f7b30df88..f82f86c1ab 100644
--- a/nscd/nscd_proto.h
+++ b/nscd/nscd_proto.h
@@ -23,6 +23,10 @@
 #include <grp.h>
 #include <pwd.h>
 
+/* Variables for communication between NSCD handler functions and NSS.  */
+extern int __nss_not_use_nscd_passwd;
+extern int __nss_not_use_nscd_group;
+
 extern int __nscd_getpwnam_r __P ((const char *name, struct passwd *resultbuf,
 				   char *buffer, size_t buflen));
 extern int __nscd_getpwuid_r __P ((uid_t uid, struct passwd *resultbuf,
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 8a38b0d628..6589b47ee7 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -56,6 +56,9 @@
 # define NSCD_NAME ADD_NSCD (REENTRANT_NAME)
 # define ADD_NSCD(name) ADD_NSCD1 (name)
 # define ADD_NSCD1(name) __nscd_##name
+# define NOT_USENSCD_NAME ADD_NOT_NSCDUSE (DATABASE_NAME)
+# define ADD_NOT_NSCDUSE(name) ADD_NOT_NSCDUSE1 (name)
+# define ADD_NOT_NSCDUSE1(name) __nss_not_use_nscd_##name
 #endif
 
 #define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME)
@@ -88,10 +91,6 @@ extern struct __res_state _res;
 /* The lookup function for the first entry of this service.  */
 extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp);
 
-/* Nonzero if the NSCD is not available.  This variable will be increased
-   whenever we try to use the NSCD but see it is not avilable.  So we
-   can recheck the presence every once in a while.  */
-extern int __nss_nscd_not_available;
 /* Interval in which we transfer retry to contact the NSCD.  */
 #define NSS_NSCD_RETRY	100
 
@@ -117,10 +116,10 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 #endif
 
 #ifdef USE_NSCD
-  if (__nss_nscd_not_available && ++__nss_nscd_not_available > NSS_NSCD_RETRY)
-    __nss_nscd_not_available = 0;
+  if (NOT_USENSCD_NAME && ++NOT_USENSCD_NAME > NSS_NSCD_RETRY)
+    NOT_USENSCD_NAME = 0;
 
-  if (!__nss_nscd_not_available)
+  if (!NOT_USENSCD_NAME)
     {
       nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen
 			       H_ERRNO_VAR);
@@ -129,9 +128,6 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 	  *result = nscd_status == 0 ? resbuf : NULL;
 	  return nscd_status;
 	}
-      if (nscd_status == 2)
-	/* This return value indicates that contacting the server failed.  */
-	__nss_nscd_not_available = 1;
     }
 #endif
 
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 2e403caa0e..604e685607 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -16,9 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <wordexp.h>
+#include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <wordexp.h>
 
 struct test_case_struct
 {
@@ -33,63 +34,87 @@ struct test_case_struct
     { 0, NULL, "one", 0, 1, { "one", } },
     { 0, NULL, "one two", 0, 2, { "one", "two", } },
     { 0, NULL, "one two three", 0, 3, { "one", "two", "three", } },
-    { 0, NULL, "~root", 0, 1, { "/root", } },
     { 0, "foo", "${var}", 0, 1, { "foo", } },
     { 0, "foo", "$var", 0, 1, { "foo", } },
     { 0, NULL, "\"quoted\"", 0, 1, { "quoted", } },
     { -1, NULL, NULL, 0, 0, { NULL, } },
   };
 
+static int testit (struct test_case_struct *tc);
+
 int
 main (int argc, char * argv[])
 {
-  wordexp_t we;
+  struct passwd *pw;
   int test;
   int fail = 0;
-  int retval;
-  int i;
 
   setenv ("IFS", " \t\n", 1);
   for (test = 0; test_case[test].retval != -1; test++)
+    if (testit (&test_case[test]))
+      ++fail;
+
+  pw = getpwnam ("root");
+  if (pw != NULL)
     {
-      int bzzzt = 0;
-
-      if (test_case[test].env)
-	setenv ("var", test_case[test].env, 1);
-      else
-	unsetenv ("var");
-
-      printf ("Test %d: ", test);
-      retval = wordexp (test_case[test].words, &we, test_case[test].flags);
-
-      if (retval != test_case[test].retval ||
-	  we.we_wordc != test_case[test].wordc)
-	bzzzt = 1;
-      else
-	for (i = 0; i < we.we_wordc; i++)
-	  if (strcmp (test_case[test].wordv[i], we.we_wordv[i]) != 0)
-	    {
-	      bzzzt = 1;
-	      break;
-	    }
-
-      if (bzzzt)
+      struct test_case_struct ts;
+
+      ts.retval = 0;
+      ts.env = NULL;
+      ts.words = "~root";
+      ts.flags = 0;
+      ts.wordc = 1;
+      ts.wordv[0] = pw->pw_dir;
+
+      if (testit (&ts))
+	++fail;
+    }
+
+  return fail != 0;
+}
+
+
+static int
+testit (struct test_case_struct *tc)
+{
+  static int test;
+  int retval;
+  wordexp_t we;
+  int bzzzt = 0;
+  int i;
+
+  if (tc->env)
+    setenv ("var", tc->env, 1);
+  else
+    unsetenv ("var");
+
+  printf ("Test %d: ", ++test);
+  retval = wordexp (tc->words, &we, tc->flags);
+
+  if (retval != tc->retval || we.we_wordc != tc->wordc)
+    bzzzt = 1;
+  else
+    for (i = 0; i < we.we_wordc; ++i)
+      if (strcmp (tc->wordv[i], we.we_wordv[i]) != 0)
 	{
-	  ++fail;
-	  printf ("FAILED\n");
-	  printf ("Test words: <%s>, need retval %d, wordc %d\n",
-		  test_case[test].words, test_case[test].retval,
-		  test_case[test].wordc);
-	  printf ("Got retval %d, wordc %d: ", retval, we.we_wordc);
-	  for (i = 0; i < we.we_wordc; i++)
-	    printf ("<%s> ", we.we_wordv[i]);
-	  printf ("\n");
+	  bzzzt = 1;
+	  break;
 	}
-      else
-	printf ("OK\n");
 
-      wordfree (&we);
+  if (bzzzt)
+    {
+      printf ("FAILED\n");
+      printf ("Test words: <%s>, need retval %d, wordc %d\n",
+	      tc->words, tc->retval, tc->wordc);
+      printf ("Got retval %d, wordc %d: ", retval, we.we_wordc);
+      for (i = 0; i < we.we_wordc; ++i)
+	printf ("<%s> ", we.we_wordv[i]);
+      printf ("\n");
     }
+  else
+    printf ("OK\n");
+
+  wordfree (&we);
 
-  return fail;
+  return bzzzt;
 }
diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h
index 2ba01f4240..276188f188 100644
--- a/sysdeps/generic/sysdep.h
+++ b/sysdeps/generic/sysdep.h
@@ -41,8 +41,3 @@
 #ifndef END
 #define END(sym)
 #endif
-
-/* Local label name for asm code. */
-#ifndef L
-#define L(name)		name
-#endif
diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index 563e7dd009..af04c4a229 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -120,4 +120,9 @@ lose: SYSCALL_PIC_SETUP							      \
 #define SYSCALL_PIC_SETUP	/* Nothing.  */
 #endif
 
+/* Local label name for asm code. */
+#ifndef L
+#define L(name)		name
+#endif
+
 #endif	/* ASSEMBLER */
diff --git a/sysdeps/unix/alpha/sysdep.S b/sysdeps/unix/alpha/sysdep.S
index d79c48a9bf..53fc454eb6 100644
--- a/sysdeps/unix/alpha/sysdep.S
+++ b/sysdeps/unix/alpha/sysdep.S
@@ -48,9 +48,6 @@ __syscall_error:
 	.mask	0x4000001, -16
 	.prologue 1
 
-	/* Store into the "real" variable.  */
-	stl	v0, errno
-
 	/* Find our per-thread errno address  */
 	jsr	ra, __errno_location
 
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index b296bb707a..ff1fc0f431 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -39,8 +39,9 @@ syscall_error:
 notb:
 #endif
 #ifndef	PIC
+#ifndef	_LIBC_REENTRANT
 	movl %eax, C_SYMBOL_NAME(errno)
-#ifdef	_LIBC_REENTRANT
+#else
 	pushl %eax
 	call __errno_location
 	popl %ecx
@@ -49,14 +50,13 @@ notb:
 #else
 	/* The caller has pushed %ebx and then set it up to
 	   point to the GOT before calling us through the PLT.  */
+#ifndef	_LIBC_REENTRANT
 	movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx
 
-#ifndef	_LIBC_REENTRANT
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
 	movl %eax, (%ecx)
 #else
-	movl %eax, (%ecx)
 	pushl %eax
 	call C_SYMBOL_NAME(__errno_location@PLT)
 	popl %ecx
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 4ebcc6c852..713bd44524 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -74,8 +74,6 @@ syscall_error:								      \
   xorl %edx, %edx;							      \
   addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx;				      \
   subl %eax, %edx;							      \
-  movl errno@GOT(%ebx), %ecx;						      \
-  movl %edx, (%ecx);							      \
   pushl %edx;								      \
   call __errno_location@PLT;						      \
   popl %ecx;								      \
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
index abdd7e6604..333f9916f8 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
@@ -75,7 +75,9 @@ ENTRY(__brk)
 	
 	/* What a horrible way to die.  */
 .Lerr0:	set	ENOMEM, %o0
-.Lerr1:	sethi	%hi(errno), %g1
+.Lerr1:
+#ifndef _LIBC_REENTRANT
+	sethi	%hi(errno), %g1
 	or	%g1, %lo(errno), %g1
 #ifdef PIC
 	ldx	[%l7+%g1], %g1
@@ -83,7 +85,7 @@ ENTRY(__brk)
 #else
 	st	%o0, [%g4+%g1]
 #endif
-#ifdef _LIBC_REENTRANT
+#else
 	call	__errno_location
 	 mov	%o0,%l1
 	st	%l1, [%o0]
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index a5cb1a4c4a..a16f9b7c9b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -53,6 +53,7 @@ __libc_clone:
 	ret
 	 restore
 99:
+#ifndef _LIBC_REENTRANT
 #ifdef PIC
 	call	1f
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(99b-.)), %l7
@@ -68,7 +69,7 @@ __libc_clone:
 	set	EINVAL, %i0
 	st	%i0, [%g2+%lo(errno)]
 #endif
-#ifdef _LIBC_REENTRANT
+#else
 	call	__errno_location
 	 nop
 	st	%i0, [%o0]
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index c880e4a2dc..1a3736201c 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -46,17 +46,7 @@
 #ifdef PIC
 # ifdef _LIBC_REENTRANT
 #  define SYSCALL_ERROR_HANDLER						\
-	.global C_SYMBOL_NAME(errno);					\
-	.type C_SYMBOL_NAME(errno),@object;				\
 	save %sp,-160,%sp;						\
-  101:	call 102f;							\
-	sethi %hi(_GLOBAL_OFFSET_TABLE_-(101b-.)),%g2;			\
-  102:	or %g2,%lo(_GLOBAL_OFFSET_TABLE_-(101b-.)),%g2;			\
-	sethi %hi(errno),%i1;						\
-	add %g2,%o7,%l7;						\
-	or %i1,%lo(errno),%i1;						\
-	ldx [%l7+%i1],%g2;						\
-	st %i0,[%g2];							\
 	call __errno_location;						\
 	 nop;								\
 	st %i0,[%o0];							\
@@ -76,17 +66,14 @@
 	or %o1,%lo(errno),%o1;						\
 	mov %g3,%o7;							\
 	ldx [%l7+%o1],%g2;						\
-	st %o0,[%g2]
+	st %o0,[%g2];							\
+	retl;								\
+	 sub %g0,1,%i0
 # endif
 #else
 # ifdef _LIBC_REENTRANT
 #  define SYSCALL_ERROR_HANDLER						\
-	.global C_SYMBOL_NAME(errno);					\
-	.type C_SYMBOL_NAME(errno),@object;				\
 	save %sp,-160,%sp;						\
-	sethi %hi(errno),%g1;						\
-	or %g1,%lo(errno),%g1;						\
-	st %i0,[%g1+%g4];						\
 	call __errno_location;						\
 	 nop;								\
 	st %i0,[%o0];							\