Compare commits

...

11 Commits

Author SHA1 Message Date
Giovanni Mazzeo
7ec1ebd15f
Merge 6aa94f0edf into 0e8b57d8a8 2025-05-07 12:04:23 +02:00
Chris Woods
0e8b57d8a8
More detail to python setup, and fixed small typo (#4247)
Some checks are pending
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_INTERP_BUILD_OPTIONS, ubuntu-22.04, linux-sgx) (push) Waiting to run
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-22.04, linux-sgx) (push) Waiting to run
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, linux-sgx) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $SIMD_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, aot, $XIP_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-22.04, fast-jit, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / build (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
2025-05-07 11:32:43 +08:00
YAMAMOTO Takashi
88b5f6a535
samples/wasm-c-api: remove unused valgrind detection (#4249)
- it's unused
- valgrind is basically a linux-only software.
  it isn't a good idea to make it a hard requirement.
  if we want to use valgrind, it's better to introduce
  a separate option to control it.
2025-05-07 11:32:29 +08:00
YAMAMOTO Takashi
ac2fe552d5
aot_resolve_object_relocation_group: adapt to LLVM 16 (#4250)
cf. https://reviews.llvm.org/D123264
2025-05-07 11:32:14 +08:00
liang.he
ea417d7619
Add overflow check for preserved local offset in preserve_referenced_local (#4211) 2025-05-07 09:45:49 +08:00
YAMAMOTO Takashi
bb36a43fa4
riscv: avoid llvm.cttz.i32/i64 for xip (#4248)
LLVM 16 and later expands cttz intrinsic to a table lookup,
which involves some relocations. (unless ZBB is available,
in which case the native instructions are preferred over
the table-based lowering.)

cf. https://reviews.llvm.org/D128911
2025-05-07 09:42:51 +08:00
Giovanni Mazzeo
6aa94f0edf
Update README.md 2025-05-05 21:57:35 +02:00
Giovanni Mazzeo
7daf2d346d
Update Makefile 2025-04-25 14:35:31 +02:00
Giovanni Mazzeo
e07859026d
Update Makefile 2025-04-23 11:51:29 +02:00
Giovanni Mazzeo
10d579cf8a
Update Makefile 2025-04-22 22:06:41 +02:00
Giovanni Mazzeo
9ae55e7ee7
Fix Librats EDL Include
Given the definition of the LIB_RATS vars, this line should be fixed in this way.
2025-04-22 21:35:55 +02:00
8 changed files with 57 additions and 22 deletions

View File

@ -898,6 +898,17 @@ aot_intrinsic_fill_capability_flags(AOTCompContext *comp_ctx)
if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) { if (!strncmp(comp_ctx->target_arch, "riscv32", 7)) {
add_i64_common_intrinsics(comp_ctx); add_i64_common_intrinsics(comp_ctx);
} }
/*
* LLVM 16 and later expands cttz intrinsic to a table lookup,
* which involves some relocations. (unless ZBB is available,
* in which case the native instructions are preferred over
* the table-based lowering.)
* https://reviews.llvm.org/D128911
*/
#if LLVM_VERSION_MAJOR >= 16
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I32_CTZ);
add_intrinsic_capability(comp_ctx, AOT_INTRINSIC_FLAG_I64_CTZ);
#endif
} }
else if (!strncmp(comp_ctx->target_arch, "xtensa", 6)) { else if (!strncmp(comp_ctx->target_arch, "xtensa", 6)) {
/* /*

View File

@ -4007,8 +4007,12 @@ aot_resolve_object_relocation_group(AOTObjectData *obj_data,
&& (str_starts_with(relocation->symbol_name, ".LCPI") && (str_starts_with(relocation->symbol_name, ".LCPI")
|| str_starts_with(relocation->symbol_name, ".LJTI") || str_starts_with(relocation->symbol_name, ".LJTI")
|| str_starts_with(relocation->symbol_name, ".LBB") || str_starts_with(relocation->symbol_name, ".LBB")
|| str_starts_with(relocation->symbol_name, || str_starts_with(relocation->symbol_name, ".Lswitch.table.")
".Lswitch.table."))) { #if LLVM_VERSION_MAJOR >= 16
/* cf. https://reviews.llvm.org/D123264 */
|| str_starts_with(relocation->symbol_name, ".Lpcrel_hi")
#endif
)) {
/* change relocation->relocation_addend and /* change relocation->relocation_addend and
relocation->symbol_name */ relocation->symbol_name */
LLVMSectionIteratorRef contain_section; LLVMSectionIteratorRef contain_section;

View File

@ -9197,6 +9197,15 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode,
loader_ctx->preserved_local_offset += 2; loader_ctx->preserved_local_offset += 2;
emit_label(EXT_OP_COPY_STACK_TOP_I64); emit_label(EXT_OP_COPY_STACK_TOP_I64);
} }
/* overflow */
if (preserved_offset > loader_ctx->preserved_local_offset) {
set_error_buf_v(error_buf, error_buf_size,
"too much local cells 0x%x",
loader_ctx->preserved_local_offset);
return false;
}
emit_operand(loader_ctx, local_index); emit_operand(loader_ctx, local_index);
emit_operand(loader_ctx, preserved_offset); emit_operand(loader_ctx, preserved_offset);
emit_label(opcode); emit_label(opcode);

