]>
git.ipfire.org Git - thirdparty/glibc.git/blob - elf/tst-tls6.c
9 # include "tls-macros.h"
11 /* This gives the executable a TLS segment so that even if the libc.so
12 it loads has none (i.e. --with-tls --without-__thread), ld.so will
13 permit loading of objects with TLS segments. */
14 COMMON_INT_DEF(loser
);
18 #define TEST_FUNCTION do_test ()
23 static const char modname
[] = "tst-tlsmod2.so";
27 int (*fp
) (int, int *);
32 for (i
= 0; i
< 10; ++i
)
34 h
= dlopen (modname
, RTLD_LAZY
);
37 printf ("cannot open '%s': %s\n", modname
, dlerror ());
41 /* Dirty test code here: we peek into a private data structure.
42 We make sure that the module gets assigned the same ID every
43 time. The value of the first round is used. */
45 modid
= ((struct link_map
*) h
)->l_tls_modid
;
46 else if (((struct link_map
*) h
)->l_tls_modid
!= modid
)
48 printf ("round %d: modid now %d, initially %d\n",
49 i
, ((struct link_map
*) h
)->l_tls_modid
, modid
);
53 foop
= dlsym (h
, "foo");
56 printf ("cannot get symbol 'foo': %s\n", dlerror ());
62 fp
= dlsym (h
, "in_dso");
65 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
69 result
|= fp (42 + i
, foop
);
71 foop2
= dlsym (h
, "foo");
74 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
80 puts ("address of 'foo' different the second time");
99 #include "../test-skeleton.c"