mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* elf/dl-close.c (free_mem): Free _dl_scope_free_list.
2007-06-13 Jakub Jelinek <jakub@redhat.com> * include/link.h: Don't include rtld-lowlevel.h. (struct link_map): Remove l_scope_lock. * sysdeps/generic/ldsodefs.h: Don't include rtld-lowlevel.h. (_dl_scope_free_list): New field (variable) in _rtld_global. (DL_LOOKUP_SCOPE_LOCK): Remove. (_dl_scope_free): New prototype. * elf/dl-runtime.c (_dl_fixup): Don't use __rtld_mrlock_*lock. Don't pass DL_LOOKUP_SCOPE_LOCK to _dl_lookup_symbol_x. (_dl_profile_fixup): Likewise. * elf/dl-sym.c (do_sym): Likewise. Use wrapped _dl_lookup_symbol_x whenever !RTLD_SINGLE_THREAD_P, use THREAD_GSCOPE_SET_FLAG and THREAD_GSCOPE_RESET_FLAG around it. * elf/dl-close.c (_dl_close_worker): Don't use __rtld_mrlock_{change,done}. Call _dl_scope_free on the old scope. Make sure THREAD_GSCOPE_WAIT () happens if any old scopes were queued or if l_scope_mem has been abandoned. * elf/dl-open.c (_dl_scope_free): New function. (dl_open_worker): Use it. Don't use __rtld_mrlock_{change,done}. * elf/dl-support.c (_dl_scope_free_list): New variable. * elf/dl-lookup.c (add_dependency): Remove flags argument. Remove DL_LOOKUP_SCOPE_LOCK handling. (_dl_lookup_symbol_x): Adjust caller. Remove DL_LOOKUP_SCOPE_LOCK handling. * elf/dl-object.c (_dl_new_object): Don't use __rtld_mrlock_initialize. 2007-06-19 Ulrich Drepper <drepper@redhat.com>
This commit is contained in:
@ -165,6 +165,40 @@ add_to_global (struct link_map *new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_dl_scope_free (struct r_scope_elem **old)
|
||||
{
|
||||
struct dl_scope_free_list *fsl;
|
||||
#define DL_SCOPE_FREE_LIST_SIZE (sizeof (fsl->list) / sizeof (fsl->list[0]))
|
||||
|
||||
if (RTLD_SINGLE_THREAD_P)
|
||||
free (old);
|
||||
else if ((fsl = GL(dl_scope_free_list)) == NULL)
|
||||
{
|
||||
GL(dl_scope_free_list) = fsl = malloc (sizeof (*fsl));
|
||||
if (fsl == NULL)
|
||||
{
|
||||
THREAD_GSCOPE_WAIT ();
|
||||
free (old);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fsl->list[0] = old;
|
||||
fsl->count = 1;
|
||||
}
|
||||
}
|
||||
else if (fsl->count < DL_SCOPE_FREE_LIST_SIZE)
|
||||
fsl->list[fsl->count++] = old;
|
||||
else
|
||||
{
|
||||
THREAD_GSCOPE_WAIT ();
|
||||
while (fsl->count > 0)
|
||||
free (fsl->list[--fsl->count]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
dl_open_worker (void *a)
|
||||
@ -429,17 +463,10 @@ dl_open_worker (void *a)
|
||||
memcpy (newp, imap->l_scope, cnt * sizeof (imap->l_scope[0]));
|
||||
struct r_scope_elem **old = imap->l_scope;
|
||||
|
||||
if (RTLD_SINGLE_THREAD_P)
|
||||
imap->l_scope = newp;
|
||||
else
|
||||
{
|
||||
__rtld_mrlock_change (imap->l_scope_lock);
|
||||
imap->l_scope = newp;
|
||||
__rtld_mrlock_done (imap->l_scope_lock);
|
||||
}
|
||||
imap->l_scope = newp;
|
||||
|
||||
if (old != imap->l_scope_mem)
|
||||
free (old);
|
||||
_dl_scope_free (old);
|
||||
|
||||
imap->l_scope_max = new_size;
|
||||
}
|
||||
|
Reference in New Issue
Block a user