From: Roland McGrath Date: Wed, 16 Feb 2005 11:07:20 +0000 (+0000) Subject: 2005-01-23 Roland McGrath X-Git-Tag: cvs/fedora-glibc-2_3-20050216T1256~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67d3cf0ee4e8cbfa9877b8ab3bc06d904be19541;p=thirdparty%2Fglibc.git 2005-01-23 Roland McGrath [BZ #737] * sysdeps/i386/Makefile (defines): If -mno-tls-direct-seg-refs appears in $(CFLAGS), add -DNO_TLS_DIRECT_SEG_REFS. * sysdeps/unix/sysv/linux/i386/sysdep.h [USE___THREAD] (SYSCALL_ERROR_HANDLER) [NO_TLS_DIRECT_SEG_REFS]: Load thread pointer from %gs:0 and add to that value, rather that direct %gs:OFFSET access. * sysdeps/unix/i386/sysdep.S [NO_TLS_DIRECT_SEG_REFS]: Likewise. --- diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index 52faaa31091..ece94f36109 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 6056cbeef27..83ce3eadecb 100644 --- a/sysdeps/unix/i386/sysdep.S +++ b/sysdeps/unix/i386/sysdep.S @@ -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)