build.sh 838 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. #
  3. # Copyright (C) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. #
  6. set -eo pipefail
  7. CC=${CC:=/opt/wasi-sdk/bin/clang}
  8. WAMR_DIR=../../../../..
  9. for test_c in *.c; do
  10. test_wasm="$(basename $test_c .c).wasm"
  11. echo "Compiling $test_c to $test_wasm"
  12. $CC \
  13. -target wasm32-wasi-threads \
  14. -pthread -ftls-model=local-exec \
  15. -z stack-size=32768 \
  16. -Wl,--export=__heap_base \
  17. -Wl,--export=__data_end \
  18. -Wl,--shared-memory,--max-memory=1966080 \
  19. -Wl,--export=wasi_thread_start \
  20. -Wl,--export=malloc \
  21. -Wl,--export=free \
  22. -I $WAMR_DIR/samples/wasi-threads/wasm-apps \
  23. $WAMR_DIR/samples/wasi-threads/wasm-apps/wasi_thread_start.S \
  24. $test_c -o $test_wasm
  25. done