Set what were default values for some emscripten linkflags

- Set `-sSTACK_SIZE` to what it was before emscripten 3.1.27.
  It was renamed in 3.1.25 so also set `-sTOTAL_SIZE` for older
  versions for consistency.
- Set `-sDEFAULT_PTHREAD_STACK_SIZE` to what it was before 3.1.30.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
(cherry picked from commit 8e5fbd4348)
This commit is contained in:
Adam Scott 2023-12-11 10:48:35 -05:00 committed by Rémi Verschelde
parent 346c9a6671
commit 4a02e6159d
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -172,9 +172,17 @@ def configure(env):
env["LIBPREFIXES"] = ["$LIBPREFIX"] env["LIBPREFIXES"] = ["$LIBPREFIX"]
env["LIBSUFFIXES"] = ["$LIBSUFFIX"] env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
# Get version info for checks below.
cc_semver = tuple(get_compiler_version(env))
env.Prepend(CPPPATH=["#platform/javascript"]) env.Prepend(CPPPATH=["#platform/javascript"])
env.Append(CPPDEFINES=["JAVASCRIPT_ENABLED", "UNIX_ENABLED"]) env.Append(CPPDEFINES=["JAVASCRIPT_ENABLED", "UNIX_ENABLED"])
if cc_semver >= (3, 1, 25):
env.Append(LINKFLAGS=["-s", "STACK_SIZE=5MB"])
else:
env.Append(LINKFLAGS=["-s", "TOTAL_STACK=5MB"])
if env["javascript_eval"]: if env["javascript_eval"]:
env.Append(CPPDEFINES=["JAVASCRIPT_EVAL_ENABLED"]) env.Append(CPPDEFINES=["JAVASCRIPT_EVAL_ENABLED"])
@ -183,15 +191,13 @@ def configure(env):
env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"]) env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"])
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"]) env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"]) env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(LINKFLAGS=["-s", "DEFAULT_PTHREAD_STACK_SIZE=2MB"])
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"]) env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"]) env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])
env.extra_suffix = ".threads" + env.extra_suffix env.extra_suffix = ".threads" + env.extra_suffix
else: else:
env.Append(CPPDEFINES=["NO_THREADS"]) env.Append(CPPDEFINES=["NO_THREADS"])
# Get version info for checks below.
cc_semver = tuple(get_compiler_version(env))
if env["lto"] != "none": if env["lto"] != "none":
# Workaround https://github.com/emscripten-core/emscripten/issues/19781. # Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46): if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):