This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Re: New binutils required for TLS?


On Tue, Feb 12, 2002 at 12:32:02PM +0100, Wolfram Gloger wrote:
> Hi,
> 
> Compiling CVS-head on i586, I get
> 
> gcc tst-tlsmod1.c -c -O -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g   -fPIC    -I../include -I. -I/mount/public/export/glibc/cvs/BUILD/elf -I.. -I../libio  -I/mount/public/export/glibc/cvs/BUILD -I../sysdeps/i386/elf -I../linuxthreads/sysdeps/unix/sysv/linux/i386 -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/i386/i586 -I../linuxthreads/sysdeps/i386 -I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../sysdeps/unix/sysv -I../sysdeps/unix/i386/i586 -I../sysdeps/unix/i386 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../linuxthreads/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee7!
54!
> /dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic   -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED   -o /mount/public/export/glibc/cvs/BUILD/elf/tst-tlsmod1.os
> /tmp/cc4mu7d2.s: Assembler messages:
> /tmp/cc4mu7d2.s:664: Error: unknown pseudo-op: `.tls_common'
> 
> I know that I might need current binutils for the new TLS stuff, but I
> have configured with --disable-tls, so they shouldn't be needed..

This should do the trick:

2002-02-12  Jakub Jelinek  <jakub@redhat.com>

	* elf/tls-macros.h: If USE_TLS is not defined, provide dummy
	macros instead.

--- libc/elf/tls-macros.h.jj	Mon Feb 11 02:39:36 2002
+++ libc/elf/tls-macros.h	Tue Feb 12 12:45:29 2002
@@ -1,39 +1,41 @@
 /* Macros to support TLS testing in times of missing compiler support.  */
 
-#define COMMON_INT_DEF(x) \
+#ifdef USE_TLS
+
+# define COMMON_INT_DEF(x) \
   asm (".tls_common " #x ",4,4")
 /* XXX Until we get compiler support we don't need declarations.  */
-#define COMMON_INT_DECL(x)
+# define COMMON_INT_DECL(x)
 
 /* XXX This definition will probably be machine specific, too.  */
-#define VAR_INT_DEF(x) \
+# define VAR_INT_DEF(x) \
   asm (".section .tdata\n\t"						      \
        ".globl " #x "\n"						      \
        #x ":\t.long 0\n\t"						      \
        ".size " #x ",4\n\t"						      \
        ".previous")
 /* XXX Until we get compiler support we don't need declarations.  */
-#define VAR_INT_DECL(x)
+# define VAR_INT_DECL(x)
 
 
   /* XXX Each architecture must have its own asm for now.  */
-#ifdef __i386__
-# define TLS_LE(x) \
+# ifdef __i386__
+#  define TLS_LE(x) \
   ({ int *__l;								      \
      asm ("movl %%gs:0,%0\n\t"						      \
 	  "subl $" #x "@tpoff,%0"					      \
 	  : "=r" (__l));						      \
      __l; })
 
-# ifdef PIC
-#  define TLS_IE(x) \
+#  ifdef PIC
+#   define TLS_IE(x) \
   ({ int *__l;								      \
      asm ("movl %%gs:0,%0\n\t"						      \
 	  "subl " #x "@gottpoff(%%ebx),%0"				      \
 	  : "=r" (__l));						      \
      __l; })
-# else
-#  define TLS_IE(x) \
+#  else
+#   define TLS_IE(x) \
   ({ int *__l, __b;							      \
      asm ("call 1f\n\t"							      \
 	  ".subsection 1\n"						      \
@@ -45,18 +47,18 @@
 	  "subl " #x "@gottpoff(%%ebx),%0"				      \
 	  : "=r" (__l), "=&b" (__b));					      \
      __l; })
-# endif
+#  endif
 
-# ifdef PIC
-#  define TLS_LD(x) \
+#  ifdef PIC
+#   define TLS_LD(x) \
   ({ int *__l;								      \
      asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
 	  "call ___tls_get_addr@plt\n\t"				      \
 	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
 	  : "=a" (__l));						      \
      __l; })
-# else
-#  define TLS_LD(x) \
+#  else
+#   define TLS_LD(x) \
   ({ int *__l, __b;							      \
      asm ("call 1f\n\t"							      \
 	  ".subsection 1\n"						      \
@@ -69,18 +71,18 @@
 	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
 	  : "=a" (__l), "=&b" (__b));					      \
      __l; })
-# endif
+#  endif
 
-# ifdef PIC
-#  define TLS_GD(x) \
+#  ifdef PIC
+#   define TLS_GD(x) \
   ({ int *__l;								      \
      asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
 	  "call ___tls_get_addr@plt\n\t"				      \
 	  "nop"								      \
 	  : "=a" (__l));						      \
      __l; })
-# else
-#  define TLS_GD(x) \
+#  else
+#   define TLS_GD(x) \
   ({ int *__l, __b;							      \
      asm ("call 1f\n\t"							      \
 	  ".subsection 1\n"						      \
@@ -93,8 +95,18 @@
 	  "nop"								      \
 	  : "=a" (__l), "=&b" (__b));					      \
      __l; })
+#  endif
+
+# else
+#  error "No support for this architecture so far."
 # endif
 
 #else
-# error "No support for this architecture so far."
+
+/* Dummy versions if TLS should not be tested.  */
+# define COMMON_INT_DEF(x)
+# define COMMON_INT_DECL(x)
+# define VAR_INT_DEF(x)
+# define VAR_INT_DECL(x)
+
 #endif

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]