Skip to content

Commit 27bb0c1

Browse files
authored
Build libwasm_worker with standard cflags (#19317)
Split out from #19263
1 parent dd5ae0f commit 27bb0c1

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

system/lib/wasm_worker/library_wasm_worker.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ emscripten_wasm_worker_t emscripten_create_wasm_worker(void *stackLowestAddress,
4343
// We expect TLS area to need to be at most 16 bytes aligned
4444
assert(__builtin_wasm_tls_align() == 0 || 16 % __builtin_wasm_tls_align() == 0);
4545

46+
#ifndef NDEBUG
4647
uint32_t tlsSize = (__builtin_wasm_tls_size() + 15) & -16;
4748
assert(stackSize > tlsSize);
49+
#endif
4850

4951
return _emscripten_create_wasm_worker(stackLowestAddress, stackSize);
5052
}

tools/system_libs.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,22 +1333,25 @@ def can_use(self):
13331333

13341334

13351335
class libwasm_workers(MTLibrary):
1336+
name = 'libwasm_workers'
1337+
13361338
def __init__(self, **kwargs):
13371339
self.debug = kwargs.pop('debug')
13381340
super().__init__(**kwargs)
13391341

1340-
name = 'libwasm_workers'
1341-
13421342
def get_cflags(self):
1343-
cflags = get_base_cflags() + ['-D_DEBUG' if self.debug else '-Oz']
1343+
cflags = super().get_cflags()
13441344
if self.debug:
1345+
cflags += ['-D_DEBUG']
13451346
# library_wasm_worker.c contains an assert that a nonnull paramater
13461347
# is no NULL, which llvm now warns is redundant/tautological.
13471348
cflags += ['-Wno-tautological-pointer-compare']
1349+
# Override the `-O2` default. Building library_wasm_worker.c with
1350+
# `-O1` or `-O2` currently causes tests to fail.
1351+
# https://github.com/emscripten-core/emscripten/issues/19331
1352+
cflags += ['-O0']
13481353
else:
1349-
cflags += ['-DNDEBUG']
1350-
if self.is_ww or self.is_mt:
1351-
cflags += ['-pthread', '-sWASM_WORKERS']
1354+
cflags += ['-DNDEBUG', '-Oz']
13521355
if settings.MAIN_MODULE:
13531356
cflags += ['-fPIC']
13541357
return cflags

0 commit comments

Comments
 (0)