aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-29 21:50:55 +0000
committerRoland McGrath <roland@gnu.org>2002-09-29 21:50:55 +0000
commit28b48696d14a8b4a4203011b26d8add3db087870 (patch)
tree6a69f75f7134229b27ecacfaffd406e60d7baaef
parentcc590e1d4e84f931a954a06a5f743d8f61090713 (diff)
downloadglibc-28b48696d14a8b4a4203011b26d8add3db087870.tar
glibc-28b48696d14a8b4a4203011b26d8add3db087870.tar.gz
glibc-28b48696d14a8b4a4203011b26d8add3db087870.tar.bz2
glibc-28b48696d14a8b4a4203011b26d8add3db087870.zip
* sysdeps/unix/sysv/linux/x86_64/sysdep.S [USE_TLS && HAVE___THREAD]:
Define errno in .tbss. * sysdeps/unix/x86_64/sysdep.S [USE_TLS && HAVE___THREAD]: Use TLS access for setting errno. * sysdeps/unix/x86_64/sysdep.S: Store 32 bits at errno, not 64 bits. AFAICT, it was just blind luck that the word following errno in .bss was just alignment padding and not some other variable to be clobbered.
-rw-r--r--ChangeLog11
-rw-r--r--sysdeps/unix/x86_64/sysdep.S16
2 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index d6dde1f8f5..75a632710a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-09-29 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/unix/sysv/linux/x86_64/sysdep.S [USE_TLS && HAVE___THREAD]:
+ Define errno in .tbss.
+ * sysdeps/unix/x86_64/sysdep.S [USE_TLS && HAVE___THREAD]: Use TLS
+ access for setting errno.
+
+ * sysdeps/unix/x86_64/sysdep.S: Store 32 bits at errno, not 64 bits.
+ AFAICT, it was just blind luck that the word following errno in .bss
+ was just alignment padding and not some other variable to be clobbered.
+
2002-09-29 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/kernel-features.h
diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S
index b26b1db934..a54c151013 100644
--- a/sysdeps/unix/x86_64/sysdep.S
+++ b/sysdeps/unix/x86_64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
#include <bits/errno.h>
#include <bp-asm.h>
#include <bp-sym.h>
+#include <tls.h>
.globl C_SYMBOL_NAME(errno)
.globl syscall_error
@@ -40,28 +41,31 @@ syscall_error:
movq $EAGAIN, %rax /* Yes; translate it to EAGAIN. */
notb:
#endif
-#ifndef PIC
+#if USE_TLS && HAVE___THREAD
+ movq C_SYMBOL_NAME(errno)@GOTTPOFF(%rip), %rcx
+ movl %eax, %fs:0(%rcx)
+#elif !defined PIC
# ifndef _LIBC_REENTRANT
- movq %rax, C_SYMBOL_NAME(errno)
+ movl %eax, C_SYMBOL_NAME(errno)
# else
pushq %rax
PUSH_ERRNO_LOCATION_RETURN
call BP_SYM (__errno_location)
POP_ERRNO_LOCATION_RETURN
popq %rcx
- movq %rcx, (%rax)
+ movl %ecx, (%rax)
# endif
#else
# ifndef _LIBC_REENTRANT
movq C_SYMBOL_NAME(errno)@GOTPCREL(%rip), %rcx
- movq %rax, (%rcx)
+ movl %eax, (%rcx)
# else
pushq %rax
PUSH_ERRNO_LOCATION_RETURN
call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
POP_ERRNO_LOCATION_RETURN
popq %rcx
- movq %rcx, (%rax)
+ movl %ecx, (%rax)
# endif
#endif
movq $-1, %rax