Skip to content

Commit

Permalink
[Web] Force emcc to use "wasm" longjmp mode
Browse files Browse the repository at this point in the history
SUPPORT_LONGJMP have changed since emscripten 3.1.32 to default to
"wasm" mode when exceptions are enabled, and "emscripten" mode when
disabled.

While we generally doesn't use exception in core, linked libraries may
need them, and emscripten don't plan to support WASM EH + Emscripten
SjLj in the long term.

(cherry picked from commit 1bb543b)
  • Loading branch information
Faless authored and dsnopek committed Sep 4, 2024
1 parent fd31fab commit 5921734
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ def generate(env):

# Thread support (via SharedArrayBuffer).
if env["threads"]:
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(CCFLAGS=["-sUSE_PTHREADS=1"])
env.Append(LINKFLAGS=["-sUSE_PTHREADS=1"])

# Build as side module (shared library).
env.Append(CCFLAGS=["-sSIDE_MODULE=1"])
env.Append(LINKFLAGS=["-sSIDE_MODULE=1"])

# Force wasm longjmp mode.
env.Append(CCFLAGS=["-sSUPPORT_LONGJMP='wasm'"])
env.Append(LINKFLAGS=["-sSUPPORT_LONGJMP='wasm'"])

env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])

common_compiler_flags.generate(env)

0 comments on commit 5921734

Please sign in to comment.