Skip to content

Commit 3e820aa

Browse files
authored
Merge branch 'main' into dev/zephyr_file_socket
2 parents 5cead96 + 6b51c61 commit 3e820aa

File tree

10 files changed

+141
-67
lines changed

10 files changed

+141
-67
lines changed

.github/workflows/release_process.yml

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ on:
1111
type: boolean
1212
required: false
1313
default: false
14+
release_wamr_sdk:
15+
description: "If the WAMR SDK in the release"
16+
type: boolean
17+
required: false
18+
default: false
19+
release_wamr_lldb:
20+
description: "If the WAMR LLDB in the release"
21+
type: boolean
22+
required: false
23+
default: false
24+
release_wamr_ide_vscode_ext:
25+
description: "If the WAMR VSCode extension in the release"
26+
type: boolean
27+
required: false
28+
default: false
29+
release_wamr_wasi_ext:
30+
description: "If the WAMR WASI extensions in the release"
31+
type: boolean
32+
required: false
33+
default: true
1434

1535
# Cancel any in-flight jobs for the same PR/branch so there's only one active
1636
# at a time
@@ -93,7 +113,7 @@ jobs:
93113
release_wamrc_on_ubuntu_2204:
94114
permissions:
95115
contents: write # upload release artifact
96-
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2204 ]
116+
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2204]
97117
uses: ./.github/workflows/build_wamrc.yml
98118
with:
99119
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
@@ -170,6 +190,7 @@ jobs:
170190
permissions:
171191
contents: write # upload release artifact
172192
needs: [create_tag, create_release]
193+
if: ${{ inputs.release_wamr_sdk }}
173194
uses: ./.github/workflows/build_wamr_sdk.yml
174195
with:
175196
config_file: wamr_config_ubuntu_release.cmake
@@ -183,6 +204,7 @@ jobs:
183204
permissions:
184205
contents: write # upload release artifact
185206
needs: [create_tag, create_release]
207+
if: ${{ inputs.release_wamr_sdk }}
186208
uses: ./.github/workflows/build_wamr_sdk.yml
187209
with:
188210
config_file: wamr_config_macos_release.cmake
@@ -192,37 +214,38 @@ jobs:
192214
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz
193215
wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git
194216

195-
# Let's disable it for now and reopen it when the actual requirement arises.
196-
# Please ensure all dependencies have been updated before reopening.
197217
#
198-
# # vscode extension cross-platform
199-
# release_wamr_ide_vscode_ext:
200-
# permissions:
201-
# contents: write # upload release artifact
202-
# needs: [create_tag, create_release]
203-
# uses: ./.github/workflows/build_wamr_vscode_ext.yml
204-
# secrets: inherit
205-
# with:
206-
# upload_url: ${{ needs.create_release.outputs.upload_url }}
207-
# ver_num: ${{ needs.create_tag.outputs.new_ver }}
208-
209-
# #
210-
# # vscode extension docker images package
211-
# release_wamr_ide_docker_images_package:
212-
# permissions:
213-
# contents: write # upload release artifact
214-
# needs: [create_tag, create_release]
215-
# uses: ./.github/workflows/build_docker_images.yml
216-
# with:
217-
# upload_url: ${{ needs.create_release.outputs.upload_url }}
218-
# ver_num: ${{ needs.create_tag.outputs.new_ver }}
218+
# vscode extension cross-platform
219+
release_wamr_ide_vscode_ext:
220+
permissions:
221+
contents: write # upload release artifact
222+
needs: [create_tag, create_release]
223+
if: ${{ inputs.release_wamr_ide_vscode_ext}}
224+
uses: ./.github/workflows/build_wamr_vscode_ext.yml
225+
secrets: inherit
226+
with:
227+
upload_url: ${{ needs.create_release.outputs.upload_url }}
228+
ver_num: ${{ needs.create_tag.outputs.new_ver }}
229+
230+
#
231+
# vscode extension docker images package
232+
release_wamr_ide_docker_images_package:
233+
permissions:
234+
contents: write # upload release artifact
235+
needs: [create_tag, create_release]
236+
if: ${{ inputs.release_wamr_ide_vscode_ext}}
237+
uses: ./.github/workflows/build_docker_images.yml
238+
with:
239+
upload_url: ${{ needs.create_release.outputs.upload_url }}
240+
ver_num: ${{ needs.create_tag.outputs.new_ver }}
219241

