Skip to content

Commit 1f3aab6

Browse files
authored
WasmFS: Fix preload-files forcing the filesystem (#19562)
The bug fixed here is that the preloading logic for setting FORCE_FILESYSTEM must appear before the WasmFS code that reads it. This just moves code upwards (and enables a test that shows the problem).
1 parent 58707d1 commit 1f3aab6

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

emcc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,6 +2297,12 @@ def phase_linker_setup(options, state, newargs):
22972297
if not settings.GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS and settings.GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS:
22982298
exit_with_error('-sGL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS=0 only makes sense with -sGL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0!')
22992299

2300+
if options.use_preload_plugins or len(options.preload_files) or len(options.embed_files):
2301+
if settings.NODERAWFS:
2302+
exit_with_error('--preload-file and --embed-file cannot be used with NODERAWFS which disables virtual filesystem')
2303+
# if we include any files, or intend to use preload plugins, then we definitely need filesystem support
2304+
settings.FORCE_FILESYSTEM = 1
2305+
23002306
if settings.WASMFS:
23012307
if settings.NODERAWFS:
23022308
# wasmfs will be included normally in system_libs.py, but we must include
@@ -2374,12 +2380,6 @@ def phase_linker_setup(options, state, newargs):
23742380
if settings.SIDE_MODULE and 'GLOBAL_BASE' in user_settings:
23752381
exit_with_error('GLOBAL_BASE is not compatible with SIDE_MODULE')
23762382

2377-
if options.use_preload_plugins or len(options.preload_files) or len(options.embed_files):
2378-
if settings.NODERAWFS:
2379-
exit_with_error('--preload-file and --embed-file cannot be used with NODERAWFS which disables virtual filesystem')
2380-
# if we include any files, or intend to use preload plugins, then we definitely need filesystem support
2381-
settings.FORCE_FILESYSTEM = 1
2382-
23832383
if settings.PROXY_TO_WORKER or options.use_preload_plugins:
23842384
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += ['$Browser']
23852385

test/test_browser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,6 +3525,7 @@ def test_modularize_init_error(self):
35253525

35263526
# test illustrating the regression on the modularize feature since commit c5af8f6
35273527
# when compiling with the --preload-file option
3528+
@also_with_wasmfs
35283529
def test_modularize_and_preload_files(self):
35293530
self.set_setting('EXIT_RUNTIME')
35303531
# TODO(sbc): Fix closure warnings with MODULARIZE + WASM=0

0 commit comments

Comments
 (0)