@@ -62,6 +62,8 @@ def get_cflags(force_object_files=False):
62
62
flags += ['-flto=' + shared .Settings .LTO ]
63
63
if shared .Settings .RELOCATABLE :
64
64
flags += ['-s' , 'RELOCATABLE' ]
65
+ if shared .Settings .USE_PTHREADS :
66
+ flags += ['-s' , 'USE_PTHREADS' ]
65
67
return flags
66
68
67
69
@@ -635,7 +637,7 @@ def get_default_variation(cls, **kwargs):
635
637
return super (AsanInstrumentedLibrary , cls ).get_default_variation (is_asan = shared .Settings .USE_ASAN , ** kwargs )
636
638
637
639
638
- class libcompiler_rt (MTLibrary ):
640
+ class libcompiler_rt (Library ):
639
641
name = 'libcompiler_rt'
640
642
# compiler_rt files can't currently be part of LTO although we are hoping to remove this
641
643
# restriction soon: https://reviews.llvm.org/D71738
@@ -649,7 +651,7 @@ class libcompiler_rt(MTLibrary):
649
651
src_files .append (shared .path_from_root ('system' , 'lib' , 'compiler-rt' , 'emscripten_exception_builtins.c' ))
650
652
651
653
652
- class libc (AsanInstrumentedLibrary , MuslInternalLibrary , MTLibrary ):
654
+ class libc (AsanInstrumentedLibrary , MuslInternalLibrary ):
653
655
name = 'libc'
654
656
655
657
# Without -fno-builtin, LLVM can optimize away or convert calls to library
@@ -760,7 +762,7 @@ def get_files(self):
760
762
filenames = ['vfprintf.c' ])
761
763
762
764
763
- class libsockets (MuslInternalLibrary , MTLibrary ):
765
+ class libsockets (MuslInternalLibrary ):
764
766
name = 'libsockets'
765
767
766
768
cflags = ['-Os' , '-fno-builtin' ]
@@ -770,7 +772,7 @@ def get_files(self):
770
772
return [os .path .join (network_dir , x ) for x in LIBC_SOCKETS ]
771
773
772
774
773
- class libsockets_proxy (MuslInternalLibrary , MTLibrary ):
775
+ class libsockets_proxy (MuslInternalLibrary ):
774
776
name = 'libsockets_proxy'
775
777
776
778
cflags = ['-Os' ]
@@ -810,7 +812,7 @@ def can_use(self):
810
812
return super (crt1_reactor , self ).can_use () and shared .Settings .STANDALONE_WASM
811
813
812
814
813
- class libcxxabi (NoExceptLibrary , MTLibrary ):
815
+ class libcxxabi (NoExceptLibrary ):
814
816
name = 'libc++abi'
815
817
cflags = [
816
818
'-Oz' ,
@@ -823,7 +825,7 @@ class libcxxabi(NoExceptLibrary, MTLibrary):
823
825
def get_cflags (self ):
824
826
cflags = super (libcxxabi , self ).get_cflags ()
825
827
cflags .append ('-DNDEBUG' )
826
- if not self . is_mt :
828
+ if shared . Settings . USE_PTHREADS == 0 :
827
829
cflags .append ('-D_LIBCXXABI_HAS_NO_THREADS' )
828
830
if self .eh_mode == exceptions .none :
829
831
cflags .append ('-D_LIBCXXABI_NO_EXCEPTIONS' )
@@ -863,7 +865,7 @@ def get_files(self):
863
865
filenames = filenames )
864
866
865
867
866
- class libcxx (NoExceptLibrary , MTLibrary ):
868
+ class libcxx (NoExceptLibrary ):
867
869
name = 'libc++'
868
870
869
871
cflags = ['-DLIBCXX_BUILDING_LIBCXXABI=1' , '-D_LIBCPP_BUILDING_LIBRARY' , '-Oz' ,
@@ -910,7 +912,7 @@ class libcxx(NoExceptLibrary, MTLibrary):
910
912
]
911
913
912
914
913
- class libunwind (NoExceptLibrary , MTLibrary ):
915
+ class libunwind (NoExceptLibrary ):
914
916
name = 'libunwind'
915
917
cflags = ['-Oz' , '-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS' ]
916
918
src_dir = ['system' , 'lib' , 'libunwind' , 'src' ]
@@ -925,7 +927,7 @@ def can_use(self):
925
927
def get_cflags (self ):
926
928
cflags = super (libunwind , self ).get_cflags ()
927
929
cflags .append ('-DNDEBUG' )
928
- if not self . is_mt :
930
+ if shared . Settings . USE_PTHREADS == 0 :
929
931
cflags .append ('-D_LIBUNWIND_HAS_NO_THREADS' )
930
932
if self .eh_mode == exceptions .none :
931
933
cflags .append ('-D_LIBUNWIND_HAS_NO_EXCEPTIONS' )
@@ -936,7 +938,7 @@ def get_cflags(self):
936
938
return cflags
937
939
938
940
939
- class libmalloc (MTLibrary ):
941
+ class libmalloc (Library ):
940
942
name = 'libmalloc'
941
943
942
944
cflags = ['-O2' , '-fno-builtin' ]
@@ -1024,7 +1026,7 @@ class libal(Library):
1024
1026
src_files = ['al.c' ]
1025
1027
1026
1028
1027
- class libgl (MTLibrary ):
1029
+ class libgl (Library ):
1028
1030
name = 'libgl'
1029
1031
1030
1032
src_dir = ['system' , 'lib' , 'gl' ]
@@ -1078,15 +1080,15 @@ def get_default_variation(cls, **kwargs):
1078
1080
)
1079
1081
1080
1082
1081
- class libwebgpu_cpp (MTLibrary ):
1083
+ class libwebgpu_cpp (Library ):
1082
1084
name = 'libwebgpu_cpp'
1083
1085
1084
1086
cflags = ['-std=c++11' , '-O2' ]
1085
1087
src_dir = ['system' , 'lib' , 'webgpu' ]
1086
1088
src_files = ['webgpu_cpp.cpp' ]
1087
1089
1088
1090
1089
- class libembind (MTLibrary ):
1091
+ class libembind (Library ):
1090
1092
name = 'libembind'
1091
1093
never_force = True
1092
1094
@@ -1118,15 +1120,15 @@ def get_default_variation(cls, **kwargs):
1118
1120
return super (libembind , cls ).get_default_variation (with_rtti = shared .Settings .USE_RTTI , ** kwargs )
1119
1121
1120
1122
1121
- class libfetch (MTLibrary ):
1123
+ class libfetch (Library ):
1122
1124
name = 'libfetch'
1123
1125
never_force = True
1124
1126
1125
1127
def get_files (self ):
1126
1128
return [shared .path_from_root ('system' , 'lib' , 'fetch' , 'emscripten_fetch.cpp' )]
1127
1129
1128
1130
1129
- class libasmfs (MTLibrary ):
1131
+ class libasmfs (Library ):
1130
1132
name = 'libasmfs'
1131
1133
never_force = True
1132
1134
@@ -1147,12 +1149,12 @@ class libhtml5(Library):
1147
1149
src_glob = '*.c'
1148
1150
1149
1151
1150
- class libpthread (AsanInstrumentedLibrary , MuslInternalLibrary , MTLibrary ):
1152
+ class libpthread (AsanInstrumentedLibrary , MuslInternalLibrary ):
1151
1153
name = 'libpthread'
1152
1154
cflags = ['-O2' ]
1153
1155
1154
1156
def get_files (self ):
1155
- if self . is_mt :
1157
+ if shared . Settings . USE_PTHREADS :
1156
1158
files = files_in_path (
1157
1159
path_components = ['system' , 'lib' , 'libc' , 'musl' , 'src' , 'thread' ],
1158
1160
filenames = [
@@ -1196,7 +1198,7 @@ def get_files(self):
1196
1198
return [shared .path_from_root ('system' , 'lib' , 'pthread' , 'library_pthread_stub.c' )]
1197
1199
1198
1200
def get_base_name_prefix (self ):
1199
- return 'libpthread' if self . is_mt else 'libpthread_stub'
1201
+ return 'libpthread' if shared . Settings . USE_PTHREADS else 'libpthread_stub'
1200
1202
1201
1203
1202
1204
class CompilerRTLibrary (Library ):
@@ -1206,14 +1208,14 @@ class CompilerRTLibrary(Library):
1206
1208
force_object_files = True
1207
1209
1208
1210
1209
- class libc_rt_wasm (AsanInstrumentedLibrary , CompilerRTLibrary , MuslInternalLibrary , MTLibrary ):
1211
+ class libc_rt_wasm (AsanInstrumentedLibrary , CompilerRTLibrary , MuslInternalLibrary ):
1210
1212
name = 'libc_rt_wasm'
1211
1213
1212
1214
def get_files (self ):
1213
1215
return get_wasm_libc_rt_files ()
1214
1216
1215
1217
1216
- class libubsan_minimal_rt_wasm (CompilerRTLibrary , MTLibrary ):
1218
+ class libubsan_minimal_rt_wasm (CompilerRTLibrary ):
1217
1219
name = 'libubsan_minimal_rt_wasm'
1218
1220
never_force = True
1219
1221
@@ -1222,7 +1224,7 @@ class libubsan_minimal_rt_wasm(CompilerRTLibrary, MTLibrary):
1222
1224
src_files = ['ubsan_minimal_handlers.cpp' ]
1223
1225
1224
1226
1225
- class libsanitizer_common_rt (CompilerRTLibrary , MTLibrary ):
1227
+ class libsanitizer_common_rt (CompilerRTLibrary ):
1226
1228
name = 'libsanitizer_common_rt'
1227
1229
includes = [['system' , 'lib' , 'libc' , 'musl' , 'src' , 'internal' ],
1228
1230
['system' , 'lib' , 'compiler-rt' , 'lib' ]]
@@ -1233,7 +1235,7 @@ class libsanitizer_common_rt(CompilerRTLibrary, MTLibrary):
1233
1235
src_glob_exclude = ['sanitizer_common_nolibc.cpp' ]
1234
1236
1235
1237
1236
- class SanitizerLibrary (CompilerRTLibrary , MTLibrary ):
1238
+ class SanitizerLibrary (CompilerRTLibrary ):
1237
1239
never_force = True
1238
1240
1239
1241
includes = [['system' , 'lib' , 'compiler-rt' , 'lib' ]]
@@ -1268,7 +1270,7 @@ class libasan_rt(SanitizerLibrary):
1268
1270
src_dir = ['system' , 'lib' , 'compiler-rt' , 'lib' , 'asan' ]
1269
1271
1270
1272
1271
- class libasan_js (MTLibrary ):
1273
+ class libasan_js (Library ):
1272
1274
name = 'libasan_js'
1273
1275
1274
1276
cflags = ['-fsanitize=address' ]
0 commit comments