File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
libc-top-half/musl/src/env Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ __getopt_msg
90
90
__gmtime_r
91
91
__hwcap
92
92
__inet_aton
93
+ __init_tp
93
94
__intscan
94
95
__invtrigl_R
95
96
__isalnum_l
@@ -324,6 +325,7 @@ __wasi_fd_seek
324
325
__wasi_fd_sync
325
326
__wasi_fd_tell
326
327
__wasi_fd_write
328
+ __wasi_init_tp
327
329
__wasi_path_create_directory
328
330
__wasi_path_filestat_get
329
331
__wasi_path_filestat_set_times
Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ __wasi_fd_seek
275
275
__wasi_fd_sync
276
276
__wasi_fd_tell
277
277
__wasi_fd_write
278
+ __wasi_init_tp
278
279
__wasi_path_create_directory
279
280
__wasi_path_filestat_get
280
281
__wasi_path_filestat_set_times
Original file line number Diff line number Diff line change
1
+ #include "libc.h"
1
2
#include <wasi/api.h>
2
3
extern void __wasm_call_ctors (void );
3
4
extern int __main_void (void );
@@ -7,6 +8,11 @@ extern void __wasm_call_dtors(void);
7
8
// that the `_start` function isn't started more than once.
8
9
static volatile int started = 0 ;
9
10
11
+ static void dummy_0 ()
12
+ {
13
+ }
14
+ weak_alias (dummy_0 , __wasi_init_tp );
15
+
10
16
__attribute__((export_name ("_start" )))
11
17
void _start (void ) {
12
18
// Don't allow the program to be called multiple times.
@@ -15,6 +21,8 @@ void _start(void) {
15
21
}
16
22
started = 1 ;
17
23
24
+ __wasi_init_tp ();
25
+
18
26
// The linker synthesizes this to call constructors.
19
27
__wasm_call_ctors ();
20
28
Original file line number Diff line number Diff line change 15
15
16
16
volatile int __thread_list_lock ;
17
17
18
- #ifdef __wasilibc_unmodified_upstream
18
+ #ifndef __wasilibc_unmodified_upstream
19
+ void __wasi_init_tp () {
20
+ __init_tp ((void * )__get_tp ());
21
+ }
22
+ #endif
23
+
19
24
int __init_tp (void * p )
20
25
{
21
26
pthread_t td = p ;
22
27
td -> self = td ;
28
+ #ifdef __wasilibc_unmodified_upstream
23
29
int r = __set_thread_area (TP_ADJ (p ));
24
30
if (r < 0 ) return -1 ;
25
31
if (!r ) libc .can_do_threads = 1 ;
26
32
td -> detach_state = DT_JOINABLE ;
27
33
td -> tid = __syscall (SYS_set_tid_address , & __thread_list_lock );
34
+ #endif
28
35
td -> locale = & libc .global_locale ;
29
36
td -> robust_list .head = & td -> robust_list .head ;
30
37
td -> sysinfo = __sysinfo ;
31
38
td -> next = td -> prev = td ;
32
39
return 0 ;
33
40
}
34
41
42
+ #ifdef __wasilibc_unmodified_upstream
43
+
35
44
static struct builtin_tls {
36
45
char c ;
37
46
struct pthread pt ;
You can’t perform that action at this time.
0 commit comments