Update wasm app build scripts for wasi-sdk-12 and refine interpreter (#481)

Update wasm app build scripts for wasi-sdk-12.0: add --export=__main_argc_argv, remove --no-threads
Lookup function with name "__main_argc_argv" as main function besides "main"
Change module_malloc to runtime_malloc in wasi native lib
Refine classic interpreter op_block and op_br_table
Refine faster interpreter op_br_table

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2020-12-27 20:46:31 -06:00
committed by GitHub
parent 13f0b2485b
commit 724858c731
19 changed files with 144 additions and 192 deletions

View File

@ -3,13 +3,23 @@
WAMR_DIR=${PWD}/../../..
/opt/wasi-sdk/bin/clang \
--target=wasm32 -O3 \
echo "Build wasm app .."
/opt/wasi-sdk/bin/clang -O3 \
-z stack-size=4096 -Wl,--initial-memory=65536 \
--sysroot=${WAMR_DIR}/wamr-sdk/app/libc-builtin-sysroot \
-Wl,--allow-undefined-file=${WAMR_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt \
-Wl,--export=main, \
-Wl,--export=__data_end, -Wl,--export=__heap_base \
-Wl,--no-threads,--strip-all,--no-entry \
-nostdlib -o test.wasm *.c
#./jeffdump -o test_wasm.h -n wasm_test_file test.wasm
-o test.wasm main.c \
-Wl,--export=main -Wl,--export=__main_argc_argv \
-Wl,--export=__data_end -Wl,--export=__heap_base \
-Wl,--strip-all,--no-entry \
-Wl,--allow-undefined \
-nostdlib \
echo "Build binarydump tool .."
rm -fr build && mkdir build && cd build
cmake ../../../../test-tools/binarydump-tool
make
cd ..
echo "Generate test_wasm.h .."
./build/binarydump -o test_wasm.h -n wasm_test_file test.wasm
echo "Done"