Skip to content

Commit

Permalink
Fix crash caused when Windows needs a lot of TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Jul 1, 2024
1 parent 7695798 commit e437bed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libc/runtime/enable_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "libc/intrin/dll.h"
#include "libc/intrin/getenv.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/maps.h"
#include "libc/intrin/weaken.h"
#include "libc/macros.internal.h"
#include "libc/nt/files.h"
Expand All @@ -37,6 +38,8 @@
#include "libc/stdalign.internal.h"
#include "libc/str/locale.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/thread.h"
#include "libc/thread/tls.h"
Expand Down Expand Up @@ -168,7 +171,8 @@ textstartup void __enable_tls(void) {
if (I(_tls_align) <= TLS_ALIGNMENT && size <= sizeof(__static_tls)) {
mem = __static_tls;
} else {
mem = _weaken(_mapanon)(size);
mem = __mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
}

struct CosmoTib *tib =
Expand Down

0 comments on commit e437bed

Please sign in to comment.