Merge pull request #558 from bytecodealliance/main

Merge bytecodealliance:main into wenyongh:main
This commit is contained in:
Wenyong Huang 2022-06-20 09:58:58 +08:00 committed by GitHub
commit bf61c0bf02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 862 additions and 372 deletions

View File

@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Cancel Workflow Action - name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.6.0 uses: styfle/cancel-workflow-action@0.9.1
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0

View File

@ -1,7 +1,7 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved. # Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: compilation on android, ubuntu-18.04, ubuntu-20.04, macos-latest name: compilation on android, ubuntu-18.04, ubuntu-20.04
on: on:
# will be triggered on PR events # will be triggered on PR events
@ -11,7 +11,7 @@ on:
- "ci/**" - "ci/**"
- "doc/**" - "doc/**"
- "test-tools/**" - "test-tools/**"
- ".github/workflows/compilation_on_android_ubuntu_macos.yml" - ".github/workflows/compilation_on_android_ubuntu.yml"
# will be triggered on push events # will be triggered on push events
push: push:
paths-ignore: paths-ignore:
@ -19,7 +19,7 @@ on:
- "ci/**" - "ci/**"
- "doc/**" - "doc/**"
- "test-tools/**" - "test-tools/**"
- ".github/workflows/compilation_on_android_ubuntu_macos.yml" - ".github/workflows/compilation_on_android_ubuntu.yml"
# allow to be triggered manually # allow to be triggered manually
workflow_dispatch: workflow_dispatch:
@ -30,12 +30,20 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
# For BUILD
AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0" MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
# LLVM
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex" LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
# For Spec Test
DEFAULT_TEST_OPTIONS: "-s spec -P"
MULTI_MODULES_TEST_OPTIONS: "-s spec -M -P"
SIMD_TEST_OPTIONS: "-s spec -S -P"
THREADS_TEST_OPTIONS: "-s spec -p -P"
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
jobs: jobs:
# Cancel any in-flight jobs for the same PR/branch so there's only one active # Cancel any in-flight jobs for the same PR/branch so there's only one active
@ -44,25 +52,25 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest] os: [ubuntu-18.04, ubuntu-20.04]
steps: steps:
- name: Cancel Workflow Action - name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.6.0 uses: styfle/cancel-workflow-action@0.9.1
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
# set different traffic lights based on the current repo and the running OS. # set different traffic lights based on the current repo and the running OS.
# according to light colors, the workflow will run different jobs # according to light colors, the workflow will run different jobs
# it is used to separate between the public repo and the private repo
check_repo: check_repo:
needs: cancel_previous needs: cancel_previous
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest] os: [ubuntu-18.04, ubuntu-20.04]
outputs: outputs:
traffic_light_on_ubuntu_1804: ${{ steps.do_check_on_ubuntu_1804.outputs.light }} traffic_light_on_ubuntu_1804: ${{ steps.do_check_on_ubuntu_1804.outputs.light }}
traffic_light_on_ubuntu_2004: ${{ steps.do_check_on_ubuntu_2004.outputs.light }} traffic_light_on_ubuntu_2004: ${{ steps.do_check_on_ubuntu_2004.outputs.light }}
traffic_light_on_macos_latest: ${{ steps.do_check_on_macos_latest.outputs.light }}
steps: steps:
- name: do_check_on_ubuntu_1804 - name: do_check_on_ubuntu_1804
id: do_check_on_ubuntu_1804 id: do_check_on_ubuntu_1804
@ -84,41 +92,29 @@ jobs:
echo "::set-output name=light::green" echo "::set-output name=light::green"
fi fi
- name: do_check_on_macos_latest
id: do_check_on_macos_latest
if: ${{ matrix.os == 'macos-latest' }}
run: |
if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
echo "::set-output name=light::green"
else
echo "::set-output name=light::red"
fi
build_llvm_libraries: build_llvm_libraries:
needs: check_repo needs: check_repo
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest] os: [ubuntu-18.04, ubuntu-20.04]
include: include:
- os: ubuntu-18.04 - os: ubuntu-18.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
- os: ubuntu-20.04 - os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
steps: steps:
- name: light status - name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Cache LLVM libraries - name: Cache LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -128,43 +124,35 @@ jobs:
./core/deps/llvm/build/share ./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Build llvm and clang from source on ubuntu - name: Build llvm and clang from source
id: build_llvm_ubuntu id: build_llvm
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os != 'macos-latest' }} if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb
working-directory: build-scripts working-directory: build-scripts
- name: Build llvm and clang from source on macos
id: build_llvm_macos
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' }}
run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly
working-directory: build-scripts
build_wamrc: build_wamrc:
needs: [build_llvm_libraries, check_repo] needs: [build_llvm_libraries, check_repo]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest] os: [ubuntu-18.04, ubuntu-20.04]
include: include:
- os: ubuntu-18.04 - os: ubuntu-18.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
- os: ubuntu-20.04 - os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
steps: steps:
- name: light status - name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -193,11 +181,11 @@ jobs:
matrix: matrix:
make_options_run_mode: [ make_options_run_mode: [
# Running mode # Running mode
$AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
$LAZY_JIT_BUILD_OPTIONS, $LAZY_JIT_BUILD_OPTIONS,
$MC_JIT_BUILD_OPTIONS, $MC_JIT_BUILD_OPTIONS,
$AOT_BUILD_OPTIONS,
] ]
make_options_feature: [ make_options_feature: [
# Features # Features
@ -206,6 +194,7 @@ jobs:
"-DWAMR_BUILD_DEBUG_INTERP=1", "-DWAMR_BUILD_DEBUG_INTERP=1",
"-DWAMR_BUILD_DUMP_CALL_STACK=1", "-DWAMR_BUILD_DUMP_CALL_STACK=1",
"-DWAMR_BUILD_LIB_PTHREAD=1", "-DWAMR_BUILD_LIB_PTHREAD=1",
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
"-DWAMR_BUILD_MINI_LOADER=1", "-DWAMR_BUILD_MINI_LOADER=1",
"-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MEMORY_PROFILING=1",
"-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_MULTI_MODULE=1",
@ -214,25 +203,11 @@ jobs:
"-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_SIMD=1",
"-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_BUILD_TAIL_CALL=1",
"-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
] ]
os: [ubuntu-18.04, ubuntu-20.04, macos-latest] os: [ubuntu-18.04, ubuntu-20.04]
platform: [android, linux, darwin] platform: [android, linux]
exclude: exclude:
# uncompatiable os and platform
# ubuntu can not go with darwin
- os: ubuntu-18.04
platform: darwin
- os: ubuntu-20.04
platform: darwin
# macos can not go with android, linux
- os: macos-latest
platform: android
- os: macos-latest
platform: linux
# uncompatiable feature and platform # uncompatiable feature and platform
- os: macos-latest
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
# uncompatiable mode and feature # uncompatiable mode and feature
# MULTI_MODULE only on INTERP mode # MULTI_MODULE only on INTERP mode
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
@ -277,20 +252,19 @@ jobs:
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
- os: ubuntu-20.04 - os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
steps: steps:
- name: light status - name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
# only download llvm cache when needed
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }} if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS'))
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -301,7 +275,7 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build iwasm - name: Build iwasm
@ -325,7 +299,7 @@ jobs:
$MC_JIT_BUILD_OPTIONS, $MC_JIT_BUILD_OPTIONS,
$AOT_BUILD_OPTIONS, $AOT_BUILD_OPTIONS,
] ]
os: [ubuntu-18.04, ubuntu-20.04, macos-latest] os: [ubuntu-18.04, ubuntu-20.04]
include: include:
- os: ubuntu-18.04 - os: ubuntu-18.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }}
@ -335,30 +309,18 @@ jobs:
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz
exclude:
# TODO: a .aot compatiable problem
- os: macos-latest
make_options: $LAZY_JIT_BUILD_OPTIONS
- os: macos-latest
make_options: $AOT_BUILD_OPTIONS
- os: macos-latest
make_options: $MC_JIT_BUILD_OPTIONS
steps: steps:
- name: light status - name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }} if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -369,7 +331,7 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wabt - name: download and install wabt
@ -381,7 +343,7 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: Build wamrc - name: Build wamrc
if: ${{ matrix.light == 'green' }} if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
@ -407,7 +369,7 @@ jobs:
working-directory: samples/wasm-c-api working-directory: samples/wasm-c-api
build_samples_others: build_samples_others:
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] needs: [build_iwasm, check_repo]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -420,34 +382,13 @@ jobs:
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }}
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz
steps: steps:
- name: light status - name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wasi-sdk - name: download and install wasi-sdk
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
@ -465,14 +406,6 @@ jobs:
sudo tar -xzf wabt-1.0.24-*.tar.gz sudo tar -xzf wabt-1.0.24-*.tar.gz
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
working-directory: wamr-compiler
- name: Build Sample [basic] - name: Build Sample [basic]
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
run: | run: |
@ -515,3 +448,110 @@ jobs:
cmake .. cmake ..
cmake --build . --config Release --parallel 4 cmake --build . --config Release --parallel 4
./hello ./hello
spec_test_default:
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo]
runs-on: ubuntu-20.04
strategy:
matrix:
test_option: [$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS]
steps:
- name: checkout
uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
uses: actions/cache@v3
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja
run: sudo apt install -y ninja-build
- name: run spec tests
run: ./test_wamr.sh ${{ matrix.test_option }}
working-directory: ./tests/wamr-test-suites
spec_test_extra:
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }}
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo]
runs-on: ubuntu-20.04
strategy:
matrix:
test_option: [$MULTI_MODULES_TEST_OPTIONS, $THREADS_TEST_OPTIONS]
steps:
- name: checkout
uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
uses: actions/cache@v3
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja
run: sudo apt install -y ninja-build
- name: run spec tests
run: ./test_wamr.sh ${{ matrix.test_option }}
working-directory: ./tests/wamr-test-suites
spec_test_x86_32:
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }}
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo]
runs-on: ubuntu-20.04
strategy:
matrix:
test_option: [$DEFAULT_TEST_OPTIONS, $THREADS_TEST_OPTIONS]
steps:
- name: checkout
uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
uses: actions/cache@v3
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja and x32 support libraries
run:
# Add another apt repository as some packages cannot
# be downloaded with the github default repository
sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod &&
sudo apt-get update &&
sudo apt install -y g++-multilib lib32gcc-9-dev ninja-build
- name: run spec tests
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }}
working-directory: ./tests/wamr-test-suites

View File

@ -0,0 +1,393 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: compilation on macos-latest
on:
# will be triggered on PR events
pull_request:
paths-ignore:
- "assembly-script/**"
- "ci/**"
- "doc/**"
- "test-tools/**"
- ".github/workflows/compilation_on_macos.yml"
# will be triggered on push events
push:
paths-ignore:
- "assembly-script/**"
- "ci/**"
- "doc/**"
- "test-tools/**"
- ".github/workflows/compilation_on_macos.yml"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
jobs:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
cancel_previous:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
# set different traffic lights based on the current repo and the running OS.
# according to light colors, the workflow will run different jobs
check_repo:
needs: cancel_previous
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
outputs:
traffic_light: ${{ steps.do_check.outputs.light }}
steps:
- name: do_check
id: do_check
if: ${{ matrix.os == 'macos-latest' }}
run: |
if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
echo "::set-output name=light::green"
else
echo "::set-output name=light::red"
fi
build_llvm_libraries:
needs: check_repo
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
include:
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light }}
steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3
- name: Cache LLVM libraries
id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v3
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Build llvm and clang from source
id: build_llvm
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly
working-directory: build-scripts
build_wamrc:
needs: [build_llvm_libraries, check_repo]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
include:
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light }}
steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v3
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
working-directory: wamr-compiler
build_iwasm:
needs: [build_llvm_libraries, check_repo]
runs-on: ${{ matrix.os }}
strategy:
matrix:
make_options_run_mode: [
# Running mode
$AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS,
$LAZY_JIT_BUILD_OPTIONS,
$MC_JIT_BUILD_OPTIONS,
]
make_options_feature: [
# Features
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
# doesn't support
#"-DWAMR_BUILD_DEBUG_AOT=1",
"-DWAMR_BUILD_DEBUG_INTERP=1",
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
"-DWAMR_BUILD_LIB_PTHREAD=1",
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
"-DWAMR_BUILD_MINI_LOADER=1",
"-DWAMR_BUILD_MEMORY_PROFILING=1",
"-DWAMR_BUILD_MULTI_MODULE=1",
"-DWAMR_BUILD_PERF_PROFILING=1",
"-DWAMR_BUILD_REF_TYPES=1",
"-DWAMR_BUILD_SIMD=1",
"-DWAMR_BUILD_TAIL_CALL=1",
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
]
os: [macos-latest]
platform: [darwin]
exclude:
# uncompatiable feature and platform
# uncompatiable mode and feature
# MULTI_MODULE only on INTERP mode
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
# SIMD only on JIT/AOT mode
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_SIMD=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_SIMD=1"
# DEBUG_INTERP only on CLASSIC INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
# DEBUG_AOT only on JIT/AOT mode
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
# TODO: DEBUG_AOT on JIT
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
# MINI_LOADER only on INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
- make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
- make_options_run_mode: $MC_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
include:
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light }}
steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3
# only download llvm cache when needed
- name: Get LLVM libraries
id: cache_llvm
if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS'))
uses: actions/cache@v3
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true')
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build iwasm
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
cmake --build . --config Release --parallel 4
working-directory: product-mini/platforms/${{ matrix.platform }}
build_samples_wasm_c_api:
needs: [build_iwasm, check_repo]
runs-on: ${{ matrix.os }}
strategy:
matrix:
make_options: [
# Running mode
$CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS,
# doesn't support
#$LAZY_JIT_BUILD_OPTIONS,
#$MC_JIT_BUILD_OPTIONS,
#$AOT_BUILD_OPTIONS,
]
os: [macos-latest]
include:
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light }}
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz
steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3
- name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.24-*.tar.gz
sudo mv wabt-1.0.24 wabt
- name: Build Sample [wasm-c-api]
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake .. ${{ matrix.make_options }}
cmake --build . --config Release --parallel 4
./callback
./callback_chain
./empty_imports
./global
./hello
./hostref
./memory
./reflect
./table
./trap
working-directory: samples/wasm-c-api
build_samples_others:
needs: [build_iwasm, check_repo]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light }}
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz
steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3
- name: download and install wasi-sdk
if: ${{ matrix.light == 'green' }}
run: |
cd /opt
sudo wget ${{ matrix.wasi_sdk_release }}
sudo tar -xzf wasi-sdk-12.0-*.tar.gz
sudo mv wasi-sdk-12.0 wasi-sdk
- name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: |
cd /opt
sudo wget ${{ matrix.wabt_release }}
sudo tar -xzf wabt-1.0.24-*.tar.gz
sudo mv wabt-1.0.24 wabt
- name: Build Sample [basic]
if: ${{ matrix.light == 'green' }}
run: |
cd samples/basic
./build.sh
./run.sh
- name: Build Sample [multi-thread]
if: ${{ matrix.light == 'green' }}
run: |
cd samples/multi-thread
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
./iwasm wasm-apps/test.wasm
- name: Build Sample [multi-module]
if: ${{ matrix.light == 'green' }}
run: |
cd samples/multi-module
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
./multi_module
- name: Build Sample [spawn-thread]
if: ${{ matrix.light == 'green' }}
run: |
cd samples/spawn-thread
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
./spawn_thread
- name: Build Sample [ref-types]
if: ${{ matrix.light == 'green' }}
run: |
cd samples/ref-types
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
./hello

