about summary refs log tree commit diff
path: root/sysdeps/unix/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/x86_64')
-rw-r--r--sysdeps/unix/x86_64/sysdep.S11
1 files changed, 9 insertions, 2 deletions
diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S
index b0580a39ae..dfa92dcd2c 100644
--- a/sysdeps/unix/x86_64/sysdep.S
+++ b/sysdeps/unix/x86_64/sysdep.S
@@ -23,6 +23,10 @@
 #include <bp-sym.h>
 #include <tls.h>
 
+#ifdef IS_IN_rtld
+# include <dl-sysdep.h>		/* Defines RTLD_PRIVATE_ERRNO.  */
+#endif
+
 .globl C_SYMBOL_NAME(errno)
 .globl syscall_error
 
@@ -41,7 +45,7 @@ syscall_error:
 	movq $EAGAIN, %rax	/* Yes; translate it to EAGAIN.  */
 notb:
 #endif
-#if USE_TLS && HAVE___THREAD
+#if USE___THREAD
 # ifdef PIC
 	movq C_SYMBOL_NAME(errno@GOTTPOFF)(%rip), %rcx
 	movl %eax, %fs:0(%rcx)
@@ -60,7 +64,10 @@ notb:
 	movl %ecx, (%rax)
 # endif
 #else
-# ifndef _LIBC_REENTRANT
+# if RTLD_PRIVATE_ERRNO
+	leaq errno(%rip), %rcx
+	movl %eax, (%rcx)
+# elif !defined _LIBC_REENTRANT
 	movq C_SYMBOL_NAME(errno)@GOTPCREL(%rip), %rcx
 	movl %eax, (%rcx)
 # else