Commit 1440cae
committed
Refactor stub pthread library and enable unconditionally.
This commit changes the layout of the stub pthread library to match
that of libc-top-half: splits it into (mostly) one file per function,
and ensures the same API is exposed from both libraries, adding stub
functions as necessary.
This commit also removes `-lwasi-emulated-pthread` as well as
`-D_WASI_EMULATED_PTHREAD` and enables this functionality
unconditionally, seeing as this is necessary for building libc++ with
threading enabled.
It adds a flag `-D_WASI_STRICT_PTHREAD` that causes thread creation
functions (`pthread_create`, `pthread_detach`, `pthread_join`) to
be defined as a macro causing a compile error, which can be used to
locate the parts of a codebase requiring changes for the single thread
model.
Specifically, after this commit, the two targets `wasm32-wasip1` and
`wasm32-wasip1-threads` differ as follows (cleaned up for clarity):
--- expected/wasm32-wasip1/defined-symbols.txt
+++ expected/wasm32-wasip1-threads/defined-symbols.txt
+flockfile
+ftrylockfile
+funlockfile
+sem_destroy
+sem_getvalue
+sem_init
+sem_post
+sem_timedwait
+sem_trywait
+sem_wait
+thrd_detach
+wasi_thread_start
--- expected/wasm32-wasip1/predefined-macros.txt
+++ expected/wasm32-wasip1-threads/predefined-macros.txt
+#define _REENTRANT 1
+#define SEM_NSEMS_MAX 256
+#define SEM_VALUE_MAX 0x7fffffff
+#define __wasm_atomics__ 1
+#define __wasm_bulk_memory__ 11 parent 50ae119 commit 1440cae
File tree
46 files changed
+1023
-1007
lines changed- expected
- wasm32-wasip1
- wasm32-wasip2
- libc-top-half/musl/include
- stub-pthreads
- thread-stub
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+1023
-1007
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | 141 | | |
144 | 142 | | |
145 | 143 | | |
| |||
373 | 371 | | |
374 | 372 | | |
375 | 373 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
382 | 406 | | |
383 | 407 | | |
384 | 408 | | |
| |||
505 | 529 | | |
506 | 530 | | |
507 | 531 | | |
508 | | - | |
509 | 532 | | |
510 | 533 | | |
511 | 534 | | |
| |||
529 | 552 | | |
530 | 553 | | |
531 | 554 | | |
532 | | - | |
533 | 555 | | |
534 | 556 | | |
535 | 557 | | |
| |||
546 | 568 | | |
547 | 569 | | |
548 | 570 | | |
549 | | - | |
550 | 571 | | |
551 | 572 | | |
552 | 573 | | |
| |||
646 | 667 | | |
647 | 668 | | |
648 | 669 | | |
649 | | - | |
650 | | - | |
651 | 670 | | |
652 | 671 | | |
653 | 672 | | |
| |||
666 | 685 | | |
667 | 686 | | |
668 | 687 | | |
669 | | - | |
670 | | - | |
671 | 688 | | |
672 | 689 | | |
673 | 690 | | |
| |||
770 | 787 | | |
771 | 788 | | |
772 | 789 | | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | 790 | | |
780 | 791 | | |
781 | 792 | | |
| |||
816 | 827 | | |
817 | 828 | | |
818 | 829 | | |
819 | | - | |
820 | 830 | | |
821 | 831 | | |
822 | 832 | | |
| |||
835 | 845 | | |
836 | 846 | | |
837 | 847 | | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | 848 | | |
843 | 849 | | |
844 | 850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | 185 | | |
187 | 186 | | |
188 | 187 | | |
189 | | - | |
190 | 188 | | |
191 | 189 | | |
192 | 190 | | |
193 | 191 | | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
991 | 990 | | |
992 | 991 | | |
993 | 992 | | |
994 | | - | |
| 993 | + | |
995 | 994 | | |
996 | 995 | | |
997 | 996 | | |
998 | 997 | | |
999 | 998 | | |
1000 | 999 | | |
| 1000 | + | |
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
| |||
0 commit comments