mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* elf/dl-deps.c (_dl_map_object_deps): Put l_initfini array before r_list array in allocated memory. * elf/dl-close.c (_dl_close): Optimize access to l_initfini list and remove use of r_list.
This commit is contained in:
@ -1,5 +1,10 @@
|
|||||||
2000-10-24 Ulrich Drepper <drepper@redhat.com>
|
2000-10-24 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-deps.c (_dl_map_object_deps): Put l_initfini array before
|
||||||
|
r_list array in allocated memory.
|
||||||
|
* elf/dl-close.c (_dl_close): Optimize access to l_initfini list
|
||||||
|
and remove use of r_list.
|
||||||
|
|
||||||
* elf/dl-close.c (_dl_close): Use correct list (l_initfini) when
|
* elf/dl-close.c (_dl_close): Use correct list (l_initfini) when
|
||||||
computing new opencounts.
|
computing new opencounts.
|
||||||
* elf/Makefile: Add rules to build and run neededtest3.
|
* elf/Makefile: Add rules to build and run neededtest3.
|
||||||
|
@ -86,7 +86,7 @@ _dl_close (void *_map)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
list = map->l_searchlist.r_list;
|
list = map->l_initfini;
|
||||||
nsearchlist = map->l_searchlist.r_nlist;
|
nsearchlist = map->l_searchlist.r_nlist;
|
||||||
|
|
||||||
/* Compute the new l_opencount values. */
|
/* Compute the new l_opencount values. */
|
||||||
@ -94,23 +94,23 @@ _dl_close (void *_map)
|
|||||||
* sizeof (unsigned int));
|
* sizeof (unsigned int));
|
||||||
for (i = 0; i < nsearchlist; ++i)
|
for (i = 0; i < nsearchlist; ++i)
|
||||||
{
|
{
|
||||||
map->l_initfini[i]->l_idx = i;
|
list[i]->l_idx = i;
|
||||||
new_opencount[i] = map->l_initfini[i]->l_opencount;
|
new_opencount[i] = list[i]->l_opencount;
|
||||||
}
|
}
|
||||||
--new_opencount[0];
|
--new_opencount[0];
|
||||||
for (i = 1; i < nsearchlist; ++i)
|
for (i = 1; i < nsearchlist; ++i)
|
||||||
if (! (map->l_initfini[i]->l_flags_1 & DF_1_NODELETE)
|
if (! (list[i]->l_flags_1 & DF_1_NODELETE)
|
||||||
/* Decrement counter. */
|
/* Decrement counter. */
|
||||||
&& --new_opencount[i] == 0
|
&& --new_opencount[i] == 0
|
||||||
/* Test whether this object was also loaded directly. */
|
/* Test whether this object was also loaded directly. */
|
||||||
&& map->l_initfini[i]->l_searchlist.r_list != NULL)
|
&& list[i]->l_searchlist.r_list != NULL)
|
||||||
{
|
{
|
||||||
/* In this case we have the decrement all the dependencies of
|
/* In this case we have the decrement all the dependencies of
|
||||||
this object. They are all in MAP's dependency list. */
|
this object. They are all in MAP's dependency list. */
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
struct link_map **dep_list = map->l_initfini[i]->l_searchlist.r_list;
|
struct link_map **dep_list = list[i]->l_searchlist.r_list;
|
||||||
|
|
||||||
for (j = 1; j < map->l_initfini[i]->l_searchlist.r_nlist; ++j)
|
for (j = 1; j < list[i]->l_searchlist.r_nlist; ++j)
|
||||||
if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE))
|
if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE))
|
||||||
{
|
{
|
||||||
assert (dep_list[j]->l_idx < nsearchlist);
|
assert (dep_list[j]->l_idx < nsearchlist);
|
||||||
@ -125,7 +125,7 @@ _dl_close (void *_map)
|
|||||||
/* Call all termination functions at once. */
|
/* Call all termination functions at once. */
|
||||||
for (i = 0; i < nsearchlist; ++i)
|
for (i = 0; i < nsearchlist; ++i)
|
||||||
{
|
{
|
||||||
struct link_map *imap = map->l_initfini[i];
|
struct link_map *imap = list[i];
|
||||||
if (new_opencount[i] == 0 && imap->l_type == lt_loaded
|
if (new_opencount[i] == 0 && imap->l_type == lt_loaded
|
||||||
&& (imap->l_info[DT_FINI] || imap->l_info[DT_FINI_ARRAY])
|
&& (imap->l_info[DT_FINI] || imap->l_info[DT_FINI_ARRAY])
|
||||||
&& ! (imap->l_flags_1 & DF_1_NODELETE)
|
&& ! (imap->l_flags_1 & DF_1_NODELETE)
|
||||||
@ -235,12 +235,7 @@ _dl_close (void *_map)
|
|||||||
|
|
||||||
/* Remove the searchlists. */
|
/* Remove the searchlists. */
|
||||||
if (imap != map)
|
if (imap != map)
|
||||||
{
|
free (imap->l_initfini);
|
||||||
if (imap->l_searchlist.r_list != NULL)
|
|
||||||
free (imap->l_searchlist.r_list);
|
|
||||||
else
|
|
||||||
free (imap->l_initfini);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imap->l_phdr_allocated)
|
if (imap->l_phdr_allocated)
|
||||||
free ((void *) imap->l_phdr);
|
free ((void *) imap->l_phdr);
|
||||||
|
@ -468,12 +468,16 @@ _dl_map_object_deps (struct link_map *map,
|
|||||||
|
|
||||||
/* Store the search list we built in the object. It will be used for
|
/* Store the search list we built in the object. It will be used for
|
||||||
searches in the scope of this object. */
|
searches in the scope of this object. */
|
||||||
map->l_searchlist.r_list = malloc ((2 * nlist + 1
|
map->l_initfini =
|
||||||
+ (nlist == nduplist ? 0 : nduplist))
|
(struct link_map **) malloc ((2 * nlist + 1
|
||||||
* sizeof (struct link_map *));
|
+ (nlist == nduplist ? 0 : nduplist))
|
||||||
if (map->l_searchlist.r_list == NULL)
|
* sizeof (struct link_map *));
|
||||||
|
if (map->l_initfini == NULL)
|
||||||
_dl_signal_error (ENOMEM, map->l_name,
|
_dl_signal_error (ENOMEM, map->l_name,
|
||||||
N_("cannot allocate symbol search list"));
|
N_("cannot allocate symbol search list"));
|
||||||
|
|
||||||
|
|
||||||
|
map->l_searchlist.r_list = &map->l_initfini[nlist + 1];
|
||||||
map->l_searchlist.r_nlist = nlist;
|
map->l_searchlist.r_nlist = nlist;
|
||||||
|
|
||||||
for (nlist = 0, runp = known; runp; runp = runp->unique)
|
for (nlist = 0, runp = known; runp; runp = runp->unique)
|
||||||
@ -507,10 +511,8 @@ _dl_map_object_deps (struct link_map *map,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now determine the order in which the initialization has to happen. */
|
/* Now determine the order in which the initialization has to happen. */
|
||||||
map->l_initfini =
|
memcpy (map->l_initfini, map->l_searchlist.r_list,
|
||||||
(struct link_map **) memcpy (map->l_searchlist.r_duplist + nduplist,
|
nlist * sizeof (struct link_map *));
|
||||||
map->l_searchlist.r_list,
|
|
||||||
nlist * sizeof (struct link_map *));
|
|
||||||
/* We can skip looking for the binary itself which is at the front
|
/* We can skip looking for the binary itself which is at the front
|
||||||
of the search list. Look through the list backward so that circular
|
of the search list. Look through the list backward so that circular
|
||||||
dependencies are not changing the order. */
|
dependencies are not changing the order. */
|
||||||
|
Reference in New Issue
Block a user