diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c706ca2ad8d52..a843e9e01ce4d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,16 +1,16 @@ - + https://github.com/dotnet/icu - 4f251e7593b1150af58bba4f461698d6d4a1eb95 + cd095b0fb4c6f8adca9e44ef17346b3e13a73a7c https://github.com/dotnet/msquic a7213b4676c1803bb251771291a525482d42e511 - + https://github.com/dotnet/emsdk - b2054b98cb7b9e555cbbe19955df823ec81a93ad + b581f08ff228099e732aa8c8cde53995a5870901 https://github.com/dotnet/wcf diff --git a/eng/Versions.props b/eng/Versions.props index acb9e5910defa..fd4ec195fcbdd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -180,7 +180,7 @@ 7.0.100-1.22078.1 $(MicrosoftNETILLinkTasksVersion) - 7.0.0-preview.2.22081.1 + 7.0.0-preview.2.22101.1 7.0.0-alpha.1.21529.3 @@ -193,7 +193,7 @@ 11.1.0-alpha.1.22081.2 11.1.0-alpha.1.22081.2 - 7.0.0-alpha.2.22077.1 + 7.0.0-alpha.2.22078.1 $(MicrosoftNETWorkloadEmscriptenManifest70100Version) 1.1.87-gba258badda diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index aab934c42ae6b..c2f64bf1abf8a 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -190,6 +190,7 @@ $(LibrariesNativeArtifactsPath)src\*.c; $(LibrariesNativeArtifactsPath)src\*.js; $(LibrariesNativeArtifactsPath)src\emcc-default.rsp; + $(LibrariesNativeArtifactsPath)src\emcc-link.rsp; $(LibrariesNativeArtifactsPath)src\emcc-props.json;" NativeSubDirectory="src" IsNative="true" /> diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index cd5403088873a..d815a72e3511b 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -303,7 +303,7 @@ jobs: targetRid: browser-wasm platform: Browser_wasm container: - image: ubuntu-18.04-webassembly-20210707133424-12f133e + image: ubuntu-18.04-webassembly-20211208134944-544b18c registry: mcr jobParameters: hostedOs: Linux diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index a04d1ac5a665e..e8df34eb26a84 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -185,6 +185,6 @@ jobs: # WebAssembly windows - ${{ if eq(parameters.platform, 'Browser_wasm_win') }}: - - (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h2.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-webassembly-amd64-20210702131541-6837048 + - (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h2.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-webassembly-amd64-20211208140215-544b18c ${{ insert }}: ${{ parameters.jobParameters }} diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props index f122fd1fcf526..e94c73bb92386 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props @@ -235,6 +235,7 @@ + diff --git a/src/mono/mono/component/debugger-agent.c b/src/mono/mono/component/debugger-agent.c index 51e801e71763a..8221e93c36bf6 100644 --- a/src/mono/mono/component/debugger-agent.c +++ b/src/mono/mono/component/debugger-agent.c @@ -414,7 +414,7 @@ static gboolean buffer_replies; DebuggerTlsData *tls; \ tls = (DebuggerTlsData *)mono_native_tls_get_value (debugger_tls_id); #else -#define GET_TLS_DATA_FROM_THREAD(thread) \ +#define GET_TLS_DATA_FROM_THREAD(...) \ DebuggerTlsData *tls; \ tls = &debugger_wasm_thread; #define GET_DEBUGGER_TLS() \ @@ -9145,7 +9145,9 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf) int objid; ErrorCode err; MonoThread *thread_obj; +#ifndef TARGET_WASM MonoInternalThread *thread; +#endif int pos, i, len, frame_idx; StackFrame *frame; MonoDebugMethodJitInfo *jit; @@ -9159,11 +9161,16 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf) if (err != ERR_NONE) return err; +#ifndef TARGET_WASM thread = THREAD_TO_INTERNAL (thread_obj); - +#endif id = decode_id (p, &p, end); +#ifndef TARGET_WASM GET_TLS_DATA_FROM_THREAD (thread); +#else + GET_TLS_DATA_FROM_THREAD (); +#endif g_assert (tls); for (i = 0; i < tls->frame_count; ++i) { diff --git a/src/mono/mono/metadata/seq-points-data.c b/src/mono/mono/metadata/seq-points-data.c index fa80737f1e2b3..47208dbf26f8e 100644 --- a/src/mono/mono/metadata/seq-points-data.c +++ b/src/mono/mono/metadata/seq-points-data.c @@ -409,7 +409,10 @@ mono_seq_point_data_read (SeqPointData *data, char *path) fseek(f, 0, SEEK_SET); buffer_orig = buffer = (guint8 *)g_malloc (fsize + 1); - fread(buffer_orig, fsize, 1, f); + size_t items = fread(buffer_orig, fsize, 1, f); + if (items != 1) + return FALSE; + fclose(f); entry_count = decode_var_int (buffer, &buffer); diff --git a/src/mono/mono/metadata/sre-encode.c b/src/mono/mono/metadata/sre-encode.c index 4bcbbf7683c4b..1a5520a4852fe 100644 --- a/src/mono/mono/metadata/sre-encode.c +++ b/src/mono/mono/metadata/sre-encode.c @@ -422,7 +422,7 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType * HANDLE_FUNCTION_ENTER (); MonoDynamicTable *table; - guint32 token, enclosing; + guint32 token; MonoClass *klass; /* if the type requires a typespec, we must try that first*/ @@ -446,11 +446,8 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType * goto leave; } - if (m_class_get_nested_in (klass)) { - enclosing = mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE); - /* get the typeref idx of the enclosing type */ - enclosing >>= MONO_TYPEDEFORREF_BITS; - } + if (m_class_get_nested_in (klass)) + mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE); table = &assembly->tables [MONO_TABLE_TYPEREF]; token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */ g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token)); diff --git a/src/mono/mono/mini/aot-runtime.c b/src/mono/mono/mini/aot-runtime.c index 4bfbd29519977..d7e370676fe6c 100644 --- a/src/mono/mono/mini/aot-runtime.c +++ b/src/mono/mono/mini/aot-runtime.c @@ -2668,7 +2668,7 @@ compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **c #ifdef HOST_WASM gsize min = 1 << 30, max = 0; - gsize prev = 0; + //gsize prev = 0; // FIXME: This depends on emscripten allocating ftnptr ids sequentially for (int i = 0; i < amodule->info.nmethods; ++i) { @@ -2682,7 +2682,7 @@ compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **c min = val; else if (val > max) max = val; - prev = val; + //prev = val; } } if (max) { @@ -5689,12 +5689,16 @@ get_new_unbox_arbitrary_trampoline_frome_page (gpointer addr) static gpointer get_numerous_trampoline (MonoAotTrampoline tramp_type, int n_got_slots, MonoAotModule **out_amodule, guint32 *got_offset, guint32 *out_tramp_size) { +#ifndef DISABLE_ASSERT_MESSAGES MonoImage *image; +#endif MonoAotModule *amodule = get_mscorlib_aot_module (); int index, tramp_size; +#ifndef DISABLE_ASSERT_MESSAGES /* Currently, we keep all trampolines in the mscorlib AOT image */ image = mono_defaults.corlib; +#endif *out_amodule = amodule; diff --git a/src/mono/mono/mini/driver.c b/src/mono/mono/mini/driver.c index a249b3d6d3678..ba1fa81246ad2 100644 --- a/src/mono/mono/mini/driver.c +++ b/src/mono/mono/mini/driver.c @@ -2067,9 +2067,12 @@ mono_main (int argc, char* argv[]) MonoDomain *domain; MonoImageOpenStatus open_status; const char* aname, *mname = NULL; - int i, count = 1; - guint32 opt, action = DO_EXEC, recompilation_times = 1; + int i; +#ifndef DISABLE_JIT + int count = 1; MonoGraphOptions mono_graph_options = (MonoGraphOptions)0; +#endif + guint32 opt, action = DO_EXEC, recompilation_times = 1; int mini_verbose_level = 0; char *trace_options = NULL; char *aot_options = NULL; @@ -2222,6 +2225,7 @@ mono_main (int argc, char* argv[]) } else if (strcmp (argv [i], "--mixed-mode") == 0) { mixed_mode = TRUE; #endif +#ifndef DISABLE_JIT } else if (strcmp (argv [i], "--ncompile") == 0) { if (i + 1 >= argc){ fprintf (stderr, "error: --ncompile requires an argument\n"); @@ -2229,6 +2233,7 @@ mono_main (int argc, char* argv[]) } count = atoi (argv [++i]); action = DO_BENCH; +#endif } else if (strcmp (argv [i], "--trace") == 0) { trace_options = (char*)""; } else if (strncmp (argv [i], "--trace=", 8) == 0) { @@ -2346,6 +2351,7 @@ mono_main (int argc, char* argv[]) mname = argv [++i]; action = DO_BENCH; +#ifndef DISABLE_JIT } else if (strncmp (argv [i], "--graph=", 8) == 0) { if (i + 1 >= argc){ fprintf (stderr, "error: --graph option requires a method name argument\n"); @@ -2364,6 +2370,7 @@ mono_main (int argc, char* argv[]) mname = argv [++i]; mono_graph_options = MONO_GRAPH_CFG; action = DO_DRAW; +#endif } else if (strcmp (argv [i], "--debug") == 0) { enable_debugging = TRUE; } else if (strncmp (argv [i], "--debug=", 8) == 0) { diff --git a/src/mono/mono/mini/mini-generic-sharing.c b/src/mono/mono/mini/mini-generic-sharing.c index 91811f678deb6..6ba217275875f 100644 --- a/src/mono/mono/mini/mini-generic-sharing.c +++ b/src/mono/mono/mini/mini-generic-sharing.c @@ -1739,7 +1739,9 @@ mini_get_interp_in_wrapper (MonoMethodSignature *sig) static GHashTable *cache; const char *name; gboolean generic = FALSE; +#ifndef DISABLE_JIT gboolean return_native_struct; +#endif sig = mini_get_underlying_reg_signature (sig); @@ -1763,7 +1765,9 @@ mini_get_interp_in_wrapper (MonoMethodSignature *sig) * stack, pass this address to the interp_entry and when we return it we use * CEE_MONO_LDNATIVEOBJ */ +#ifndef DISABLE_JIT return_native_struct = sig->ret->type == MONO_TYPE_VALUETYPE && sig->pinvoke && !sig->marshalling_disabled; +#endif /* Create the signature for the wrapper */ csig = g_malloc0 (MONO_SIZEOF_METHOD_SIGNATURE + (sig->param_count * sizeof (MonoType*))); diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index a52e6cb1a7628..93cc2a51357fc 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -3285,7 +3285,7 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void static MonoObject* mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error) { - MonoMethod *invoke, *callee; + MonoMethod *callee; MonoObject *(*runtime_invoke) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method); RuntimeInvokeInfo *info, *info2; MonoJitInfo *ji = NULL; @@ -3328,7 +3328,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec MonoMethod *wrapper; wrapper = mono_marshal_get_array_accessor_wrapper (method); - invoke = mono_marshal_get_runtime_invoke (wrapper, FALSE); + mono_marshal_get_runtime_invoke (wrapper, FALSE); callee = wrapper; } else { callee = NULL; @@ -3404,8 +3404,8 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec static RuntimeInvokeDynamicFunction dyn_runtime_invoke = NULL; if (info->dyn_call_info) { if (!dyn_runtime_invoke) { - invoke = mono_marshal_get_runtime_invoke_dynamic (); - RuntimeInvokeDynamicFunction invoke_func = (RuntimeInvokeDynamicFunction)mono_jit_compile_method_jit_only (invoke, error); + MonoMethod *dynamic_invoke = mono_marshal_get_runtime_invoke_dynamic (); + RuntimeInvokeDynamicFunction invoke_func = (RuntimeInvokeDynamicFunction)mono_jit_compile_method_jit_only (dynamic_invoke, error); mono_memory_barrier (); dyn_runtime_invoke = invoke_func; if (!dyn_runtime_invoke && mono_use_interpreter) { diff --git a/src/mono/mono/mini/mini-wasm.c b/src/mono/mono/mini/mini-wasm.c index f341690dd7d59..4d1af4eeb520a 100644 --- a/src/mono/mono/mini/mini-wasm.c +++ b/src/mono/mono/mini/mini-wasm.c @@ -209,7 +209,6 @@ mono_arch_create_vars (MonoCompile *cfg) { MonoMethodSignature *sig; CallInfo *cinfo; - MonoType *sig_ret; sig = mono_method_signature_internal (cfg->method); @@ -220,7 +219,7 @@ mono_arch_create_vars (MonoCompile *cfg) // if (cinfo->ret.storage == ArgValuetypeInReg) // cfg->ret_var_is_local = TRUE; - sig_ret = mini_get_underlying_type (sig->ret); + mini_get_underlying_type (sig->ret); if (cinfo->ret.storage == ArgValuetypeAddrInIReg || cinfo->ret.storage == ArgGsharedVTOnStack) { cfg->vret_addr = mono_compile_create_var (cfg, mono_get_int_type (), OP_ARG); if (G_UNLIKELY (cfg->verbose_level > 1)) { @@ -647,8 +646,6 @@ mono_arch_patch_code_new (MonoCompile *cfg, guint8 *code, MonoJumpInfo *ji, gpoi G_BEGIN_DECLS -void * getgrnam (const char *name); -void * getgrgid (gid_t gid); int inotify_init (void); int inotify_rm_watch (int fd, int wd); int inotify_add_watch (int fd, const char *pathname, uint32_t mask); @@ -678,13 +675,6 @@ pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *pa return 0; } -int -pthread_sigmask (int how, const sigset_t *set, sigset_t *oset) -{ - return 0; -} - - int sigsuspend(const sigset_t *sigmask) { @@ -698,18 +688,6 @@ getdtablesize (void) return 256; //random constant that is the fd limit } -void * -getgrnam (const char *name) -{ - return NULL; -} - -void * -getgrgid (gid_t gid) -{ - return NULL; -} - int inotify_init (void) { @@ -747,22 +725,6 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) return -1; } -int -getpwnam_r (const char *name, struct passwd *pwd, char *buffer, size_t bufsize, - struct passwd **result) -{ - *result = NULL; - return ENOTSUP; -} - -int -getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, - struct passwd **result) -{ - *result = NULL; - return ENOTSUP; -} - G_END_DECLS /* Helper for runtime debugging */ diff --git a/src/mono/mono/sgen/sgen-gc.h b/src/mono/mono/sgen/sgen-gc.h index ef7569f4fe980..43e397727abdd 100644 --- a/src/mono/mono/sgen/sgen-gc.h +++ b/src/mono/mono/sgen/sgen-gc.h @@ -1222,6 +1222,7 @@ sgen_dummy_use (gpointer v) { #if defined(_MSC_VER) || defined(HOST_WASM) static volatile gpointer ptr; + (void)ptr; // avoid compiler warning: variable 'ptr' set but not used ptr = v; #elif defined(__GNUC__) __asm__ volatile ("" : "=r"(v) : "r"(v)); diff --git a/src/mono/mono/sgen/sgen-workers.h b/src/mono/mono/sgen/sgen-workers.h index 577466ea3c325..cb42d695aee89 100644 --- a/src/mono/mono/sgen/sgen-workers.h +++ b/src/mono/mono/sgen/sgen-workers.h @@ -81,7 +81,7 @@ void sgen_workers_set_num_active_workers (int generation, int num_workers); #ifndef DISABLE_SGEN_MAJOR_MARKSWEEP_CONC void sgen_workers_start_all_workers (int generation, SgenObjectOperations *object_ops_nopar, SgenObjectOperations *object_ops_par, SgenWorkersFinishCallback finish_job); #else -#define sgen_workers_start_all_workers(...) +#define sgen_workers_start_all_workers(generation, object_ops_nopar, object_ops_par, finish_job) (void)object_ops_par; // avoid compiler warning: variable 'object_ops_par' set but not used #endif void sgen_workers_enqueue_job (int generation, SgenThreadPoolJob *job, gboolean enqueue); diff --git a/src/mono/mono/utils/mono-mmap-wasm.c b/src/mono/mono/utils/mono-mmap-wasm.c index 3364ec4fed939..bf325fa8959ea 100644 --- a/src/mono/mono/utils/mono-mmap-wasm.c +++ b/src/mono/mono/utils/mono-mmap-wasm.c @@ -161,7 +161,6 @@ int mono_vfree (void *addr, size_t length, MonoMemAccountType type) { VallocInfo *info = (VallocInfo*)(valloc_hash ? g_hash_table_lookup (valloc_hash, addr) : NULL); - int res; if (info) { /* @@ -169,13 +168,13 @@ mono_vfree (void *addr, size_t length, MonoMemAccountType type) * mono_valloc_align (), free the original mapping. */ BEGIN_CRITICAL_SECTION; - res = munmap (info->addr, info->size); + munmap (info->addr, info->size); END_CRITICAL_SECTION; g_free (info); g_hash_table_remove (valloc_hash, addr); } else { BEGIN_CRITICAL_SECTION; - res = munmap (addr, length); + munmap (addr, length); END_CRITICAL_SECTION; } diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 6fb3e5beda18a..99180181d7a37 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -151,6 +151,7 @@ <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm')) <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp')) + <_EmccDefaultLinkFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-link.rsp')) false true true @@ -216,10 +217,11 @@ <_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" /> <_EmccLDFlags Include="@(_EmccCommonFlags)" /> - <_EmccLDFlags Include="-s TOTAL_MEMORY=$(EmccTotalMemory)" /> + <_EmccLDFlags Include="-Wl,--allow-undefined" /> + <_EmccLDSFlags Include="-s TOTAL_MEMORY=$(EmccTotalMemory)" /> - <_EmccLDFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" Condition="'$(WasmBuildingForNestedPublish)' != 'true'" /> + <_EmccLDSFlags Include="-s ERROR_ON_UNDEFINED_SYMBOLS=0" Condition="'$(WasmBuildingForNestedPublish)' != 'true'" /> <_DriverCDependencies Include="$(_WasmPInvokeHPath);$(_WasmICallTablePath)" /> <_DriverCDependencies Include="$(_DriverGenCPath)" Condition="'$(_DriverGenCNeeded)' == 'true'" /> @@ -371,6 +373,7 @@ <_WasmExtraJSFile Include="@(Content)" Condition="'%(Content.Extension)' == '.js'" /> <_EmccLinkStepArgs Include="@(_EmccLDFlags)" /> + <_EmccLinkStepArgs Include="@(_EmccLDSFlags)" /> <_EmccLinkStepArgs Include="--%(_WasmExtraJSFile.Kind) "%(_WasmExtraJSFile.Identity)"" Condition="'%(_WasmExtraJSFile.Kind)' != ''" /> <_WasmLinkDependencies Include="@(_WasmExtraJSFile)" /> @@ -391,14 +394,14 @@ - + diff --git a/src/mono/wasm/emscripten-version.txt b/src/mono/wasm/emscripten-version.txt index 8fe1046e01fc8..59ef4a7aa8377 100644 --- a/src/mono/wasm/emscripten-version.txt +++ b/src/mono/wasm/emscripten-version.txt @@ -1 +1 @@ -2.0.23 \ No newline at end of file +2.0.34 \ No newline at end of file diff --git a/src/mono/wasm/runtime/CMakeLists.txt b/src/mono/wasm/runtime/CMakeLists.txt index 9721e39682c9b..955228621ab93 100644 --- a/src/mono/wasm/runtime/CMakeLists.txt +++ b/src/mono/wasm/runtime/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_EXECUTABLE_SUFFIX ".js") add_executable(dotnet corebindings.c driver.c pinvoke.c) target_include_directories(dotnet PUBLIC ${MONO_INCLUDES} ${MONO_OBJ_INCLUDES}) -target_compile_options(dotnet PUBLIC @${NATIVE_BIN_DIR}/src/emcc-default.rsp -DCORE_BINDINGS -DGEN_PINVOKE=1) +target_compile_options(dotnet PUBLIC @${NATIVE_BIN_DIR}/src/emcc-default.rsp @${NATIVE_BIN_DIR}/src/emcc-compile.rsp -DCORE_BINDINGS -DGEN_PINVOKE=1) set_target_properties(dotnet PROPERTIES COMPILE_FLAGS ${CONFIGURATION_EMCC_FLAGS}) @@ -25,7 +25,7 @@ target_link_libraries(dotnet set_target_properties(dotnet PROPERTIES LINK_DEPENDS "${NATIVE_BIN_DIR}/src/emcc-default.rsp;${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.pre.js;${NATIVE_BIN_DIR}/src/cjs/runtime.cjs.iffe.js;${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.lib.js;${NATIVE_BIN_DIR}/src/pal_random.lib.js;${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.post.js;${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.extpost.js;" - LINK_FLAGS "@${NATIVE_BIN_DIR}/src/emcc-default.rsp ${CONFIGURATION_LINK_FLAGS} -DENABLE_NETCORE=1 --extern-pre-js ${NATIVE_BIN_DIR}/src/cjs/runtime.cjs.iffe.js --pre-js ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.pre.js --js-library ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.lib.js --js-library ${NATIVE_BIN_DIR}/src/pal_random.lib.js --post-js ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.post.js --extern-post-js ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.extpost.js " + LINK_FLAGS "@${NATIVE_BIN_DIR}/src/emcc-default.rsp @${NATIVE_BIN_DIR}/src/emcc-link.rsp ${CONFIGURATION_LINK_FLAGS} -DENABLE_NETCORE=1 --extern-pre-js ${NATIVE_BIN_DIR}/src/cjs/runtime.cjs.iffe.js --pre-js ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.pre.js --js-library ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.lib.js --js-library ${NATIVE_BIN_DIR}/src/pal_random.lib.js --post-js ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.post.js --extern-post-js ${NATIVE_BIN_DIR}/src/cjs/dotnet.cjs.extpost.js " RUNTIME_OUTPUT_DIRECTORY "${NATIVE_BIN_DIR}") if(CMAKE_BUILD_TYPE STREQUAL "Release") diff --git a/src/mono/wasm/test-main.js b/src/mono/wasm/test-main.js index 9de96a2749fcc..b7021154834e2 100644 --- a/src/mono/wasm/test-main.js +++ b/src/mono/wasm/test-main.js @@ -242,7 +242,7 @@ globalThis.App = App; // Necessary as System.Runtime.InteropServices.JavaScript. function set_exit_code(exit_code, reason) { if (reason) { - console.error(reason.toString()); + console.error(`${JSON.stringify(reason)}`); if (reason.stack) { console.error(reason.stack); } @@ -272,6 +272,8 @@ function set_exit_code(exit_code, reason) { }; stop_when_ws_buffer_empty(); + } else if (is_node) { + process.exit(exit_code); } else if (App && App.INTERNAL) { App.INTERNAL.mono_wasm_exit(exit_code); } diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 512ec272cf135..fffeeb55d7c2e 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -12,6 +12,8 @@ emcc $(ArtifactsObjDir)wasm <_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp + <_EmccCompileRspPath>$(NativeBinDir)src\emcc-compile.rsp + <_EmccLinkRspPath>$(NativeBinDir)src\emcc-link.rsp false @@ -64,21 +66,22 @@ - <_EmccCommonFlags Include="-s ALLOW_MEMORY_GROWTH=1" /> - <_EmccCommonFlags Include="-s NO_EXIT_RUNTIME=1" /> - <_EmccCommonFlags Include="-s FORCE_FILESYSTEM=1" /> - <_EmccCommonFlags Include="-s EXPORTED_RUNTIME_METHODS="['FS','print','ccall','cwrap','setValue','getValue','UTF8ToString','UTF8ArrayToString','FS_createPath','FS_createDataFile','removeRunDependency','addRunDependency']"" /> - <_EmccCommonFlags Include="-s EXPORTED_FUNCTIONS="['_free','_malloc']"" /> - <_EmccCommonFlags Include="--source-map-base http://example.com" /> - - <_EmccCommonFlags Include="-s STRICT_JS=1" /> - <_EmccCommonFlags Include="-s EXPORT_NAME="'createDotnetRuntime'"" /> - <_EmccCommonFlags Include="-s MODULARIZE=1"/> - <_EmccCommonFlags Include="-s EXPORT_ES6=1" Condition="'$(WasmEnableES6)' == 'true'" /> + <_EmccLinkFlags Include="-s EXPORT_ES6=1" Condition="'$(WasmEnableES6)' == 'true'" /> + <_EmccLinkFlags Include="-s ALLOW_MEMORY_GROWTH=1" /> + <_EmccLinkFlags Include="-s NO_EXIT_RUNTIME=1" /> + <_EmccLinkFlags Include="-s FORCE_FILESYSTEM=1" /> + <_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS="['FS','print','ccall','cwrap','setValue','getValue','UTF8ToString','UTF8ArrayToString','FS_createPath','FS_createDataFile','removeRunDependency','addRunDependency']"" /> + <_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS="['_free','_malloc']"" /> + <_EmccLinkFlags Include="--source-map-base http://example.com" /> + <_EmccLinkFlags Include="-s STRICT_JS=1" /> + <_EmccLinkFlags Include="-s EXPORT_NAME="'createDotnetRuntime'"" /> + <_EmccLinkFlags Include="-s MODULARIZE=1"/> + <_EmccLinkFlags Include="-Wl,--allow-undefined"/> + <_EmccLinkFlags Include="-s ENVIRONMENT="web,webview,worker,node,shell"" /> - <_EmccFlags Include="--profiling-funcs" /> + <_EmccLinkFlags Include="--profiling-funcs" /> <_EmccFlags Include="@(_EmccCommonFlags)" /> @@ -90,6 +93,14 @@ Lines="@(_EmccFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> + + @@ -203,6 +214,8 @@