220242
#
221243
# WAMR_LLDB
222244
release_wamr_lldb_on_ubuntu_2204:
223245
permissions:
224246
contents: write # upload release artifact
225247
needs: [create_tag, create_release]
248+
if: ${{ inputs.release_wamr_lldb }}
226249
uses: ./.github/workflows/build_wamr_lldb.yml
227250
with:
228251
runner: ubuntu-22.04
@@ -233,17 +256,21 @@ jobs:
233256
permissions:
234257
contents: write # upload release artifact
235258
needs: [create_tag, create_release]
259+
if: ${{ inputs.release_wamr_lldb }}
236260
uses: ./.github/workflows/build_wamr_lldb.yml
237261
with:
238262
runner: macos-13
239263
arch: universal
240264
upload_url: ${{ needs.create_release.outputs.upload_url }}
241265
ver_num: ${{ needs.create_tag.outputs.new_ver}}
242266

267+
#
268+
#
243269
release_wamr_wasi_extensions:
244270
permissions:
245271
contents: write # upload release artifact
246272
needs: [create_tag, create_release]
273+
if: ${{ inputs.release_wamr_wasi_ext }}
247274
uses: ./.github/workflows/build_wamr_wasi_extensions.yml
248275
with:
249276
upload_url: ${{ needs.create_release.outputs.upload_url }}

build-scripts/config_common.cmake

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ if (WAMR_BUILD_JIT EQUAL 1)
9999
# Enable Lazy JIT by default
100100
set (WAMR_BUILD_LAZY_JIT 1)
101101
endif ()
102+
103+
# In Debug mode, always use release builds of pre-built dependency libraries
104+
if (WAMR_BUILD_PLATFORM STREQUAL "windows" AND MSVC)
105+
add_compile_options($<$<CONFIG:Debug>:/MD>)
106+
endif()
107+
102108
if (NOT DEFINED LLVM_DIR)
103109
set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
104110
set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build")
@@ -141,28 +147,58 @@ include (${WAMR_ROOT_DIR}/build-scripts/package.cmake)
141147

142148
if (NOT DEFINED WAMR_BUILD_SANITIZER)
143149
set(WAMR_BUILD_SANITIZER $ENV{WAMR_BUILD_SANITIZER})
144-
endif ()
150+
endif()
145151

146-
if (NOT DEFINED WAMR_BUILD_SANITIZER)
147-
set(WAMR_BUILD_SANITIZER "")
148-
elseif (WAMR_BUILD_SANITIZER STREQUAL "ubsan")
149-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=alignment" )
150-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
151-
elseif (WAMR_BUILD_SANITIZER STREQUAL "asan")
152-
if (NOT WAMR_BUILD_JIT EQUAL 1)
153-
set (ASAN_OPTIONS "verbosity=2 debug=true ")
154-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=address -fno-sanitize-recover=all" )
155-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
152+
if (NOT WAMR_BUILD_SANITIZER STREQUAL "")
153+
set(SUPPORTED_SANITIZERS "ubsan;asan;tsan;posan")
154+
string(REPLACE "," ";" SANITIZER_LIST "${WAMR_BUILD_SANITIZER}")
155+
156+
# Check uncompabile sanitizers
157+
if("tsan" IN_LIST SANITIZER_LIST AND "asan" IN_LIST SANITIZER_LIST)
158+
message(FATAL_ERROR "ThreadSanitizer (tsan) and AddressSanitizer (asan) cannot be used together!")
156159
endif()
157-
elseif (WAMR_BUILD_SANITIZER STREQUAL "tsan")
158-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" )
159-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
160-
elseif (WAMR_BUILD_SANITIZER STREQUAL "posan")
161-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=pointer-overflow -fno-sanitize-recover=all" )
162-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=pointer-overflow")
163-
elseif (NOT (WAMR_BUILD_SANITIZER STREQUAL "") )
164-
message(SEND_ERROR "Unsupported sanitizer: ${WAMR_BUILD_SANITIZER}")
165-
endif()
160+
161+
# Check every sanitizer in the list
162+
set(INVALID_SANITIZERS "")
163+
list(REMOVE_DUPLICATES SANITIZER_LIST)
164+
set(SANITIZER_FLAGS)
165+
set(NO_SANITIZER_FLAGS)
166+
foreach(sanitizer ${SANITIZER_LIST})
167+
string(STRIP "${sanitizer}" sanitizer)
168+
if(NOT sanitizer IN_LIST SUPPORTED_SANITIZERS)
169+
list(APPEND INVALID_SANITIZERS "${sanitizer}")
170+
elseif(sanitizer STREQUAL "ubsan")
171+
list(APPEND SANITIZER_FLAGS "undefined")
172+
list(APPEND NO_SANITIZER_FLAGS "alignment")
173+
elseif(sanitizer STREQUAL "asan")
174+
if (NOT WAMR_BUILD_JIT EQUAL 1)
175+
set(ENV{ASAN_OPTIONS} "verbosity=2 debug=true")
176+
list(APPEND SANITIZER_FLAGS "address")
177+
else()
178+
message(WARNING "AddressSanitizer is not supported in LLVM JIT mode, skip it")
179+
endif()
180+
elseif(sanitizer STREQUAL "tsan")
181+
list(APPEND SANITIZER_FLAGS "thread")
182+
elseif(sanitizer STREQUAL "posan")
183+
list(APPEND SANITIZER_FLAGS "pointer-overflow")
184+
endif()
185+
endforeach()
186+
187+
if(INVALID_SANITIZERS)
188+
message(FATAL_ERROR "Unsupported sanitizers: ${INVALID_SANITIZERS}")
189+
endif()
190+
# common flags for all sanitizers
191+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fno-sanitize-recover=all")
192+
if(SANITIZER_FLAGS)
193+
string(REPLACE ";" "," SANITIZER_FLAGS_STR "${SANITIZER_FLAGS}")
194+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZER_FLAGS_STR}")
195+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZER_FLAGS_STR}")
196+
endif()
197+
if(NO_SANITIZER_FLAGS)
198+
string(REPLACE ";" "," NO_SANITIZER_FLAGS_STR "${NO_SANITIZER_FLAGS}")
199+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=${NO_SANITIZER_FLAGS_STR}")
200+
endif()
201+
endif ()
166202

167203
if (WAMR_BUILD_LINUX_PERF EQUAL 1)
168204
if (NOT WAMR_BUILD_JIT AND NOT WAMR_BUILD_AOT)

core/iwasm/libraries/lib-socket/test/nslookup.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include <assert.h>
7+
#include <errno.h>
78
#include <string.h>
89
#include <stdio.h>
910
#include <pthread.h>
@@ -28,6 +29,15 @@ test_nslookup(int af)
2829
hints.ai_family = af;
2930
hints.ai_socktype = SOCK_STREAM;
3031
int ret = getaddrinfo(url, 0, &hints, &res);
32+
if (ret != 0) {
33+
if (ret == EAI_SYSTEM) {
34+
fprintf(stderr, "getaddrinfo failed: %s (%s)\n", gai_strerror(ret),
35+
strerror(errno));
36+
}
37+
else {
38+
fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret));
39+
}
40+
}
3141
assert(ret == 0);
3242
struct addrinfo *address = res;
3343
while (address) {

core/iwasm/libraries/wasi-nn/src/utils/wasi_nn_app_native.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,18 @@ tensor_data_app_native(wasm_module_inst_t instance, uint32_t total_elements,
108108
#define data_size total_elements
109109
#endif
110110

111+
uint64 data_size_in_bytes = data_size;
112+
#if WASM_ENABLE_WASI_EPHEMERAL_NN == 0
113+
data_size_in_bytes *= sizeof(float);
114+
if (data_size_in_bytes / sizeof(float) != data_size) {
115+
/* overflow */
116+
return invalid_argument;
117+
}
118+
#endif
119+
111120
if (!wasm_runtime_validate_app_addr(instance,
112121
(uint64)input_tensor_wasm->data_offset,
113-
(uint64)data_size)) {
122+
data_size_in_bytes)) {
114123
NN_ERR_PRINTF("input_tensor_wasm->data_offset is invalid");
115124
return invalid_argument;
116125
}

core/iwasm/libraries/wasi-nn/src/wasi_nn_tensorflowlite.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,6 @@ set_input(void *tflite_ctx, graph_execution_context ctx, uint32_t index,
297297
return runtime_error;
298298
}
299299

300-
if (input_tensor->type != fp32) {
301-
NN_ERR_PRINTF("unsupported input tensor type %u", input_tensor->type);
302-
return runtime_error;
303-
}
304-
305300
wasi_nn_error res;
306301
if (success != (res = is_valid_graph_execution_context(tfl_ctx, ctx)))
307302
return res;

core/shared/platform/common/posix/posix_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,3 +1067,4 @@ os_compare_file_handle(os_file_handle handle1, os_file_handle handle2)
10671067
{
10681068
return handle1 == handle2;
10691069
}
1070+

core/shared/platform/windows/win_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,3 +1852,4 @@ os_poll(os_poll_file_handle *fds, os_nfds_t nfs, int timeout)
18521852
{
18531853
return BHT_ERROR;
18541854
}
1855+

product-mini/platforms/common/libc_wasi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ libc_wasi_parse(char *arg, libc_wasi_parse_context_t *ctx)
141141
}
142142

