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