From 752a2a50d4574791b2861653d4352c6b6e4b97ff Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 19 Aug 2000 07:17:09 +0000 Subject: Update. 2000-08-19 Ulrich Drepper * elf/Versions [ld] (GLIBC_2.2): Export _dl_check_map_versions. * elf/dl-deps.c (_dl_map_object_deps): If object was dependency of a dynamically loaded object remove old l_initfini list. * elf/dl-libc.c (free_mem): Used as __libc_subfreeres callback to remove some dynamically allocated memory blocks in the dynamic loading data structures. * elf/dl-load.c (add_name_to_object): Initialize dont_free to 0. * elf/dl-open.c (dl_open_workder): Don't call _dl_check_all_versions. Instead call _dl_check_map_versions only for the dependencies. * elf/rtld.c: Avoid unneccessary initializations. Mark l_libname information of initial objects as not free-able. * sysdeps/generic/ldsodefs.h (struct libname_list): Add dont_free element. * elf/filter.c: Call mtrace. * elf/restest1.c: Likewise. Close the objects. * elf/loadtest.c: Call mtrace. Check result of dlclose. Print more debug information. * elf/constload1.c: Add comment explaining not freed memory. --- elf/loadtest.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'elf/loadtest.c') diff --git a/elf/loadtest.c b/elf/loadtest.c index 5b9e116..80f9960 100644 --- a/elf/loadtest.c +++ b/elf/loadtest.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -66,10 +67,16 @@ static const struct #define NTESTS (sizeof (tests) / sizeof (tests[0])) +#include + + int main (void) { int count = TEST_ROUNDS; + int result = 0; + + mtrace (); /* Just a seed. */ srandom (TEST_ROUNDS); @@ -102,23 +109,38 @@ main (void) fct (10); - printf ("successfully loaded `%s'\n", testobjs[index].name); + printf ("successfully loaded `%s', handle %p\n", + testobjs[index].name, testobjs[index].handle); } else { - dlclose (testobjs[index].handle); - testobjs[index].handle = NULL; + if (dlclose (testobjs[index].handle) != 0) + { + printf ("failed to close %s\n", testobjs[index].name); + result = 1; + } + else + printf ("successfully unloaded `%s', handle %p\n", + testobjs[index].name, testobjs[index].handle); - printf ("successfully unloaded `%s'\n", testobjs[index].name); + testobjs[index].handle = NULL; } } /* Unload all loaded modules. */ for (count = 0; count < NOBJS; ++count) if (testobjs[count].handle != NULL) - dlclose (testobjs[count].handle); +{ 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; +} } - return 0; + return result; } -- cgit v1.1