- main_thread.tlsdesc[0] = -1;
- main_thread.tlsdesc[1] = (long)&main_thread;
- main_thread.tlsdesc[2] = SIZE_MAX/PAGE_SIZE;
- main_thread.tlsdesc[3] = 0x51;
+ void *tsd = 0;
+ if (__pthread_tsd_size) {
+ tsd = mmap(0, __pthread_tsd_size, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ if (tsd == MAP_FAILED) return -1;
+ }
+ main_thread.tsd = tsd;