From 6adf418cb30e9a5a2944e86260a40890e242ab25 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 29 Sep 2021 13:08:07 -0700 Subject: [PATCH] Move WASMFS linking hack to emcc.py --- emcc.py | 3 +++ tests/common.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/emcc.py b/emcc.py index 9ae48ab398e74..5e7f55f35c968 100755 --- a/emcc.py +++ b/emcc.py @@ -2506,6 +2506,9 @@ def phase_calculate_system_libraries(state, linker_arguments, linker_inputs, new # unless running in strict mode. if not settings.STRICT and '-nostdlib++' not in newargs: settings.LINK_AS_CXX = True + # WASMFS itself is written in C++, and needs C++ standard libraries + if settings.WASMFS: + settings.LINK_AS_CXX = True extra_files_to_link += system_libs.calculate([f for _, f in sorted(linker_inputs)] + extra_files_to_link, forced=state.forced_stdlibs) linker_arguments.extend(extra_files_to_link) diff --git a/tests/common.py b/tests/common.py index 53eeb6f8ce1a3..63f5abf9e2725 100644 --- a/tests/common.py +++ b/tests/common.py @@ -551,7 +551,7 @@ def verify_es5(self, filename): def build(self, filename, libraries=[], includes=[], force_c=False, js_outfile=True, emcc_args=[], output_basename=None): suffix = '.js' if js_outfile else '.wasm' compiler = [compiler_for(filename, force_c)] - if compiler[0] == EMCC and not self.get_setting('WASMFS'): + if compiler[0] == EMCC: # TODO change test behaviour in the future when WASMFS becomes default file system # WASMFS is excluded here since it currently requires stdlib++ functions # TODO(https://github.com/emscripten-core/emscripten/issues/11121)