PowerPC: Fix gettimeofday ifunc selection
[glibc.git] / elf / tst-tls14.c
blob6bacb599dddbd10b5b42d3b9a4fdf4e25781ffe4
1 /* Check alignment of TLS variable. */
2 #include <dlfcn.h>
3 #include <stdint.h>
4 #include <stdio.h>
5 #include <stdlib.h>
7 #define AL 4096
8 struct foo
10 int i;
11 } __attribute ((aligned (AL)));
13 static __thread struct foo f;
14 static struct foo g;
17 extern int in_dso1 (void);
20 static int
21 do_test (void)
23 int result = 0;
25 int fail = (((uintptr_t) &f) & (AL - 1)) != 0;
26 printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
27 result |= fail;
29 fail = (((uintptr_t) &g) & (AL - 1)) != 0;
30 printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK");
31 result |= fail;
33 result |= in_dso1 ();
35 void *h = dlopen ("tst-tlsmod14b.so", RTLD_LAZY);
36 if (h == NULL)
38 printf ("cannot open tst-tlsmod14b.so: %m\n");
39 exit (1);
42 int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso2");
43 if (fp == NULL)
45 puts ("cannot find in_dso2");
46 exit (1);
49 result |= fp ();
51 return result;
54 #define TEST_FUNCTION do_test ()
55 #include "../test-skeleton.c"