View File

@ -1,7 +1,7 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved. # Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: CI on SGX name: compilation on SGX
on: on:
# will be triggered on PR events # will be triggered on PR events
@ -47,7 +47,7 @@ jobs:
os: [ubuntu-20.04] os: [ubuntu-20.04]
steps: steps:
- name: Cancel Workflow Action - name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.6.0 uses: styfle/cancel-workflow-action@0.9.1
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
@ -87,12 +87,12 @@ jobs:
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Cache LLVM libraries - name: Cache LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -103,24 +103,24 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Build llvm and clang from source - name: Build llvm and clang from source
id: build_llvm_ubuntu id: build_llvm
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb
working-directory: build-scripts working-directory: build-scripts
build_iwasm: build_iwasm:
needs: [build_llvm_libraries, check_repo] needs: [check_repo]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
make_options_run_mode: [ make_options_run_mode: [
# Running mode # Running mode
$AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
# doesn't support # doesn't support
# $LAZY_JIT_BUILD_OPTIONS, # $LAZY_JIT_BUILD_OPTIONS,
# $MC_JIT_BUILD_OPTIONS, # $MC_JIT_BUILD_OPTIONS,
$AOT_BUILD_OPTIONS,
] ]
make_options_feature: [ make_options_feature: [
# Features # Features
@ -130,6 +130,7 @@ jobs:
# "-DWAMR_BUILD_DEBUG_INTERP=1", # "-DWAMR_BUILD_DEBUG_INTERP=1",
"-DWAMR_BUILD_DUMP_CALL_STACK=1", "-DWAMR_BUILD_DUMP_CALL_STACK=1",
"-DWAMR_BUILD_LIB_PTHREAD=1", "-DWAMR_BUILD_LIB_PTHREAD=1",
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
"-DWAMR_BUILD_MINI_LOADER=1", "-DWAMR_BUILD_MINI_LOADER=1",
"-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MEMORY_PROFILING=1",
"-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_MULTI_MODULE=1",
@ -139,7 +140,6 @@ jobs:
# "-DWAMR_BUILD_SIMD=1", # "-DWAMR_BUILD_SIMD=1",
"-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_BUILD_TAIL_CALL=1",
"-DWAMR_DISABLE_HW_BOUND_CHECK=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
] ]
os: [ubuntu-20.04] os: [ubuntu-20.04]
platform: [linux-sgx] platform: [linux-sgx]
@ -174,12 +174,51 @@ jobs:
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Build iwasm
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
cmake --build . --config Release --parallel 4
working-directory: product-mini/platforms/${{ matrix.platform }}
build_wamrc:
needs: [build_llvm_libraries, check_repo]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
include:
- os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: install SGX SDK and necessary libraries
if: ${{ matrix.light == 'green' }}
run: |
mkdir -p /opt/intel
cd /opt/intel
wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin
chmod +x sgx_linux_x64_sdk_2.15.100.3.bin
echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin
echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
sudo apt update
sudo apt install -y libsgx-launch libsgx-urts
source /opt/intel/sgxsdk/environment
- name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -193,16 +232,16 @@ jobs:
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build iwasm - name: Build wamrc
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} cmake ..
cmake --build . --config Release --parallel 4 cmake --build . --config Release --parallel 4
working-directory: product-mini/platforms/${{ matrix.platform }} working-directory: wamr-compiler
build_samples_wasm_c_api: build_samples_wasm_c_api:
needs: [build_iwasm, build_llvm_libraries, check_repo] needs: [build_iwasm, check_repo]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -227,24 +266,7 @@ jobs:
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
@ -268,14 +290,6 @@ jobs:
sudo apt install -y libsgx-launch libsgx-urts sudo apt install -y libsgx-launch libsgx-urts
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
- name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
working-directory: wamr-compiler
- name: Build Sample [wasm-c-api] - name: Build Sample [wasm-c-api]
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
run: | run: |
@ -295,7 +309,7 @@ jobs:
working-directory: samples/wasm-c-api working-directory: samples/wasm-c-api
build_samples_others: build_samples_others:
needs: [build_iwasm, build_llvm_libraries, check_repo] needs: [build_iwasm, check_repo]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -310,24 +324,7 @@ jobs:
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Get LLVM libraries
id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v2
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wasi-sdk - name: download and install wasi-sdk
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
@ -359,14 +356,6 @@ jobs:
sudo apt install -y libsgx-launch libsgx-urts sudo apt install -y libsgx-launch libsgx-urts
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
- name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: |
mkdir build && cd build
cmake ..
cmake --build . --config Release --parallel 4
working-directory: wamr-compiler
- name: Build Sample [basic] - name: Build Sample [basic]
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
run: | run: |
@ -411,7 +400,7 @@ jobs:
./hello ./hello
spec_test_default: spec_test_default:
needs: [build_iwasm, build_llvm_libraries, check_repo] needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
@ -423,12 +412,12 @@ jobs:
steps: steps:
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
id: cache_llvm id: cache_llvm
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
./core/deps/llvm/build/bin ./core/deps/llvm/build/bin
@ -438,6 +427,10 @@ jobs:
./core/deps/llvm/build/share ./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }}
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja - name: install Ninja
if: ${{ matrix.light == 'green' }} if: ${{ matrix.light == 'green' }}
run: sudo apt install -y ninja-build run: sudo apt install -y ninja-build

