about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile2
-rw-r--r--elf/dl-lookup.c7
-rw-r--r--elf/dl-open.c2
-rw-r--r--elf/loadtest.c30
4 files changed, 26 insertions, 15 deletions
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;
 }