Fix skwasm target in wasm_debug_unopt build. (#162100)

Fixes a couple issues in the skwasm build rules:
* `DEMANGLE_SUPPORT` is deprecated in emscripten, so just remove it.
* `sSHARED_MEMORY=1` needs to be added to the cflags so that emscripten
appends the proper feature flags (`-matomics` and `-mbulk-memory`) when
doing the compile so that the flags match the linking step.
This commit is contained in:
Jackson Gardner 2025-01-23 14:05:52 -08:00 committed by GitHub
parent 8c4ad50389
commit bfe31d607c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 4 deletions

View File

@ -280,6 +280,9 @@ config("compiler") {
if (wasm_use_pthreads) {
cflags += [ "-pthread" ]
ldflags += [ "-pthread" ]
} if (wasm_shared_memory) {
cflags += [ "-sSHARED_MEMORY=1" ]
ldflags += [ "-sSHARED_MEMORY=1" ]
}
ldflags += [
"-s",

View File

@ -12,6 +12,7 @@ declare_args() {
emsdk_dir = rebase_path("//flutter/prebuilts/emsdk")
wasm_use_pthreads = false
wasm_shared_memory = false
wasm_use_dwarf = false
}

View File

@ -47,7 +47,6 @@ template("skwasm_variant") {
"-lexports.js",
"-sEXPORTED_FUNCTIONS=[stackAlloc]",
"-sEXPORTED_RUNTIME_METHODS=[addFunction,wasmExports,wasmMemory,stackAlloc]",
"-sSHARED_MEMORY=1",
"-sINCOMING_MODULE_JS_API=[instantiateWasm,noExitRuntime,mainScriptUrlOrBlob]",
"-sUSE_ES6_IMPORT_META=0",
"--js-library",
@ -76,7 +75,6 @@ template("skwasm_variant") {
if (is_debug) {
ldflags += [
"-sDEMANGLE_SUPPORT=1",
"-sASSERTIONS=1",
"-sGL_ASSERTIONS=1",
]

View File

@ -63,7 +63,6 @@ canvaskit_wasm_lib("canvaskit") {
if (is_debug) {
ldflags += [
"-O0",
"-sDEMANGLE_SUPPORT=1",
"-sASSERTIONS=1",
"-sGL_ASSERTIONS=1",
"-g3",

View File

@ -109,8 +109,10 @@ wasm_toolchain("skwasm_st") {
skia_use_no_png_encode = true
skia_use_libpng_encode = false
# skwasm_st is singlethreaded
# skwasm_st doesn't use pthreads, but does pass the shared memory flag in order
# to be compatible with the way app modules import the memory object.
wasm_use_pthreads = false
wasm_shared_memory = true
wasm_prioritize_size = true
}
}