Skip to content

Commit 26b745f

Browse files
authored
Merge pull request #3824 from ruby/reduce-wasm-size
Reduce size of the WASM file (2M->480K)
2 parents 57afd7c + 9c5066e commit 26b745f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ build/libprism.a: $(STATIC_OBJECTS)
4343

4444
javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS)
4545
$(ECHO) "building $@"
46-
$(Q) $(WASI_SDK_PATH)/bin/clang --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot/ $(DEBUG_FLAGS) -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(CFLAGS) -Wl,--export-all -Wl,--no-entry -mexec-model=reactor -o $@ $(SOURCES)
46+
$(Q) $(WASI_SDK_PATH)/bin/clang --sysroot=$(WASI_SDK_PATH)/share/wasi-sysroot/ \
47+
$(DEBUG_FLAGS) \
48+
-DPRISM_EXPORT_SYMBOLS -DPRISM_EXCLUDE_PRETTYPRINT -DPRISM_EXCLUDE_JSON -DPRISM_EXCLUDE_PACK \
49+
-D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(CFLAGS) \
50+
-Wl,--export-all -Wl,--gc-sections -Wl,--strip-all -Wl,--lto-O3 -Wl,--no-entry -mexec-model=reactor \
51+
-Oz -g0 -flto -fdata-sections -ffunction-sections \
52+
-o $@ $(SOURCES)
4753

4854
java-wasm/src/test/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS)
4955
$(ECHO) "building $@"

0 commit comments

Comments
 (0)