From: drepper Date: Sat, 21 Oct 2000 07:13:32 +0000 (+0000) Subject: Test for dlopen with RTLD_GLOBAL only in the second call for the same object. X-Git-Tag: glibc-2_1_96~186 X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=commitdiff_plain;h=517779d7a1974ae7641bd7d7b4df9f91f8e04e23 Test for dlopen with RTLD_GLOBAL only in the second call for the same object. --- 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; +}