Add build-many-glibcs.py arm-linux-gnueabihf-v7{-disable-multiarch}
[glibc.git] / elf / tst-tls7.c
blobfa46709600ddef8a597bc1d4ad707bdafb4dc6ba
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 #include <link.h>
8 static int
9 do_test (void)
11 static const char modname[] = "tst-tlsmod3.so";
12 int result = 0;
13 int (*fp) (void);
14 void *h;
15 int i;
16 int modid = -1;
18 for (i = 0; i < 10; ++i)
20 h = dlopen (modname, RTLD_LAZY);
21 if (h == NULL)
23 printf ("cannot open '%s': %s\n", modname, dlerror ());
24 exit (1);
27 /* Dirty test code here: we peek into a private data structure.
28 We make sure that the module gets assigned the same ID every
29 time. The value of the first round is used. */
30 if (modid == -1)
31 modid = ((struct link_map *) h)->l_tls_modid;
32 else if (((struct link_map *) h)->l_tls_modid != (size_t) modid)
34 printf ("round %d: modid now %zu, initially %d\n",
35 i, ((struct link_map *) h)->l_tls_modid, modid);
36 result = 1;
39 fp = dlsym (h, "in_dso2");
40 if (fp == NULL)
42 printf ("cannot get symbol 'in_dso2': %s\n", dlerror ());
43 exit (1);
46 result |= fp ();
48 dlclose (h);
51 return result;
55 #include <support/test-driver.c>