8 #define TEST_FUNCTION do_test ()
12 static const char modname
[] = "tst-tlsmod2.so";
15 int (*fp
) (int, int *);
18 h
= dlopen (modname
, RTLD_LAZY
);
21 printf ("cannot open '%s': %s\n", modname
, dlerror ());
25 fp
= dlsym (h
, "in_dso");
28 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
33 if (dlinfo (h
, RTLD_DI_TLS_MODID
, &modid
))
35 printf ("dlinfo RTLD_DI_TLS_MODID failed: %s\n", dlerror ());
39 printf ("dlinfo says TLS module ID %Zu\n", modid
);
42 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
44 printf ("dlinfo RTLD_DI_TLS_DATA failed: %s\n", dlerror ());
47 else if (block
!= NULL
)
49 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be unallocated\n",
54 result
|= fp (0, NULL
);
56 foop
= dlsym (h
, "foo");
59 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
68 /* Now the module's TLS block has been used and should appear. */
69 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
71 printf ("dlinfo RTLD_DI_TLS_DATA failed the second time: %s\n",
75 else if (block
!= foop
)
77 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be %p\n",
88 #include "../test-skeleton.c"