summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-12-05 13:03:03 -0800
committerGitHub <noreply@github.com>2022-12-05 21:03:03 +0000
commit145e8f9ece5a2f6f42eeedf75f8e24987cb8511a (patch)
tree8ba14d86e0a6cd8764cddc6f254cf53b42b53b79
parent69f6235c36ebf87a700341a78bcf38a32c752b29 (diff)
downloadbinaryen-145e8f9ece5a2f6f42eeedf75f8e24987cb8511a.tar.gz
binaryen-145e8f9ece5a2f6f42eeedf75f8e24987cb8511a.tar.bz2
binaryen-145e8f9ece5a2f6f42eeedf75f8e24987cb8511a.zip
binaryen.js: Properly export malloc/free (#5324)
This should unbreak the build. This is an old problem but was just noticed due to a recent emscripten change (emscripten-core/emscripten#18292).
-rw-r--r--CMakeLists.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05d0a9645..223c45fec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -418,6 +418,7 @@ if(EMSCRIPTEN)
target_link_libraries(binaryen_wasm "-sNODERAWFS=0")
target_link_libraries(binaryen_wasm "-sEXPORT_ES6")
target_link_libraries(binaryen_wasm "-sEXPORTED_RUNTIME_METHODS=allocateUTF8OnStack")
+ target_link_libraries(binaryen_wasm "-sEXPORTED_FUNCTIONS=_malloc,_free")
target_link_libraries(binaryen_wasm "--post-js=${CMAKE_CURRENT_SOURCE_DIR}/src/js/binaryen.js-post.js")
target_link_libraries(binaryen_wasm "-msign-ext")
target_link_libraries(binaryen_wasm "-mbulk-memory")
@@ -456,6 +457,7 @@ if(EMSCRIPTEN)
target_link_libraries(binaryen_js "-sEXPORT_ES6=1")
endif()
target_link_libraries(binaryen_js "-sEXPORTED_RUNTIME_METHODS=allocateUTF8OnStack")
+ target_link_libraries(binaryen_js "-sEXPORTED_FUNCTIONS=_malloc,_free")
target_link_libraries(binaryen_js "--post-js=${CMAKE_CURRENT_SOURCE_DIR}/src/js/binaryen.js-post.js")
# js_of_ocaml needs a specified variable with special comment to provide the library to consumers
if(JS_OF_OCAML)