View File

@ -36,7 +36,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Cancel Workflow Action - name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.6.0 uses: styfle/cancel-workflow-action@0.9.1
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
@ -44,7 +44,7 @@ jobs:
needs: cancel_previous needs: cancel_previous
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: clone uvwasi library - name: clone uvwasi library
run: | run: |

View File

@ -1,155 +0,0 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Spec tests on non-windows
on:
# will be triggered on PR events
pull_request:
paths:
- "core/config.h"
- "core/iwasm/**"
- "core/shared/**"
- "wamr-compiler/**"
- "product-mini/**"
- "tests/wamr-test-suites/spec-test-script/**"
- "tests/wamr-test-suites/test_wamr.sh"
- ".github/workflows/spec_test.yml"
# will be triggered on push events
push:
paths:
- "core/config.h"
- "core/iwasm/**"
- "core/shared/**"
- "wamr-compiler/**"
- "product-mini/**"
- "tests/wamr-test-suites/spec-test-script/**"
- "tests/wamr-test-suites/test_wamr.sh"
- ".github/workflows/spec_test.yml"
# allow to be triggered manually
workflow_dispatch:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEFAULT_TEST_OPTIONS: "-s spec -P"
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
MULTI_MODULES_TEST_OPTIONS: "-s spec -M -P"
SIMD_TEST_OPTIONS: "-s spec -S -P"
THREADS_TEST_OPTIONS: "-s spec -p -P"
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
jobs:
cancel_previous:
runs-on: ubuntu-20.04
steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
spec_test_default:
needs: cancel_previous
runs-on: ubuntu-20.04
strategy:
matrix:
test_option: [$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS]
steps:
- name: checkout
uses: actions/checkout@v2
- name: Get LLVM libraries
id: cache_llvm
uses: actions/cache@v2
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: install Ninja
run: sudo apt install -y ninja-build
- name: run spec tests
run: ./test_wamr.sh ${{ matrix.test_option }}
working-directory: ./tests/wamr-test-suites
spec_test_extra:
needs: cancel_previous
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }}
runs-on: ubuntu-20.04
strategy:
matrix:
test_option: [$MULTI_MODULES_TEST_OPTIONS, $THREADS_TEST_OPTIONS]
steps:
- name: checkout
uses: actions/checkout@v2
- name: Get LLVM libraries
id: cache_llvm
uses: actions/cache@v2
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja
run: sudo apt install -y ninja-build
- name: run spec tests
run: ./test_wamr.sh ${{ matrix.test_option }}
working-directory: ./tests/wamr-test-suites
spec_test_x86_32:
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }}
needs: cancel_previous
runs-on: ubuntu-20.04
strategy:
matrix:
test_option: [$DEFAULT_TEST_OPTIONS, $THREADS_TEST_OPTIONS]
steps:
- name: checkout
uses: actions/checkout@v2
- name: Get LLVM libraries
id: cache_llvm
uses: actions/cache@v2
with:
path: |
./core/deps/llvm/build/bin
./core/deps/llvm/build/include
./core/deps/llvm/build/lib
./core/deps/llvm/build/libexec
./core/deps/llvm/build/share
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss
if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja and x32 support libraries
run:
# Add another apt repository as some packages cannot
# be downloaded with the github default repository
sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod &&
sudo apt-get update &&
sudo apt install -y g++-multilib lib32gcc-9-dev ninja-build
- name: run spec tests
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }}
working-directory: ./tests/wamr-test-suites

