]> git.pld-linux.org Git - packages/glibc.git/blame - glibc-tls_fix.patch
- added nscd todo
[packages/glibc.git] / glibc-tls_fix.patch
CommitLineData
b7cab492
MM
1--- glibc-20041208T1024/linuxthreads/ChangeLog 5 Dec 2004 09:39:04 -0000 1.831
2+++ glibc-20041208T1024-fedora/linuxthreads/ChangeLog 7 Dec 2004 14:00:53 -0000 1.817.2.12
3@@ -710,6 +726,12 @@
4 (pthread_barrierattr_setpshared): Return EINVAL if pshared
5 is neither PTHREAD_PROCESS_PRIVATE nor PTHREAD_PROCESS_SHARED.
6
7+2003-09-02 Jakub Jelinek <jakub@redhat.com>
8+
9+ * sysdeps/sparc/tls.h (TLS_TCB_SIZE): If in ld.so and NPTL struct
10+ pthread is bigger than struct _pthread_descr_struct, use NPTL struct
11+ pthread size.
12+
13 2003-09-02 Ulrich Drepper <drepper@redhat.com>
14
15 * sysdeps/unix/sysv/linux/i386/dl-sysdep.h
16@@ -842,6 +864,34 @@
17
18 2003-07-22 Jakub Jelinek <jakub@redhat.com>
19
20+ * sysdeps/alpha/tls.h (TLS_INIT_TCB_SIZE, TLS_TCB_SIZE): Change to 0.
21+ (TLS_INIT_TCB_ALIGN, TLS_TCB_ALIGN): Alignment of struct
22+ _pthread_descr_struct.
23+ (TLS_PRE_TCB_SIZE): Add sizeof (tcbhead_t) and pad to align.
24+ If in ld.so and NPTL struct pthread is bigger than struct
25+ _pthread_descr_struct, use NPTL struct pthread size.
26+ (TLS_TCB_OFFSET): Define.
27+ (INSTALL_DTV, INSTALL_NEW_DTV, GET_DTV, TLS_INIT_TP, THREAD_DTV,
28+ THREAD_SELF, INIT_THREAD_SELF): Changed to match NPTL tls.h
29+ definitions.
30+ * sysdeps/i386/tls.h (TLS_TCB_SIZE): If in ld.so and NPTL struct
31+ pthread is bigger than struct _pthread_descr_struct, use NPTL struct
32+ pthread size.
33+ * sysdeps/ia64/tls.h (TLS_PRE_TCB_SIZE): Likewise.
34+ * sysdeps/powerpc/tls.h (TLS_PRE_TCB_SIZE): Likewise.
35+ * sysdeps/s390/tls.h (TLS_TCB_SIZE): Likewise.
36+ * sysdeps/sh/tls.h (TLS_PRE_TCB_SIZE): Likewise.
37+ * sysdeps/x86_64/tls.h (TLS_TCB_SIZE): Likewise.
38+ * sysdeps/pthread/Makefile (gen-as-const-headers): Add
39+ nptl-struct-pthread.sym if nptl tree is present.
40+ (before-compile): Add $(common-objpfx)nptl-struct-pthread.h
41+ if nptl tree is not present.
42+ (common-generated): Add nptl-struct-pthread.h.
43+ ($(common-objpfx)nptl-struct-pthread.h): New rule.
44+ * sysdeps/pthread/nptl-struct-pthread.sym: New file.
45+
46+2003-07-22 Jakub Jelinek <jakub@redhat.com>
47+
48 * descr.h (struct _pthread_descr_struct): Provide p_res member
49 even if USE_TLS && HAVE___THREAD.
50 * sysdeps/pthread/res-state.c (__res_state): Return __resp
51--- glibc-20041208T1024/nptl/ChangeLog 7 Dec 2004 20:32:24 -0000 1.747
52+++ glibc-20041208T1024-fedora/nptl/ChangeLog 8 Dec 2004 10:52:11 -0000 1.706.2.25
53@@ -2470,6 +2491,11 @@
54
55 * Makefile [$(build-shared) = yes] (tests): Depend on $(test-modules).
56
57+2003-07-22 Jakub Jelinek <jakub@redhat.com>
58+
59+ * descr.h: Don't include lowlevellock.h, pthreaddef.h and dl-sysdep.h
60+ if __need_struct_pthread_size, instead define lll_lock_t.
61+
62 2003-07-25 Jakub Jelinek <jakub@redhat.com>
63
64 * tst-cancel17.c (do_test): Check if aio_cancel failed.
620eb0b6
MM
65--- glibc-20041208T1024/linuxthreads/sysdeps/alpha/tls.h 30 Jan 2003 21:03:40 -0000 1.5
66+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/alpha/tls.h 22 Sep 2004 21:20:55 -0000 1.5.2.1
67@@ -53,54 +53,76 @@ typedef struct
68 # include <sysdep.h>
69
70 /* This is the size of the initial TCB. */
71-# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
72+# define TLS_INIT_TCB_SIZE 0
73
74 /* Alignment requirements for the initial TCB. */
75-# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
76+# define TLS_INIT_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
77
78 /* This is the size of the TCB. */
79-# define TLS_TCB_SIZE sizeof (tcbhead_t)
80+# define TLS_TCB_SIZE 0
81
82 /* Alignment requirements for the TCB. */
83-# define TLS_TCB_ALIGN __alignof__ (tcbhead_t)
84+# define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
85
86 /* This is the size we need before TCB. */
87-# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
88+# ifndef IS_IN_rtld
89+# define TLS_PRE_TCB_SIZE \
90+ (sizeof (struct _pthread_descr_struct) \
91+ + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
92+# else
93+# include <nptl-struct-pthread.h>
94+# define TLS_PRE_TCB_SIZE \
95+ ((sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
96+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE) \
97+ + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
98+# endif
99
100 /* The DTV is allocated at the TP; the TCB is placed elsewhere. */
101 # define TLS_DTV_AT_TP 1
102
103+/* The following assumes that TP (R2 or R13) points to the end of the
104+ TCB + 0x7000 (per the ABI). This implies that TCB address is
105+ TP - 0x7000. As we define TLS_DTV_AT_TP we can
106+ assume that the pthread struct is allocated immediately ahead of the
107+ TCB. This implies that the pthread_descr address is
108+ TP - (TLS_PRE_TCB_SIZE + 0x7000). */
109+/* ??? PPC uses offset 0x7000; seems like a good idea for alpha too,
110+ but binutils not yet changed to match. */
111+# define TLS_TCB_OFFSET 0
112+
113 /* Install the dtv pointer. The pointer passed is to the element with
114 index -1 which contain the length. */
115 # define INSTALL_DTV(TCBP, DTVP) \
116- (((tcbhead_t *) (TCBP))->dtv = (DTVP) + 1)
117+ (((tcbhead_t *) (TCBP))[-1].dtv = (DTVP) + 1)
118
119 /* Install new dtv for current thread. */
120 # define INSTALL_NEW_DTV(DTV) \
121- (((tcbhead_t *)__builtin_thread_pointer ())->dtv = (DTV))
122+ (THREAD_DTV() = (DTV))
123
124 /* Return dtv of given thread descriptor. */
125 # define GET_DTV(TCBP) \
126- (((tcbhead_t *) (TCBP))->dtv)
127+ (((tcbhead_t *) (TCBP))[-1].dtv)
128
129 /* Code to initially initialize the thread pointer. This might need
130 special attention since 'errno' is not yet available and if the
131 operation can cause a failure 'errno' must not be touched. */
132 # define TLS_INIT_TP(TCBP, SECONDCALL) \
133- (__builtin_set_thread_pointer (TCBP), 0)
134+ (__builtin_set_thread_pointer ((void *) (TCBP) + TLS_TCB_OFFSET), NULL)
135
136 /* Return the address of the dtv for the current thread. */
137 # define THREAD_DTV() \
138- (((tcbhead_t *)__builtin_thread_pointer ())->dtv)
139+ (((tcbhead_t *) (__builtin_thread_pointer () - TLS_TCB_OFFSET))[-1].dtv)
140
141 /* Return the thread descriptor for the current thread. */
142 # undef THREAD_SELF
143 # define THREAD_SELF \
144- ((pthread_descr)__builtin_thread_pointer () - 1)
145+ ((pthread_descr) (__builtin_thread_pointer () \
146+ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
147
148 # undef INIT_THREAD_SELF
149 # define INIT_THREAD_SELF(DESCR, NR) \
150- __builtin_set_thread_pointer ((struct _pthread_descr_struct *)(DESCR) + 1)
151+ __builtin_set_thread_pointer ((char *)(DESCR) \
152+ + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
153
154 /* Get the thread descriptor definition. */
155 # include <linuxthreads/descr.h>
156--- glibc-20041208T1024/linuxthreads/sysdeps/i386/tls.h 19 Oct 2004 05:12:58 -0000 1.37
157+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/i386/tls.h 20 Oct 2004 10:47:17 -0000 1.35.2.4
158@@ -81,7 +81,14 @@ typedef struct
159 # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
160
161 /* This is the size of the TCB. */
162-# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
163+# ifndef IS_IN_rtld
164+# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
165+# else
166+# include <nptl-struct-pthread.h>
167+# define TLS_TCB_SIZE \
168+ (sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
169+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE)
170+# endif
171
172 /* Alignment requirements for the TCB. */
173 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
174--- glibc-20041208T1024/linuxthreads/sysdeps/ia64/tls.h 8 Jul 2004 21:20:57 -0000 1.9
175+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/ia64/tls.h 22 Sep 2004 21:20:55 -0000 1.9.2.1
176@@ -60,7 +60,14 @@ typedef struct
177 # define TLS_TCB_SIZE sizeof (tcbhead_t)
178
179 /* This is the size we need before TCB. */
180-# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
181+# ifndef IS_IN_rtld
182+# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
183+# else
184+# include <nptl-struct-pthread.h>
185+# define TLS_PRE_TCB_SIZE \
186+ (sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
187+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE)
188+# endif
189
190 /* Alignment requirements for the TCB. */
191 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
192--- glibc-20041208T1024/linuxthreads/sysdeps/powerpc/tls.h 9 Apr 2004 19:09:42 -0000 1.8
193+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/powerpc/tls.h 22 Sep 2004 21:20:55 -0000 1.8.2.1
194@@ -64,11 +64,19 @@ typedef struct
195 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
196
197 /* This is the size we need before TCB. */
198-# define TLS_PRE_TCB_SIZE \
199+# ifndef IS_IN_rtld
200+# define TLS_PRE_TCB_SIZE \
201 (sizeof (struct _pthread_descr_struct) \
202 + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
203+# else
204+# include <nptl-struct-pthread.h>
205+# define TLS_PRE_TCB_SIZE \
206+ ((sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
207+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE) \
208+ + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
209+# endif
210
211-/* The following assumes that TP (R2 or R13) is points to the end of the
212+/* The following assumes that TP (R2 or R13) points to the end of the
213 TCB + 0x7000 (per the ABI). This implies that TCB address is
214 TP - 0x7000. As we define TLS_DTV_AT_TP we can
215 assume that the pthread_descr is allocated immediately ahead of the
216--- glibc-20041208T1024/linuxthreads/sysdeps/pthread/Makefile 14 Aug 2003 00:14:22 -0000 1.7
217+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/pthread/Makefile 22 Sep 2004 21:20:56 -0000 1.7.2.1
218@@ -12,3 +12,15 @@ endif
219 ifeq ($(subdir),posix)
220 CFLAGS-confstr.c += -DLIBPTHREAD_VERSION="\"$(shell sed 's/\(.*\) by .*/\1/' ../linuxthreads/Banner)\""
221 endif
d65ee2aa 222+
620eb0b6
MM
223+ifeq ($(subdir),csu)
224+# Find out the size of NPTL struct pthread
225+ifneq (,$(wildcard $(..)nptl/descr.h))
226+gen-as-const-headers += nptl-struct-pthread.sym
227+else
228+before-compile += $(common-objpfx)nptl-struct-pthread.h
229+common-generated += nptl-struct-pthread.h
230+$(common-objpfx)nptl-struct-pthread.h:
231+ @echo '#define NPTL_STRUCT_PTHREAD_SIZE 0' > $@
232+endif
233+endif
234--- glibc-20041208T1024/linuxthreads/sysdeps/pthread/nptl-struct-pthread.sym 1 Jan 1970 00:00:00 -0000
235+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/pthread/nptl-struct-pthread.sym 22 Sep 2004 21:20:56 -0000 1.1.2.1
236@@ -0,0 +1,13 @@
237+#ifdef HAVE_TLS_SUPPORT
238+# ifndef HAVE_FORCED_UNWIND
239+# define HAVE_FORCED_UNWIND 1
d65ee2aa 240+# endif
620eb0b6
MM
241+# define __need_struct_pthread_size
242+# include <nptl/descr.h>
243+#endif
244+
245+--
246+
247+#ifdef HAVE_TLS_SUPPORT
248+NPTL_STRUCT_PTHREAD_SIZE sizeof (struct pthread)
249+#endif
620eb0b6
MM
250--- glibc-20041208T1024/linuxthreads/sysdeps/s390/tls.h 30 Jan 2003 18:34:11 -0000 1.3
251+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/s390/tls.h 22 Sep 2004 21:20:56 -0000 1.3.2.1
252@@ -72,7 +72,14 @@ typedef struct
253 # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
254
255 /* This is the size of the TCB. */
256-# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
257+# ifndef IS_IN_rtld
258+# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
259+# else
260+# include <nptl-struct-pthread.h>
261+# define TLS_TCB_SIZE \
262+ (sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
263+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE)
264+# endif
265
266 /* Alignment requirements for the TCB. */
267 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
268--- glibc-20041208T1024/linuxthreads/sysdeps/sh/tls.h 2 Mar 2003 11:44:20 -0000 1.9
269+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/sh/tls.h 22 Sep 2004 21:20:57 -0000 1.9.2.1
270@@ -64,7 +64,14 @@ typedef struct
271 # define TLS_TCB_SIZE sizeof (tcbhead_t)
272
273 /* This is the size we need before TCB. */
274-# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
275+# ifndef IS_IN_rtld
276+# define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
277+# else
278+# include <nptl-struct-pthread.h>
279+# define TLS_PRE_TCB_SIZE \
280+ (sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
281+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE)
282+# endif
283
284 /* Alignment requirements for the TCB. */
285 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
286--- glibc-20041208T1024/linuxthreads/sysdeps/sparc/tls.h 4 Feb 2003 20:41:02 -0000 1.3
287+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/sparc/tls.h 22 Sep 2004 21:20:57 -0000 1.3.2.1
288@@ -64,7 +64,14 @@ typedef struct
289 # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
290
291 /* This is the size of the TCB. */
292-# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
293+# ifndef IS_IN_rtld
294+# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
295+# else
296+# include <nptl-struct-pthread.h>
297+# define TLS_TCB_SIZE \
298+ (sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
299+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE)
300+# endif
301
302 /* Alignment requirements for the TCB. */
303 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
304--- glibc-20041208T1024/linuxthreads/sysdeps/x86_64/tls.h 18 Apr 2004 02:32:25 -0000 1.6
305+++ glibc-20041208T1024-fedora/linuxthreads/sysdeps/x86_64/tls.h 22 Sep 2004 21:20:57 -0000 1.6.2.1
306@@ -66,7 +66,14 @@ typedef struct
307 # define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
308
309 /* This is the size of the TCB. */
310-# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
311+# ifndef IS_IN_rtld
312+# define TLS_TCB_SIZE sizeof (struct _pthread_descr_struct)
313+# else
314+# include <nptl-struct-pthread.h>
315+# define TLS_TCB_SIZE \
316+ (sizeof (struct _pthread_descr_struct) > NPTL_STRUCT_PTHREAD_SIZE \
317+ ? sizeof (struct _pthread_descr_struct) : NPTL_STRUCT_PTHREAD_SIZE)
318+# endif
319
320 /* Alignment requirements for the TCB. */
321 # define TLS_TCB_ALIGN __alignof__ (struct _pthread_descr_struct)
322--- glibc-20041208T1024/nptl/descr.h 12 Nov 2004 01:24:24 -0000 1.25
323+++ glibc-20041208T1024-fedora/nptl/descr.h 12 Nov 2004 16:56:12 -0000 1.23.2.3
324@@ -27,9 +27,13 @@
325 #include <sys/types.h>
326 #include <hp-timing.h>
327 #include <list.h>
328+#ifdef __need_struct_pthread_size
329+#define lll_lock_t int
330+#else
331 #include <lowlevellock.h>
332 #include <pthreaddef.h>
333 #include <dl-sysdep.h>
334+#endif
335 #include "../nptl_db/thread_db.h"
336 #include <tls.h>
337 #ifdef HAVE_FORCED_UNWIND
d65ee2aa 338
This page took 0.080354 seconds and 4 git commands to generate.