about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--sysdeps/i386/Makefile4
-rw-r--r--sysdeps/unix/i386/sysdep.S12
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h14
3 files changed, 26 insertions, 4 deletions
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
index 52faaa3109..ece94f3610 100644
--- a/sysdeps/i386/Makefile
+++ b/sysdeps/i386/Makefile
@@ -61,3 +61,7 @@ CFLAGS-dlopenold.c += -mpreferred-stack-boundary=4
 CFLAGS-dlclose.c += -mpreferred-stack-boundary=4
 CFLAGS-dlerror.c += -mpreferred-stack-boundary=4
 endif
+
+ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS)))
+defines += -DNO_TLS_DIRECT_SEG_REFS
+endif
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index 6056cbeef2..3bc872add8 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000, 2002, 2004
+/* Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2000,2002,2004,2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -47,7 +47,12 @@ notb:
 #endif
 #ifndef	PIC
 # if USE___THREAD
+#  ifndef NO_TLS_DIRECT_SEG_REFS
 	movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
+#  else
+	movl %gs:0, %ecx
+	movl %eax, C_SYMBOL_NAME(errno@NTPOFF)(%ecx)
+#  endif
 # elif !defined _LIBC_REENTRANT
 	movl %eax, C_SYMBOL_NAME(errno)
 # else
@@ -66,7 +71,12 @@ notb:
 
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
+#  ifndef NO_TLS_DIRECT_SEG_REFS
+	addl %gs:0, %ecx
+	movl %eax, (%ecx)
+#  else
 	movl %eax, %gs:0(%ecx)
+#  endif
 # elif RTLD_PRIVATE_ERRNO
 	movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
 
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index af75d4c51a..02a35dc129 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995-2000,2002,2003,2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,2005
+   	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
 
@@ -154,9 +154,17 @@ __i686.get_pc_thunk.reg:						      \
   movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx;			      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
-  movl %edx, %gs:0(%ecx);						      \
+  SYSCALL_ERROR_HANDLER_TLS_STORE (%edx, %ecx);				      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);
+#   ifndef NO_TLS_DIRECT_SEG_REFS
+#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+  movl src, %gs:0(destoff)
+#   else
+#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+  addl %gs:0, destoff;							      \
+  movl src, (destoff)
+#   endif
 #  else
 #   define SYSCALL_ERROR_HANDLER					      \
 0:pushl %ebx;								      \