tst-tlsmod14a.c 557 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #if USE_TLS && HAVE___THREAD
  4. #define AL 4096
  5. struct foo
  6. {
  7. int i;
  8. } __attribute ((aligned (AL)));
  9. static __thread struct foo f;
  10. static struct foo g;
  11. #ifndef FCT
  12. # define FCT in_dso1
  13. #endif
  14. int
  15. FCT (void)
  16. {
  17. puts (__func__);
  18. int result = 0;
  19. int fail = (((uintptr_t) &f) & (AL - 1)) != 0;
  20. printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK");
  21. result |= fail;
  22. fail = (((uintptr_t) &g) & (AL - 1)) != 0;
  23. printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK");
  24. result |= fail;
  25. return result;
  26. }
  27. #endif