13 #define TEST_FUNCTION do_test ()
18 static const char modname[] = "tst-tlsmod2.so";
22 int (*fp) (int, int *);
27 for (i = 0; i < 10; ++i)
29 h = dlopen (modname, RTLD_LAZY);
32 printf ("cannot open '%s': %s\n", modname, dlerror ());
36 /* Dirty test code here: we peek into a private data structure.
37 We make sure that the module gets assigned the same ID every
38 time. The value of the first round is used. */
41 modid = ((struct dyn_elf *) h)->dyn->l_tls_modid;
42 else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid)
44 printf ("round %d: modid now %zu, initially %d\n",
46 ((struct dyn_elf *)h)->dyn->l_tls_modid,
52 modid = ((struct link_map *) h)->l_tls_modid;
53 else if (((struct link_map *) h)->l_tls_modid != modid)
55 printf ("round %d: modid now %zd, initially %d\n",
56 i, ((struct link_map *) h)->l_tls_modid, modid);
61 foop = dlsym (h, "foo");
64 printf ("cannot get symbol 'foo': %s\n", dlerror ());
70 fp = dlsym (h, "in_dso");
73 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
77 result |= fp (42 + i, foop);
79 foop2 = dlsym (h, "foo");
82 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
88 puts ("address of 'foo' different the second time");
107 #include "../test-skeleton.c"