Skip to content

Commit c18ffa3

Browse files
committed
Simplify stub pthread library. NFC
The dylink_all test contains a few extra functions that were previously just not included.
1 parent 71d627a commit c18ffa3

3 files changed

Lines changed: 20 additions & 55 deletions

File tree

system/lib/pthread/library_pthread_stub.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ void __lock(void* ptr) {}
5555

5656
void __unlock(void* ptr) {}
5757

58+
void __inhibit_ptc() {}
59+
5860
void __acquire_ptc() {}
5961

6062
void __release_ptc() {}

test/codesize/test_codesize_hello_dylink_all.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"a.out.js": 267889,
3-
"a.out.nodebug.wasm": 587151,
4-
"total": 855040,
3+
"a.out.nodebug.wasm": 587563,
4+
"total": 855452,
55
"sent": [
66
"IMG_Init",
77
"IMG_Load",
@@ -3206,6 +3206,7 @@
32063206
"pthread_detach",
32073207
"pthread_equal",
32083208
"pthread_exit",
3209+
"pthread_getattr_default_np",
32093210
"pthread_getattr_np",
32103211
"pthread_getconcurrency",
32113212
"pthread_getcpuclockid",
@@ -3230,6 +3231,7 @@
32303231
"pthread_mutexattr_init",
32313232
"pthread_mutexattr_setprotocol",
32323233
"pthread_mutexattr_setpshared",
3234+
"pthread_mutexattr_setrobust",
32333235
"pthread_mutexattr_settype",
32343236
"pthread_once",
32353237
"pthread_rwlock_destroy",
@@ -3246,6 +3248,7 @@
32463248
"pthread_rwlockattr_init",
32473249
"pthread_rwlockattr_setpshared",
32483250
"pthread_self",
3251+
"pthread_setattr_default_np",
32493252
"pthread_setcancelstate",
32503253
"pthread_setcanceltype",
32513254
"pthread_setconcurrency",
@@ -4960,6 +4963,7 @@
49604963
"$pthread_condattr_setclock",
49614964
"$pthread_condattr_setpshared",
49624965
"$pthread_equal",
4966+
"$pthread_getattr_default_np",
49634967
"$pthread_getattr_np",
49644968
"$pthread_getcpuclockid",
49654969
"$pthread_getspecific",
@@ -4970,8 +4974,10 @@
49704974
"$pthread_mutexattr_gettype",
49714975
"$pthread_mutexattr_setprotocol",
49724976
"$pthread_mutexattr_setpshared",
4977+
"$pthread_mutexattr_setrobust",
49734978
"$pthread_mutexattr_settype",
49744979
"$pthread_rwlockattr_init",
4980+
"$pthread_setattr_default_np",
49754981
"$pthread_setspecific",
49764982
"$pthread_sigmask",
49774983
"$pthread_spin_init",

tools/system_libs.py

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,73 +1247,30 @@ def get_files(self):
12471247
'pthread_self_stub.c',
12481248
'proxying_stub.c',
12491249
])
1250+
1251+
for pat in ('pthread_*attr*.c',
1252+
'pthread_spin*.c',
1253+
# C11 thread library functions
1254+
'cnd_*.c',
1255+
'mtx_*.c',
1256+
'tss_*.c',
1257+
'thrd_*.c'):
1258+
libc_files += glob_in_path('system/lib/libc/musl/src/thread', pat)
1259+
12501260
libc_files += files_in_path(
12511261
path='system/lib/libc/musl/src/thread',
12521262
filenames=[
12531263
'pthread_self.c',
12541264
'pthread_cleanup_push.c',
1255-
'pthread_attr_init.c',
1256-
'pthread_attr_destroy.c',
1257-
'pthread_attr_get.c',
1258-
'pthread_attr_setdetachstate.c',
1259-
'pthread_attr_setguardsize.c',
1260-
'pthread_attr_setinheritsched.c',
1261-
'pthread_attr_setschedparam.c',
1262-
'pthread_attr_setschedpolicy.c',
1263-
'pthread_attr_setscope.c',
1264-
'pthread_attr_setstack.c',
1265-
'pthread_attr_setstacksize.c',
1266-
'pthread_barrierattr_destroy.c',
1267-
'pthread_barrierattr_init.c',
1268-
'pthread_barrierattr_setpshared.c',
1269-
'pthread_condattr_destroy.c',
1270-
'pthread_condattr_init.c',
1271-
'pthread_condattr_setpshared.c',
1272-
'pthread_condattr_setclock.c',
1273-
'pthread_mutexattr_destroy.c',
1274-
'pthread_mutexattr_init.c',
1275-
'pthread_mutexattr_setprotocol.c',
1276-
'pthread_mutexattr_settype.c',
1277-
'pthread_mutexattr_setpshared.c',
1278-
'pthread_rwlockattr_destroy.c',
1279-
'pthread_rwlockattr_init.c',
1280-
'pthread_rwlockattr_setpshared.c',
1281-
'pthread_getattr_np.c',
12821265
'pthread_getconcurrency.c',
12831266
'pthread_getcpuclockid.c',
12841267
'pthread_getschedparam.c',
1285-
'pthread_spin_destroy.c',
1286-
'pthread_spin_init.c',
1287-
'pthread_spin_lock.c',
1288-
'pthread_spin_trylock.c',
1289-
'pthread_spin_unlock.c',
12901268
'pthread_setschedprio.c',
12911269
'pthread_setconcurrency.c',
12921270
'default_attr.c',
1293-
# C11 thread library functions
12941271
'call_once.c',
1295-
'tss_create.c',
1296-
'tss_delete.c',
1297-
'tss_set.c',
1298-
'cnd_broadcast.c',
1299-
'cnd_destroy.c',
1300-
'cnd_init.c',
1301-
'cnd_signal.c',
1302-
'cnd_timedwait.c',
1303-
'cnd_wait.c',
1304-
'mtx_destroy.c',
1305-
'mtx_init.c',
1306-
'mtx_lock.c',
1307-
'mtx_timedlock.c',
1308-
'mtx_trylock.c',
1309-
'mtx_unlock.c',
13101272
'sem_destroy.c',
13111273
'sem_init.c',
1312-
'thrd_create.c',
1313-
'thrd_exit.c',
1314-
'thrd_join.c',
1315-
'thrd_sleep.c',
1316-
'thrd_yield.c',
13171274
])
13181275

13191276
if self.is_mt or self.is_ww:

0 commit comments

Comments
 (0)