View File

@ -152,7 +152,7 @@ GET_U64_FROM_ADDR(uint32 *addr)
#define read_byte_array(p, p_end, addr, len) \ #define read_byte_array(p, p_end, addr, len) \
do { \ do { \
CHECK_BUF(p, p_end, len); \ CHECK_BUF(p, p_end, len); \
memcpy(addr, p, len); \ bh_memcpy_s(addr, len, p, len); \
p += len; \ p += len; \
} while (0) } while (0)
@ -1847,7 +1847,7 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
return false; return false;
} }
} }
memcpy(symbol, relocation->symbol_name, symbol_len); bh_memcpy_s(symbol, symbol_len, relocation->symbol_name, symbol_len);
symbol[symbol_len] = '\0'; symbol[symbol_len] = '\0';
if (!strncmp(symbol, AOT_FUNC_PREFIX, strlen(AOT_FUNC_PREFIX))) { if (!strncmp(symbol, AOT_FUNC_PREFIX, strlen(AOT_FUNC_PREFIX))) {

View File

@ -13,6 +13,7 @@
#define R_ARC_32_ME 27 #define R_ARC_32_ME 27
/* clang-format off */ /* clang-format off */
#ifndef __CCAC__
void __st_r13_to_r15(); void __st_r13_to_r15();
void __st_r13_to_r16(); void __st_r13_to_r16();
void __st_r13_to_r17(); void __st_r13_to_r17();
@ -41,29 +42,86 @@ void __divdf3();
void __divdi3(); void __divdi3();
void __divsf3(); void __divsf3();
void __divsi3(); void __divsi3();
void __eqsf2();
void __extendsfdf2(); void __extendsfdf2();
void __fixdfsi(); void __fixdfsi();
void __floatsidf(); void __floatsidf();
void __floatsisf(); void __floatsisf();
void __gedf2();
void __gtdf2();
void __ledf2();
void __lesf2();
void __ltdf2();
void __muldf3(); void __muldf3();
void __mulsf3(); void __mulsf3();
void __subdf3(); void __subdf3();
void __subsf3(); void __subsf3();
void __truncdfsf2(); void __truncdfsf2();
#else
void __ac_push_13_to_13();
void __ac_push_13_to_14();
void __ac_push_13_to_15();
void __ac_push_13_to_16();
void __ac_push_13_to_17();
void __ac_push_13_to_18();
void __ac_push_13_to_19();
void __ac_push_13_to_20();
void __ac_push_13_to_21();
void __ac_push_13_to_22();
void __ac_push_13_to_23();
void __ac_push_13_to_24();
void __ac_push_13_to_25();
void __ac_push_13_to_26();
void __ac_push_none();
void __ac_pop_13_to_26();
void __ac_pop_13_to_26v();
void __ac_pop_13_to_25();
void __ac_pop_13_to_25v();
void __ac_pop_13_to_24();
void __ac_pop_13_to_24v();
void __ac_pop_13_to_23();
void __ac_pop_13_to_23v();
void __ac_pop_13_to_22();
void __ac_pop_13_to_22v();
void __ac_pop_13_to_21();
void __ac_pop_13_to_21v();
void __ac_pop_13_to_20();
void __ac_pop_13_to_20v();
void __ac_pop_13_to_19();
void __ac_pop_13_to_19v();
void __ac_pop_13_to_18();
void __ac_pop_13_to_18v();
void __ac_pop_13_to_17();
void __ac_pop_13_to_17v();
void __ac_pop_13_to_16();
void __ac_pop_13_to_16v();
void __ac_pop_13_to_15();
void __ac_pop_13_to_15v();
void __ac_pop_13_to_14();
void __ac_pop_13_to_14v();
void __ac_pop_13_to_13();
void __ac_pop_13_to_13v();
void __ac_pop_none();
void __ac_pop_nonev();
void __eqdf2();
void __nedf2();
void __ltsf2();
void __nesf2();
void __gesf2();
void __gtsf2();
void __unordsf2();
void __truncdfhf2();
void __truncsfhf2();
#endif /* end of __CCAC__ */
void __ledf2();
void __ltdf2();
void __gedf2();
void __gtdf2();
void __eqsf2();
void __lesf2();
void __unorddf2(); void __unorddf2();
/* clang-format on */ /* clang-format on */
static SymbolMap target_sym_map[] = { static SymbolMap target_sym_map[] = {
/* clang-format off */ /* clang-format off */
REG_COMMON_SYMBOLS REG_COMMON_SYMBOLS
#ifndef __CCAC__
REG_SYM(__st_r13_to_r15), REG_SYM(__st_r13_to_r15),
/* clang-format on */
REG_SYM(__st_r13_to_r16), REG_SYM(__st_r13_to_r16),
REG_SYM(__st_r13_to_r17), REG_SYM(__st_r13_to_r17),
REG_SYM(__st_r13_to_r18), REG_SYM(__st_r13_to_r18),
@ -91,22 +149,80 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__divdi3), REG_SYM(__divdi3),
REG_SYM(__divsf3), REG_SYM(__divsf3),
REG_SYM(__divsi3), REG_SYM(__divsi3),
REG_SYM(__eqsf2),
REG_SYM(__extendsfdf2), REG_SYM(__extendsfdf2),
REG_SYM(__fixdfsi), REG_SYM(__fixdfsi),
REG_SYM(__floatsidf), REG_SYM(__floatsidf),
REG_SYM(__floatsisf), REG_SYM(__floatsisf),
REG_SYM(__gedf2),
REG_SYM(__gtdf2),
REG_SYM(__ledf2),
REG_SYM(__lesf2),
REG_SYM(__ltdf2),
REG_SYM(__muldf3), REG_SYM(__muldf3),
REG_SYM(__mulsf3), REG_SYM(__mulsf3),
REG_SYM(__subdf3), REG_SYM(__subdf3),
REG_SYM(__subsf3), REG_SYM(__subsf3),
REG_SYM(__truncdfsf2), REG_SYM(__truncdfsf2),
#else
REG_SYM(__ac_push_13_to_13),
REG_SYM(__ac_push_13_to_14),
REG_SYM(__ac_push_13_to_15),
REG_SYM(__ac_push_13_to_16),
REG_SYM(__ac_push_13_to_17),
REG_SYM(__ac_push_13_to_18),
REG_SYM(__ac_push_13_to_19),
REG_SYM(__ac_push_13_to_20),
REG_SYM(__ac_push_13_to_21),
REG_SYM(__ac_push_13_to_22),
REG_SYM(__ac_push_13_to_23),
REG_SYM(__ac_push_13_to_24),
REG_SYM(__ac_push_13_to_25),
REG_SYM(__ac_push_13_to_26),
REG_SYM(__ac_push_none),
REG_SYM(__ac_pop_13_to_26),
REG_SYM(__ac_pop_13_to_26v),
REG_SYM(__ac_pop_13_to_25),
REG_SYM(__ac_pop_13_to_25v),
REG_SYM(__ac_pop_13_to_24),
REG_SYM(__ac_pop_13_to_24v),
REG_SYM(__ac_pop_13_to_23),
REG_SYM(__ac_pop_13_to_23v),
REG_SYM(__ac_pop_13_to_22),
REG_SYM(__ac_pop_13_to_22v),
REG_SYM(__ac_pop_13_to_21),
REG_SYM(__ac_pop_13_to_21v),
REG_SYM(__ac_pop_13_to_20),
REG_SYM(__ac_pop_13_to_20v),
REG_SYM(__ac_pop_13_to_19),
REG_SYM(__ac_pop_13_to_19v),
REG_SYM(__ac_pop_13_to_18),
REG_SYM(__ac_pop_13_to_18v),
REG_SYM(__ac_pop_13_to_17),
REG_SYM(__ac_pop_13_to_17v),
REG_SYM(__ac_pop_13_to_16),
REG_SYM(__ac_pop_13_to_16v),
REG_SYM(__ac_pop_13_to_15),
REG_SYM(__ac_pop_13_to_15v),
REG_SYM(__ac_pop_13_to_14),
REG_SYM(__ac_pop_13_to_14v),
REG_SYM(__ac_pop_13_to_13),
REG_SYM(__ac_pop_13_to_13v),
REG_SYM(__ac_pop_none),
REG_SYM(__ac_pop_nonev),
REG_SYM(__eqdf2),
REG_SYM(__nedf2),
REG_SYM(__ltsf2),
REG_SYM(__nesf2),
REG_SYM(__gesf2),
REG_SYM(__gtsf2),
REG_SYM(__unordsf2),
REG_SYM(__truncdfhf2),
REG_SYM(__truncsfhf2),
#endif /* end of __CCAC__ */
REG_SYM(__ledf2),
REG_SYM(__ltdf2),
REG_SYM(__gedf2),
REG_SYM(__gtdf2),
REG_SYM(__eqsf2),
REG_SYM(__lesf2),
REG_SYM(__unorddf2), REG_SYM(__unorddf2),
/* clang-format on */
}; };
static void static void
@ -168,6 +284,45 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
int32 symbol_index, char *error_buf, uint32 error_buf_size) int32 symbol_index, char *error_buf, uint32 error_buf_size)
{ {
switch (reloc_type) { switch (reloc_type) {
case R_ARC_S25H_PCREL:
{
uint32 insn = LOAD_I32(target_section_addr + reloc_offset);
int32 addend, value;
uintptr_t S, P;
intptr_t A;
CHECK_RELOC_OFFSET(sizeof(void *));
/* Convert from middle endian */
insn = middle_endian_convert(insn);
addend = ((insn << 28) >> 28) << 10;
/* Extract the next 10 bits from Position 6 to 15 in insn */
addend |= ((insn << 16) >> 22);
addend = addend << 10;
/* Extract the remaining 10 bits from Position 17 to 26 in insn */
addend |= ((insn << 5) >> 22);
/* Fill in 1 bits to get the 25 bit Offset Value */
addend = addend << 1;
/* (S + A) - P */
S = (uintptr_t)(uint8 *)symbol_addr;
A = (intptr_t)reloc_addend;
P = (uintptr_t)(target_section_addr + reloc_offset);
P &= (uintptr_t)~1;
value = (int32)(S + A + addend - P);
insn = insn & 0xf8010030;
insn |= ((((value >> 1) & 0x3ff) << 17)
| (((value >> 1) & 0xffc00) >> 3)
| (((value >> 1) & 0xf00000) >> 19));
/* Convert to middle endian */
insn = middle_endian_convert(insn);
STORE_U32(target_section_addr + reloc_offset, insn);
break;
}
case R_ARC_S25W_PCREL: case R_ARC_S25W_PCREL:
{ {
uint32 insn = LOAD_I32(target_section_addr + reloc_offset); uint32 insn = LOAD_I32(target_section_addr + reloc_offset);

View File

@ -22,6 +22,26 @@ void __modsi3();
void __divdi3(); void __divdi3();
void __udivdi3();
void __unorddf2();
void __adddf3();
void __eqdf2();
void __muldf3();
void __gedf2();
void __ledf2();
void __fixunsdfsi();
void __floatunsidf();
void __subdf3();
void __nedf2();
void __fixdfsi();
void __moddi3();
void __extendsfdf2();
void __truncdfsf2();
void __gtdf2();
void __umoddi3();
void __floatdidf();
void __divsf3();
static SymbolMap target_sym_map[] = { static SymbolMap target_sym_map[] = {
REG_COMMON_SYMBOLS REG_COMMON_SYMBOLS
@ -40,6 +60,28 @@ static SymbolMap target_sym_map[] = {
REG_SYM(__modsi3), REG_SYM(__modsi3),
REG_SYM(__divdi3), REG_SYM(__divdi3),
REG_SYM(__udivdi3),
REG_SYM(__unorddf2),
REG_SYM(__adddf3),
REG_SYM(__eqdf2),
REG_SYM(__muldf3),
REG_SYM(__gedf2),
REG_SYM(__ledf2),
REG_SYM(__fixunsdfsi),
REG_SYM(__floatunsidf),
REG_SYM(__subdf3),
REG_SYM(__nedf2),
REG_SYM(__fixdfsi),
REG_SYM(__moddi3),
REG_SYM(__extendsfdf2),
REG_SYM(__truncdfsf2),
REG_SYM(__gtdf2),
REG_SYM(__umoddi3),
REG_SYM(__floatdidf),
REG_SYM(__divsf3),
REG_SYM(sqrt),
REG_SYM(sqrtf),
}; };
/* clang-format on */ /* clang-format on */

View File

@ -485,7 +485,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
u.ieee.ieee_little_endian.negative = 1; u.ieee.ieee_little_endian.negative = 1;
else else
u.ieee.ieee_big_endian.negative = 1; u.ieee.ieee_big_endian.negative = 1;
memcpy(&f32, &u.f, sizeof(float)); bh_memcpy_s(&f32, sizeof(float), &u.f, sizeof(float));
} }
if (endptr[0] == ':') { if (endptr[0] == ':') {
uint32 sig; uint32 sig;
@ -496,10 +496,11 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
u.ieee.ieee_little_endian.mantissa = sig; u.ieee.ieee_little_endian.mantissa = sig;
else else
u.ieee.ieee_big_endian.mantissa = sig; u.ieee.ieee_big_endian.mantissa = sig;
memcpy(&f32, &u.f, sizeof(float)); bh_memcpy_s(&f32, sizeof(float), &u.f, sizeof(float));
} }
} }
memcpy(&argv1[p++], &f32, sizeof(float)); bh_memcpy_s(&argv1[p], total_size - p, &f32, sizeof(float));
p++;
break; break;
} }
case VALUE_TYPE_F64: case VALUE_TYPE_F64:
@ -517,7 +518,8 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
ud.ieee.ieee_little_endian.negative = 1; ud.ieee.ieee_little_endian.negative = 1;
else else
ud.ieee.ieee_big_endian.negative = 1; ud.ieee.ieee_big_endian.negative = 1;
memcpy(&u.val, &ud.d, sizeof(double)); bh_memcpy_s(&u.val, sizeof(double), &ud.d,
sizeof(double));
} }
if (endptr[0] == ':') { if (endptr[0] == ':') {
uint64 sig; uint64 sig;
@ -532,7 +534,8 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
ud.ieee.ieee_big_endian.mantissa0 = sig >> 32; ud.ieee.ieee_big_endian.mantissa0 = sig >> 32;
ud.ieee.ieee_big_endian.mantissa1 = (uint32)sig; ud.ieee.ieee_big_endian.mantissa1 = (uint32)sig;
} }
memcpy(&u.val, &ud.d, sizeof(double)); bh_memcpy_s(&u.val, sizeof(double), &ud.d,
sizeof(double));
} }
} }
argv1[p++] = u.parts[0]; argv1[p++] = u.parts[0];

