Skip to content

Commit 7b00b48

Browse files
authored
Disable building of wasm worker + dylink libraries. NFC (#26476)
Dynamic linking (PIC) is not yet supported for WASM_WORKERS. Without this change `./embuilder build libc-ww-debug --pic` could work, and `./embuild build ALL --pic` would include it, even though its not a reasonable combination.
1 parent 8097250 commit 7b00b48

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

embuilder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ def main():
236236

237237
if args.pic:
238238
settings.MAIN_MODULE = 1
239+
# Note: we have to filter out the `-ww` libraries here because wasm workers don't
240+
# support dynamic linking.
241+
global MINIMAL_TASKS
242+
global MINIMAL_PIC_TASKS
243+
MINIMAL_TASKS = [t for t in MINIMAL_TASKS if '-ww' not in t]
244+
MINIMAL_PIC_TASKS = [t for t in MINIMAL_PIC_TASKS if '-ww' not in t]
239245

240246
if args.wasm64:
241247
settings.MEMORY64 = 1

src/lib/libwasm_worker.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#if LINKABLE
1616
#error "-sLINKABLE is not supported with -sWASM_WORKERS"
1717
#endif
18-
#if MAIN_MODULE
19-
#error "dynamic linking is not supported with -sWASM_WORKERS"
20-
#endif
2118
#if WASM2JS && MODULARIZE
2219
#error "-sWASM=0 + -sMODULARIZE + -sWASM_WORKERS is not supported"
2320
#endif

tools/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
# List of incompatible settings, of the form (SETTINGS_A, SETTING_B, OPTIONAL_REASON_FOR_INCOMPAT)
126126
INCOMPATIBLE_SETTINGS = [
127127
('MINIMAL_RUNTIME', 'MAIN_MODULE', None),
128+
('WASM_WORKERS', 'MAIN_MODULE', 'dynamic linking is not supported with -sWASM_WORKERS'),
128129
('WASM2JS', 'MAIN_MODULE', 'wasm2js does not support dynamic linking'),
129130
('WASM2JS', 'SIDE_MODULE', 'wasm2js does not support dynamic linking'),
130131
('MODULARIZE', 'NO_DECLARE_ASM_MODULE_EXPORTS', None),

tools/system_libs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,10 @@ def variations(cls):
746746
# These are mutually exclusive, only one flag will be set at any give time.
747747
return [combo for combo in combos if not combo['is_mt'] or not combo['is_ww']]
748748

749+
def can_build(self):
750+
# Wasm workers do not support dynamic linking.
751+
return super().can_build() and not (settings.MAIN_MODULE and self.is_ww)
752+
749753

750754
class DebugLibrary(Library):
751755
def __init__(self, **kwargs):

0 commit comments

Comments
 (0)