tst-tlsmod8.c 1002 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include "tst-tls10.h"
  2. #ifdef USE_TLS__THREAD
  3. __thread long long dummy __attribute__((visibility ("hidden"))) = 12;
  4. __thread struct A a2 = { 22, 23, 24 };
  5. __thread struct A a4 __attribute__((tls_model("initial-exec")))
  6. = { 25, 26, 27 };
  7. static __thread struct A local1 = { 28, 29, 30 };
  8. static __thread struct A local2 __attribute__((tls_model("initial-exec")))
  9. = { 31, 32, 33 };
  10. void
  11. check2 (void)
  12. {
  13. if (a2.a != 22 || a2.b != 23 || a2.c != 24)
  14. abort ();
  15. if (a4.a != 25 || a4.b != 26 || a4.c != 27)
  16. abort ();
  17. if (local1.a != 28 || local1.b != 29 || local1.c != 30)
  18. abort ();
  19. if (local2.a != 31 || local2.b != 32 || local2.c != 33)
  20. abort ();
  21. }
  22. struct A *
  23. f7a (void)
  24. {
  25. return &a2;
  26. }
  27. struct A *
  28. f8a (void)
  29. {
  30. return &a4;
  31. }
  32. struct A *
  33. f9a (void)
  34. {
  35. return &local1;
  36. }
  37. struct A *
  38. f10a (void)
  39. {
  40. return &local2;
  41. }
  42. int
  43. f7b (void)
  44. {
  45. return a2.b;
  46. }
  47. int
  48. f8b (void)
  49. {
  50. return a4.a;
  51. }
  52. int
  53. f9b (void)
  54. {
  55. return local1.b;
  56. }
  57. int
  58. f10b (void)
  59. {
  60. return local2.c;
  61. }
  62. #endif