Fix crash caused when Windows needs a lot of TLS

This commit is contained in:
Justine Tunney 2024-06-30 20:53:43 -07:00
parent 76957983cf
commit e437bed006
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -24,6 +24,7 @@
#include "libc/intrin/dll.h" #include "libc/intrin/dll.h"
#include "libc/intrin/getenv.internal.h" #include "libc/intrin/getenv.internal.h"
#include "libc/intrin/kprintf.h" #include "libc/intrin/kprintf.h"
#include "libc/intrin/maps.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/nt/files.h" #include "libc/nt/files.h"
@ -37,6 +38,8 @@
#include "libc/stdalign.internal.h" #include "libc/stdalign.internal.h"
#include "libc/str/locale.h" #include "libc/str/locale.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
#include "libc/thread/posixthread.internal.h" #include "libc/thread/posixthread.internal.h"
#include "libc/thread/thread.h" #include "libc/thread/thread.h"
#include "libc/thread/tls.h" #include "libc/thread/tls.h"
@ -168,7 +171,8 @@ textstartup void __enable_tls(void) {
if (I(_tls_align) <= TLS_ALIGNMENT && size <= sizeof(__static_tls)) { if (I(_tls_align) <= TLS_ALIGNMENT && size <= sizeof(__static_tls)) {
mem = __static_tls; mem = __static_tls;
} else { } else {
mem = _weaken(_mapanon)(size); mem = __mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
} }
struct CosmoTib *tib = struct CosmoTib *tib =