Skip to content

Commit 91bb7d9

Browse files
committed
Merge branch main into dev/instantiate_linking
- fix: when load aot init expr,no type_idx set. (bytecodealliance#4094) - Cmake improvements (bytecodealliance#4076) - fix(aot_emit_aot_file): prevent buffer emission for zero byte_count (bytecodealliance#4095) - fix(unit-test): libc_builtin_test issues (bytecodealliance#4073) - feat: add support for EXTERNREF value type and enable AOT validator in fuzz tests (bytecodealliance#4083) - [gc] Subtyping fix (bytecodealliance#4075) - Add a conditional check for the macro __STDC_VERSION__ (bytecodealliance#4080) - Unit test:type matching issue and code redundancy (bytecodealliance#4079) - build(deps): Bump github/codeql-action from 3.28.8 to 3.28.9 (bytecodealliance#4074) - fix(aot): ensure value_cmp does not exceed br_count in branch table compilation (bytecodealliance#4065) - In wasm32, fix potential conversion overflow when enlarging 65536 pages (bytecodealliance#4064) - [fuzzing] execute every exported function (bytecodealliance#3959) - Update memory allocation functions to use allocator user data (bytecodealliance#4043) - Show wasm proposals status during compilation and execution (bytecodealliance#3989) - add a validator for aot module (bytecodealliance#3995) - Use wasm32-wasip1 instead of wasm32-wasi target for rust code (bytecodealliance#4057) - Update Rust target from 'wasm32-wasi' to 'wasm32-wasip1' in CI (bytecodealliance#4050) - Fix wasm loader check data segment count (bytecodealliance#4039) - Synchronize the GC spec tests to the commit from December 9. 2024. (bytecodealliance#4022) - Refine getting const offsets in wasm loader of fast-interp (bytecodealliance#4012) - fixes for compiling on windows (bytecodealliance#4026) - .github: Add shared lib builds (bytecodealliance#3975) - Refine read leb int wasm loader of fast interpreter (bytecodealliance#4017) - build(deps): Bump github/codeql-action from 3.28.0 to 3.28.1 (bytecodealliance#4020) - build(deps): Bump actions/upload-artifact from 4.5.0 to 4.6.0 (bytecodealliance#4021) - Enable shrunk memory by default and add related configurations (bytecodealliance#4008) - Add documentation regarding security issues and the status of Wasm proposals (bytecodealliance#3972) - Improve stack consistency by ensuring sufficient space for dummy offsets (bytecodealliance#4011) - Check whether related table has funcref elem in opcode call_indirect (bytecodealliance#3999) - [fuzzing] Use software bound-check during fuzzing (bytecodealliance#4003) - Add an example of how to embed WAMR in Zephyr user mode (bytecodealliance#3998) - Fix table index calculations in wasm_loader and wasm_mini_loader (bytecodealliance#4004) - Ensure __heap_base and __data_end global indices are validated against import count (bytecodealliance#3996) - Error message improvement (bytecodealliance#4000) - Handle a new scenario where an item is both exported and imported. (bytecodealliance#3984) - Optimize memory initialization handling in AOT loader (bytecodealliance#3983) - build(deps): Bump actions/upload-artifact from 4.4.3 to 4.5.0 (bytecodealliance#3981) - build(deps): Bump github/codeql-action from 3.27.9 to 3.28.0 (bytecodealliance#3982) - Add Tianlong into code owners (bytecodealliance#3970) - Set thread information earlier in exec_env creation (bytecodealliance#3967) - top-level cmake: link llvm libraries to our shared library (bytecodealliance#3973) - add reference type support by default for darwin to support WASI-SDK-25 (bytecodealliance#3978) - CMakeLists.txt: Do not require C++ (bytecodealliance#3956) - [fuzzing] Enable instantiation (bytecodealliance#3958) - use a random secret key (bytecodealliance#3971) - top-level cmakefile: fix macOS build (bytecodealliance#3968) - Only access Zephyr thread stats info when it's available (bytecodealliance#3962) - build(deps): Bump github/codeql-action from 3.27.6 to 3.27.9 (bytecodealliance#3960) - wasm_export.h: Use "default" visibility for gcc and clang (bytecodealliance#3957) - set alignment 4 when loading multi return value (bytecodealliance#3955) - Fix aot table instantiate (bytecodealliance#3946) - Consume the placeholders that were put when emitting table info (bytecodealliance#3940) - Refactor SConscript and add file checks in iwasm.c (bytecodealliance#3945) - Improvements for platform thread APIs on Windows and Zephyr (bytecodealliance#3941) - Fix incorrect assignment in win_file.c (bytecodealliance#3939) - don't return an uninitialized trap if argv_to_results fails (bytecodealliance#3935) - support WASM_FUNCREF return type in argv_to_results (bytecodealliance#3936) - add thread cpu time for zephyr (bytecodealliance#3937) - build(deps): bump github/codeql-action from 3.27.4 to 3.27.5 (bytecodealliance#3931) - Update README.md to clarify Windows toolchain support and ESP-IDF reference (bytecodealliance#3917) - Enable ref types by default (bytecodealliance#3894) - Fix loader small bug (bytecodealliance#3928) - add testcases for shared heap and fix POP_MEM_OFFSET of memory64 (bytecodealliance#3916) - Use plain assignment rather than bh_memcpy_s (bytecodealliance#3924) - Fix WASI Path Mapping Processing (bytecodealliance#3923) - Drop declarative elements on module instantiation (bytecodealliance#3922) - Check possible integer overflow in aot memory boundary check (bytecodealliance#3920) - Fix CI wamr-ide error (bytecodealliance#3913) - Support external toolchain on Windows for aot compiler (bytecodealliance#3911) - build(deps): bump github/codeql-action from 3.27.1 to 3.27.4 (bytecodealliance#3912) - Correct the table index calculation in aot_instantiation (bytecodealliance#3903) - Fix a leak in wasm_loader_emit_br_info (bytecodealliance#3900) - GlobalValueSet was moved to IRPartitionLayer recently, but we have a local definition anyway (bytecodealliance#3899) - build(deps): bump github/codeql-action from 3.27.0 to 3.27.1 (bytecodealliance#3902) - Fix linked global initialization in multimodule (bytecodealliance#3905) - Wasm loader enhancement: check code size in code entry (bytecodealliance#3892) - Refactor AOT loader to support compatible versions (bytecodealliance#3891) - Fix out of bounds issue in is_native_addr_in_shared_heap function (bytecodealliance#3886) - Fix mmap flags for AOT loader on non-Linux SGX platforms (bytecodealliance#3890) - Bump AOT_CURRENT_VERSION for WAMR 2.x (gc, memory64) (bytecodealliance#3880) - Refine looking up aot function with index (bytecodealliance#3882) - build(deps): bump github/codeql-action from 3.26.13 to 3.27.0 (bytecodealliance#3888) - fix(ios): Remove `float-abi` flag (bytecodealliance#3889) - Fix out of bounds issues after memory.grow on non-aot non-threads builds (bytecodealliance#3872) - Exclude fuzz test python and npm packages in scoreboard scan (bytecodealliance#3871) Author: Chris Woods <[email protected]> Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Author: Dylan Johnston <[email protected]> Author: edoardo <[email protected]> Author: eric <[email protected]> Author: Fadumina Barre <[email protected]> Author: Huang Qi <[email protected]> Author: James Ring <[email protected]> Author: Jérôme Vouillon <[email protected]> Author: kk <[email protected]> Author: [email protected] <[email protected]> Author: liang.he <[email protected]> Author: Maks Litskevich <[email protected]> Author: Marcin Kolny <[email protected]> Author: peter-tatrai <[email protected]> Author: TianlongLiang <[email protected]> Author: Tomáš Malý <[email protected]> Author: Viacheslav Palchikov <[email protected]> Author: WenLY1 <[email protected]> Author: Wenyong Huang <[email protected]> Author: Xavier Del Campo <[email protected]> Author: YAMAMOTO Takashi <[email protected]> Author: yangkun27 <[email protected]>
1 parent 918b364 commit 91bb7d9

File tree

113 files changed

+3769
-1621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3769
-1621
lines changed

.github/workflows/build_llvm_libraries.yml

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
shell: bash
6666
run: |
6767
echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py ${{ inputs.extra_build_llvm_options }} --llvm-ver)" >> $GITHUB_OUTPUT
68+
working-directory: build-scripts
6869