View File

@ -1245,6 +1245,8 @@ wasm_func_get_param_count(WASMFunctionInstanceCommon *const func_inst,
{ {
WASMType *type = WASMType *type =
wasm_runtime_get_function_type(func_inst, module_inst->module_type); wasm_runtime_get_function_type(func_inst, module_inst->module_type);
bh_assert(type);
return type->param_count; return type->param_count;
} }
@ -1254,6 +1256,8 @@ wasm_func_get_result_count(WASMFunctionInstanceCommon *const func_inst,
{ {
WASMType *type = WASMType *type =
wasm_runtime_get_function_type(func_inst, module_inst->module_type); wasm_runtime_get_function_type(func_inst, module_inst->module_type);
bh_assert(type);
return type->result_count; return type->result_count;
} }
@ -1288,6 +1292,8 @@ wasm_func_get_param_types(WASMFunctionInstanceCommon *const func_inst,
wasm_runtime_get_function_type(func_inst, module_inst->module_type); wasm_runtime_get_function_type(func_inst, module_inst->module_type);
uint32 i; uint32 i;
bh_assert(type);
for (i = 0; i < type->param_count; i++) { for (i = 0; i < type->param_count; i++) {
param_types[i] = val_type_to_val_kind(type->types[i]); param_types[i] = val_type_to_val_kind(type->types[i]);
} }
@ -1302,6 +1308,8 @@ wasm_func_get_result_types(WASMFunctionInstanceCommon *const func_inst,
wasm_runtime_get_function_type(func_inst, module_inst->module_type); wasm_runtime_get_function_type(func_inst, module_inst->module_type);
uint32 i; uint32 i;
bh_assert(type);
for (i = 0; i < type->result_count; i++) { for (i = 0; i < type->result_count; i++) {
result_types[i] = result_types[i] =
val_type_to_val_kind(type->types[type->param_count + i]); val_type_to_val_kind(type->types[type->param_count + i]);

View File

@ -1287,6 +1287,7 @@ fail:
static uint32 static uint32
get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data) get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data)
{ {
#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
uint32 size = 0, i; uint32 size = 0, i;
for (i = 0; i < comp_ctx->custom_sections_count; i++) { for (i = 0; i < comp_ctx->custom_sections_count; i++) {
@ -1312,6 +1313,9 @@ get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data)
} }
return size; return size;
#else
return 0;
#endif
} }
static bool static bool
@ -1941,6 +1945,7 @@ static bool
aot_emit_custom_sections(uint8 *buf, uint8 *buf_end, uint32 *p_offset, aot_emit_custom_sections(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
AOTCompData *comp_data, AOTCompContext *comp_ctx) AOTCompData *comp_data, AOTCompContext *comp_ctx)
{ {
#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
uint32 offset = *p_offset, i; uint32 offset = *p_offset, i;
for (i = 0; i < comp_ctx->custom_sections_count; i++) { for (i = 0; i < comp_ctx->custom_sections_count; i++) {
@ -1968,6 +1973,7 @@ aot_emit_custom_sections(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
} }
*p_offset = offset; *p_offset = offset;
#endif
return true; return true;
} }

View File

@ -374,6 +374,8 @@ send_thread_stop_status(WASMGDBServer *server, uint32 status, korp_tid tid)
exec_env = wasm_debug_instance_get_current_env( exec_env = wasm_debug_instance_get_current_env(
(WASMDebugInstance *)server->thread->debug_instance); (WASMDebugInstance *)server->thread->debug_instance);
bh_assert(exec_env);
exception = exception =
wasm_runtime_get_exception(wasm_runtime_get_module_inst(exec_env)); wasm_runtime_get_exception(wasm_runtime_get_module_inst(exec_env));
if (exception) { if (exception) {

View File

@ -1091,7 +1091,7 @@ static float
freebsd_fminf(float x, float y) freebsd_fminf(float x, float y)
{ {
if (is_little_endian()) { if (is_little_endian()) {
IEEEf2bits_L u[2]; IEEEf2bits_L u[2] = { 0 };
u[0].f = x; u[0].f = x;
u[1].f = y; u[1].f = y;
@ -1107,7 +1107,7 @@ freebsd_fminf(float x, float y)
return (u[u[1].bits.sign].f); return (u[u[1].bits.sign].f);
} }
else { else {
IEEEf2bits_B u[2]; IEEEf2bits_B u[2] = { 0 };
u[0].f = x; u[0].f = x;
u[1].f = y; u[1].f = y;
@ -1130,7 +1130,7 @@ static float
freebsd_fmaxf(float x, float y) freebsd_fmaxf(float x, float y)
{ {
if (is_little_endian()) { if (is_little_endian()) {
IEEEf2bits_L u[2]; IEEEf2bits_L u[2] = { 0 };
u[0].f = x; u[0].f = x;
u[1].f = y; u[1].f = y;
@ -1146,7 +1146,7 @@ freebsd_fmaxf(float x, float y)
return (u[u[0].bits.sign].f); return (u[u[0].bits.sign].f);
} }
else { else {
IEEEf2bits_B u[2]; IEEEf2bits_B u[2] = { 0 };
u[0].f = x; u[0].f = x;
u[1].f = y; u[1].f = y;

View File

@ -42,7 +42,8 @@ extend_vector(Vector *vector, size_t length)
return false; return false;
} }
memcpy(data, vector->data, vector->size_elem * vector->max_elems); bh_memcpy_s(data, vector->size_elem * length, vector->data,
vector->size_elem * vector->max_elems);
BH_FREE(vector->data); BH_FREE(vector->data);
vector->data = data; vector->data = data;
@ -109,8 +110,8 @@ bh_vector_set(Vector *vector, uint32 index, const void *elem_buf)
if (vector->lock) if (vector->lock)
os_mutex_lock(vector->lock); os_mutex_lock(vector->lock);
memcpy(vector->data + vector->size_elem * index, elem_buf, bh_memcpy_s(vector->data + vector->size_elem * index, vector->size_elem,
vector->size_elem); elem_buf, vector->size_elem);
if (vector->lock) if (vector->lock)
os_mutex_unlock(vector->lock); os_mutex_unlock(vector->lock);
return true; return true;
@ -131,8 +132,8 @@ bh_vector_get(Vector *vector, uint32 index, void *elem_buf)
if (vector->lock) if (vector->lock)
os_mutex_lock(vector->lock); os_mutex_lock(vector->lock);
memcpy(elem_buf, vector->data + vector->size_elem * index, bh_memcpy_s(elem_buf, vector->size_elem,
vector->size_elem); vector->data + vector->size_elem * index, vector->size_elem);
if (vector->lock) if (vector->lock)
os_mutex_unlock(vector->lock); os_mutex_unlock(vector->lock);
return true; return true;
@ -165,11 +166,12 @@ bh_vector_insert(Vector *vector, uint32 index, const void *elem_buf)
p = vector->data + vector->size_elem * vector->num_elems; p = vector->data + vector->size_elem * vector->num_elems;
for (i = vector->num_elems - 1; i > index; i--) { for (i = vector->num_elems - 1; i > index; i--) {
memcpy(p, p - vector->size_elem, vector->size_elem); bh_memcpy_s(p, vector->size_elem, p - vector->size_elem,
vector->size_elem);
p -= vector->size_elem; p -= vector->size_elem;
} }
memcpy(p, elem_buf, vector->size_elem); bh_memcpy_s(p, vector->size_elem, elem_buf, vector->size_elem);
vector->num_elems++; vector->num_elems++;
ret = true; ret = true;
@ -199,8 +201,8 @@ bh_vector_append(Vector *vector, const void *elem_buf)
goto unlock_return; goto unlock_return;
} }
memcpy(vector->data + vector->size_elem * vector->num_elems, elem_buf, bh_memcpy_s(vector->data + vector->size_elem * vector->num_elems,
vector->size_elem); vector->size_elem, elem_buf, vector->size_elem);
vector->num_elems++; vector->num_elems++;
ret = true; ret = true;
@ -232,11 +234,12 @@ bh_vector_remove(Vector *vector, uint32 index, void *old_elem_buf)
p = vector->data + vector->size_elem * index; p = vector->data + vector->size_elem * index;
if (old_elem_buf) { if (old_elem_buf) {
memcpy(old_elem_buf, p, vector->size_elem); bh_memcpy_s(old_elem_buf, vector->size_elem, p, vector->size_elem);
} }
for (i = index; i < vector->num_elems - 1; i++) { for (i = index; i < vector->num_elems - 1; i++) {
memcpy(p, p + vector->size_elem, vector->size_elem); bh_memcpy_s(p, vector->size_elem, p + vector->size_elem,
vector->size_elem);
p += vector->size_elem; p += vector->size_elem;
} }