blob: ba12e7d9c4dc31477e0906d5151423ee6702e548 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include <dlfcn.h>
2#include <mcheck.h>
3#include <stdio.h>
4#include <stdlib.h>
5
6int
7main (void)
8{
9 int i;
10 void *h1, *h2;
11
12 mtrace ();
13
14 for (i = 0; i < 3; i++)
15 {
16 h1 = dlopen ("reldep4mod1.so", RTLD_NOW | RTLD_GLOBAL);
17 if (h1 == NULL)
18 {
19 printf ("cannot open reldep4mod1.so: %s\n", dlerror ());
20 exit (1);
21 }
22 h2 = dlopen ("reldep4mod2.so", RTLD_NOW | RTLD_GLOBAL);
23 if (h2 == NULL)
24 {
25 printf ("cannot open reldep4mod2.so: %s\n", dlerror ());
26 exit (1);
27 }
28 if (dlclose (h1) != 0)
29 {
30 printf ("closing h1 failed: %s\n", dlerror ());
31 exit (1);
32 }
33 if (dlclose (h2) != 0)
34 {
35 printf ("closing h2 failed: %s\n", dlerror ());
36 exit (1);
37 }
38 }
39 return 0;
40}