6970
# Bump the prefix number to evict all previous caches and
7071
# enforce a clean build, in the unlikely case that some

.github/workflows/check_version_h.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (C) 2019 Intel Corporation. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
name: confirm version.h stay in sync
4+
5+
on:
6+
workflow_call:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
confirm_version:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: checkout
17+
uses: actions/checkout@v4
18+
19+
- name: cmake execute to generate version.h
20+
run: cmake -B build_version -S .
21+
22+
- name: confirm version.h
23+
run: |
24+
if [ -z "$(git status --porcelain | grep version.h)" ]; then
25+
echo "version.h is in sync"
26+
else
27+
echo "version.h is not in sync"
28+
exit 1
29+
fi

.github/workflows/codeql.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
# Initializes the CodeQL tools for scanning.
5555
- name: Initialize CodeQL
56-
uses: github/codeql-action/init@v3.27.4
56+
uses: github/codeql-action/init@v3.28.9
5757
with:
5858
languages: ${{ matrix.language }}
5959

@@ -70,7 +70,7 @@ jobs:
7070
- run: |
7171
./.github/scripts/codeql_buildscript.sh
7272
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@v3.27.4
73+
uses: github/codeql-action/analyze@v3.28.9
7474
with:
7575
category: "/language:${{matrix.language}}"
7676
upload: false
@@ -99,14 +99,14 @@ jobs:
9999
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
100100

