Undo last change. Add asflags-cpu to ASFLAGS in the same place we add
[glibc/history.git] / elf / tst-tls14.c
blobc1e6ba7e2cbeb0054e1e5e65e6c3fc1c19928a93
1 /* Check alignment of TLS variable. */
2 #include <dlfcn.h>
3 #include <stdint.h>
4 #include <stdio.h>
5 #include <stdlib.h>
7 #include <tls.h>
9 #if HAVE___THREAD
11 # define AL 4096
12 struct foo
14 int i;
15 } __attribute ((aligned (AL)));
17 static __thread struct foo f;
18 static struct foo g;
21 extern int in_dso1 (void);
24 static int
25 do_test (void)
27 int result = 0;
29 int fail = (((uintptr_t) &f) & (AL - 1)) != 0;
30 printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
31 result |= fail;
33 fail = (((uintptr_t) &g) & (AL - 1)) != 0;
34 printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK");
35 result |= fail;
37 result |= in_dso1 ();
39 void *h = dlopen ("tst-tlsmod14b.so", RTLD_LAZY);
40 if (h == NULL)
42 printf ("cannot open tst-tlsmod14b.so: %m\n");
43 exit (1);
46 int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso2");
47 if (fp == NULL)
49 puts ("cannot find in_dso2");
50 exit (1);
53 result |= fp ();
55 return result;
58 # define TEST_FUNCTION do_test ()
60 #else
62 # define TEST_FUNCTION 0
64 #endif
66 #include "../test-skeleton.c"