about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-30 07:26:12 +0000
committerRoland McGrath <roland@gnu.org>2002-09-30 07:26:12 +0000
commit3efdff78b3ca58748dc709d3c6f6d32f7c6f0f05 (patch)
treedcc70f30a66873b6e55db42a47bc36aa72e80953 /sysdeps
parent78dfb643533f655f993d0cee177799921c5de19d (diff)
downloadglibc-3efdff78b3ca58748dc709d3c6f6d32f7c6f0f05.tar.gz
glibc-3efdff78b3ca58748dc709d3c6f6d32f7c6f0f05.tar.xz
glibc-3efdff78b3ca58748dc709d3c6f6d32f7c6f0f05.zip
* sysdeps/unix/sysv/linux/x86_64/sysdep.h
	[USE_TLS && HAVE___THREAD] (SYSCALL_ERROR_HANDLER): Use TLS access.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 53dbe8143f..5588b4606e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -78,10 +78,16 @@
 
 #ifndef PIC
 #define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
-#else
-/* Store (- %rax) into errno through the GOT.  Note that errno occupies 4 bytes.  */
-#ifdef _LIBC_REENTRANT
-#define SYSCALL_ERROR_HANDLER			\
+#elif USE_TLS && HAVE___THREAD
+# define SYSCALL_ERROR_HANDLER			\
+  movq errno@GOTTPOFF(%rip), %rcx;		\
+  xorq %rdx, %rdx;				\
+  subq %rax, %rdx;				\
+  movl %eax, %fs:0(%rcx)
+#elif defined _LIBC_REENTRANT
+/* Store (- %rax) into errno through the GOT.
+   Note that errno occupies only 4 bytes.  */
+# define SYSCALL_ERROR_HANDLER			\
 0:						\
   xorq %rdx, %rdx;				\
   subq %rax, %rdx;				\
@@ -96,15 +102,14 @@
 
 /* A quick note: it is assumed that the call to `__errno_location' does
    not modify the stack!  */
-#else
-#define SYSCALL_ERROR_HANDLER			\
+#else /* Not _LIBC_REENTRANT.  */
+# define SYSCALL_ERROR_HANDLER			\
 0:movq errno@GOTPCREL(%RIP), %rcx;		\
   xorq %rdx, %rdx;				\
   subq %rax, %rdx;				\
   movl %edx, (%rcx);				\
   orq $-1, %rax;				\
   jmp L(pseudo_end);
-#endif	/* _LIBC_REENTRANT */
 #endif	/* PIC */
 
 /* Linux/x86-64 takes system call arguments in registers: