From d785c366924df522974f4ee88d77fd8aaed58803 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 21 Oct 2000 07:16:18 +0000 Subject: Update. 2000-10-21 Ulrich Drepper * elf/dl-open.c (add_to_global): New function. Split out from dl_open_worker. (dl_open_worker): Call add_to_global not only for new objects, also for previously loaded objects when (mode & RTLD_GLOBAL) and the object was not yet in the global scope. * elf/Makefile: Add rules to build and run lateglobal. * elf/lateglobal.c: New file. * elf/ltglobmod1.c: New file. * elf/ltglobmod2.c: New file. --- elf/lateglobal.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 elf/lateglobal.c (limited to 'elf/lateglobal.c') diff --git a/elf/lateglobal.c b/elf/lateglobal.c new file mode 100644 index 0000000000..2f6c2692a6 --- /dev/null +++ b/elf/lateglobal.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +int +main (void) +{ + void *h[2]; + int fail; + int (*fp) (void); + + mtrace (); + + h[0] = dlopen ("ltglobmod1.so", RTLD_LAZY); + if (h == NULL) + { + printf ("%s: cannot open %s: %s", + __FUNCTION__, "ltglobmod1.so", dlerror ()); + exit (EXIT_FAILURE); + } + h[1] = dlopen ("ltglobmod2.so", RTLD_LAZY); + if (h == NULL) + { + printf ("%s: cannot open %s: %s", + __FUNCTION__, "ltglobmod2.so", dlerror ()); + exit (EXIT_FAILURE); + } + + puts ("loaded \"ltglobmod1.so\" without RTLD_GLOBAL"); + + fp = dlsym (h[1], "foo"); + if (fp == NULL) + { + printf ("cannot get address of `foo': %s", dlerror ()); + exit (EXIT_FAILURE); + } + + fail = fp (); + + puts ("back in main"); + + dlclose (h[1]); + dlclose (h[0]); + + return fail; +} -- cgit v1.2.3