1 #include "../dlfcn/dlfcn.h" 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <gnu/lib-names.h> 5 6 static int do_test(void)7do_test (void) 8 { 9 int result = 0; 10 11 printf ("\nOpening pthread library.\n"); 12 void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY); 13 14 /* This is a test for correct DF_1_NODELETE clearing when dlopen failure 15 happens. We should clear DF_1_NODELETE for failed library only, because 16 doing this for others (e.g. libpthread) might cause them to be unloaded, 17 that may lead to some global references (e.g. __rtld_lock_unlock) to be 18 broken. The dlopen should fail because of undefined symbols in shared 19 library, that cause DF_1_NODELETE to be cleared. For libpthread, this 20 flag should be set, because if not, SIGSEGV will happen in dlclose. */ 21 if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL) 22 { 23 printf ("Unique symbols test failed\n"); 24 result = 1; 25 } 26 27 if (pthread) 28 dlclose (pthread); 29 30 if (result == 0) 31 printf ("SUCCESS\n"); 32 33 return result; 34 } 35 36 #include <support/test-driver.c> 37