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 local = { 1, 2, 3 }; |
| 5 | |
| 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 | |
| 11 | static int |
| 12 | do_test (void) |
| 13 | { |
| 14 | struct A *p; |
| 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 | |
| 36 | exit (0); |
| 37 | } |
| 38 | |
| 39 | #define TEST_FUNCTION do_test () |
| 40 | #include "../test-skeleton.c" |