Commit 3f7eb4c
authored
Refactor stub pthread library and enable unconditionally (#602)
This PR 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 PR 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):
```diff
--- 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
+wasi_thread_start
```
```diff
--- 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__ 1
```1 parent db46bf7 commit 3f7eb4c
File tree
46 files changed
+388
-369
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
+388
-369
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 | | |
| |||
1221 | 1221 | | |
1222 | 1222 | | |
1223 | 1223 | | |
| 1224 | + | |
1224 | 1225 | | |
1225 | 1226 | | |
1226 | 1227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2252 | 2252 | | |
2253 | 2253 | | |
2254 | 2254 | | |
| 2255 | + | |
| 2256 | + | |
2255 | 2257 | | |
2256 | 2258 | | |
| 2259 | + | |
| 2260 | + | |
2257 | 2261 | | |
2258 | 2262 | | |
2259 | 2263 | | |
| |||
3430 | 3434 | | |
3431 | 3435 | | |
3432 | 3436 | | |
3433 | | - | |
3434 | | - | |
3435 | 3437 | | |
3436 | | - | |
3437 | | - | |
3438 | | - | |
3439 | 3438 | | |
3440 | 3439 | | |
3441 | 3440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | 188 | | |
190 | 189 | | |
191 | 190 | | |
192 | | - | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
196 | 194 | | |
| 195 | + | |
197 | 196 | | |
198 | 197 | | |
199 | 198 | | |
| |||
1127 | 1126 | | |
1128 | 1127 | | |
1129 | 1128 | | |
1130 | | - | |
| 1129 | + | |
1131 | 1130 | | |
1132 | 1131 | | |
1133 | 1132 | | |
1134 | 1133 | | |
1135 | 1134 | | |
1136 | 1135 | | |
| 1136 | + | |
1137 | 1137 | | |
1138 | 1138 | | |
1139 | 1139 | | |
| |||
1457 | 1457 | | |
1458 | 1458 | | |
1459 | 1459 | | |
| 1460 | + | |
1460 | 1461 | | |
1461 | 1462 | | |
1462 | 1463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2403 | 2403 | | |
2404 | 2404 | | |
2405 | 2405 | | |
| 2406 | + | |
| 2407 | + | |
2406 | 2408 | | |
2407 | 2409 | | |
| 2410 | + | |
| 2411 | + | |
2408 | 2412 | | |
2409 | 2413 | | |
2410 | 2414 | | |
| |||
3585 | 3589 | | |
3586 | 3590 | | |
3587 | 3591 | | |
3588 | | - | |
3589 | | - | |
3590 | 3592 | | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
3594 | 3593 | | |
3595 | 3594 | | |
3596 | 3595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
101 | 94 | | |
102 | 95 | | |
103 | 96 | | |
| |||
249 | 242 | | |
250 | 243 | | |
251 | 244 | | |
252 | | - | |
| 245 | + | |
253 | 246 | | |
254 | 247 | | |
255 | 248 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 249 | + | |
| 250 | + | |
262 | 251 | | |
263 | 252 | | |
264 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
| 347 | + | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments