aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-10-27 23:11:47 +0000
committerUlrich Drepper <drepper@redhat.com>2006-10-27 23:11:47 +0000
commitb52bbc1bdf3886da8dd3265fd955cafe5368d34a (patch)
tree117b2e9abb35c86cb2259bf7cdf639fd0df9d39f /elf/dl-close.c
parentffd0e1b7e9b540716e5a98b49157eb1aed231b57 (diff)
downloadglibc-b52bbc1bdf3886da8dd3265fd955cafe5368d34a.zip
glibc-b52bbc1bdf3886da8dd3265fd955cafe5368d34a.tar.gz
glibc-b52bbc1bdf3886da8dd3265fd955cafe5368d34a.tar.bz2
USE_TLS support is now default.
* tls.make.c: USE_TLS support is now default. * csu/Versions: Likewise. * csu/libc-start.c: Likewise. * csu/libc-tls.c: Likewise. * csu/version.c: Likewise. * dlfcn/dlinfo.c: Likewise. * elf/dl-addr.c: Likewise. * elf/dl-cache.c: Likewise. * elf/dl-close.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-object.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-support.c: Likewise. * elf/dl-sym.c: Likewise. * elf/dl-sysdep.c: Likewise. * elf/dl-tls.c: Likewise. * elf/ldconfig.c: Likewise. * elf/rtld.c: Likewise. * elf/tst-tls-dlinfo.c: Likewise. * elf/tst-tls1.c: Likewise. * elf/tst-tls10.h: Likewise. * elf/tst-tls14.c: Likewise. * elf/tst-tls2.c: Likewise. * elf/tst-tls3.c: Likewise. * elf/tst-tls4.c: Likewise. * elf/tst-tls5.c: Likewise. * elf/tst-tls6.c: Likewise. * elf/tst-tls7.c: Likewise. * elf/tst-tls8.c: Likewise. * elf/tst-tls9.c: Likewise. * elf/tst-tlsmod1.c: Likewise. * elf/tst-tlsmod13.c: Likewise. * elf/tst-tlsmod13a.c: Likewise. * elf/tst-tlsmod14a.c: Likewise. * elf/tst-tlsmod2.c: Likewise. * elf/tst-tlsmod3.c: Likewise. * elf/tst-tlsmod4.c: Likewise. * elf/tst-tlsmod5.c: Likewise. * elf/tst-tlsmod6.c: Likewise. * include/errno.h: Likewise. * include/link.h: Likewise. * include/tls.h: Likewise. * locale/global-locale.c: Likewise. * locale/localeinfo.h: Likewise. * malloc/arena.c: Likewise. * malloc/hooks.c: Likewise. * malloc/malloc.c: Likewise. * resolv/Versions: Likewise. * sysdeps/alpha/dl-machine.h: Likewise. * sysdeps/alpha/libc-tls.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/generic/tls.h: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/ia64/dl-machine.h: Likewise. * sysdeps/ia64/libc-tls.c: Likewise. * sysdeps/mach/hurd/fork.c: Likewise. * sysdeps/mach/hurd/i386/tls.h: Likewise. * sysdeps/powerpc/powerpc32/dl-machine.c: Likwise. * sysdeps/powerpc/powerpc32/dl-machine.h: Likewise. * sysdeps/powerpc/powerpc64/dl-machine.h: Likewise. * sysdeps/s390/libc-tls.c: Likewise. * sysdeps/s390/s390-32/dl-machine.h: Likewise. * sysdeps/s390/s390-64/dl-machine.h: Likewise. * sysdeps/sh/dl-machine.h: Likewise. * sysdeps/sparc/sparc32/dl-machine.h: Likewise. * sysdeps/sparc/sparc64/dl-machine.h: Likewise. * sysdeps/x86_64/dl-machine.h: Likewise.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index fdd9fe6..47316ec 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -41,7 +41,6 @@ typedef void (*fini_t) (void);
#define IDX_STILL_USED -1
-#ifdef USE_TLS
/* Returns true we an non-empty was found. */
static bool
remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
@@ -103,7 +102,6 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
/* No non-entry in this list element. */
return false;
}
-#endif
void
@@ -136,9 +134,7 @@ _dl_close_worker (struct link_map *map)
retry:
dl_close_state = pending;
-#ifdef USE_TLS
bool any_tls = false;
-#endif
const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
char used[nloaded];
char done[nloaded];
@@ -460,11 +456,9 @@ _dl_close_worker (struct link_map *map)
r->r_state = RT_DELETE;
_dl_debug_state ();
-#ifdef USE_TLS
size_t tls_free_start;
size_t tls_free_end;
tls_free_start = tls_free_end = NO_TLS_OFFSET;
-#endif
/* Check each element of the search list to see if all references to
it are gone. */
@@ -495,7 +489,6 @@ _dl_close_worker (struct link_map *map)
--GL(dl_ns)[ns]._ns_main_searchlist->r_nlist;
}
-#ifdef USE_TLS
/* Remove the object from the dtv slotinfo array if it uses TLS. */
if (__builtin_expect (imap->l_tls_blocksize > 0, 0))
{
@@ -514,7 +507,7 @@ _dl_close_worker (struct link_map *map)
this search list, going in either direction. When the
whole chunk is at the end of the used area then we can
reclaim it. */
-# if TLS_TCB_AT_TP
+#if TLS_TCB_AT_TP
if (tls_free_start == NO_TLS_OFFSET
|| (size_t) imap->l_tls_offset == tls_free_start)
{
@@ -554,7 +547,7 @@ _dl_close_worker (struct link_map *map)
= tls_free_end - imap->l_tls_blocksize;
}
}
-# elif TLS_DTV_AT_TP
+#elif TLS_DTV_AT_TP
if ((size_t) imap->l_tls_offset == tls_free_end)
/* Extend the contiguous chunk being reclaimed. */
tls_free_end -= imap->l_tls_blocksize;
@@ -571,12 +564,11 @@ _dl_close_worker (struct link_map *map)
tls_free_start = imap->l_tls_offset;
tls_free_end = tls_free_start + imap->l_tls_blocksize;
}
-# else
-# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
}
}
-#endif
/* We can unmap all the maps at once. We determined the
start address and length when we loaded the object and
@@ -642,7 +634,6 @@ _dl_close_worker (struct link_map *map)
}
}
-#ifdef USE_TLS
/* If we removed any object which uses TLS bump the generation counter. */
if (any_tls)
{
@@ -652,7 +643,6 @@ _dl_close_worker (struct link_map *map)
if (tls_free_end == GL(dl_tls_static_used))
GL(dl_tls_static_used) = tls_free_start;
}
-#endif
#ifdef SHARED
/* Auditing checkpoint: we have deleted all objects. */
@@ -712,7 +702,6 @@ _dl_close (void *_map)
}
-#ifdef USE_TLS
static bool __libc_freeres_fn_section
free_slotinfo (struct dtv_slotinfo_list **elemp)
{
@@ -739,7 +728,6 @@ free_slotinfo (struct dtv_slotinfo_list **elemp)
return true;
}
-#endif
libc_freeres_fn (free_mem)
@@ -765,22 +753,20 @@ libc_freeres_fn (free_mem)
free (old);
}
-#ifdef USE_TLS
if (USE___THREAD || GL(dl_tls_dtv_slotinfo_list) != NULL)
{
/* Free the memory allocated for the dtv slotinfo array. We can do
this only if all modules which used this memory are unloaded. */
-# ifdef SHARED
+#ifdef SHARED
if (GL(dl_initial_dtv) == NULL)
/* There was no initial TLS setup, it was set up later when
it used the normal malloc. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
else
-# endif
+#endif
/* The first element of the list does not have to be deallocated.
It was allocated in the dynamic linker (i.e., with a different
malloc), and in the static library it's in .bss space. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
}
-#endif
}