diff --git a/sdks/wasm/Makefile b/sdks/wasm/Makefile index c52364d308c1..e213b2cbde36 100644 --- a/sdks/wasm/Makefile +++ b/sdks/wasm/Makefile @@ -375,7 +375,7 @@ build-debug-sample: debug_sample/dotnet.js TEST_ASSEMBLIES = $(WASM_BCL_DIR)/nunitlite.dll $(WASM_BCL_DIR)/tests/wasm_corlib_test.dll $(WASM_BCL_DIR)/tests/wasm_System_test.dll $(WASM_BCL_DIR)/tests/wasm_System.Core_test.dll build-test-suite: packager.exe $(WASM_FRAMEWORK)/.stamp-framework binding_tests.dll mini_tests.dll main.exe runtime-tests.js - $(PACKAGER) --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --template=runtime-tests.js --appdir=bin/test-suite --builddir=obj/test-suite --asset=tests/runtime/index.html binding_tests.dll mini_tests.dll main.exe $(TEST_ASSEMBLIES) --linker + $(PACKAGER) --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --template=runtime-tests.js --appdir=bin/test-suite --builddir=obj/test-suite --asset=tests/runtime/index.html binding_tests.dll mini_tests.dll main.exe $(TEST_ASSEMBLIES) --linker --no-linker-exclude-deserialization ninja -v -C obj/test-suite XUNIT_DIR = $(TOP)/external/xunit-binaries diff --git a/sdks/wasm/packager.cs b/sdks/wasm/packager.cs index a2ce79d67b7b..a9f4ae17f751 100644 --- a/sdks/wasm/packager.cs +++ b/sdks/wasm/packager.cs @@ -370,6 +370,7 @@ class WasmOptions { public bool NativeStrip; public bool Simd; public bool EnableDynamicRuntime; + public bool LinkerExcludeDeserialization; } int Run (string[] args) { @@ -429,7 +430,8 @@ int Run (string[] args) { EnableFS = false, NativeStrip = true, Simd = false, - EnableDynamicRuntime = false + EnableDynamicRuntime = false, + LinkerExcludeDeserialization = true }; var p = new OptionSet () { @@ -475,6 +477,7 @@ int Run (string[] args) { AddFlag (p, new BoolFlag ("dynamic-runtime", "enable dynamic runtime (support for Emscripten's dlopen)", opts.EnableDynamicRuntime, b => opts.EnableDynamicRuntime = b)); AddFlag (p, new BoolFlag ("native-strip", "strip final executable", opts.NativeStrip, b => opts.NativeStrip = b)); AddFlag (p, new BoolFlag ("simd", "enable SIMD support", opts.Simd, b => opts.Simd = b)); + AddFlag (p, new BoolFlag ("linker-exclude-deserialization", "Link out .NET deserialization support", opts.LinkerExcludeDeserialization, b => opts.LinkerExcludeDeserialization = b)); var new_args = p.Parse (args).ToArray (); foreach (var a in new_args) { @@ -1109,6 +1112,8 @@ int Run (string[] args) { linker_args += "--used-attrs-only true "; linker_args += "--substitutions linker-subs.xml "; linker_infiles += "| linker-subs.xml"; + if (opts.LinkerExcludeDeserialization) + linker_args += "--exclude-feature deserialization "; if (!string.IsNullOrEmpty (linkDescriptor)) { linker_args += $"-x {linkDescriptor} "; foreach (var assembly in root_assemblies) {