]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/unload5.c
Update copyright dates not handled by scripts/update-copyrights.
[thirdparty/glibc.git] / elf / unload5.c
CommitLineData
193af754
UD
1#include <dlfcn.h>
2#include <stdio.h>
3
4int
5main (void)
6{
7 void *g = dlopen ("unload3mod1.so", RTLD_GLOBAL | RTLD_NOW);
8 void *h = dlopen ("unload3mod2.so", RTLD_GLOBAL | RTLD_NOW);
9 if (g == NULL || h == NULL)
10 {
11 printf ("dlopen unload3mod{1,2}.so failed: %p %p\n", g, h);
12 return 1;
13 }
14 dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW);
15 dlclose (h);
16 dlclose (g);
17
18 g = dlopen ("unload3mod3.so", RTLD_GLOBAL | RTLD_NOW);
19 h = dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW);
20 if (g == NULL || h == NULL)
21 {
22 printf ("dlopen unload3mod{3,4}.so failed: %p %p\n", g, h);
23 return 1;
24 }
25
26 int (*fn) (int);
27 fn = dlsym (h, "bar");
28 if (fn == NULL)
29 {
30 puts ("dlsym failed");
31 return 1;
32 }
33
34 int val = fn (16);
35 if (val != 24)
36 {
37 printf ("bar returned %d != 24\n", val);
38 return 1;
39 }
40
41 return 0;
42}