101101
- name: Upload CodeQL results to code scanning
102-
uses: github/codeql-action/upload-sarif@v3.27.4
102+
uses: github/codeql-action/upload-sarif@v3.28.9
103103
with:
104104
sarif_file: ${{ steps.step1.outputs.sarif-output }}
105105
category: "/language:${{matrix.language}}"
106106

107107
- name: Upload CodeQL results as an artifact
108108
if: success() || failure()
109-
uses: actions/upload-artifact@v4.4.3
109+
uses: actions/upload-artifact@v4.6.0
110110
with:
111111
name: codeql-results
112112
path: ${{ steps.step1.outputs.sarif-output }}

.github/workflows/compilation_on_android_ubuntu.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ permissions:
7474
contents: read
7575

7676
jobs:
77+
check_version_h:
78+
permissions:
79+
contents: read
80+
actions: write
81+
uses: ./.github/workflows/check_version_h.yml
82+
7783
build_llvm_libraries_on_ubuntu_2204:
7884
permissions:
7985
contents: read
@@ -156,6 +162,7 @@ jobs:
156162
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
157163
"-DWAMR_BUILD_MEMORY64=1",
158164
"-DWAMR_BUILD_MULTI_MEMORY=1",
165+
"-DWAMR_BUILD_SHARED=1",
159166
]
160167
os: [ubuntu-22.04]
161168
platform: [android, linux]
@@ -253,6 +260,9 @@ jobs:
253260
platform: android
254261
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
255262
platform: android
263+
# android does not support WAMR_BUILD_SHARED in its CMakeLists.txt.
264+
- make_options_feature: "-DWAMR_BUILD_SHARED=1"
265+
platform: android
256266
include:
257267
- os: ubuntu-22.04
258268
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
@@ -671,7 +681,7 @@ jobs:
671681
test_option: $MEMORY64_TEST_OPTIONS
672682
- running_mode: "multi-tier-jit"
673683
test_option: $MEMORY64_TEST_OPTIONS
674-
# aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory
684+
# aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory
675685
- running_mode: "aot"
676686
test_option: $MULTI_MEMORY_TEST_OPTIONS
677687
- running_mode: "fast-interp"
@@ -813,7 +823,7 @@ jobs:
813823

