From e30f2b9828ddff95b687b9818787ab2a99570f11 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 25 Oct 2000 04:00:08 +0000 Subject: [PATCH] Update. * elf/dl-lookup.c (add_dependency): Fix test to check whether dependency already exists. * elf/Makefile: Add testobj1 and testobj2 as dependencies of testobj6. * elf/loadtest.c (main): Add test at the end that everything is unloaded. * elf/dl-open.c (dl_open_worker): Fix typo in comment. --- ChangeLog | 8 ++++++++ elf/Makefile | 2 +- elf/dl-lookup.c | 7 +++---- elf/dl-open.c | 2 +- elf/loadtest.c | 30 +++++++++++++++++++++--------- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fdc4436a3..de078c5a14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2000-10-24 Ulrich Drepper + * elf/dl-lookup.c (add_dependency): Fix test to check whether + dependency already exists. + * elf/Makefile: Add testobj1 and testobj2 as dependencies of testobj6. + * elf/loadtest.c (main): Add test at the end that everything is + unloaded. + + * elf/dl-open.c (dl_open_worker): Fix typo in comment. + * elf/elf.h: Add even more IA-64 relocations. 2000-10-24 Geoffrey Keating diff --git a/elf/Makefile b/elf/Makefile index 444169273e..119cfa5ba0 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -246,7 +246,7 @@ $(objpfx)testobj2.so: $(objpfx)testobj1.so $(libdl) $(objpfx)testobj3.so: $(libdl) $(objpfx)testobj4.so: $(libdl) $(objpfx)testobj5.so: $(libdl) -$(objpfx)testobj6.so: $(libdl) +$(objpfx)testobj6.so: $(objpfx)testobj1.so $(objpfx)testobj2.so $(libdl) $(objpfx)failobj.so: $(objpfx)testobj6.so $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index 581c6a6c2b..9e0a25da80 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -97,14 +97,13 @@ add_dependency (struct link_map *undef_map, struct link_map *map) /* Determine whether UNDEF_MAP already has a reference to MAP. First look in the normal dependencies. */ - list = undef_map->l_searchlist.r_list; - act = undef_map->l_searchlist.r_nlist; + list = undef_map->l_initfini; - for (i = 0; i < act; ++i) + for (i = 0; list[i] != NULL; ++i) if (list[i] == map) break; - if (__builtin_expect (i == act, 1)) + if (__builtin_expect (list[i] == NULL, 1)) { /* No normal dependency. See whether we already had to add it to the special list of dynamic dependencies. */ diff --git a/elf/dl-open.c b/elf/dl-open.c index b278e2043e..48bb9f82ed 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -255,7 +255,7 @@ dl_open_worker (void *a) "\n\n", NULL); } - /* If the user requested the object t be in the global namespace + /* If the user requested the object to be in the global namespace but it is not so far, add it now. */ if ((mode & RTLD_GLOBAL) && new->l_global == 0) (void) add_to_global (new); diff --git a/elf/loadtest.c b/elf/loadtest.c index 25b27005f1..7cbe55bcd7 100644 --- a/elf/loadtest.c +++ b/elf/loadtest.c @@ -148,15 +148,27 @@ main (int argc, char *argv[]) /* Unload all loaded modules. */ for (count = 0; count < NOBJS; ++count) if (testobjs[count].handle != NULL) -{ printf ("\nclose: %s: l_initfini = %p, l_versions = %p\n", - testobjs[count].name, - ((struct link_map*)testobjs[count].handle)->l_initfini, - ((struct link_map*)testobjs[count].handle)->l_versions); - if (dlclose (testobjs[count].handle) != 0) - { - printf ("failed to close %s\n", testobjs[count].name); - result = 1; -} } + { + printf ("\nclose: %s: l_initfini = %p, l_versions = %p\n", + testobjs[count].name, + ((struct link_map*)testobjs[count].handle)->l_initfini, + ((struct link_map*)testobjs[count].handle)->l_versions); + + if (dlclose (testobjs[count].handle) != 0) + { + printf ("failed to close %s\n", testobjs[count].name); + result = 1; + } + } + + /* Check whether all files are unloaded. */ + for (map = _r_debug.r_map; map != NULL; map = map->l_next) + if (map->l_type == lt_loaded) + { + printf ("name = \"%s\", opencount = %d\n", + map->l_name, (int) map->l_opencount); + result = 1; + } return result; }