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] linuxthread with TLS compilation fix


Hi all:

I found the compilation problem about linuxthread with TLS problem.
The glibc in cvs repository could not compile when
I enabled linuxthread with TLS(please see following outputs).

--  outputs
make[2]: Entering directory `/home2/ares/cross/expr/ppc440/src/glibc-current/csu'
powerpc-440-linux-gnu-gcc ../sysdeps/generic/libc-tls.c -c -std=gnu99 -O3 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -mcpu=440 -msoft-float -mnew-mnemonics      -I../include -I. -I/home/ares/cross/expr/ppc440/build/glibc/csu -I.. -I../libio  -I/home/ares/cross/expr/ppc440/build/glibc -I../sysdeps/powerpc/powerpc32/elf -I../sysdeps/powerpc/elf -I../linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32 -I../linuxthreads/sysdeps/unix/sysv/linux/powerpc -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/powerpc/powerpc32 -I../linuxthreads/sysdeps/powerpc -I../sysdeps/unix/sysv/linux/powerpc/powerpc32 -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/powerpc/powerpc32 -I../sysdeps/wordsize-32 -I../sysdeps/powerpc/soft-fp -I../sysdeps/powerpc/nofpu -I../sysdeps/powerpc -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -nostdinc -isystem /home2/ares/cross/expr/ppc440/bin/../lib/gcc/powerpc-440-linux-gnu/3.4.4/include -isystem /home/ares/cross/expr/ppc440/powerpc-440-linux-gnu/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -DHAVE_INITFINI -o /home/ares/cross/expr/ppc440/build/glibc/csu/libc-tls.o -MD -MP -MF /home/ares/cross/expr/ppc440/build/glibc/csu/libc-tls.o.dt -MT /home/ares/cross/expr/ppc440/build/glibc/csu/libc-tls.o
In file included from ../socket/sys/socket.h:27,
                from ../include/sys/socket.h:2,
                from ../inet/netinet/in.h:24,
                from ../include/netinet/in.h:3,
                from ../resolv/resolv.h:57,
                from ../include/resolv.h:11,
                from ../linuxthreads/descr.h:19,
                from ../linuxthreads/sysdeps/powerpc/tls.h:130,
                from ../include/tls.h:6,
                from ../include/errno.h:22,
                from ../sysdeps/generic/libc-tls.c:20:
../include/sys/uio.h:5: warning: `altivec' attribute ignored
../include/sys/uio.h:7: warning: `altivec' attribute ignored
../include/sys/uio.h:9: warning: `altivec' attribute ignored
../include/sys/uio.h:11: warning: `altivec' attribute ignored
../sysdeps/generic/libc-tls.c: In function `__libc_setup_tls':
../sysdeps/generic/libc-tls.c:185: error: request for member `val' in something not a structure or union
../sysdeps/generic/libc-tls.c:190: error: request for member `is_static' in something not a structure or union
../sysdeps/generic/libc-tls.c:192: error: request for member `val' in something not a structure or union
--  outputs


Appearantly, nptl/sysdeps/xxxx/tls.h(xxxx is powerpc/i386 and so on), was changed , but this change did not be propagated to linuxthread part.

So, I fix the TLS relevant files in linuxthread as same as nptl.

Is this correct?

--
Takeharu KATO

diff -Naur glibc-current/linuxthreads/pthread.c glibc-current.fix/linuxthreads/pthread.c
--- glibc-current/linuxthreads/pthread.c	2005-01-09 22:13:15.946056888 +0900
+++ glibc-current.fix/linuxthreads/pthread.c	2005-01-09 22:18:29.131725492 +0900
@@ -482,7 +482,7 @@
 # endif
 
   /* Fill in the DTV slot so that a later LD/GD access will find it.  */
-  dtv[map->l_tls_modid].pointer = dest;
+  dtv[map->l_tls_modid].pointer.val = dest;
 
   /* Initialize the memory.  */
   memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
diff -Naur glibc-current/linuxthreads/sysdeps/alpha/tls.h glibc-current.fix/linuxthreads/sysdeps/alpha/tls.h
--- glibc-current/linuxthreads/sysdeps/alpha/tls.h	2003-01-31 06:03:40.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/alpha/tls.h	2005-01-09 18:15:43.000000000 +0900
@@ -24,12 +24,17 @@
 
 # include <pt-machine.h>
 # include <stddef.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 
diff -Naur glibc-current/linuxthreads/sysdeps/i386/tls.h glibc-current.fix/linuxthreads/sysdeps/i386/tls.h
--- glibc-current/linuxthreads/sysdeps/i386/tls.h	2004-10-19 14:12:58.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/i386/tls.h	2005-01-09 18:22:02.000000000 +0900
@@ -26,12 +26,17 @@
 #ifndef __ASSEMBLER__
 # include <stddef.h>
 # include <stdint.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 
diff -Naur glibc-current/linuxthreads/sysdeps/ia64/tls.h glibc-current.fix/linuxthreads/sysdeps/ia64/tls.h
--- glibc-current/linuxthreads/sysdeps/ia64/tls.h	2004-07-09 06:20:57.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/ia64/tls.h	2005-01-09 18:15:18.000000000 +0900
@@ -25,12 +25,17 @@
 # include <dl-sysdep.h>
 # include <pt-machine.h>
 # include <stddef.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 #else /* __ASSEMBLER__ */
diff -Naur glibc-current/linuxthreads/sysdeps/powerpc/tls.h glibc-current.fix/linuxthreads/sysdeps/powerpc/tls.h
--- glibc-current/linuxthreads/sysdeps/powerpc/tls.h	2004-04-10 04:09:42.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/powerpc/tls.h	2005-01-09 18:21:59.000000000 +0900
@@ -24,12 +24,17 @@
 
 # include <pt-machine.h>
 # include <stddef.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 #else /* __ASSEMBLER__ */
@@ -37,7 +42,7 @@
 #endif /* __ASSEMBLER__ */
 
 #ifdef HAVE_TLS_SUPPORT
-
+# include <stdbool.h>
 /* Signal that TLS support is available.  */
 # define USE_TLS	1
 
diff -Naur glibc-current/linuxthreads/sysdeps/s390/tls.h glibc-current.fix/linuxthreads/sysdeps/s390/tls.h
--- glibc-current/linuxthreads/sysdeps/s390/tls.h	2003-01-31 03:34:11.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/s390/tls.h	2005-01-09 18:15:54.000000000 +0900
@@ -24,12 +24,17 @@
 
 # include <pt-machine.h>
 # include <stddef.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 typedef struct
diff -Naur glibc-current/linuxthreads/sysdeps/sh/tls.h glibc-current.fix/linuxthreads/sysdeps/sh/tls.h
--- glibc-current/linuxthreads/sysdeps/sh/tls.h	2003-03-02 20:44:20.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/sh/tls.h	2005-01-09 18:15:34.000000000 +0900
@@ -26,12 +26,17 @@
 #ifndef __ASSEMBLER__
 # include <stddef.h>
 # include <stdint.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 #else /* __ASSEMBLER__ */
diff -Naur glibc-current/linuxthreads/sysdeps/sparc/tls.h glibc-current.fix/linuxthreads/sysdeps/sparc/tls.h
--- glibc-current/linuxthreads/sysdeps/sparc/tls.h	2003-02-05 05:41:02.000000000 +0900
+++ glibc-current.fix/linuxthreads/sysdeps/sparc/tls.h	2005-01-09 18:20:55.000000000 +0900
@@ -24,12 +24,17 @@
 
 # include <pt-machine.h>
 # include <stddef.h>
+# include <stdbool.h>
 
 /* Type for the dtv.  */
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+   {
+     void *val;
+     bool is_static;
+   } pointer;
 } dtv_t;
 
 typedef struct
diff -Naur glibc-current/linuxthreads_db/td_thr_tlsbase.c glibc-current.fix/linuxthreads_db/td_thr_tlsbase.c
--- glibc-current/linuxthreads_db/td_thr_tlsbase.c	2004-03-14 12:40:06.000000000 +0900
+++ glibc-current.fix/linuxthreads_db/td_thr_tlsbase.c	2005-01-09 22:34:54.010629293 +0900
@@ -59,10 +59,10 @@
 
   /* It could be that the memory for this module is not allocated for
      the given thread.  */
-  if (pdtv.pointer == TLS_DTV_UNALLOCATED)
+  if (pdtv.pointer.val == TLS_DTV_UNALLOCATED)
     return TD_TLSDEFER;
 
-  *base = (char *) pdtv.pointer;
+  *base = (char *) pdtv.pointer.val;
 
   return TD_OK;
 #else

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