From e6c725bf548dc6b510fc88819ce5a0e43a88adcc Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 10 Nov 2021 23:06:56 -0500 Subject: [PATCH] Don't export ZSTD_ symbols (reduce wasm size) --- Makefile | 1 + src/cpu.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e558da46..1d35baac 100644 --- a/Makefile +++ b/Makefile @@ -207,6 +207,7 @@ build/zstddeclib.o: lib/zstd/zstddeclib.c mkdir -p build clang -c -Wall \ --target=wasm32 -O3 -flto -nostdlib -fvisibility=hidden -ffunction-sections -fdata-sections \ + -DZSTDLIB_VISIBILITY="" \ -o build/zstddeclib.o \ lib/zstd/zstddeclib.c diff --git a/src/cpu.js b/src/cpu.js index ddd81639..00953521 100644 --- a/src/cpu.js +++ b/src/cpu.js @@ -198,7 +198,7 @@ CPU.prototype.create_jit_imports = function() for(let name of Object.keys(this.wm.exports)) { - if(name.startsWith("_") || name.startsWith("ZSTD") || name.startsWith("zstd") || name.endsWith("_js")) + if(name.startsWith("_") || name.startsWith("zstd") || name.endsWith("_js")) { continue; }