* sysdeps/unix/sysv/linux/x86_64/sysdep.h

[USE_TLS && HAVE___THREAD] (SYSCALL_ERROR_HANDLER): Use TLS access.
This commit is contained in:
Roland McGrath 2002-09-30 07:26:12 +00:00
parent 78dfb64353
commit 3efdff78b3
2 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,8 @@
2002-09-30 Roland McGrath <roland@redhat.com> 2002-09-30 Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sysdep.h
[USE_TLS && HAVE___THREAD] (SYSCALL_ERROR_HANDLER): Use TLS access.
* rt/tst-aio7.c (do_test): Don't read from stdin, which could be the * rt/tst-aio7.c (do_test): Don't read from stdin, which could be the
terminal when the test is running in a background job. Instead, make terminal when the test is running in a background job. Instead, make
a pipe and read from its read half while never writing anything to it. a pipe and read from its read half while never writing anything to it.

View File

@ -78,10 +78,16 @@
#ifndef PIC #ifndef PIC
#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ #define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
#else #elif USE_TLS && HAVE___THREAD
/* Store (- %rax) into errno through the GOT. Note that errno occupies 4 bytes. */ # define SYSCALL_ERROR_HANDLER \
#ifdef _LIBC_REENTRANT movq errno@GOTTPOFF(%rip), %rcx; \
#define SYSCALL_ERROR_HANDLER \ 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: \ 0: \
xorq %rdx, %rdx; \ xorq %rdx, %rdx; \
subq %rax, %rdx; \ subq %rax, %rdx; \
@ -96,15 +102,14 @@
/* A quick note: it is assumed that the call to `__errno_location' does /* A quick note: it is assumed that the call to `__errno_location' does
not modify the stack! */ not modify the stack! */
#else #else /* Not _LIBC_REENTRANT. */
#define SYSCALL_ERROR_HANDLER \ # define SYSCALL_ERROR_HANDLER \
0:movq errno@GOTPCREL(%RIP), %rcx; \ 0:movq errno@GOTPCREL(%RIP), %rcx; \
xorq %rdx, %rdx; \ xorq %rdx, %rdx; \
subq %rax, %rdx; \ subq %rax, %rdx; \
movl %edx, (%rcx); \ movl %edx, (%rcx); \
orq $-1, %rax; \ orq $-1, %rax; \
jmp L(pseudo_end); jmp L(pseudo_end);
#endif /* _LIBC_REENTRANT */
#endif /* PIC */ #endif /* PIC */
/* Linux/x86-64 takes system call arguments in registers: /* Linux/x86-64 takes system call arguments in registers: