Skip to content

Commit 27b6917

Browse files
authored
Merge pull request #3792 from bytecodealliance/main
Merge branch main into dev/shared_heap
2 parents 5164aca + 9aadbfe commit 27b6917

File tree

78 files changed

+2375
-746
lines changed

Some content is hidden

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

78 files changed

+2375
-746
lines changed

.github/workflows/compilation_on_nuttx.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ jobs:
119119
run: make -j$(nproc) EXTRAFLAGS=-Werror
120120

121121
- name: Checkout Bloaty
122-
uses: actions/checkout@v3
122+
uses: actions/checkout@v4
123123
with:
124124
repository: google/bloaty
125125
submodules: recursive
126126
path: bloaty
127+
ref: 34f4a66559ad4938c1e629e9b5f54630b2b4d7b0
127128

128129
- name: Build Bloaty
129130
run: |

.github/workflows/spec_test_on_nuttx.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ jobs:
7474
target: "riscv32",
7575
fpu_type: "none"
7676
},
77-
{
78-
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
79-
target: "riscv32_ilp32f",
80-
fpu_type: "fp"
81-
},
77+
#{
78+
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
79+
# target: "riscv32_ilp32f",
80+
# fpu_type: "fp"
81+
#},
8282
# {
8383
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
8484
# target: "riscv32_ilp32d",
@@ -327,19 +327,6 @@ jobs:
327327
working-directory: apps/interpreters/wamr/wamr
328328

329329
- name: Test
330-
if: matrix.target_config.target != 'xtensa'
331-
run: |
332-
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
333-
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -P -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
334-
335-
# for xtensa, for some reasons, when running the tests
336-
# with test_wamr.sh -P, nuttx occasionally hangs after
337-
# "total segments stored 6" on the CI.
338-
# i (yamamoto) couldn't reproduce it locally (macOS) even
339-
# with the identical flash image.
340-
# for now, run the tests without -P.
341-
- name: Test
342-
if: matrix.target_config.target == 'xtensa'
343330
run: |
344331
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
345332
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
.clangd
1414
.DS_Store
1515
*.o
16+
.aider*
1617

1718
core/deps/**
1819
core/shared/mem-alloc/tlsf

CMakeLists.txt

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
121121

122122
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
123123

124-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow -Wno-unused-parameter -fvisibility=hidden")
125-
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
126-
127-
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
124+
if (NOT WIN32)
125+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \
126+
-ffunction-sections -fdata-sections \
127+
-Wno-unused-parameter -Wno-pedantic")
128+
# Remove the extra spaces for better make log
129+
string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
130+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
131+
endif()
128132

129133
if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
130134
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
@@ -145,6 +149,10 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
145149
set (THREADS_PREFER_PTHREAD_FLAG ON)
146150
find_package(Threads REQUIRED)
147151

152+
if (MSVC)
153+
add_definitions(-DCOMPILING_WASM_RUNTIME_API=1)
154+
endif ()
155+
148156
# STATIC LIBRARY
149157
if (WAMR_BUILD_STATIC)
150158
add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE})
@@ -155,6 +163,14 @@ if (WAMR_BUILD_STATIC)
155163
target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
156164
endif ()
157165

166+
if (MINGW)
167+
target_link_libraries (iwasm_static PRIVATE ws2_32)
168+
endif ()
169+
170+
if (WIN32)
171+
target_link_libraries(iwasm_static PRIVATE ntdll)
172+
endif()
173+
158174
install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
159175
endif ()
160176

@@ -169,9 +185,14 @@ if (WAMR_BUILD_SHARED)
169185
endif ()
170186

171187
if (MINGW)
172-
target_link_libraries (iwasm_shared INTERFACE -lWs2_32 -lwsock32)
188+
target_link_libraries(iwasm_shared INTERFACE -lWs2_32 -lwsock32)
189+
target_link_libraries(iwasm_shared PRIVATE ws2_32)
173190
endif ()
174191

192+
if (WIN32)
193+
target_link_libraries(iwasm_shared PRIVATE ntdll)
194+
endif()
195+
175196
install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
176197
endif ()
177198

build-scripts/config_common.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,9 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
442442
message (" WASI-NN enabled")
443443
add_definitions (-DWASM_ENABLE_WASI_NN=1)
444444
# Variant backends
445-
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
445+
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND
446+
NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1 AND
447+
NOT WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1)
446448
message (FATAL_ERROR " Need to select a backend for WASI-NN")
447449
endif ()
448450

@@ -454,6 +456,10 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
454456
message (" WASI-NN: backend openvino enabled")
455457
add_definitions (-DWASM_ENABLE_WASI_NN_OPENVINO)
456458
endif ()
459+
if (WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1)
460+
message (" WASI-NN: backend llamacpp enabled")
461+
add_definitions (-DWASM_ENABLE_WASI_NN_LLAMACPP)
462+
endif ()
457463
# Variant devices
458464
if (WAMR_BUILD_WASI_NN_ENABLE_GPU EQUAL 1)
459465
message (" WASI-NN: GPU enabled")

core/iwasm/aot/aot_loader.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,10 @@ loader_mmap(uint32 size, bool prot_exec, char *error_buf, uint32 error_buf_size)
302302
int map_flags;
303303
void *mem;
304304

305-
#if UINTPTR_MAX == UINT64_MAX
305+
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64) \
306+
|| defined(BUILD_TARGET_RISCV64_LP64D) \
307+
|| defined(BUILD_TARGET_RISCV64_LP64)
308+
#ifndef __APPLE__
306309
/* The mmapped AOT data and code in 64-bit targets had better be in
307310
range 0 to 2G, or aot loader may fail to apply some relocations,
308311
e.g., R_X86_64_32/R_X86_64_32S/R_X86_64_PC32/R_RISCV_32.
@@ -316,6 +319,7 @@ loader_mmap(uint32 size, bool prot_exec, char *error_buf, uint32 error_buf_size)
316319
bh_assert((uintptr_t)mem < INT32_MAX);
317320
return mem;
318321
}
322+
#endif
319323
#endif
320324

321325
map_flags = MMAP_MAP_NONE;
@@ -579,6 +583,10 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end,
579583
return false;
580584
}
581585

586+
/* for backwards compatibility with previous wamrc aot files */
587+
if (!strcmp(target_info.arch, "arm64"))
588+
bh_strcpy_s(target_info.arch, sizeof(target_info.arch), "aarch64v8");
589+
582590
/* Check machine info */
583591
if (!check_machine_info(&target_info, error_buf, error_buf_size)) {
584592
return false;
@@ -589,6 +597,10 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end,
589597
return false;
590598
}
591599

600+
#if WASM_ENABLE_DUMP_CALL_STACK != 0
601+
module->feature_flags = target_info.feature_flags;
602+
#endif
603+
592604
/* Finally, check feature flags */
593605
return check_feature_flags(error_buf, error_buf_size,
594606
target_info.feature_flags);

core/iwasm/aot/aot_reloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ SymbolMap *
226226
get_target_symbol_map(uint32 *sym_num);
227227

228228
uint32
229-
get_plt_table_size();
229+
get_plt_table_size(void);
230230

231231
void
232232
init_plt_table(uint8 *plt);

0 commit comments

Comments
 (0)