View File

@ -4778,6 +4778,11 @@ preserve_referenced_local(WASMLoaderContext *loader_ctx, uint8 opcode,
loader_ctx->preserved_local_offset += 2; loader_ctx->preserved_local_offset += 2;
emit_label(EXT_OP_COPY_STACK_TOP_I64); emit_label(EXT_OP_COPY_STACK_TOP_I64);
} }
/* overflow */
bh_assert(preserved_offset
<= loader_ctx->preserved_local_offset);
emit_operand(loader_ctx, local_index); emit_operand(loader_ctx, local_index);
emit_operand(loader_ctx, preserved_offset); emit_operand(loader_ctx, preserved_offset);
emit_label(opcode); emit_label(opcode);

View File

@ -1,14 +1,17 @@
# WARM API # WAMR API
* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.10`. * **Notice**: The python package `wamr.wamrapi.wamr` requires a python version >= `3.10`.
## Setup ## Setup
### Pre-requisites ### Pre-requisites
#### Install requirements
Before proceeding it is necessary to make sure your Python environment is correctly configured. To do ths open a terminal session in this directory and perfom the following:
Install requirements,
```shell ```shell
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
``` ```

View File

@ -20,8 +20,8 @@ WAMR_BUILD_LIBC_WASI = 1
VMLIB_BUILD_DIR ?= $(CURDIR)/../build VMLIB_BUILD_DIR ?= $(CURDIR)/../build
LIB_RATS_SRC ?= $(VMLIB_BUILD_DIR)/_deps/librats-build LIB_RATS_SRC ?= $(VMLIB_BUILD_DIR)/_deps/librats-build
LIB_RATS_INSTALL_DIR := $(VMLIB_BUILD_DIR)/librats/lib/librats LIB_RATS_INSTALL_DIR := $(VMLIB_BUILD_DIR)/_deps/librats-build
LIB_RATS_INCLUDE_DIR := $(VMLIB_BUILD_DIR)/librats/include LIB_RATS_INCLUDE_DIR := $(VMLIB_BUILD_DIR)/_deps/librats-src/include
ifeq ($(shell getconf LONG_BIT), 32) ifeq ($(shell getconf LONG_BIT), 32)
SGX_ARCH := x86 SGX_ARCH := x86
@ -99,7 +99,7 @@ else
endif endif
ifeq ($(WAMR_BUILD_LIB_RATS), 1) ifeq ($(WAMR_BUILD_LIB_RATS), 1)
App_Link_Flags += -L$(LIB_RATS_INSTALL_DIR) -L$(SGX_SSL)/lib64 -lrats_u -lsgx_dcap_ql -lsgx_dcap_quoteverify -lsgx_ukey_exchange -lsgx_usgxssl App_Link_Flags += -L$(LIB_RATS_SRC)/tee/sgx/untrust -L$(SGX_SSL)/lib64 -lrats_u -lsgx_dcap_ql -lsgx_dcap_quoteverify -lsgx_ukey_exchange -lsgx_usgxssl
endif endif
App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o)
@ -152,7 +152,19 @@ else
endif endif
ifeq ($(WAMR_BUILD_LIB_RATS), 1) ifeq ($(WAMR_BUILD_LIB_RATS), 1)
Rats_Lib_Link_Dirs := -L$(LIB_RATS_INSTALL_DIR) -L$(LIB_RATS_INSTALL_DIR)/attesters -L$(LIB_RATS_INSTALL_DIR)/verifiers -L$(SGX_SSL)/lib64 -L$(VMLIB_BUILD_DIR)/external/libcbor/src/libcbor/lib -L$(LIB_RATS_INSTALL_DIR)/crypto_wrappers Rats_Lib_Link_Dirs := -L$(LIB_RATS_INSTALL_DIR) \
-L$(LIB_RATS_SRC)/tee/sgx/trust \
-L$(LIB_RATS_SRC)/attesters/sgx-ecdsa \
-L$(LIB_RATS_SRC)/attesters/nullattester \
-L$(LIB_RATS_SRC)/attesters/sgx-la \
-L$(LIB_RATS_SRC)/verifiers/nullverifier \
-L$(LIB_RATS_SRC)/verifiers/sgx-la \
-L$(LIB_RATS_SRC)/verifiers/sgx-ecdsa-qve \
-L$(SGX_SSL)/lib64 \
-L$(VMLIB_BUILD_DIR)/external/libcbor/src/libcbor/lib \
-L$(LIB_RATS_SRC)/crypto_wrappers/openssl \
-L$(LIB_RATS_SRC)/crypto_wrappers/openssl \
-L$(LIB_RATS_SRC)/crypto_wrappers/nullcrypto
Rats_Lib_W_Link_libs := -lattester_nullattester -lattester_sgx_ecdsa -lattester_sgx_la \ Rats_Lib_W_Link_libs := -lattester_nullattester -lattester_sgx_ecdsa -lattester_sgx_la \
-lverifier_nullverifier -lverifier_sgx_la -lverifier_sgx_ecdsa_qve -lcbor \ -lverifier_nullverifier -lverifier_sgx_la -lverifier_sgx_ecdsa_qve -lcbor \
-lrats_lib -lsgx_tsgxssl -lcrypto_wrapper_nullcrypto -lcrypto_wrapper_openssl -lrats_lib -lsgx_tsgxssl -lcrypto_wrapper_nullcrypto -lcrypto_wrapper_openssl
@ -171,7 +183,7 @@ Enclave_Edl_Search_Path = --search-path ../Enclave \
--search-path $(SGX_SDK)/include \ --search-path $(SGX_SDK)/include \
--search-path $(WAMR_ROOT)/core/shared/platform/linux-sgx --search-path $(WAMR_ROOT)/core/shared/platform/linux-sgx
ifeq ($(WAMR_BUILD_LIB_RATS), 1) ifeq ($(WAMR_BUILD_LIB_RATS), 1)
Enclave_Edl_Search_Path += --search-path $(LIB_RATS_INCLUDE_DIR)/librats/edl --search-path $(SGX_SSL)/include Enclave_Edl_Search_Path += --search-path $(LIB_RATS_INCLUDE_DIR)/edl --search-path $(SGX_SSL)/include
endif endif

View File

@ -20,9 +20,9 @@ $ cd $HOME
$ OS_PLATFORM=ubuntu20.04 $ OS_PLATFORM=ubuntu20.04
$ OS_CODE_NAME=`lsb_release -sc` $ OS_CODE_NAME=`lsb_release -sc`
$ SGX_PLATFORM=$OS_PLATFORM-server $ SGX_PLATFORM=$OS_PLATFORM-server
$ SGX_RELEASE_VERSION=1.17 $ SGX_RELEASE_VERSION=1.22
$ SGX_DRIVER_VERSION=1.41 $ SGX_DRIVER_VERSION=1.41
$ SGX_SDK_VERSION=2.20.100.4 $ SGX_SDK_VERSION=2.25.100.3
# install the dependencies # install the dependencies
$ sudo apt-get update $ sudo apt-get update
@ -53,7 +53,7 @@ $ # Verify that the paths are correctly set
$ which ar as ld objcopy objdump ranlib $ which ar as ld objcopy objdump ranlib
$ cd ../ $ cd ../
$ git clone https://github.com/intel/intel-sgx-ssl.git $ git clone https://github.com/intel/intel-sgx-ssl.git
$ wget https://www.openssl.org/source/openssl-1.1.1v.tar.gz -O intel-sgx-ssl/openssl_source/openssl-1.1.1v.tar.gz $ wget https://www.openssl.org/source/openssl-3.0.14.tar.gz -O intel-sgx-ssl/openssl_source/openssl-3.0.14.tar.gz
$ cd intel-sgx-ssl/Linux $ cd intel-sgx-ssl/Linux
$ source /opt/intel/sgxsdk/environment $ source /opt/intel/sgxsdk/environment
$ make all $ make all

View File

@ -205,12 +205,3 @@ foreach(EX ${EXAMPLES})
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
) )
endforeach() endforeach()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
find_program(VALGRIND
valgrind
REQUIRED
)
# run `ctest -T memcheck -V --test-dir build`
endif()