diff --git a/ChangeLog.md b/ChangeLog.md index 1f669df95e636..2adebfb0da10d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works. 4.0.13 (in development) ----------------------- +- emcc will now error if `MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION` is used + when not generating html output. This was always incompatible but previously + ignored. (#24849) 4.0.12 - 08/01/25 ----------------- diff --git a/site/source/docs/tools_reference/settings_reference.rst b/site/source/docs/tools_reference/settings_reference.rst index 4597d3c8c67b0..d8e7116976217 100644 --- a/site/source/docs/tools_reference/settings_reference.rst +++ b/site/source/docs/tools_reference/settings_reference.rst @@ -2954,6 +2954,7 @@ For large .wasm modules and production environments, this should be set to 1 for faster startup speeds. However this setting is disabled by default since it requires server side configuration and for really small pages there is no observable difference (also has a ~100 byte impact to code size) +This setting is only compatible with html output. Default value: false diff --git a/src/settings.js b/src/settings.js index 4ebb276ea88f3..c5d63adf9414e 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1938,6 +1938,7 @@ var MINIMAL_RUNTIME = 0; // for faster startup speeds. However this setting is disabled by default // since it requires server side configuration and for really small pages there // is no observable difference (also has a ~100 byte impact to code size) +// This setting is only compatible with html output. // [link] var MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION = false; diff --git a/test/test_core.py b/test/test_core.py index b8074cc94b0d4..eab7c7ca2f232 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -8789,16 +8789,13 @@ def test_no_declare_asm_module_exports(self): @no_modularize_instance('MODULARIZE=instance is not compatible with MINIMAL_RUNTIME') @parameterized({ 'default': ([],), - 'streaming': (['-sMINIMAL_RUNTIME_STREAMING_WASM_COMPILATION'],), 'streaming_inst': (['-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION'],), 'no_export': (['-sDECLARE_ASM_MODULE_EXPORTS=0'],), }) @requires_node # TODO: Support for non-Node.js shells under MINIMAL_RUNTIME def test_minimal_runtime_hello_world(self, args): - self.cflags = args - self.set_setting('MINIMAL_RUNTIME') self.maybe_closure() - self.do_runf('small_hello_world.c', 'hello!') + self.do_runf('small_hello_world.c', 'hello!', cflags=['-sMINIMAL_RUNTIME'] + args) # Test that printf() works in MINIMAL_RUNTIME=1 @no_wasmfs('https://github.com/emscripten-core/emscripten/issues/16816') diff --git a/test/test_other.py b/test/test_other.py index 55f92652d26f8..865a5604a65fa 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -1651,6 +1651,16 @@ def test_minimal_runtime_export_all_modularize(self): ''') self.assertContained('libf1\nlibf2\n', self.run_js('main.mjs')) + def test_minimal_runtime_errors(self): + err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME_STREAMING_WASM_COMPILATION']) + self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION requires MINIMAL_RUNTIME', err) + + err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION']) + self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION requires MINIMAL_RUNTIME', err) + + err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME', '-sMINIMAL_RUNTIME_STREAMING_WASM_COMPILATION']) + self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION is only compatible with html output', err) + def test_export_all_and_exported_functions(self): # EXPORT_ALL should not export library functions by default. # This means that to export library function you also need to explicitly diff --git a/tools/link.py b/tools/link.py index 2a40d7a0ff885..b1c6a5b88f6eb 100644 --- a/tools/link.py +++ b/tools/link.py @@ -1057,6 +1057,15 @@ def limit_incoming_module_api(): if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and settings.MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION: exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION are mutually exclusive!') + if settings.MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION and not settings.MINIMAL_RUNTIME: + exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION requires MINIMAL_RUNTIME') + + if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and not settings.MINIMAL_RUNTIME: + exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION requires MINIMAL_RUNTIME') + + if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and options.oformat != OFormat.HTML: + exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION is only compatible with html output') + if options.use_closure_compiler: settings.USE_CLOSURE_COMPILER = 1