9 #define TEST_FUNCTION do_test ()
14 static const char modname1
[] = "tst-tlsmod3.so";
15 static const char modname2
[] = "tst-tlsmod4.so";
18 int (*fp2
) (int, int *);
26 for (i
= 0; i
< 10; ++i
)
28 h1
= dlopen (modname1
, RTLD_LAZY
);
31 printf ("cannot open '%s': %s\n", modname1
, dlerror ());
35 /* Dirty test code here: we peek into a private data structure.
36 We make sure that the module gets assigned the same ID every
37 time. The value of the first round is used. */
39 modid1
= ((struct link_map
*) h1
)->l_tls_modid
;
40 else if (((struct link_map
*) h1
)->l_tls_modid
!= modid1
)
42 printf ("round %d: modid now %zd, initially %d\n",
43 i
, ((struct link_map
*) h1
)->l_tls_modid
, modid1
);
47 fp1
= dlsym (h1
, "in_dso2");
50 printf ("cannot get symbol 'in_dso2' in %s\n", modname1
);
58 h2
= dlopen (modname2
, RTLD_LAZY
);
61 printf ("cannot open '%s': %s\n", modname2
, dlerror ());
65 /* Dirty test code here: we peek into a private data structure.
66 We make sure that the module gets assigned the same ID every
67 time. The value of the first round is used. */
69 modid2
= ((struct link_map
*) h1
)->l_tls_modid
;
70 else if (((struct link_map
*) h1
)->l_tls_modid
!= modid2
)
72 printf ("round %d: modid now %zd, initially %d\n",
73 i
, ((struct link_map
*) h1
)->l_tls_modid
, modid2
);
77 bazp
= dlsym (h2
, "baz");
80 printf ("cannot get symbol 'baz' in %s\n", modname2
);
86 fp2
= dlsym (h2
, "in_dso");
89 printf ("cannot get symbol 'in_dso' in %s\n", modname2
);
93 result
|= fp2 (42 + i
, bazp
);
99 h1
= dlopen (modname1
, RTLD_LAZY
);
102 printf ("cannot open '%s': %s\n", modname1
, dlerror ());
106 /* Dirty test code here: we peek into a private data structure.
107 We make sure that the module gets assigned the same ID every
108 time. The value of the first round is used. */
109 if (((struct link_map
*) h1
)->l_tls_modid
!= modid1
)
111 printf ("round %d: modid now %zd, initially %d\n",
112 i
, ((struct link_map
*) h1
)->l_tls_modid
, modid1
);
116 fp1
= dlsym (h1
, "in_dso2");
119 printf ("cannot get symbol 'in_dso2' in %s\n", modname1
);
127 h2
= dlopen (modname2
, RTLD_LAZY
);
130 printf ("cannot open '%s': %s\n", modname2
, dlerror ());
134 /* Dirty test code here: we peek into a private data structure.
135 We make sure that the module gets assigned the same ID every
136 time. The value of the first round is used. */
137 if (((struct link_map
*) h1
)->l_tls_modid
!= modid2
)
139 printf ("round %d: modid now %zd, initially %d\n",
140 i
, ((struct link_map
*) h1
)->l_tls_modid
, modid2
);
144 bazp
= dlsym (h2
, "baz");
147 printf ("cannot get symbol 'baz' in %s\n", modname2
);
153 fp2
= dlsym (h2
, "in_dso");
156 printf ("cannot get symbol 'in_dso' in %s\n", modname2
);
160 result
|= fp2 (62 + i
, bazp
);
162 /* This time the dlclose calls are in reverse order. */
174 #include "../test-skeleton.c"