Implement STB_GNU_UNIQUE handling.
[platform/upstream/glibc.git] / elf / tst-unique1.c
1 #include <config.h>
2 #include <dlfcn.h>
3 #include <stdio.h>
4
5 static int
6 do_test (void)
7 {
8 #ifdef HAVE_ASM_UNIQUE_OBJECT
9   void *h1 = dlopen ("tst-unique1mod1.so", RTLD_LAZY);
10   if (h1 == NULL)
11     {
12       puts ("cannot load tst-unique1mod1");
13       return 1;
14     }
15   int *(*f1) (void) = dlsym (h1, "f");
16   if (f1 == NULL)
17     {
18       puts ("cannot locate f in tst-unique1mod1");
19       return 1;
20     }
21   void *h2 = dlopen ("tst-unique1mod2.so", RTLD_LAZY);
22   if (h2 == NULL)
23     {
24       puts ("cannot load tst-unique1mod2");
25       return 1;
26     }
27   int (*f2) (int *) = dlsym (h2, "f");
28   if (f2 == NULL)
29     {
30       puts ("cannot locate f in tst-unique1mod2");
31       return 1;
32     }
33   return f2 (f1 ());
34 #else
35   return 0;
36 #endif
37 }
38
39 #define TEST_FUNCTION do_test ()
40 #include "../test-skeleton.c"