about summary refs log tree commit diff
path: root/sysdeps/unix/i386/sysdep.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/i386/sysdep.S')
-rw-r--r--sysdeps/unix/i386/sysdep.S13
1 files changed, 11 insertions, 2 deletions
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index 294865877f..dceb6815f4 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -23,6 +23,10 @@
 #include <bp-asm.h>
 #include <bp-sym.h>
 
+#ifdef IS_IN_rtld
+# include <dl-sysdep.h>		/* Defines RTLD_PRIVATE_ERRNO.  */
+#endif
+
 .globl C_SYMBOL_NAME(errno)
 .globl syscall_error
 
@@ -42,7 +46,7 @@ syscall_error:
 notb:
 #endif
 #ifndef	PIC
-# if USE_TLS && HAVE___THREAD
+# if USE___THREAD
 	movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
 # elif !defined _LIBC_REENTRANT
 	movl %eax, C_SYMBOL_NAME(errno)
@@ -57,12 +61,17 @@ notb:
 #else
 	/* The caller has pushed %ebx and then set it up to
 	   point to the GOT before calling us through the PLT.  */
-# if USE_TLS && HAVE___THREAD
+# if USE___THREAD
 	movl C_SYMBOL_NAME(errno@GOTNTPOFF)(%ebx), %ecx
 
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
 	movl %eax, %gs:0(%ecx)
+# elif RTLD_PRIVATE_ERRNO
+	movl %eax, C_SYMBOL_NAME(errno@GOTOFF)(%ebx)
+
+	/* Pop %ebx value saved before jumping here.  */
+	popl %ebx
 # elif !defined _LIBC_REENTRANT
 	movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx