9 #define TEST_FUNCTION do_test ()
14 static const char modname
[] = "tst-tlsmod2.so";
18 int (*fp
) (int, int *);
23 for (i
= 0; i
< 10; ++i
)
25 h
= dlopen (modname
, RTLD_LAZY
);
28 printf ("cannot open '%s': %s\n", modname
, dlerror ());
32 /* Dirty test code here: we peek into a private data structure.
33 We make sure that the module gets assigned the same ID every
34 time. The value of the first round is used. */
36 modid
= ((struct link_map
*) h
)->l_tls_modid
;
37 else if (((struct link_map
*) h
)->l_tls_modid
!= modid
)
39 printf ("round %d: modid now %d, initially %d\n",
40 i
, ((struct link_map
*) h
)->l_tls_modid
, modid
);
44 foop
= dlsym (h
, "foo");
47 printf ("cannot get symbol 'foo': %s\n", dlerror ());
53 fp
= dlsym (h
, "in_dso");
56 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
60 result
|= fp (42 + i
, foop
);
62 foop2
= dlsym (h
, "foo");
65 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
71 puts ("address of 'foo' different the second time");
90 #include "../test-skeleton.c"