tst-tls10.c 888 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "tst-tls10.h"
  2. #ifdef USE_TLS__THREAD
  3. __thread int dummy __attribute__((visibility ("hidden"))) = 12;
  4. __thread struct A local = { 1, 2, 3 };
  5. #endif
  6. #define CHECK(N, S) \
  7. p = f##N##a (); \
  8. if (p->a != S || p->b != S + 1 || p->c != S + 2) \
  9. abort ()
  10. int
  11. main (void)
  12. {
  13. struct A *p;
  14. #ifdef USE_TLS__THREAD
  15. if (local.a != 1 || local.b != 2 || local.c != 3)
  16. abort ();
  17. if (a1.a != 4 || a1.b != 5 || a1.c != 6)
  18. abort ();
  19. if (a2.a != 22 || a2.b != 23 || a2.c != 24)
  20. abort ();
  21. if (a3.a != 10 || a3.b != 11 || a3.c != 12)
  22. abort ();
  23. if (a4.a != 25 || a4.b != 26 || a4.c != 27)
  24. abort ();
  25. check1 ();
  26. check2 ();
  27. if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4)
  28. abort ();
  29. CHECK (5, 16);
  30. CHECK (6, 19);
  31. if (f7a () != &a2 || f8a () != &a4)
  32. abort ();
  33. CHECK (9, 28);
  34. CHECK (10, 31);
  35. #endif
  36. exit (0);
  37. }