[PATCH] Fix --with-tls --without-__thread on !TLS_INIT_TP_EXPENSIVE arches
Jakub Jelinek
jakub@redhat.com
Thu Jan 16 10:46:00 GMT 2003
Hi!
If TLS_INIT_TP_EXPENSIVE is not defined or zero, rtld.c sets up TLS
even if no PT_TLS segments were found, but this means GL(dl_tls_max_dtv_idx)
is still 0 and thus either dl-load.c or pthread.c would try to initialize
it once again.
GL(dl_tls_dtv_slotinfo_list) != NULL is a better check.
Sorry for not finding this earlier, was building with -DNDEBUG=1.
2003-01-16 Jakub Jelinek <jakub@redhat.com>
* elf/dl-load.c (_dl_map_object_from_fd): Use
GL(dl_tls_dtv_slotinfo_list) != NULL to check whether TLS has
been already initialized.
linuxthreads/
* pthread.c (_pthread_initialize_minimal): Use
GL(dl_tls_dtv_slotinfo_list) != NULL to check whether TLS has
been already initialized.
--- libc/elf/dl-load.c.jj 2002-12-10 15:08:25.000000000 +0100
+++ libc/elf/dl-load.c 2003-01-16 11:18:41.000000000 +0100
@@ -953,9 +953,9 @@ _dl_map_object_from_fd (const char *name
/* If not loading the initial set of shared libraries,
check whether we should permit loading a TLS segment. */
if (__builtin_expect (l->l_type == lt_library, 1)
- /* If GL(dl_tls_max_dtv_idx) == 0, then rtld.c did not
- set up TLS data structures, so don't use them now. */
- || __builtin_expect (GL(dl_tls_max_dtv_idx), 1) != 0)
+ /* If GL(dl_tls_dtv_slotinfo_list) == NULL, then rtld.c did
+ not set up TLS data structures, so don't use them now. */
+ || __builtin_expect (GL(dl_tls_dtv_slotinfo_list) != NULL, 1))
{
/* Assign the next available module ID. */
l->l_tls_modid = _dl_next_tls_modid ();
--- libc/linuxthreads/pthread.c.jj 2003-01-13 13:57:09.000000000 +0100
+++ libc/linuxthreads/pthread.c 2003-01-16 11:23:03.000000000 +0100
@@ -305,7 +305,7 @@ __pthread_initialize_minimal(void)
taken care of initializing the TLS data structures. */
__libc_setup_tls (TLS_TCB_SIZE, TLS_TCB_ALIGN);
# elif !USE___THREAD
- if (__builtin_expect (GL(dl_tls_max_dtv_idx) == 0, 0))
+ if (__builtin_expect (GL(dl_tls_dtv_slotinfo_list) == NULL, 0))
{
tcbhead_t *tcbp;
Jakub
More information about the Libc-hacker
mailing list