8 #define TEST_FUNCTION do_test ()
13 static const char modname
[] = "tst-tlsmod2.so";
16 int (*fp
) (int, int *);
19 h
= dlopen (modname
, RTLD_LAZY
);
22 printf ("cannot open '%s': %s\n", modname
, dlerror ());
26 fp
= dlsym (h
, "in_dso");
29 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
34 if (dlinfo (h
, RTLD_DI_TLS_MODID
, &modid
))
36 printf ("dlinfo RTLD_DI_TLS_MODID failed: %s\n", dlerror ());
40 printf ("dlinfo says TLS module ID %Zu\n", modid
);
43 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
45 printf ("dlinfo RTLD_DI_TLS_DATA failed: %s\n", dlerror ());
48 else if (block
!= NULL
)
50 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be unallocated\n",
55 result
|= fp (0, NULL
);
57 foop
= dlsym (h
, "foo");
60 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
69 /* Now the module's TLS block has been used and should appear. */
70 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
72 printf ("dlinfo RTLD_DI_TLS_DATA failed the second time: %s\n",
76 else if (block
!= foop
)
78 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be %p\n",
92 #include "../test-skeleton.c"