lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include "tst-tls10.h" |
| 2 | |
| 3 | __thread int dummy __attribute__((visibility ("hidden"))) = 12; |
| 4 | __thread struct A a1 = { 4, 5, 6 }; |
| 5 | __thread struct A a2 = { 7, 8, 9 }; |
| 6 | __thread struct A a3 __attribute__((tls_model("initial-exec"))) |
| 7 | = { 10, 11, 12 }; |
| 8 | __thread struct A a4 __attribute__((tls_model("initial-exec"))) |
| 9 | = { 13, 14, 15 }; |
| 10 | static __thread struct A local1 = { 16, 17, 18 }; |
| 11 | static __thread struct A local2 __attribute__((tls_model("initial-exec"))) |
| 12 | = { 19, 20, 21 }; |
| 13 | |
| 14 | void |
| 15 | check1 (void) |
| 16 | { |
| 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 | if (local1.a != 16 || local1.b != 17 || local1.c != 18) |
| 26 | abort (); |
| 27 | if (local2.a != 19 || local2.b != 20 || local2.c != 21) |
| 28 | abort (); |
| 29 | } |
| 30 | |
| 31 | struct A * |
| 32 | f1a (void) |
| 33 | { |
| 34 | return &a1; |
| 35 | } |
| 36 | |
| 37 | struct A * |
| 38 | f2a (void) |
| 39 | { |
| 40 | return &a2; |
| 41 | } |
| 42 | |
| 43 | struct A * |
| 44 | f3a (void) |
| 45 | { |
| 46 | return &a3; |
| 47 | } |
| 48 | |
| 49 | struct A * |
| 50 | f4a (void) |
| 51 | { |
| 52 | return &a4; |
| 53 | } |
| 54 | |
| 55 | struct A * |
| 56 | f5a (void) |
| 57 | { |
| 58 | return &local1; |
| 59 | } |
| 60 | |
| 61 | struct A * |
| 62 | f6a (void) |
| 63 | { |
| 64 | return &local2; |
| 65 | } |
| 66 | |
| 67 | int |
| 68 | f1b (void) |
| 69 | { |
| 70 | return a1.a; |
| 71 | } |
| 72 | |
| 73 | int |
| 74 | f2b (void) |
| 75 | { |
| 76 | return a2.b; |
| 77 | } |
| 78 | |
| 79 | int |
| 80 | f3b (void) |
| 81 | { |
| 82 | return a3.c; |
| 83 | } |
| 84 | |
| 85 | int |
| 86 | f4b (void) |
| 87 | { |
| 88 | return a4.a; |
| 89 | } |
| 90 | |
| 91 | int |
| 92 | f5b (void) |
| 93 | { |
| 94 | return local1.b; |
| 95 | } |
| 96 | |
| 97 | int |
| 98 | f6b (void) |
| 99 | { |
| 100 | return local2.c; |
| 101 | } |