Skip to content

Commit

Permalink
[wasm] Pass --exclude-feature deserialization to the linker. (mono#19031
Browse files Browse the repository at this point in the history
)

* [wasm] Pass --exclude-feature deserialization to the linker.

* Add a --linker-exclude-deserialization packager option.
  • Loading branch information
vargaz authored Feb 29, 2020
1 parent 1a6eb5a commit 89902e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sdks/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion sdks/wasm/packager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ class WasmOptions {
public bool NativeStrip;
public bool Simd;
public bool EnableDynamicRuntime;
public bool LinkerExcludeDeserialization;
}

int Run (string[] args) {
Expand Down Expand Up @@ -429,7 +430,8 @@ int Run (string[] args) {
EnableFS = false,
NativeStrip = true,
Simd = false,
EnableDynamicRuntime = false
EnableDynamicRuntime = false,
LinkerExcludeDeserialization = true
};

var p = new OptionSet () {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 89902e8

Please sign in to comment.