From 3473d30d76a5149a7dfd40507a3d57967d9d1799 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Mon, 22 Feb 2021 15:35:17 -0500 Subject: [PATCH] Make sure pal_icushim_static.c is linked in even if no symbols are used from it, so the EMSCRIPTEN_KEEPALIVE functions in it are actually kept. (#48550) --- .../System.Globalization.Native/pal_icushim_static.c | 10 ++++++++++ src/mono/wasm/runtime/driver.c | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c index 8beb3ce0de774..7f6b051ae62da 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_static.c @@ -88,6 +88,16 @@ EMSCRIPTEN_KEEPALIVE int32_t mono_wasm_load_icu_data(void * pData) return 1; } } + +/* + * driver.c calls this to make sure this file is linked, otherwise + * its not, meaning the EMSCRIPTEN_KEEPALIVE functions above + * are not kept. + */ +void mono_wasm_link_icu_shim(void) +{ +} + #endif int32_t GlobalizationNative_LoadICU(void) diff --git a/src/mono/wasm/runtime/driver.c b/src/mono/wasm/runtime/driver.c index c2ed732aab881..80b7cde181a26 100644 --- a/src/mono/wasm/runtime/driver.c +++ b/src/mono/wasm/runtime/driver.c @@ -466,11 +466,15 @@ mono_wasm_register_bundled_satellite_assemblies () } } +void mono_wasm_link_icu_shim (void); + EMSCRIPTEN_KEEPALIVE void mono_wasm_load_runtime (const char *unused, int debug_level) { const char *interp_opts = ""; + mono_wasm_link_icu_shim (); + #ifdef DEBUG monoeg_g_setenv ("MONO_LOG_LEVEL", "debug", 0); monoeg_g_setenv ("MONO_LOG_MASK", "gc", 0);