summaryrefslogtreecommitdiffstats
path: root/platform/web
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-07-12 15:56:46 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-07-17 13:18:02 +0200
commit5eed870a6a3a0cef9e52442d7d1b8cb4e45b7cbd (patch)
treef5cb08525bbffc4762f69c1e38d0e14f4a9a2768 /platform/web
parent0f7625ab46a64b3f5da2b09969ebabf38df9a6e9 (diff)
downloadredot-engine-5eed870a6a3a0cef9e52442d7d1b8cb4e45b7cbd.tar.gz
[Web] Use fvisibility=hidden for side module when dlink_enabled.
This hugely reduces the number of exports, making it acceptable for browsers. Note that dlink + threads is still not working due to upstream issues with the pthread emulation library. Should hopefully be solved once emscripten move to native WASM threads.
Diffstat (limited to 'platform/web')
-rw-r--r--platform/web/SCsub3
-rw-r--r--platform/web/detect.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/platform/web/SCsub b/platform/web/SCsub
index e44e59bfb9..1af0642554 100644
--- a/platform/web/SCsub
+++ b/platform/web/SCsub
@@ -70,6 +70,9 @@ if env["dlink_enabled"]:
sys_env.Append(LINKFLAGS=["-s", "WARN_ON_UNDEFINED_SYMBOLS=0"])
# Force exporting the standard library (printf, malloc, etc.)
sys_env["ENV"]["EMCC_FORCE_STDLIBS"] = "libc,libc++,libc++abi"
+ sys_env["CCFLAGS"].remove("-fvisibility=hidden")
+ sys_env["LINKFLAGS"].remove("-fvisibility=hidden")
+
# The main emscripten runtime, with exported standard libraries.
sys = sys_env.Program(build_targets, ["web_runtime.cpp"])
diff --git a/platform/web/detect.py b/platform/web/detect.py
index 2685cbcd63..0f1508f530 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -211,6 +211,8 @@ def configure(env: "Environment"):
env.Append(CCFLAGS=["-s", "SIDE_MODULE=2"])
env.Append(LINKFLAGS=["-s", "SIDE_MODULE=2"])
+ env.Append(CCFLAGS=["-fvisibility=hidden"])
+ env.Append(LINKFLAGS=["-fvisibility=hidden"])
env.extra_suffix = ".dlink" + env.extra_suffix
# Reduce code size by generating less support code (e.g. skip NodeJS support).