mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-05 21:00:05 +00:00
752a2a50d4
2000-08-19 Ulrich Drepper <drepper@redhat.com> * 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.
32 lines
758 B
C
32 lines
758 B
C
#include <dlfcn.h>
|
|
#include <errno.h>
|
|
#include <error.h>
|
|
#include <mcheck.h>
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int (*foo) (void);
|
|
void *h;
|
|
int ret;
|
|
|
|
mtrace ();
|
|
|
|
h = dlopen ("constload2.so", RTLD_LAZY | RTLD_GLOBAL);
|
|
if (h == NULL)
|
|
error (EXIT_FAILURE, errno, "cannot load module \"constload2.so\"");
|
|
foo = dlsym (h, "foo");
|
|
ret = foo ();
|
|
/* Note that the following dlclose() call cannot unload the objects.
|
|
Due to the introduced relocation dependency constload2.so depends
|
|
on constload3.so and the dependencies of constload2.so on constload3.so
|
|
is not visible to ld.so since it's done using dlopen(). */
|
|
if (dlclose (h) != 0)
|
|
{
|
|
puts ("failed to close");
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
return ret;
|
|
}
|