Make _Thread_local work across platforms

We now rewrite the binary image at runtime on Windows and XNU to change
mov %fs:0,%reg instructions to use %gs instead. There's also simpler
threading API introduced by this change and it's called _spawn() and
_join(), which has replaced most clone() usage.
This commit is contained in:
Justine Tunney 2022-07-10 04:01:17 -07:00
parent e4d6e263d4
commit 5f4f6b0e69
51 changed files with 808 additions and 1043 deletions

View file

@ -6,7 +6,7 @@ COSMOPOLITAN_C_START_
cosmopolitan § runtime
*/
typedef long jmp_buf[8] forcealign(CACHELINE);
typedef long jmp_buf[8];
extern char **environ; /* CRT */
extern int __argc; /* CRT */
@ -45,8 +45,10 @@ extern size_t __virtualmax;
extern bool __isworker;
void mcount(void);
int _freestack(void *);
unsigned long getauxval(unsigned long);
void *mapanon(size_t) attributeallocsize((1));
void *_mapanon(size_t) attributeallocsize((1)) mallocesque;
void *_mapstack(void) returnsaligned((FRAMESIZE)) mallocesque;
int setjmp(jmp_buf) libcesque returnstwice paramsnonnull();
void longjmp(jmp_buf, int) libcesque wontreturn paramsnonnull();
axdx_t setlongerjmp(jmp_buf) libcesque returnstwice paramsnonnull();