Skip to content

Commit

Permalink
Merge pull request #81869 from akien-mga/web-fix-lto-scalbnf-version-…
Browse files Browse the repository at this point in the history
…check

Web: Fix version check for missing scalbnf LTO workaround
  • Loading branch information
akien-mga committed Sep 19, 2023
2 parents e207595 + 5016180 commit f0a9931
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions platform/web/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ def configure(env: "Environment"):
else:
env.Append(CCFLAGS=["-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
if env["use_ubsan"]:
Expand Down Expand Up @@ -204,9 +199,16 @@ def configure(env: "Environment"):
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])

# Get version info for checks below.
cc_version = get_compiler_version(env)
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"]:
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, 14):
print("GDExtension support requires emscripten >= 3.1.14, detected: %s.%s.%s" % cc_semver)
sys.exit(255)
Expand Down

0 comments on commit f0a9931

Please sign in to comment.