814824
- name: install dependencies
815825
run: |
816-
rustup target add wasm32-wasi
826+
rustup target add wasm32-wasip1
817827
sudo apt update && sudo apt-get install -y lld ninja-build
818828
npm install
819829
working-directory: test-tools/wamr-ide/VSCode-Extension

.github/workflows/nightly_run.yml

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ jobs:
142142
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
143143
"-DWAMR_BUILD_MEMORY64=1",
144144
"-DWAMR_BUILD_MULTI_MEMORY=1",
145+
"-DWAMR_BUILD_SHARED=1",
145146
]
146147
os: [ubuntu-20.04]
147148
platform: [android, linux]

.github/workflows/spec_test_on_nuttx.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ jobs:
127127
wamr_feature_option:
128128
# Empty option for default
129129
- { option: "", mode: "" }
130-
- { option: "CONFIG_INTERPRETERS_WAMR_GC CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME", mode: "-G" }
130+
# need to install menhir
131+
# - { option: "CONFIG_INTERPRETERS_WAMR_GC CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME", mode: "-G" }
131132

132133
exclude:
133134
# XIP is not fully supported yet on RISCV64, some relocations can not be resolved
@@ -208,7 +209,7 @@ jobs:
208209
if: contains(matrix.wamr_test_option.mode, 'aot')
209210
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
210211
run: |
211-
cmake -Bbuild .
212+
cmake -B build -DWAMR_BUILD_SHRUNK_MEMORY=0 -S .
212213
cmake --build build
213214
214215
# the nuttx version we use for xtensa requires esptool.py newer than
@@ -350,7 +351,7 @@ jobs:
350351
351352
- name: upload the log
352353
if: always()
353-
uses: actions/upload-artifact@v4.4.3
354+
uses: actions/upload-artifact@v4.6.0
354355
with:
355356
name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }}
356357
path: log

.github/workflows/supply_chain.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ jobs:
5252
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
5353
# format to the repository Actions tab.
5454
- name: "Upload artifact"
55-
uses: actions/upload-artifact@184d73b71b93c222403b2e7f1ffebe4508014249 # v3.1.0
55+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v3.1.0
5656
with:
5757
name: SARIF file
5858
path: results.sarif
5959
retention-days: 5
6060

6161
# Upload the results to GitHub's code scanning dashboard.
6262
- name: "Upload to code-scanning"
63-
uses: github/codeql-action/upload-sarif@a1695c562bbfa68dc5ab58c9b5e9f616b52bf5be # v2.2.4
63+
uses: github/codeql-action/upload-sarif@0a35e8f6866a39b001e5f7ad1d0daf9836786896 # v2.2.4
6464
with:
6565
sarif_file: results.sarif

CMakeLists.txt

+36-51
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,23 @@
33

44
cmake_minimum_required (VERSION 3.0)
55

6+
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
7+
68
if(ESP_PLATFORM)
79
include (${COMPONENT_DIR}/build-scripts/esp-idf/wamr/CMakeLists.txt)
810
return()
911
endif()
1012

11-
project (iwasm)
13+
project (iwasm LANGUAGES C)
14+
15+
set(CMAKE_CXX_STANDARD 17)
1216

1317
set (CMAKE_VERBOSE_MAKEFILE OFF)
1418

1519
if (NOT DEFINED WAMR_BUILD_PLATFORM)
1620
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
1721
endif ()
1822

19-
if (NOT DEFINED WAMR_BUILD_STATIC)
20-
set (WAMR_BUILD_STATIC 1)
21-
endif ()
22-
if (NOT DEFINED WAMR_BUILD_SHARED)
23-
set (WAMR_BUILD_SHARED 1)
24-
endif ()
25-
2623
# Reset default linker flags
2724
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
2825
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
@@ -113,8 +110,8 @@ if (NOT DEFINED WAMR_BUILD_SIMD)
113110
endif ()
114111

