diff options
author | Derek Schuff <dschuff@chromium.org> | 2017-01-24 13:44:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 13:44:04 -0800 |
commit | 21eb2c7cba6af6e01219f1f3b06e82dfcf2788e8 (patch) | |
tree | f16ad91e1b429ab32fc3882e9b730b770d7dfb83 /src | |
parent | 009f172a595d5554e7e85f6acacef34e9d4e8010 (diff) | |
download | binaryen-21eb2c7cba6af6e01219f1f3b06e82dfcf2788e8.tar.gz binaryen-21eb2c7cba6af6e01219f1f3b06e82dfcf2788e8.tar.bz2 binaryen-21eb2c7cba6af6e01219f1f3b06e82dfcf2788e8.zip |
Export memalign along with malloc and friends (#888)
Emscripten's mmap2 syscall started using memalign instead of malloc with kripken/emscripten#4874, so we need to export that as well.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-linker.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp index a319af889..757fc88ca 100644 --- a/src/wasm-linker.cpp +++ b/src/wasm-linker.cpp @@ -254,20 +254,16 @@ void Linker::layout() { } } - // Export malloc, realloc, and free whenever availble. JavsScript version of + // Export malloc/realloc/free/memalign whenever availble. JavsScript version of // malloc has some issues and it cannot be called once _sbrk() is called, and // JS glue code does not have realloc(). TODO This should get the list of // exported functions from emcc.py - it has EXPORTED_FUNCTION metadata to keep // track of this. Get the list of exported functions using a command-line // argument from emcc.py and export all of them. - if (out.symbolInfo.implementedFunctions.count("malloc")) { - exportFunction("malloc", true); - } - if (out.symbolInfo.implementedFunctions.count("free")) { - exportFunction("free", true); - } - if (out.symbolInfo.implementedFunctions.count("realloc")) { - exportFunction("realloc", true); + for (auto function : {"malloc", "free", "realloc", "memalign"}) { + if (out.symbolInfo.implementedFunctions.count(function)) { + exportFunction(function, true); + } } // finalize function table |