1 __thread char c1 = 1; 2 __thread char xchar = 2; 3 __thread char c2 = 3; 4 __thread short xshort = 4; 5 __thread char c3 = 5; 6 __thread int xint = 6; 7 __thread char c4 = 7; 8 __thread long long xllong = 8; 9 10 struct { 11 char *name; 12 unsigned size; 13 unsigned align; 14 unsigned long addr; 15 } t[4]; 16 17 #define entry(i,x) \ 18 t[i].name = #x; \ 19 t[i].size = sizeof x; \ 20 t[i].align = __alignof__(x); \ 21 t[i].addr = (unsigned long)&x; 22 init(void)23__attribute__((constructor)) static void init(void) 24 { 25 entry(0, xchar) 26 entry(1, xshort) 27 entry(2, xint) 28 entry(3, xllong) 29 } 30 31