1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-09-01 05:02:03 +03:00
2000-10-24  Ulrich Drepper  <drepper@redhat.com>

	Complete revamp of the reference counter handling.
	* include/link.h (struct link_map): Add l_idx field.
	* elf/dl-close.c: Handle decrementing of reference counters more
	correctly. If necessary decrement reference counters of dependencies
	of dependencies.
	* elf/dl-lookup.c (add_dependency): Only increment reference counter
	of the object itself and not also its dependencies.
	* elf/dl-open.c: Increment reference counters here.
	* elf/dl-deps.c: Remove reference counter handling here.
	* elf/dl-load.c: Likewise.
	* elf/rtld.c: Adjust for _dl_map_deps not handling reference counters.

	* elf/loadtest.c: Print loaded objects at the beginning.
This commit is contained in:
Ulrich Drepper
2000-10-24 07:36:55 +00:00
parent 69c3325490
commit 42c4f32a44
8 changed files with 91 additions and 58 deletions

View File

@@ -550,7 +550,6 @@ of this helper program; chances are you did not intend to run this program.\n\
_dl_loaded->l_phdr = phdr;
_dl_loaded->l_phnum = phent;
_dl_loaded->l_entry = *user_entry;
_dl_loaded->l_opencount = 1;
/* At this point we are in a bit of trouble. We would have to
fill in the values for l_dev and l_ino. But in general we
@@ -707,7 +706,7 @@ of this helper program; chances are you did not intend to run this program.\n\
{
struct link_map *new_map = _dl_map_object (_dl_loaded, p, 1,
lt_library, 0, 0);
if (new_map->l_opencount == 1)
if (++new_map->l_opencount == 1)
/* It is no duplicate. */
++npreloads;
}
@@ -775,7 +774,7 @@ of this helper program; chances are you did not intend to run this program.\n\
{
struct link_map *new_map = _dl_map_object (_dl_loaded, p, 1,
lt_library, 0, 0);
if (new_map->l_opencount == 1)
if (++new_map->l_opencount == 1)
/* It is no duplicate. */
++npreloads;
}
@@ -786,7 +785,7 @@ of this helper program; chances are you did not intend to run this program.\n\
char *p = strndupa (problem, file_size - (problem - file));
struct link_map *new_map = _dl_map_object (_dl_loaded, p, 1,
lt_library, 0, 0);
if (new_map->l_opencount == 1)
if (++new_map->l_opencount == 1)
/* It is no duplicate. */
++npreloads;
}
@@ -823,9 +822,14 @@ of this helper program; chances are you did not intend to run this program.\n\
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
/* Mark all objects as being in the global scope. */
/* Mark all objects as being in the global scope and set the open
counter. */
for (i = _dl_loaded->l_searchlist.r_nlist; i > 0; )
_dl_loaded->l_searchlist.r_list[--i]->l_global = 1;
{
--i;
_dl_loaded->l_searchlist.r_list[i]->l_global = 1;
++_dl_loaded->l_searchlist.r_list[i]->l_opencount;
}
#ifndef MAP_ANON
/* We are done mapping things, so close the zero-fill descriptor. */