x86: Don't check XFD against /proc/cpuinfo
[glibc.git] / elf / tst-tls16.c
blobf2830b8a4f36ba186b2c6a357173a9babbc2a1c8
1 #include <dlfcn.h>
2 #include <stdlib.h>
3 #include <stdio.h>
5 static int
6 do_test (void)
8 void *h = dlopen ("tst-tlsmod16a.so", RTLD_LAZY | RTLD_GLOBAL);
9 if (h == NULL)
11 puts ("unexpectedly failed to open tst-tlsmod16a.so");
12 exit (1);
15 void *p = dlsym (h, "tlsvar");
17 /* This dlopen should indeed fail, because tlsvar was assigned to
18 dynamic TLS, and the new module requests it to be in static TLS.
19 However, there's a possibility that dlopen succeeds if the
20 variable is, for whatever reason, assigned to static TLS, or if
21 the module fails to require static TLS, or even if TLS is not
22 supported. */
23 h = dlopen ("tst-tlsmod16b.so", RTLD_NOW | RTLD_GLOBAL);
24 if (h == NULL)
26 return 0;
29 puts ("unexpectedly succeeded to open tst-tlsmod16b.so");
32 void *(*fp) (void) = (void *(*) (void)) dlsym (h, "in_dso");
33 if (fp == NULL)
35 puts ("cannot find in_dso");
36 exit (1);
39 /* If the dlopen passes, at least make sure the address returned by
40 dlsym is the same as that returned by the initial-exec access.
41 If the variable was assigned to dynamic TLS during dlsym, this
42 portion will fail. */
43 if (fp () != p)
45 puts ("returned values do not match");
46 exit (1);
49 return 0;
52 #include <support/test-driver.c>