Web: Fix version check for missing scalbnf LTO workaround

The check needs to happen after we set `env["CXX"]`.
Follow-up to #81340.

(cherry picked from commit 50161808c2)
This commit is contained in:
Rémi Verschelde 2023-09-18 16:32:13 +02:00 committed by Yuri Sizov
parent 6122cf3178
commit 12aeb83043
1 changed files with 9 additions and 7 deletions

View File

@ -121,11 +121,6 @@ def configure(env: "Environment"):
else: else:
env.Append(CCFLAGS=["-flto"]) env.Append(CCFLAGS=["-flto"])
env.Append(LINKFLAGS=["-flto"]) env.Append(LINKFLAGS=["-flto"])
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
cc_version = get_compiler_version(env)
cc_semver = (int(cc_version["major"]), int(cc_version["minor"]), int(cc_version["patch"]))
if cc_semver >= (3, 1, 42):
env.Append(LINKFLAGS=["-Wl,-u,scalbnf"])
# Sanitizers # Sanitizers
if env["use_ubsan"]: if env["use_ubsan"]:
@ -207,9 +202,16 @@ def configure(env: "Environment"):
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"])
if env["dlink_enabled"]: # Get version info for checks below.
cc_version = get_compiler_version(env) cc_version = get_compiler_version(env)
cc_semver = (int(cc_version["major"]), int(cc_version["minor"]), int(cc_version["patch"])) cc_semver = (int(cc_version["major"]), int(cc_version["minor"]), int(cc_version["patch"]))
if env["lto"] != "none":
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):
env.Append(LINKFLAGS=["-Wl,-u,scalbnf"])
if env["dlink_enabled"]:
if cc_semver < (3, 1, 14): if cc_semver < (3, 1, 14):
print("GDExtension support requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver) print("GDExtension support requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver)
sys.exit(255) sys.exit(255)