9 static const char modname
[] = "tst-tlsmod2.so";
12 int (*fp
) (int, int *);
15 h
= dlopen (modname
, RTLD_LAZY
);
18 printf ("cannot open '%s': %s\n", modname
, dlerror ());
22 fp
= dlsym (h
, "in_dso");
25 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
30 if (dlinfo (h
, RTLD_DI_TLS_MODID
, &modid
))
32 printf ("dlinfo RTLD_DI_TLS_MODID failed: %s\n", dlerror ());
36 printf ("dlinfo says TLS module ID %zu\n", modid
);
39 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
41 printf ("dlinfo RTLD_DI_TLS_DATA failed: %s\n", dlerror ());
44 else if (block
!= NULL
)
46 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be unallocated\n",
51 result
|= fp (0, NULL
);
53 foop
= dlsym (h
, "foo");
56 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
65 /* Now the module's TLS block has been used and should appear. */
66 if (dlinfo (h
, RTLD_DI_TLS_DATA
, &block
))
68 printf ("dlinfo RTLD_DI_TLS_DATA failed the second time: %s\n",
72 else if (block
!= foop
)
74 printf ("dlinfo RTLD_DI_TLS_DATA says %p but should be %p\n",
85 #include <support/test-driver.c>