8 #define TEST_FUNCTION do_test ()
12 static const char modname[] = "tst-tlsmod2.so";
16 int (*fp) (int, int *);
21 for (i = 0; i < 10; ++i)
23 h = dlopen (modname, RTLD_LAZY);
26 printf ("cannot open '%s': %s\n", modname, dlerror ());
30 /* Dirty test code here: we peek into a private data structure.
31 We make sure that the module gets assigned the same ID every
32 time. The value of the first round is used. */
34 modid = ((struct link_map *) h)->l_tls_modid;
35 else if (((struct link_map *) h)->l_tls_modid != modid)
37 printf ("round %d: modid now %zd, initially %d\n",
38 i, ((struct link_map *) h)->l_tls_modid, modid);
42 foop = dlsym (h, "foo");
45 printf ("cannot get symbol 'foo': %s\n", dlerror ());
51 fp = dlsym (h, "in_dso");
54 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
58 result |= fp (42 + i, foop);
60 foop2 = dlsym (h, "foo");
63 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
69 puts ("address of 'foo' different the second time");
85 #include "../test-skeleton.c"