115112
if (NOT DEFINED WAMR_BUILD_REF_TYPES)
116-
# Disable reference types by default
117-
set (WAMR_BUILD_REF_TYPES 0)
113+
# Enable reference types by default
114+
set (WAMR_BUILD_REF_TYPES 1)
118115
endif ()
119116

120117
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
@@ -154,52 +151,40 @@ if (MSVC)
154151
add_definitions(-DCOMPILING_WASM_RUNTIME_API=1)
155152
endif ()
156153

157-
# STATIC LIBRARY
158-
if (WAMR_BUILD_STATIC)
159-
add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE})
160-
set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib)
161-
target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include)
162-
target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
163-
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
164-
target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
165-
endif ()
154+
add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE})
155+
set_target_properties (vmlib PROPERTIES OUTPUT_NAME iwasm)
156+
target_include_directories(vmlib INTERFACE
157+
$<BUILD_INTERFACE:${WAMR_ROOT_DIR}/core/iwasm/include>
158+
$<INSTALL_INTERFACE:include/iwasm>
159+
)
166160

167-
if (MINGW)
168-
target_link_libraries (iwasm_static PRIVATE ws2_32)
169-
endif ()
170-
171-
if (WIN32)
172-
target_link_libraries(iwasm_static PRIVATE ntdll)
173-
endif()
161+
target_link_libraries (vmlib PUBLIC ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
162+
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
163+
target_link_libraries(vmlib INTERFACE boringssl_crypto)
164+
endif ()
174165

175-
install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
166+
if (MINGW)
167+
target_link_libraries(vmlib INTERFACE -lWs2_32 -lwsock32)
168+
target_link_libraries(vmlib PRIVATE ws2_32)
176169
endif ()
177170

178-
# SHARED LIBRARY
179-
if (WAMR_BUILD_SHARED)
180-
add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE})
181-
set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm)
182-
target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include)
183-
target_link_libraries (iwasm_shared INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
184-
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
185-
target_link_libraries(iwasm_shared INTERFACE boringssl_crypto)
186-
endif ()
171+
if (WIN32)
172+
target_link_libraries(vmlib PRIVATE ntdll)
173+
endif()
187174

188-
if (MINGW)
189-
target_link_libraries(iwasm_shared INTERFACE -lWs2_32 -lwsock32)
190-
target_link_libraries(iwasm_shared PRIVATE ws2_32)
191-
endif ()
175+
set (WAMR_PUBLIC_HEADERS
176+
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
177+
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
178+
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
179+
)
180+
set_target_properties (vmlib PROPERTIES PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}")
192181

193-
if (WIN32)
194-
target_link_libraries(iwasm_shared PRIVATE ntdll)
195-
endif()
182+
set_version_info (vmlib)
196183

197-
install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
198-
endif ()
184+
install (TARGETS vmlib
185+
EXPORT iwasmTargets
186+
LIBRARY DESTINATION lib
187+
PUBLIC_HEADER DESTINATION include/iwasm
188+
)
199189

200-
# HEADERS
201-
install (FILES
202-
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
203-
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
204-
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
205-
DESTINATION include)
190+
install_iwasm_package ()

CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# If none of the later patterns match, assign to anyone. This team is the
2323
# parent of all the other teams and automatically includes everyone on those
2424
# teams.
25-
* @loganek @lum1n0us @no1wudi @wenyongh @xujuntwt95329 @yamt
25+
* @loganek @lum1n0us @no1wudi @TianlongLiang @wenyongh @xujuntwt95329 @yamt
2626

2727
# Some parts of the project require more specialized knowledge. In those areas
2828
# we designate smaller groups who are more likely to be aware of who's working

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ The WAMR VMcore supports the following architectures:
5858
- XTENSA, MIPS, ARC
5959

6060
The following platforms are supported, click each link below for how to build iwasm on that platform. Refer to [WAMR porting guide](./doc/port_wamr.md) for how to port WAMR to a new platform.
61-
- [Linux](./product-mini/README.md#linux), [Linux SGX (Intel Software Guard Extension)](./doc/linux_sgx.md), [MacOS](./product-mini/README.md#macos), [Android](./product-mini/README.md#android), [Windows](./product-mini/README.md#windows), [Windows (MinGW)](./product-mini/README.md#mingw)
62-
- [Zephyr](./product-mini/README.md#zephyr), [AliOS-Things](./product-mini/README.md#alios-things), [VxWorks](./product-mini/README.md#vxworks), [NuttX](./product-mini/README.md#nuttx), [RT-Thread](./product-mini/README.md#RT-Thread), [ESP-IDF](./product-mini/README.md#esp-idf)
61+
- [Linux](./product-mini/README.md#linux), [Linux SGX (Intel Software Guard Extension)](./doc/linux_sgx.md), [MacOS](./product-mini/README.md#macos), [Android](./product-mini/README.md#android), [Windows](./product-mini/README.md#windows), [Windows (MinGW, MSVC)](./product-mini/README.md#mingw)
62+
- [Zephyr](./product-mini/README.md#zephyr), [AliOS-Things](./product-mini/README.md#alios-things), [VxWorks](./product-mini/README.md#vxworks), [NuttX](./product-mini/README.md#nuttx), [RT-Thread](./product-mini/README.md#RT-Thread), [ESP-IDF(FreeRTOS)](./product-mini/README.md#esp-idf)
6363

6464

6565
## Getting started

build-scripts/build_llvm.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,23 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
105105
experimental_backends = ["ARC", "Xtensa"]
106106
normal_backends = [s for s in backends if s not in experimental_backends]
107107

108+
experimental_backends = ["ARC", "Xtensa"]
109+
normal_backends = [s for s in backends if s not in experimental_backends]
110+
108111
LLVM_TARGETS_TO_BUILD = [
112+
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
113+
if normal_backends
109114
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
110115
if normal_backends
111116
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
112117
]
113118

119+
# if not on ARC platform, but want to add expeirmental backend ARC as target
120+
if platform != "ARC" and "ARC" in backends:
121+
LLVM_TARGETS_TO_BUILD.extend(
122+
LLVM_EXTRA_COMPILE_OPTIONS["arc"]
123+
)
124+
114125
# if not on ARC platform, but want to add expeirmental backend ARC as target
115126
if platform != "ARC" and "ARC" in backends:
116127
LLVM_TARGETS_TO_BUILD.extend(
@@ -217,11 +228,11 @@ def repackage_llvm_windows(llvm_dir):
217228
if not packs_path:
218229
raise Exception("Didn't find any LLVM-* package")
219230
return
220-
231+
221232
llvm_package_path = f"_CPack_Packages/win64/NSIS/{packs_path[0].name}"
222233
windows_package_dir = build_dir.joinpath(llvm_package_path).resolve()
223234

224-
# mv package dir outside of build
235+
# mv package dir outside of build
225236
shutil.move(str(windows_package_dir), str(llvm_dir))
226237
# rm -r build
227238
shutil.rmtree(str(build_dir))
@@ -231,7 +242,7 @@ def repackage_llvm_windows(llvm_dir):
231242
moved_package_dir = llvm_dir.joinpath(packs_path[0].name)
232243
for sub_dir in moved_package_dir.iterdir():
233244
shutil.move(str(sub_dir), str(build_dir))
234-
moved_package_dir.rmdir()
245+
moved_package_dir.rmdir()
235246

236247
def main():
237248
parser = argparse.ArgumentParser(description="build necessary LLVM libraries")
@@ -256,6 +267,7 @@ def main():
256267
"Xtensa",
257268
],
258269
default=[],
270+
default=[],
259271
help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
260272
)
261273
parser.add_argument(

0 commit comments

Comments
 (0)