diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-10-24 07:36:55 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-10-24 07:36:55 +0000 |
commit | 42c4f32a44c76d1f4e2b744bf80f495dc36caa87 (patch) | |
tree | 475224614ae3e30c27dc1889e86468080c48cf9c /elf/rtld.c | |
parent | 69c3325490f56db660b349d7c04daab6aaea1bf1 (diff) | |
download | glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar.gz glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar.bz2 glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.zip |
Update.
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.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r-- | elf/rtld.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index ea5d7b5a3d..c44506acc4 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -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. */ |