143143
ctx->addr_pool[ctx->addr_pool_size++] = token;
144-
token = strtok(NULL, ";");
144+
token = strtok(NULL, ",");
145145
}
146146
}
147147
else if (!strncmp(arg, "--allow-resolve=", 16)) {

tests/wamr-test-suites/test_wamr.sh

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function help()
3939
echo "-F set the firmware path used by qemu"
4040
echo "-C enable code coverage collect"
4141
echo "-j set the platform to test"
42-
echo "-T set sanitizer to use in tests(ubsan|tsan|asan|posan)"
42+
echo "-T set the sanitizer(s) used during testing. It can be either a comma-separated list
43+
(e.g., ubsan, asan) or a single option
44+
(e.g., ubsan, tsan, asan, posan)."
4345
echo "-A use the specified wamrc command instead of building it"
4446
echo "-N enable extended const expression feature"
4547
echo "-r [requirement name] [N [N ...]] specify a requirement name followed by one or more"
@@ -1066,21 +1068,9 @@ function trigger()
10661068
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_TAIL_CALL=1"
10671069
fi
10681070

1069-
echo "SANITIZER IS" $WAMR_BUILD_SANITIZER
1070-
1071-
if [[ "$WAMR_BUILD_SANITIZER" == "ubsan" ]]; then
1072-
echo "Setting run with ubsan"
1073-
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=ubsan"
1074-
fi
1075-
1076-
if [[ "$WAMR_BUILD_SANITIZER" == "asan" ]]; then
1077-
echo "Setting run with asan"
1078-
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=asan"
1079-
fi
1080-
1081-
if [[ "$WAMR_BUILD_SANITIZER" == "tsan" ]]; then
1082-
echo "Setting run with tsan"
1083-
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=tsan"
1071+
if [[ -n "$WAMR_BUILD_SANITIZER" ]]; then
1072+
echo "Setting run with sanitizer(s): $WAMR_BUILD_SANITIZER"
1073+
EXTRA_COMPILE_FLAGS+=" -DWAMR_BUILD_SANITIZER=$WAMR_BUILD_SANITIZER"
10841074
fi
10851075

10861076
if [[ "$WAMR_BUILD_SANITIZER" == "posan" ]]; then

wamr-compiler/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ if (WAMR_BUILD_DEBUG_AOT EQUAL 1)
159159
endif()
160160

161161
# Enable LLVM
162+
# In Debug mode, always use release builds of pre-built dependency libraries
163+
if (WAMR_BUILD_PLATFORM STREQUAL "windows" AND MSVC)
164+
add_compile_options($<$<CONFIG:Debug>:/MD>)
165+
endif()
166+
162167
if (NOT WAMR_BUILD_WITH_CUSTOM_LLVM)
163168
set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm")
164169
if (NOT EXISTS "${LLVM_SRC_ROOT}/build")

0 commit comments

Comments
 (0)