]> git.ipfire.org Git - thirdparty/glibc.git/blob - elf/tst-unique1.c
powerpc: Fix __fesetround_inline_nocheck on POWER9+ (BZ 31682)
[thirdparty/glibc.git] / elf / tst-unique1.c
1 #include <config.h>
2 #include <dlfcn.h>
3 #include <stdio.h>
4 #include <sys/mman.h>
5
6 static int
7 do_test (void)
8 {
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 if (f2 (f1 ()))
34 {
35 puts ("f from tst-unique1mod2 failed");
36 return 1;
37 }
38 dlclose (h2);
39 dlclose (h1);
40 mmap (NULL, 1024 * 1024 * 16, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
41 h2 = dlopen ("tst-unique1mod2.so", RTLD_LAZY);
42 if (h2 == NULL)
43 {
44 puts ("cannot load tst-unique1mod2");
45 return 1;
46 }
47 f2 = dlsym (h2, "f");
48 if (f2 == NULL)
49 {
50 puts ("cannot locate f in tst-unique1mod2");
51 return 1;
52 }
53 h1 = dlopen ("tst-unique1mod1.so", RTLD_LAZY);
54 if (h1 == NULL)
55 {
56 puts ("cannot load tst-unique1mod1");
57 return 1;
58 }
59 f1 = dlsym (h1, "f");
60 if (f1 == NULL)
61 {
62 puts ("cannot locate f in tst-unique1mod1");
63 return 1;
64 }
65 if (f2 (f1 ()))
66 {
67 puts ("f from tst-unique1mod2 failed");
68 return 1;
69 }
70 return 0;
71 }
72
73 #include <support/test-driver.c>