if_index: Remove unneeded alloca.h include
[glibc.git] / elf / tst-nodelete2.c
blob010c4ae237175b6225cf5317bfc03c734dfa1f36
1 #include "../dlfcn/dlfcn.h"
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <gnu/lib-names.h>
6 static int
7 do_test (void)
9 int result = 0;
11 printf ("\nOpening pthread library.\n");
12 void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
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)
23 printf ("Unique symbols test failed\n");
24 result = 1;
27 if (pthread)
28 dlclose (pthread);
30 if (result == 0)
31 printf ("SUCCESS\n");
33 return result;
36 #include <support/test-driver.c>