6 #define TEST_FUNCTION do_test ()
10 static const char modname
[] = "tst-tlsmod2.so";
13 int (*fp
) (int, int *);
16 h
= dlopen (modname
, RTLD_LAZY
);
19 printf ("cannot open '%s': %s\n", modname
, dlerror ());
23 fp
= dlsym (h
, "in_dso");
26 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
31 if (dlinfo (h
, RTLD_DI_TLS_MODID
, &modid
))
33 printf ("dlinfo RTLD_DI_TLS_MODID failed: %s\n", dlerror ());
37 printf ("dlinfo says TLS module ID %Zu\n", modid
);
40 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
42 printf ("dlinfo RTLD_DI_TLS_DATA failed: %s\n", dlerror ());
45 else if (block
!= NULL
)
47 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be unallocated\n",
52 result
|= fp (0, NULL
);
54 foop
= dlsym (h
, "foo");
57 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
66 /* Now the module's TLS block has been used and should appear. */
67 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
69 printf ("dlinfo RTLD_DI_TLS_DATA failed the second time: %s\n",
73 else if (block
!= foop
)
75 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be %p\n",
86 #include "../test-skeleton.c"