Add back missing TlsAlloc() call

Cosmopolitan Libc once called this important function although somewhere
along the way, possibly in a refactoring, it got removed and __tls_alloc
has always been zero ever since.
This commit is contained in:
Justine Tunney 2024-07-21 20:45:27 -07:00
parent e08a4cd99e
commit 5d2d9e9640
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
5 changed files with 12 additions and 9 deletions

View file

@ -251,6 +251,8 @@ textstartup void __enable_tls(void) {
atomic_store_explicit(&_pthread_static.ptid, tid, memory_order_release);
// ask the operating system to change the x86 segment register
if (IsWindows())
__tls_index = TlsAlloc();
__set_tls(tib);
#ifdef __x86_64__