11 static const char modname
[] = "tst-tlsmod2.so";
15 int (*fp
) (int, int *);
20 for (i
= 0; i
< 10; ++i
)
22 h
= dlopen (modname
, RTLD_LAZY
);
25 printf ("cannot open '%s': %s\n", modname
, dlerror ());
29 /* Dirty test code here: we peek into a private data structure.
30 We make sure that the module gets assigned the same ID every
31 time. The value of the first round is used. */
33 modid
= ((struct link_map
*) h
)->l_tls_modid
;
34 else if (((struct link_map
*) h
)->l_tls_modid
!= modid
)
36 printf ("round %d: modid now %zd, initially %d\n",
37 i
, ((struct link_map
*) h
)->l_tls_modid
, modid
);
41 foop
= dlsym (h
, "foo");
44 printf ("cannot get symbol 'foo': %s\n", dlerror ());
50 fp
= dlsym (h
, "in_dso");
53 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
57 result
|= fp (42 + i
, foop
);
59 foop2
= dlsym (h
, "foo");
62 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
68 puts ("address of 'foo' different the second time");
84 #include <support/test-driver.c>