Back to index

glibc  2.9
tst-tlsmod14a.c
Go to the documentation of this file.
00001 #include <stdint.h>
00002 #include <stdio.h>
00003 
00004 #include <tls.h>
00005 
00006 #if HAVE___THREAD
00007 
00008 # define AL 4096
00009 struct foo
00010 {
00011   int i;
00012 } __attribute ((aligned (AL)));
00013 
00014 static __thread struct foo f;
00015 static struct foo g;
00016 
00017 
00018 # ifndef FCT
00019 #  define FCT in_dso1
00020 # endif
00021 
00022 
00023 int
00024 FCT (void)
00025 {
00026   puts (__func__);
00027 
00028   int result = 0;
00029 
00030   int fail = (((uintptr_t) &f) & (AL - 1)) != 0;
00031   printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
00032   result |= fail;
00033 
00034   fail = (((uintptr_t) &g) & (AL - 1)) != 0;
00035   printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK");
00036   result |= fail;
00037 
00038   return result;
00039 }
00040 
00041 #endif