Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------
Expand Down
1 change: 1 addition & 0 deletions site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 1 addition & 4 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
10 changes: 10 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down