1 /* Test for unloading (really unmapping) of objects. By Franz Sirl.
2 This test does not have to passed in all dlopen() et.al. implementation
3 since it is not required the unloading actually happens. But we
4 require it for glibc. */
13 for (map = _r_debug.r_map; map != NULL; map = map->l_next) \
14 if (map->l_type == lt_loaded) \
15 printf ("name = \"%s\", opencount = %d\n", \
16 map->l_name, (int) map->l_opencount); \
38 sohandle
= dlopen ("unloadmod.so", RTLD_NOW
| RTLD_GLOBAL
);
41 printf ("*** first dlopen failed: %s\n", dlerror ());
45 puts ("\nAfter loading unloadmod.so");
48 testdat
= dlsym (sohandle
, "testdat");
49 testdat
->next
= (void *) -1;
51 ret
= dlclose (sohandle
);
54 puts ("*** first dlclose failed");
58 puts ("\nAfter closing unloadmod.so");
61 sohandle
= dlopen ("unloadmod.so", RTLD_NOW
| RTLD_GLOBAL
);
64 printf ("*** second dlopen failed: %s\n", dlerror ());
68 puts ("\nAfter loading unloadmod.so the second time");
71 testdat
= dlsym (sohandle
, "testdat");
72 if (testdat
->next
== (void *) -1)
74 puts ("*** testdat->next == (void *) -1");
78 ret
= dlclose (sohandle
);
81 puts ("*** second dlclose failed");
85 puts ("\nAfter closing unloadmod.so again");