aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/x86_64/sysdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/x86_64/sysdep.h')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 5588b4606e..b0f51b4072 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -24,6 +24,10 @@
#include <bp-sym.h>
#include <bp-asm.h>
+#ifdef IS_IN_rtld
+# include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
+#endif
+
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -78,12 +82,18 @@
#ifndef PIC
#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
-#elif USE_TLS && HAVE___THREAD
+#elif USE___THREAD
# define SYSCALL_ERROR_HANDLER \
movq errno@GOTTPOFF(%rip), %rcx; \
xorq %rdx, %rdx; \
subq %rax, %rdx; \
movl %eax, %fs:0(%rcx)
+#elif RTLD_PRIVATE_ERRNO
+# define SYSCALL_ERROR_HANDLER \
+ leaq errno(%rip), %rcx; \
+ xorq %rdx, %rdx; \
+ subq %rax, %rdx; \
+ movl %eax, (%rcx)
#elif defined _LIBC_REENTRANT
/* Store (- %rax) into errno through the GOT.
Note that errno occupies only 4 bytes. */