File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 6767 - uses : actions/checkout@v1
6868
6969 - name : Mount bazel cache
70- uses : actions/cache@v1
70+ uses : actions/cache@v4
7171 with :
7272 path : " /home/runner/.cache/bazel"
7373 key : bazel
Original file line number Diff line number Diff line change @@ -26,17 +26,23 @@ PKG_CONFIG_PATH = ${EMSDK}/upstream/emscripten/cache/sysroot/lib/pkgconfig
2626WASM_LIBS = $(shell $(PKG_CONFIG ) $(WASM_DEPS ) $(PROTO_DEPS ) \
2727 --with-path=$(PKG_CONFIG_PATH ) --libs | sed -e 's/-pthread //g')
2828
29+ # See proxy_wasm_cc_binary build rule definition in bazel/defs.bzl for
30+ # explanation of emscripten link options.
31+ EMSCRIPTEN_LINK_OPTS := --no-entry \
32+ --js-library ${PROXY_WASM_CPP_SDK}/proxy_wasm_intrinsics.js \
33+ -sSTANDALONE_WASM -sEXPORTED_FUNCTIONS=_malloc \
34+ -sALLOW_MEMORY_GROWTH=1 -sINITIAL_HEAP=64KB
35+
36+
2937debug-deps :
3038# WASM_DEPS : ${WASM_DEPS}
3139# WASM_LIBS : ${WASM_LIBS}
3240# PROTO_DEPS: ${PROTO_DEPS}
3341# PROTO_OPTS: ${PROTO_OPTS}
3442
35- # TODO(mpwarres): Add Emscripten stack/heap size params in PR#174.
3643% .wasm % .wat : % .cc
37- em++ --no-entry -sSTANDALONE_WASM -sEXPORTED_FUNCTIONS=_malloc \
38- --std=c++17 -O3 -flto \
39- --js-library ${PROXY_WASM_CPP_SDK} /proxy_wasm_intrinsics.js \
44+ em++ --std=c++17 -O3 -flto \
45+ ${EMSCRIPTEN_LINK_OPTS} \
4046-I${PROXY_WASM_CPP_SDK} \
4147${CPP_CONTEXT_LIB} \
4248${PROTO_OPTS} \
Original file line number Diff line number Diff line change @@ -90,10 +90,20 @@ def proxy_wasm_cc_binary(
9090 "@proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_js" ,
9191 ],
9292 linkopts = linkopts + [
93+ # Setting to indicate module is a "reactor library" without a main() entry point:
94+ # https://emscripten.org/docs/tools_reference/settings_reference.html#standalone-wasm
9395 "--no-entry" ,
96+ # File listing additional functions that Emscripten should expect to be implemented by the host:
97+ # https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#implement-c-in-javascript
9498 "--js-library=$(location @proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_js)" ,
99+ # Emit Wasm module that can run without JavaScript
95100 "-sSTANDALONE_WASM" ,
101+ # Give host code access to Emscripten's _malloc() function
96102 "-sEXPORTED_FUNCTIONS=_malloc" ,
103+ # Allow allocating memory past initial heap size
104+ "-sALLOW_MEMORY_GROWTH=1" ,
105+ # Initial amount of heap memory. 64KB matches Rust SDK starting heap size.
106+ "-sINITIAL_HEAP=64KB" ,
97107 ],
98108 tags = tags + [
99109 "manual" ,
You can’t perform that action at this time.
0 commit comments