diff options
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms')
66 files changed, 0 insertions, 6223 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk deleted file mode 100644 index 383e0b239..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/aos.mk +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -NAME := iwasm -CORE_ROOT := wamr/core -IWASM_ROOT := wamr/core/iwasm -SHARED_ROOT := wamr/core/shared - -GLOBAL_DEFINES += BH_MALLOC=wasm_runtime_malloc -GLOBAL_DEFINES += BH_FREE=wasm_runtime_free - -# Change it to THUMBV7M if you want to build for developerkit -WAMR_BUILD_TARGET := X86_32 - -WAMR_BUILD_PLATFORM := alios-things - -ifeq (${WAMR_BUILD_TARGET}, X86_32) - GLOBAL_DEFINES += BUILD_TARGET_X86_32 - INVOKE_NATIVE := invokeNative_ia32.s - AOT_RELOC := aot_reloc_x86_32.c -else ifeq (${WAMR_BUILD_TARGET}, X86_64) - GLOBAL_DEFINES += BUILD_TARGET_X86_64 - INVOKE_NATIVE := invokeNative_em64.s - AOT_RELOC := aot_reloc_x86_64.c -else ifeq ($(findstring ARM,$(WAMR_BUILD_TARGET)), ARM) - GLOBAL_DEFINES += BUILD_TARGET_ARM - GLOBAL_DEFINES += BUILD_TARGET=\"$(WAMR_BUILD_TARGET)\" - INVOKE_NATIVE := invokeNative_arm.s - AOT_RELOC := aot_reloc_arm.c -else ifeq ($(findstring THUMB,$(WAMR_BUILD_TARGET)), THUMB) - GLOBAL_DEFINES += BUILD_TARGET_THUMB - GLOBAL_DEFINES += BUILD_TARGET=\"$(WAMR_BUILD_TARGET)\" - INVOKE_NATIVE := invokeNative_thumb.s - AOT_RELOC := aot_reloc_thumb.c -else ifeq (${WAMR_BUILD_TARGET}, MIPS) - GLOBAL_DEFINES += BUILD_TARGET_MIPS - INVOKE_NATIVE := invokeNative_mips.s - AOT_RELOC := aot_reloc_mips.c -else ifeq (${WAMR_BUILD_TARGET}, XTENSA) - GLOBAL_DEFINES += BUILD_TARGET_XTENSA - INVOKE_NATIVE := invokeNative_xtensa.s - AOT_RELOC := aot_reloc_xtensa.c -else - $(error Build target isn't set) -endif - -# Enable Interpreter by default. -WAMR_BUILD_INTERP = 1 - -# Enable AOT by default. -WAMR_BUILD_AOT = 1 - -# Override the global heap usage -ifndef WAMR_BUILD_GLOBAL_HEAP_POOL -WAMR_BUILD_GLOBAL_HEAP_POOL=1 -endif -GLOBAL_DEFINES += WASM_ENABLE_GLOBAL_HEAP_POOL=${WAMR_BUILD_GLOBAL_HEAP_POOL} - -# Override the global heap size for small devices -ifndef WAMR_BUILD_GLOBAL_HEAP_SIZE -WAMR_BUILD_GLOBAL_HEAP_SIZE = 262144 # 256 kB -endif -GLOBAL_DEFINES += WASM_GLOBAL_HEAP_SIZE=${WAMR_BUILD_GLOBAL_HEAP_SIZE} - -ifeq (${WAMR_BUILD_INTERP}, 1) -GLOBAL_DEFINES += WASM_ENABLE_INTERP=1 -endif - -ifeq (${WAMR_BUILD_AOT}, 1) -GLOBAL_DEFINES += WASM_ENABLE_AOT=1 -endif - -GLOBAL_DEFINES += WASM_ENABLE_LIBC_BUILTIN=1 - -GLOBAL_INCLUDES += ${CORE_ROOT} \ - ${IWASM_ROOT}/include \ - ${IWASM_ROOT}/common \ - ${SHARED_ROOT}/include \ - ${SHARED_ROOT}/platform/include \ - ${SHARED_ROOT}/utils \ - ${SHARED_ROOT}/mem-alloc \ - ${SHARED_ROOT}/platform/alios - -ifeq (${WAMR_BUILD_INTERP}, 1) -GLOBAL_INCLUDES += ${IWASM_ROOT}/interpreter -endif - -ifeq (${WAMR_BUILD_AOT}, 1) -GLOBAL_INCLUDES += ${IWASM_ROOT}/aot -endif - -$(NAME)_SOURCES := ${SHARED_ROOT}/platform/alios/alios_platform.c \ - ${SHARED_ROOT}/platform/alios/alios_thread.c \ - ${SHARED_ROOT}/platform/alios/alios_time.c \ - ${SHARED_ROOT}/platform/common/math/math.c \ - ${SHARED_ROOT}/mem-alloc/mem_alloc.c \ - ${SHARED_ROOT}/mem-alloc/ems/ems_kfc.c \ - ${SHARED_ROOT}/mem-alloc/ems/ems_alloc.c \ - ${SHARED_ROOT}/mem-alloc/ems/ems_hmu.c \ - ${SHARED_ROOT}/utils/bh_assert.c \ - ${SHARED_ROOT}/utils/bh_common.c \ - ${SHARED_ROOT}/utils/bh_hashmap.c \ - ${SHARED_ROOT}/utils/bh_list.c \ - ${SHARED_ROOT}/utils/bh_log.c \ - ${SHARED_ROOT}/utils/bh_queue.c \ - ${SHARED_ROOT}/utils/bh_vector.c \ - ${SHARED_ROOT}/utils/runtime_timer.c \ - ${IWASM_ROOT}/libraries/libc-builtin/libc_builtin_wrapper.c \ - ${IWASM_ROOT}/common/wasm_application.c \ - ${IWASM_ROOT}/common/wasm_runtime_common.c \ - ${IWASM_ROOT}/common/wasm_native.c \ - ${IWASM_ROOT}/common/wasm_exec_env.c \ - ${IWASM_ROOT}/common/wasm_memory.c \ - ${IWASM_ROOT}/common/wasm_c_api.c \ - ${IWASM_ROOT}/common/arch/${INVOKE_NATIVE} \ - src/main.c - -ifeq (${WAMR_BUILD_INTERP}, 1) -$(NAME)_SOURCES += ${IWASM_ROOT}/interpreter/wasm_interp_classic.c \ - ${IWASM_ROOT}/interpreter/wasm_loader.c \ - ${IWASM_ROOT}/interpreter/wasm_runtime.c -endif - -ifeq (${WAMR_BUILD_AOT}, 1) -$(NAME)_SOURCES += ${IWASM_ROOT}/aot/aot_loader.c \ - ${IWASM_ROOT}/aot/arch/${AOT_RELOC} \ - ${IWASM_ROOT}/aot/aot_runtime.c \ - ${IWASM_ROOT}/aot/aot_intrinsic.c -endif - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c deleted file mode 100644 index f2c6f85c1..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/main.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <stdlib.h> -#include <string.h> -#include "bh_platform.h" -#include "bh_log.h" -#include "wasm_export.h" -#include "test_wasm.h" - -static int app_argc; -static char **app_argv; - -/** - * Find the unique main function from a WASM module instance - * and execute that function. - * - * @param module_inst the WASM module instance - * @param argc the number of arguments - * @param argv the arguments array - * - * @return true if the main function is called, false otherwise. - */ -bool -wasm_application_execute_main(wasm_module_inst_t module_inst, int32_t argc, - char *argv[]); - -static void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - - wasm_application_execute_main(module_inst, app_argc, app_argv); - if ((exception = wasm_runtime_get_exception(module_inst))) - printf("%s\n", exception); - return NULL; -} - -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 -static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE] = { 0 }; -#endif - -void -iwasm_main(void *arg1) -{ - uint8 *wasm_file_buf = NULL; - uint32 wasm_file_size; - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - RuntimeInitArgs init_args; - char error_buf[128]; -#if WASM_ENABLE_LOG != 0 - int log_verbose_level = 2; -#endif - - (void)arg1; - - memset(&init_args, 0, sizeof(RuntimeInitArgs)); - -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 - init_args.mem_alloc_type = Alloc_With_Pool; - init_args.mem_alloc_option.pool.heap_buf = global_heap_buf; - init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf); -#else -#error Another memory allocation scheme than global heap pool is not implemented yet for Alios. -#endif - - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - printf("Init runtime environment failed.\n"); - return; - } - -#if WASM_ENABLE_LOG != 0 - bh_log_set_verbose_level(log_verbose_level); -#endif - - /* load WASM byte buffer from byte buffer of include file */ - wasm_file_buf = (uint8 *)wasm_test_file; - wasm_file_size = sizeof(wasm_test_file); - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail1; - } - - /* instantiate the module */ - if (!(wasm_module_inst = wasm_runtime_instantiate( - wasm_module, 8 * 1024, 8 * 1024, error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail2; - } - - app_instance_main(wasm_module_inst); - - /* destroy the module instance */ - wasm_runtime_deinstantiate(wasm_module_inst); - -fail2: - /* unload the module */ - wasm_runtime_unload(wasm_module); - -fail1: - /* destroy runtime environment */ - wasm_runtime_destroy(); -} - -#define DEFAULT_THREAD_STACKSIZE (6 * 1024) -#define DEFAULT_THREAD_PRIORITY 50 - -bool -iwasm_init(void) -{ - int ret = - aos_task_new("wasm-main", iwasm_main, NULL, DEFAULT_THREAD_STACKSIZE); - return ret == 0 ? true : false; -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h deleted file mode 100644 index 0c343024a..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/alios-things/src/test_wasm.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -/** - * The byte array buffer is the file content of a test wasm binary file, - * which is compiled by wasi-sdk toolchain from C source file of: - * product-mini/app-samples/hello-world/main.c. - */ -unsigned char wasm_test_file[] = { - 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, - 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01, - 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75, - 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C, - 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66, - 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01, - 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x13, 0x03, - 0x7F, 0x01, 0x41, 0xC0, 0x28, 0x0B, 0x7F, 0x00, 0x41, 0xBA, 0x08, 0x0B, - 0x7F, 0x00, 0x41, 0xC0, 0x28, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, - 0x6D, 0x6F, 0x72, 0x79, 0x02, 0x00, 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74, - 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x03, 0x02, 0x04, 0x6D, 0x61, - 0x69, 0x6E, 0x00, 0x04, 0x0A, 0xB2, 0x01, 0x01, 0xAF, 0x01, 0x01, 0x03, - 0x7F, 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, - 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x88, 0x80, 0x80, 0x00, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, - 0x80, 0x08, 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, - 0x41, 0xA8, 0x88, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, - 0x1A, 0x41, 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x10, 0x41, 0x80, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41, - 0x10, 0x6A, 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21, - 0x04, 0x20, 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x88, - 0x80, 0x80, 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, - 0x8D, 0x88, 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x00, 0x41, 0x93, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10, - 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80, - 0x80, 0x00, 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80, - 0x80, 0x00, 0x20, 0x04, 0x0B, 0x0B, 0x41, 0x01, 0x00, 0x41, 0x80, 0x08, - 0x0B, 0x3A, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25, - 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66, - 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, - 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, - 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00 -}; diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/CMakeLists.txt deleted file mode 100644 index 638b6ab0d..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/CMakeLists.txt +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 3.4.1) - -set (CMAKE_VERBOSE_MAKEFILE on) -set (CMAKE_BUILD_TYPE Release) - -# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-3 -set (CMAKE_TOOLCHAIN_FILE "$ENV{ANDROID_NDK_LATEST_HOME}/build/cmake/android.toolchain.cmake") -set (ANDROID_SDK $ENV{ANDROID_HOME}) -set (ANDROID_NDK $ENV{ANDROID_NDK_LATEST_HOME}) - -set (ANDROID_ABI "x86") -set (ANDROID_LD lld) -if (NOT DEFINED ANDROID_PLATFORM) - set (ANDROID_PLATFORM 24) -endif () - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "android") -set (WAMR_BUILD_TARGET "X86_32") -set (WAMR_BUILD_TYPE Release) -set (WAMR_BUILD_INTERP 1) -set (WAMR_BUILD_AOT 1) -set (WAMR_BUILD_JIT 0) -set (WAMR_BUILD_LIBC_BUILTIN 1) -set (WAMR_BUILD_LIBC_WASI 1) - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) - -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE") - -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") - -if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") - if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") - endif () -endif () - -# The following flags are to enhance security, but it may impact performance, -# we disable them by default. -#if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -D_FORTIFY_SOURCE=2") -#endif () -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong --param ssp-buffer-size=4") -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now") - -add_library (iwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) -if (CMAKE_BUILD_TYPE STREQUAL Release) -target_link_libraries (iwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -landroid -llog -s) -else() -target_link_libraries (iwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -landroid -llog) -endif() - -set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) -set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") - -add_custom_command (TARGET iwasm POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" - COMMENT "Copying iwasm to output directory") diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/build_jit.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/build_jit.sh deleted file mode 100755 index ffa440e95..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/build_jit.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -rm -fr build && mkdir build -cd build -cmake .. -DWAMR_BUILD_JIT=1 -make -j ${nroc} -cd .. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/build_llvm.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/build_llvm.sh deleted file mode 100755 index 145e2dbaa..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/build_llvm.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2020 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -/usr/bin/env python3 -m pip install --user -r ../../../build-scripts/requirements.txt -/usr/bin/env python3 ../../../build-scripts/build_llvm.py --platform android "$@" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/wasm-jni.cpp b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/wasm-jni.cpp deleted file mode 100644 index c2eff3a8b..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/android/wasm-jni.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include <cstring> -#include <stdlib.h> -#include <jni.h> -#include <cinttypes> -#include <android/log.h> -#include <string> -#include <wasm_export.h> - -#define LOGI(...) \ - ((void)__android_log_print(ANDROID_LOG_INFO, "wasm_jni::", __VA_ARGS__)) - -static void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - - wasm_application_execute_main(module_inst, 0, NULL); - if ((exception = wasm_runtime_get_exception(module_inst))) - LOGI("%s\n", exception); - return NULL; -} - -// WARNING! CAN NOT BE READ ONLY!!! -static unsigned char wasm_test_file[] = { - 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, - 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01, - 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75, - 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C, - 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66, - 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01, - 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x13, 0x03, - 0x7F, 0x01, 0x41, 0xC0, 0x28, 0x0B, 0x7F, 0x00, 0x41, 0xBA, 0x08, 0x0B, - 0x7F, 0x00, 0x41, 0xC0, 0x28, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, - 0x6D, 0x6F, 0x72, 0x79, 0x02, 0x00, 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74, - 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x03, 0x02, 0x04, 0x6D, 0x61, - 0x69, 0x6E, 0x00, 0x04, 0x0A, 0xB2, 0x01, 0x01, 0xAF, 0x01, 0x01, 0x03, - 0x7F, 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, - 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x88, 0x80, 0x80, 0x00, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, - 0x80, 0x08, 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, - 0x41, 0xA8, 0x88, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, - 0x1A, 0x41, 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x10, 0x41, 0x80, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41, - 0x10, 0x6A, 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21, - 0x04, 0x20, 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x88, - 0x80, 0x80, 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, - 0x8D, 0x88, 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x00, 0x41, 0x93, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10, - 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80, - 0x80, 0x00, 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80, - 0x80, 0x00, 0x20, 0x04, 0x0B, 0x0B, 0x41, 0x01, 0x00, 0x41, 0x80, 0x08, - 0x0B, 0x3A, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25, - 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66, - 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, - 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, - 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00 -}; - -extern "C" JNIEXPORT void JNICALL -Java_com_intel_wasm_api_Runtime_run(JNIEnv *env, jclass thiz) -{ - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - RuntimeInitArgs init_args; - uint wasm_file_size = 0; - uint8_t *wasm_file_buf = NULL; - char error_buf[128] = { 0 }; - - memset(&init_args, 0, sizeof(RuntimeInitArgs)); - -#if WASM_ENABLE_GLOBAL_HEAP_POOL == 0 - init_args.mem_alloc_type = Alloc_With_Allocator; - init_args.mem_alloc_option.allocator.malloc_func = (void *)malloc; - init_args.mem_alloc_option.allocator.realloc_func = (void *)realloc; - init_args.mem_alloc_option.allocator.free_func = (void *)free; -#else -#error The usage of a global heap pool is not implemented yet for Android. -#endif - - LOGI("wasm_runtime_full_init"); - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - LOGI("Init runtime failed.\n"); - return; - } - - /* load WASM byte buffer from a preinstall WASM bin file */ - LOGI("use an internal test file, gona to output Hello World in logcat\n"); - wasm_file_buf = (uint8_t *)wasm_test_file; - wasm_file_size = sizeof(wasm_test_file); - - /* load WASM module */ - LOGI("wasm_runtime_load"); - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size, - error_buf, sizeof(error_buf)))) { - LOGI("in wasm_runtime_load %s\n", error_buf); - LOGI("goto fail1\n"); - goto fail1; - } - - /* instantiate the module */ - LOGI("wasm_runtime_instantiate"); - if (!(wasm_module_inst = - wasm_runtime_instantiate(wasm_module, 64 * 1024, /* stack size */ - 64 * 1024, /* heap size */ - error_buf, sizeof(error_buf)))) { - LOGI("%s\n", error_buf); - LOGI("goto fail2\n"); - goto fail2; - } - - LOGI("run main() of the application"); - app_instance_main(wasm_module_inst); - - /* destroy the module instance */ - LOGI("wasm_runtime_deinstantiate"); - wasm_runtime_deinstantiate(wasm_module_inst); - -fail2: - /* unload the module */ - LOGI("wasm_runtime_unload"); - wasm_runtime_unload(wasm_module); - -fail1: - // in our case, we don't need a free, but it is not a typical one - /* free the file buffer */ - // bh_free((void *) wasm_file_buf); - - /* destroy runtime environment */ - LOGI("wasm_runtime_destroy"); - wasm_runtime_destroy(); - return; -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/CMakeLists.txt deleted file mode 100644 index 4d68066b0..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 2.9) - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "darwin") - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", -# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") - set (WAMR_BUILD_TARGET "AARCH64") - elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set (WAMR_BUILD_TARGET "RISCV64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -set(CMAKE_CXX_STANDARD 14) - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_JIT) - # Disable Fast JIT by default - set (WAMR_BUILD_FAST_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Disable multiple module by default - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () - -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-U,_get_ext_lib_export_apis") -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - -set (CMAKE_MACOSX_RPATH True) - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) - -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) - -install (TARGETS iwasm DESTINATION bin) - -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/build_jit.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/build_jit.sh deleted file mode 100755 index a7d559107..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/build_jit.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -rm -fr build && mkdir build -cd build -cmake .. -DWAMR_BUILD_JIT=1 -make -j ${nproc} -cd .. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/build_llvm.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/build_llvm.sh deleted file mode 100755 index b8a9761f8..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/build_llvm.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2020 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -/usr/bin/env python3 -m pip install --user -r ../../../build-scripts/requirements.txt -/usr/bin/env python3 ../../../build-scripts/build_llvm.py --platform darwin "$@" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/main.c deleted file mode 100644 index 8f0e84a97..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/darwin/main.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include "../posix/main.c" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/.gitignore deleted file mode 100644 index c260f41fd..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -sdkconfig -sdkconfig.old
\ No newline at end of file diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/CMakeLists.txt deleted file mode 100644 index d8a3d2f96..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (C) 2019-21 Intel Corporation and others. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -# from ESP-IDF 4.0 examples/build_system/cmake/idf_as_lib -cmake_minimum_required(VERSION 3.5) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) - -set (COMPONENTS ${IDF_TARGET} main freertos esptool_py wamr) -list(APPEND EXTRA_COMPONENT_DIRS "$ENV{WAMR_PATH}/build-scripts/esp-idf") - -project(wamr-simple)
\ No newline at end of file diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/build_and_run.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/build_and_run.sh deleted file mode 100755 index dd8dd5ca9..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/build_and_run.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -e - -# Copyright (C) 2019-21 Intel Corporation and others. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -ESP32_TARGET="esp32" -ESP32C3_TARGET="esp32c3" - -usage () -{ - echo "USAGE:" - echo "$0 $ESP32_TARGET|$ESP32C3_TARGET" - echo "Example:" - echo " $0 $ESP32_TARGET" - echo " $0 $ESP32C3_TARGET" - exit 1 -} - -if [ $# != 1 ] ; then - usage -fi - -TARGET=$1 - -if [[ -z "${WAMR_PATH}" ]]; then - export WAMR_PATH=$PWD/../../.. -fi - -rm -rf build -idf.py set-target $TARGET -idf.py build -idf.py flash - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/CMakeLists.txt deleted file mode 100644 index 55e725670..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2021 Intel Corporation and others. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -idf_component_register(SRCS "main.c" - INCLUDE_DIRS "." - REQUIRES wamr) diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/main.c deleted file mode 100644 index 417fad561..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/main.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2019-21 Intel Corporation and others. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <stdio.h> -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "wasm_export.h" -#include "bh_platform.h" -#include "test_wasm.h" - -#include "esp_log.h" - -#define LOG_TAG "wamr" - -static void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - - wasm_application_execute_main(module_inst, 0, NULL); - if ((exception = wasm_runtime_get_exception(module_inst))) - printf("%s\n", exception); - return NULL; -} - -void * -iwasm_main(void *arg) -{ - (void)arg; /* unused */ - /* setup variables for instantiating and running the wasm module */ - uint8_t *wasm_file_buf = NULL; - unsigned wasm_file_buf_size = 0; - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - char error_buf[128]; - void *ret; - RuntimeInitArgs init_args; - - /* configure memory allocation */ - memset(&init_args, 0, sizeof(RuntimeInitArgs)); -#if WASM_ENABLE_GLOBAL_HEAP_POOL == 0 - init_args.mem_alloc_type = Alloc_With_Allocator; - init_args.mem_alloc_option.allocator.malloc_func = (void *)os_malloc; - init_args.mem_alloc_option.allocator.realloc_func = (void *)os_realloc; - init_args.mem_alloc_option.allocator.free_func = (void *)os_free; -#else -#error The usage of a global heap pool is not implemented yet for esp-idf. -#endif - - ESP_LOGI(LOG_TAG, "Initialize WASM runtime"); - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - ESP_LOGE(LOG_TAG, "Init runtime failed."); - return NULL; - } - -#if WASM_ENABLE_INTERP != 0 - ESP_LOGI(LOG_TAG, "Run wamr with interpreter"); - - wasm_file_buf = (uint8_t *)wasm_test_file_interp; - wasm_file_buf_size = sizeof(wasm_test_file_interp); - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_buf_size, - error_buf, sizeof(error_buf)))) { - ESP_LOGE(LOG_TAG, "Error in wasm_runtime_load: %s", error_buf); - goto fail1interp; - } - - ESP_LOGI(LOG_TAG, "Instantiate WASM runtime"); - if (!(wasm_module_inst = - wasm_runtime_instantiate(wasm_module, 32 * 1024, // stack size - 32 * 1024, // heap size - error_buf, sizeof(error_buf)))) { - ESP_LOGE(LOG_TAG, "Error while instantiating: %s", error_buf); - goto fail2interp; - } - - ESP_LOGI(LOG_TAG, "run main() of the application"); - ret = app_instance_main(wasm_module_inst); - assert(!ret); - - /* destroy the module instance */ - ESP_LOGI(LOG_TAG, "Deinstantiate WASM runtime"); - wasm_runtime_deinstantiate(wasm_module_inst); - -fail2interp: - /* unload the module */ - ESP_LOGI(LOG_TAG, "Unload WASM module"); - wasm_runtime_unload(wasm_module); - -fail1interp: -#endif -#if WASM_ENABLE_AOT != 0 - ESP_LOGI(LOG_TAG, "Run wamr with AoT"); - - wasm_file_buf = (uint8_t *)wasm_test_file_aot; - wasm_file_buf_size = sizeof(wasm_test_file_aot); - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_buf_size, - error_buf, sizeof(error_buf)))) { - ESP_LOGE(LOG_TAG, "Error in wasm_runtime_load: %s", error_buf); - goto fail1aot; - } - - ESP_LOGI(LOG_TAG, "Instantiate WASM runtime"); - if (!(wasm_module_inst = - wasm_runtime_instantiate(wasm_module, 32 * 1024, // stack size - 32 * 1024, // heap size - error_buf, sizeof(error_buf)))) { - ESP_LOGE(LOG_TAG, "Error while instantiating: %s", error_buf); - goto fail2aot; - } - - ESP_LOGI(LOG_TAG, "run main() of the application"); - ret = app_instance_main(wasm_module_inst); - assert(!ret); - - /* destroy the module instance */ - ESP_LOGI(LOG_TAG, "Deinstantiate WASM runtime"); - wasm_runtime_deinstantiate(wasm_module_inst); - -fail2aot: - /* unload the module */ - ESP_LOGI(LOG_TAG, "Unload WASM module"); - wasm_runtime_unload(wasm_module); -fail1aot: -#endif - - /* destroy runtime environment */ - ESP_LOGI(LOG_TAG, "Destroy WASM runtime"); - wasm_runtime_destroy(); - - return NULL; -} - -void -app_main(void) -{ - pthread_t t; - int res; - - pthread_attr_t tattr; - pthread_attr_init(&tattr); - pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE); - pthread_attr_setstacksize(&tattr, 4096); - - res = pthread_create(&t, &tattr, iwasm_main, (void *)NULL); - assert(res == 0); - - res = pthread_join(t, NULL); - assert(res == 0); - - ESP_LOGI(LOG_TAG, "Exiting..."); -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/test_wasm.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/test_wasm.h deleted file mode 100644 index fc2d76fdb..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/main/test_wasm.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2019-21 Intel Corporation and others. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#if WASM_ENABLE_INTERP != 0 -unsigned char __aligned(4) wasm_test_file_interp[] = { - 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, - 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01, - 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75, - 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C, - 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66, - 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01, - 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x13, 0x03, - 0x7F, 0x01, 0x41, 0xC0, 0x28, 0x0B, 0x7F, 0x00, 0x41, 0xBA, 0x08, 0x0B, - 0x7F, 0x00, 0x41, 0xC0, 0x28, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, - 0x6D, 0x6F, 0x72, 0x79, 0x02, 0x00, 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74, - 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x03, 0x02, 0x04, 0x6D, 0x61, - 0x69, 0x6E, 0x00, 0x04, 0x0A, 0xB2, 0x01, 0x01, 0xAF, 0x01, 0x01, 0x03, - 0x7F, 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, - 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x88, 0x80, 0x80, 0x00, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, - 0x80, 0x08, 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, - 0x41, 0xA8, 0x88, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, - 0x1A, 0x41, 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x10, 0x41, 0x80, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41, - 0x10, 0x6A, 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21, - 0x04, 0x20, 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x88, - 0x80, 0x80, 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, - 0x8D, 0x88, 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x00, 0x41, 0x93, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10, - 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80, - 0x80, 0x00, 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80, - 0x80, 0x00, 0x20, 0x04, 0x0B, 0x0B, 0x41, 0x01, 0x00, 0x41, 0x80, 0x08, - 0x0B, 0x3A, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25, - 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66, - 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, - 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, - 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00 -}; -#endif - -#if WASM_ENABLE_AOT != 0 -#if BUILD_TARGET_XTENSA != 0 -// XTENSA -unsigned char __aligned(4) wasm_test_file_aot[] = { - 0x00, 0x61, 0x6F, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x5E, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x78, 0x74, 0x65, 0x6E, 0x73, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x39, 0x00, 0x00, 0x00, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, - 0x20, 0x25, 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, - 0x75, 0x66, 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, - 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, - 0x6F, 0x63, 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, - 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x7F, 0x01, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x3A, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x65, 0x6E, 0x76, 0x00, 0x04, 0x00, 0x70, 0x75, 0x74, 0x73, 0x00, 0x00, - 0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00, 0x6D, 0x61, 0x6C, 0x6C, - 0x6F, 0x63, 0x01, 0x00, 0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00, - 0x70, 0x72, 0x69, 0x6E, 0x74, 0x66, 0x02, 0x00, 0x03, 0x00, 0x65, 0x6E, - 0x76, 0x00, 0x04, 0x00, 0x66, 0x72, 0x65, 0x65, 0x01, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xC1, 0x00, 0x98, - 0x62, 0x78, 0x22, 0x82, 0x27, 0x6A, 0x32, 0xC8, 0xE0, 0x0C, 0xD4, 0x37, - 0xB9, 0x08, 0xA8, 0x72, 0x0C, 0xEB, 0x37, 0xBA, 0x0F, 0x4D, 0x0B, 0x81, - 0xFF, 0xFF, 0xAD, 0x07, 0xBD, 0x04, 0xE0, 0x08, 0x00, 0x0C, 0x02, 0x1D, - 0xF0, 0xB9, 0x51, 0x49, 0x81, 0xA9, 0x61, 0x99, 0x91, 0x89, 0xC1, 0x68, - 0x32, 0x82, 0x27, 0x64, 0x89, 0xB1, 0x82, 0x27, 0x62, 0x89, 0x71, 0x82, - 0x27, 0x56, 0x89, 0xA1, 0x0C, 0x05, 0x32, 0x67, 0x6A, 0x52, 0x46, 0x03, - 0x52, 0x46, 0x02, 0x0C, 0x48, 0x89, 0xE1, 0x82, 0x46, 0x01, 0x1C, 0xB8, - 0x82, 0x46, 0x00, 0x0C, 0x1C, 0x41, 0xFF, 0xFF, 0xAD, 0x02, 0xBD, 0x05, - 0xDD, 0x06, 0xE0, 0x04, 0x00, 0x92, 0xA0, 0xFF, 0x90, 0x8A, 0x10, 0x16, - 0xA8, 0x1E, 0x0C, 0x05, 0x52, 0x46, 0x03, 0x52, 0x46, 0x02, 0x88, 0xE1, - 0x82, 0x46, 0x01, 0x52, 0x46, 0x00, 0x0C, 0x1B, 0xAD, 0x02, 0xCD, 0x0B, - 0x99, 0xD1, 0xDD, 0x06, 0xE0, 0x04, 0x00, 0x98, 0xD1, 0x90, 0x8A, 0x10, - 0x16, 0x58, 0x1C, 0x49, 0x41, 0xE8, 0x06, 0x16, 0xCE, 0x17, 0x88, 0xC1, - 0x82, 0xC8, 0xF0, 0x0C, 0x24, 0x37, 0xB8, 0x02, 0xC6, 0xDB, 0xFF, 0x98, - 0xB1, 0x87, 0xB9, 0x02, 0xC6, 0xD9, 0xFF, 0x98, 0xA1, 0x8A, 0x99, 0x1C, - 0x8B, 0x00, 0x0B, 0x40, 0xE0, 0xA0, 0x91, 0xA2, 0x49, 0x03, 0x1C, 0x0C, - 0x00, 0x0C, 0x40, 0xE0, 0xA0, 0x91, 0xA2, 0x49, 0x02, 0xE0, 0xA8, 0x41, - 0xA9, 0x01, 0xA2, 0x49, 0x01, 0xE2, 0x49, 0x00, 0xC9, 0x11, 0x00, 0x0C, - 0x40, 0x80, 0x90, 0x91, 0x92, 0x46, 0x06, 0xB9, 0x21, 0x00, 0x0B, 0x40, - 0x80, 0x90, 0x91, 0x92, 0x46, 0x07, 0x82, 0x46, 0x04, 0x80, 0x88, 0x41, - 0x82, 0x46, 0x05, 0x0C, 0x05, 0x52, 0x46, 0x02, 0x52, 0x46, 0x03, 0x52, - 0x46, 0x00, 0x88, 0xE1, 0x82, 0x46, 0x01, 0x0C, 0x24, 0xAD, 0x02, 0xBD, - 0x04, 0xCD, 0x04, 0xDD, 0x06, 0x88, 0x41, 0xE9, 0x31, 0xE0, 0x08, 0x00, - 0x88, 0xD1, 0x80, 0x8A, 0x10, 0x16, 0xC8, 0x13, 0xF8, 0x31, 0x4B, 0x8F, - 0x98, 0x71, 0x87, 0xB9, 0x02, 0x86, 0xBB, 0xFF, 0x92, 0xA4, 0x11, 0xD8, - 0xA1, 0x9A, 0x9D, 0x92, 0x09, 0x00, 0x8A, 0x8D, 0xA2, 0xA4, 0x12, 0xAA, - 0xAD, 0xA2, 0x0A, 0x00, 0xA2, 0x48, 0x01, 0x92, 0x48, 0x00, 0xE8, 0xB1, - 0xF7, 0xBE, 0x02, 0x06, 0xB3, 0xFF, 0x82, 0xA4, 0x0E, 0x8A, 0x8D, 0x82, - 0x08, 0x00, 0x92, 0xA4, 0x0D, 0x9A, 0x9D, 0x92, 0x09, 0x00, 0xA2, 0xA4, - 0x10, 0xAA, 0xAD, 0xA2, 0x0A, 0x00, 0xFA, 0xBD, 0xC2, 0xA4, 0x0F, 0xCA, - 0xCD, 0xC2, 0x0C, 0x00, 0xC2, 0x4B, 0x02, 0xA2, 0x4B, 0x03, 0x92, 0x4B, - 0x00, 0x82, 0x4B, 0x01, 0x37, 0xBE, 0x02, 0x06, 0xA6, 0xFF, 0x88, 0xA1, - 0x3A, 0x88, 0xA8, 0x21, 0x00, 0x0A, 0x40, 0xF0, 0x90, 0x91, 0x92, 0x48, - 0x03, 0x98, 0x11, 0x00, 0x09, 0x40, 0xF0, 0x90, 0x91, 0x92, 0x48, 0x02, - 0x98, 0x01, 0x92, 0x48, 0x01, 0xF2, 0x48, 0x00, 0x30, 0x80, 0x91, 0x82, - 0x46, 0x06, 0x00, 0x0A, 0x40, 0x30, 0x80, 0x91, 0x82, 0x46, 0x07, 0x32, - 0x46, 0x04, 0x30, 0x88, 0x41, 0x82, 0x46, 0x05, 0x0C, 0x05, 0x52, 0x46, - 0x02, 0x52, 0x46, 0x03, 0x1C, 0x38, 0x82, 0x46, 0x00, 0x88, 0xE1, 0x82, - 0x46, 0x01, 0x0C, 0x2B, 0xAD, 0x02, 0xCD, 0x0B, 0xDD, 0x06, 0x48, 0x41, - 0x3D, 0x0F, 0xE0, 0x04, 0x00, 0x98, 0xD1, 0x90, 0x8A, 0x10, 0x16, 0x78, - 0x07, 0x32, 0x46, 0x00, 0x88, 0x21, 0x00, 0x08, 0x40, 0x30, 0x80, 0x91, - 0x82, 0x46, 0x03, 0x88, 0x11, 0x00, 0x08, 0x40, 0x30, 0x80, 0x91, 0x82, - 0x46, 0x02, 0x88, 0x01, 0x82, 0x46, 0x01, 0x0C, 0x3B, 0x0C, 0x1C, 0xAD, - 0x02, 0x5D, 0x09, 0xDD, 0x06, 0xE0, 0x04, 0x00, 0x50, 0x8A, 0x10, 0x0C, - 0x05, 0x56, 0xB8, 0x02, 0x46, 0x10, 0x00, 0x0C, 0x05, 0x52, 0x46, 0x03, - 0x52, 0x46, 0x02, 0x88, 0xE1, 0x82, 0x46, 0x01, 0x2C, 0x88, 0x82, 0x46, - 0x00, 0x0C, 0x1C, 0xAD, 0x02, 0xBD, 0x05, 0x4D, 0x09, 0xDD, 0x06, 0x88, - 0x41, 0xE0, 0x08, 0x00, 0x40, 0x8A, 0x10, 0x16, 0xA8, 0x01, 0x7C, 0xF5, - 0x48, 0x81, 0x88, 0xC1, 0x98, 0x91, 0x87, 0x39, 0x02, 0x86, 0x72, 0xFF, - 0x48, 0x51, 0x98, 0x61, 0x87, 0xB9, 0x02, 0x06, 0x70, 0xFF, 0x82, 0x67, - 0x6A, 0x2D, 0x05, 0x1D, 0xF0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x6D, 0x65, 0x6D, 0x6F, - 0x72, 0x79, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, - 0x6D, 0x61, 0x69, 0x6E, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0A, 0x00, - 0x5F, 0x5F, 0x64, 0x61, 0x74, 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0B, 0x00, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xC8, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0C, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, - 0x3A, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x2E, 0x72, - 0x65, 0x6C, 0x61, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x08, 0x00, 0x2E, 0x6C, - 0x69, 0x74, 0x65, 0x72, 0x61, 0x6C, 0x0D, 0x00, 0x2E, 0x72, 0x65, 0x6C, - 0x61, 0x2E, 0x6C, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6C, 0x00, 0x11, 0x00, - 0x61, 0x6F, 0x74, 0x5F, 0x69, 0x6E, 0x76, 0x6F, 0x6B, 0x65, 0x5F, 0x6E, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x00, 0x19, 0x00, 0x61, 0x6F, 0x74, 0x5F, - 0x73, 0x65, 0x74, 0x5F, 0x65, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, - 0x6E, 0x5F, 0x77, 0x69, 0x74, 0x68, 0x5F, 0x69, 0x64, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x1B, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 -}; -#else -// RISC-V -unsigned char __aligned(4) wasm_test_file_aot[] = { - 0x00, 0x61, 0x6F, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xF3, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x72, 0x69, 0x73, 0x63, 0x76, 0x33, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x39, 0x00, 0x00, 0x00, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, - 0x20, 0x25, 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, - 0x75, 0x66, 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, - 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, - 0x6F, 0x63, 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, - 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x7F, 0x01, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x3A, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x41, 0x00, 0x40, 0x14, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, - 0x65, 0x6E, 0x76, 0x00, 0x04, 0x00, 0x70, 0x75, 0x74, 0x73, 0x00, 0x00, - 0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00, 0x6D, 0x61, 0x6C, 0x6C, - 0x6F, 0x63, 0x01, 0x00, 0x03, 0x00, 0x65, 0x6E, 0x76, 0x00, 0x06, 0x00, - 0x70, 0x72, 0x69, 0x6E, 0x74, 0x66, 0x02, 0x00, 0x03, 0x00, 0x65, 0x6E, - 0x76, 0x00, 0x04, 0x00, 0x66, 0x72, 0x65, 0x65, 0x01, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x01, 0x01, 0xFC, 0x23, 0x2E, 0x11, 0x02, 0x23, 0x2C, 0x81, 0x02, - 0x23, 0x2A, 0x91, 0x02, 0x23, 0x28, 0x21, 0x03, 0x23, 0x26, 0x31, 0x03, - 0x23, 0x24, 0x41, 0x03, 0x23, 0x22, 0x51, 0x03, 0x23, 0x20, 0x61, 0x03, - 0x23, 0x2E, 0x71, 0x01, 0x23, 0x2C, 0x81, 0x01, 0x23, 0x2A, 0x91, 0x01, - 0x23, 0x28, 0xA1, 0x01, 0x23, 0x26, 0xB1, 0x01, 0x83, 0x29, 0x85, 0x00, - 0x03, 0xAA, 0x89, 0x1A, 0x83, 0x2A, 0x85, 0x01, 0x93, 0x0B, 0x0A, 0xFE, - 0x13, 0x04, 0xD0, 0x00, 0x63, 0xFA, 0x7A, 0x01, 0x93, 0x04, 0x05, 0x00, - 0x03, 0x2B, 0xC5, 0x01, 0x13, 0x04, 0xE0, 0x00, 0x63, 0x7A, 0x7B, 0x05, - 0x13, 0x85, 0x09, 0x00, 0x93, 0x05, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, - 0xE7, 0x80, 0x00, 0x00, 0x13, 0x05, 0x00, 0x00, 0x83, 0x2D, 0xC1, 0x00, - 0x03, 0x2D, 0x01, 0x01, 0x83, 0x2C, 0x41, 0x01, 0x03, 0x2C, 0x81, 0x01, - 0x83, 0x2B, 0xC1, 0x01, 0x03, 0x2B, 0x01, 0x02, 0x83, 0x2A, 0x41, 0x02, - 0x03, 0x2A, 0x81, 0x02, 0x83, 0x29, 0xC1, 0x02, 0x03, 0x29, 0x01, 0x03, - 0x83, 0x24, 0x41, 0x03, 0x03, 0x24, 0x81, 0x03, 0x83, 0x20, 0xC1, 0x03, - 0x13, 0x01, 0x01, 0x04, 0x67, 0x80, 0x00, 0x00, 0x03, 0xA9, 0xC4, 0x00, - 0x03, 0xAC, 0x89, 0x15, 0x83, 0xAD, 0x89, 0x18, 0x83, 0xAC, 0x09, 0x19, - 0x23, 0xA4, 0x79, 0x1B, 0xA3, 0x01, 0x09, 0x00, 0x23, 0x01, 0x09, 0x00, - 0x13, 0x04, 0x40, 0x00, 0xA3, 0x00, 0x89, 0x00, 0x13, 0x05, 0xB0, 0x01, - 0x23, 0x00, 0xA9, 0x00, 0x13, 0x06, 0x10, 0x00, 0x13, 0x85, 0x04, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00, - 0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, 0xE3, 0x0C, 0x05, 0xF6, - 0xA3, 0x01, 0x09, 0x00, 0x23, 0x01, 0x09, 0x00, 0xA3, 0x00, 0x89, 0x00, - 0x23, 0x00, 0x09, 0x00, 0x93, 0x05, 0x10, 0x00, 0x13, 0x06, 0x10, 0x00, - 0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00, - 0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, 0xE3, 0x04, 0x05, 0xF4, - 0x03, 0x2D, 0x09, 0x00, 0x63, 0x08, 0x0D, 0x18, 0x13, 0x05, 0x0A, 0xFF, - 0xB3, 0x35, 0x75, 0x01, 0x33, 0xB6, 0xAC, 0x00, 0xB3, 0xE5, 0xC5, 0x00, - 0x13, 0x04, 0x20, 0x00, 0xE3, 0x9C, 0x05, 0xF0, 0xB3, 0x05, 0xAC, 0x00, - 0x13, 0x56, 0x8D, 0x01, 0x23, 0x24, 0xC1, 0x00, 0xA3, 0x81, 0xC5, 0x00, - 0x13, 0x56, 0x0D, 0x01, 0x23, 0x22, 0xC1, 0x00, 0x23, 0x81, 0xC5, 0x00, - 0x13, 0x56, 0x8D, 0x00, 0x23, 0x20, 0xC1, 0x00, 0xA3, 0x80, 0xC5, 0x00, - 0x23, 0x80, 0xA5, 0x01, 0x23, 0x01, 0x09, 0x00, 0xA3, 0x01, 0x09, 0x00, - 0x23, 0x00, 0x09, 0x00, 0x93, 0x05, 0x40, 0x00, 0xA3, 0x00, 0xB9, 0x00, - 0x93, 0x55, 0x05, 0x01, 0x23, 0x03, 0xB9, 0x00, 0x93, 0x55, 0x85, 0x01, - 0xA3, 0x03, 0xB9, 0x00, 0x23, 0x02, 0xA9, 0x00, 0x13, 0x55, 0x85, 0x00, - 0xA3, 0x02, 0xA9, 0x00, 0x93, 0x05, 0x20, 0x00, 0x13, 0x06, 0x20, 0x00, - 0x13, 0x04, 0x20, 0x00, 0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, - 0x97, 0x00, 0x00, 0x00, 0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, - 0xE3, 0x04, 0x05, 0xEA, 0x13, 0x05, 0x4D, 0x00, 0xE3, 0xE8, 0xAD, 0xE8, - 0x83, 0x05, 0x2C, 0x41, 0x03, 0x46, 0x1C, 0x41, 0x33, 0x05, 0xAC, 0x00, - 0xA3, 0x00, 0xB5, 0x00, 0x23, 0x00, 0xC5, 0x00, 0xE3, 0xEC, 0xAC, 0xE7, - 0x03, 0x45, 0xEC, 0x40, 0x83, 0x45, 0xFC, 0x40, 0x03, 0x46, 0x0C, 0x41, - 0x83, 0x46, 0xDC, 0x40, 0x33, 0x07, 0xAC, 0x01, 0x23, 0x01, 0xB7, 0x00, - 0xA3, 0x01, 0xC7, 0x00, 0x23, 0x00, 0xD7, 0x00, 0xA3, 0x00, 0xA7, 0x00, - 0xE3, 0xE8, 0x7C, 0xE5, 0x33, 0x05, 0x7C, 0x01, 0x03, 0x24, 0x81, 0x00, - 0xA3, 0x01, 0x85, 0x00, 0x03, 0x2C, 0x41, 0x00, 0x23, 0x01, 0x85, 0x01, - 0x83, 0x2C, 0x01, 0x00, 0xA3, 0x00, 0x95, 0x01, 0x23, 0x00, 0xA5, 0x01, - 0x23, 0x01, 0x09, 0x00, 0xA3, 0x01, 0x09, 0x00, 0x13, 0x05, 0x30, 0x01, - 0x23, 0x00, 0xA9, 0x00, 0x13, 0x05, 0x40, 0x00, 0xA3, 0x00, 0xA9, 0x00, - 0x13, 0xD5, 0x0B, 0x01, 0x23, 0x03, 0xA9, 0x00, 0x13, 0xD5, 0x8B, 0x01, - 0xA3, 0x03, 0xA9, 0x00, 0x23, 0x02, 0x79, 0x01, 0x13, 0xD5, 0x8B, 0x00, - 0xA3, 0x02, 0xA9, 0x00, 0x93, 0x05, 0x20, 0x00, 0x13, 0x06, 0x20, 0x00, - 0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00, - 0xE7, 0x80, 0x00, 0x00, 0x13, 0x75, 0xF5, 0x0F, 0xE3, 0x06, 0x05, 0xDE, - 0x23, 0x00, 0xA9, 0x01, 0xA3, 0x01, 0x89, 0x00, 0x23, 0x01, 0x89, 0x01, - 0xA3, 0x00, 0x99, 0x01, 0x93, 0x05, 0x30, 0x00, 0x13, 0x06, 0x10, 0x00, - 0x13, 0x85, 0x04, 0x00, 0x93, 0x06, 0x09, 0x00, 0x97, 0x00, 0x00, 0x00, - 0xE7, 0x80, 0x00, 0x00, 0x93, 0x75, 0xF5, 0x0F, 0x13, 0x05, 0x00, 0x00, - 0x63, 0x92, 0x05, 0x04, 0x6F, 0xF0, 0x9F, 0xDB, 0xA3, 0x01, 0x09, 0x00, - 0x23, 0x01, 0x09, 0x00, 0x13, 0x05, 0x40, 0x00, 0xA3, 0x00, 0xA9, 0x00, - 0x13, 0x05, 0x80, 0x02, 0x23, 0x00, 0xA9, 0x00, 0x13, 0x06, 0x10, 0x00, - 0x13, 0x85, 0x04, 0x00, 0x93, 0x05, 0x00, 0x00, 0x93, 0x06, 0x09, 0x00, - 0x97, 0x00, 0x00, 0x00, 0xE7, 0x80, 0x00, 0x00, 0x93, 0x75, 0xF5, 0x0F, - 0x13, 0x05, 0xF0, 0xFF, 0xE3, 0x8C, 0x05, 0xD6, 0x13, 0x04, 0xD0, 0x00, - 0xE3, 0xF0, 0x4A, 0xD7, 0x13, 0x04, 0xE0, 0x00, 0xE3, 0x6C, 0x4B, 0xD5, - 0x23, 0xA4, 0x49, 0x1B, 0x6F, 0xF0, 0x5F, 0xD6, 0x03, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x6D, 0x65, 0x6D, 0x6F, - 0x72, 0x79, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, - 0x6D, 0x61, 0x69, 0x6E, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0A, 0x00, - 0x5F, 0x5F, 0x64, 0x61, 0x74, 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0B, 0x00, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x00, 0x05, 0x00, 0x00, 0x00, - 0xCC, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0C, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, - 0x0A, 0x00, 0x2E, 0x72, 0x65, 0x6C, 0x61, 0x2E, 0x74, 0x65, 0x78, 0x74, - 0x19, 0x00, 0x61, 0x6F, 0x74, 0x5F, 0x73, 0x65, 0x74, 0x5F, 0x65, 0x78, - 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x5F, 0x77, 0x69, 0x74, 0x68, - 0x5F, 0x69, 0x64, 0x00, 0x11, 0x00, 0x61, 0x6F, 0x74, 0x5F, 0x69, 0x6E, - 0x76, 0x6F, 0x6B, 0x65, 0x5F, 0x6E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xBC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xA8, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0xE8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00 -}; -#endif -#endif
\ No newline at end of file diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults deleted file mode 100644 index bb158eea9..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -# CONFIG_ESP_SYSTEM_MEMPROT_FEATURE is not set diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults.esp32 b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults.esp32 deleted file mode 100644 index 538ea3da1..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults.esp32 +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_ESP32_MEMPROT_FEATURE is not set diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults.esp32c3 b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults.esp32c3 deleted file mode 100644 index 29b82c4b8..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/esp-idf/sdkconfig.defaults.esp32c3 +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_ESP32C3_MEMPROT_FEATURE is not set diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/CMakeLists.txt deleted file mode 100644 index fee2934c0..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/CMakeLists.txt +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 2.9) - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "freebsd") - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", -# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") - set (WAMR_BUILD_TARGET "AARCH64") - elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set (WAMR_BUILD_TARGET "RISCV64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -set(CMAKE_CXX_STANDARD 14) - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_JIT) - # Disable Fast JIT by default - set (WAMR_BUILD_FAST_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Disable multiple module by default - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () - -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -set (WAMR_DISABLE_HW_BOUND_CHECK 1) - -set (CMAKE_SHARED_LINKER_FLAGS "-Wl") -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - -set (CMAKE_MACOSX_RPATH True) - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) - -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) - -install (TARGETS iwasm DESTINATION bin) - -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/build_jit.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/build_jit.sh deleted file mode 100755 index e6bee753c..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/build_jit.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -rm -fr build && mkdir build -cd build -cmake .. -DWAMR_BUILD_JIT=1 -nproc=$(sysctl -n hw.ncpu) -make -j ${nproc} -cd .. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/build_llvm.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/build_llvm.sh deleted file mode 100755 index c5666b7f5..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/build_llvm.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2020 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -/usr/bin/env python3 -m pip install --user -r ../../../build-scripts/requirements.txt -/usr/bin/env python3 ../../../build-scripts/build_llvm.py "$@" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/main.c deleted file mode 100644 index 8f0e84a97..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/freebsd/main.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include "../posix/main.c" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/ios/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/ios/CMakeLists.txt deleted file mode 100644 index 764bc7f65..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/ios/CMakeLists.txt +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 3.21) - -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard") - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "darwin") -set (WAMR_BUILD_TYPE Release) -set (WAMR_BUILD_INTERP 1) -set (WAMR_BUILD_AOT 0) -set (WAMR_BUILD_LIBC_BUILTIN 1) -set (WAMR_BUILD_LIBC_WASI 1) - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", -# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") - set (WAMR_BUILD_TARGET "AARCH64") - elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set (WAMR_BUILD_TARGET "RISCV64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -set(CMAKE_CXX_STANDARD 14) - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_JIT) - # Disable Fast JIT by default - set (WAMR_BUILD_FAST_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Disable multiple module by default - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) - -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE") - -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") - -if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") - if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") - endif () -endif () - -# The following flags are to enhance security, but it may impact performance, -# we disable them by default. -#if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -D_FORTIFY_SOURCE=2") -#endif () -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong --param ssp-buffer-size=4") -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now") - -add_library (iwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) -if (CMAKE_BUILD_TYPE STREQUAL Release) -target_link_libraries (iwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -s) -else() -target_link_libraries (iwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl) -endif() - -set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) -set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") - -add_custom_command (TARGET iwasm POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" - COMMENT "Copying iwasm to output directory") diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/ios/generate_xcodeproj.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/ios/generate_xcodeproj.sh deleted file mode 100755 index 168608168..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/ios/generate_xcodeproj.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2022 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -rm -rf ./iwasm-proj -git clone https://github.com/leetal/ios-cmake.git ios-cmake -cmake -Biwasm-proj -G Xcode -DDEPLOYMENT_TARGET=11.0 -DPLATFORM=OS64 -DENABLE_BITCODE=0 -DCMAKE_TOOLCHAIN_FILE=ios-cmake/ios.toolchain.cmake . diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/CMakeLists.txt deleted file mode 100644 index e1cbe2cc7..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/CMakeLists.txt +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 2.9) - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "linux-sgx") - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default - # Please install Intel SGX SDKv2.8 or later. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_JIT) - # Disable Fast JIT by default - set (WAMR_BUILD_FAST_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_RATS) - # Disable lib rats support by default - set (WAMR_BUILD_LIB_RATS 0) -endif() - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Enable multiple modules - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Enable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Disable SIMD by default - set (WAMR_BUILD_SIMD 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SGX_IPFS) - # Disable SGX IPFS by default - set (WAMR_BUILD_SGX_IPFS 0) -endif () - -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -ffunction-sections -fdata-sections \ - -Wall -Wno-unused-parameter -Wno-pedantic \ - -nostdinc -fvisibility=hidden -fpie" ) - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -add_custom_command ( - OUTPUT libvmlib_untrusted.a - COMMAND mkdir -p untrusted && cd untrusted && - ${CMAKE_C_COMPILER} -c ${PLATFORM_SHARED_SOURCE_UNTRUSTED} - COMMAND ${CMAKE_AR} rc libvmlib_untrusted.a untrusted/*.o) - -add_custom_target (vmlib_untrusted ALL DEPENDS libvmlib_untrusted.a) - -if (DEFINED WAMR_BUILD_GLOBAL_HEAP_POOL) - execute_process( - COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_GLOBAL_HEAP_POOL = .*/WAMR_BUILD_GLOBAL_HEAP_POOL = ${WAMR_BUILD_GLOBAL_HEAP_POOL}/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Makefile" - OUTPUT_VARIABLE cmdOutput - ) - if (DEFINED WAMR_BUILD_GLOBAL_HEAP_SIZE) - execute_process( - COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_GLOBAL_HEAP_SIZE = .*/WAMR_BUILD_GLOBAL_HEAP_SIZE = ${WAMR_BUILD_GLOBAL_HEAP_SIZE}/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Makefile" - OUTPUT_VARIABLE cmdOutput - ) - endif() -endif() - -if (WAMR_BUILD_LIB_RATS EQUAL 1) - execute_process( - COMMAND bash -c "sed -i -E 's/^#define WASM_ENABLE_LIB_RATS 0/#define WASM_ENABLE_LIB_RATS 1/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Enclave/Enclave.edl" - COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_LIB_RATS = 0/WAMR_BUILD_LIB_RATS = 1/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Makefile" - OUTPUT_VARIABLE cmdOutput - ) -else() - execute_process( - COMMAND bash -c "sed -i -E 's/^#define WASM_ENABLE_LIB_RATS 1/#define WASM_ENABLE_LIB_RATS 0/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Enclave/Enclave.edl" - COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_LIB_RATS = 1/WAMR_BUILD_LIB_RATS = 0/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Makefile" - OUTPUT_VARIABLE cmdOutput - ) -endif() - -if (WAMR_BUILD_SGX_IPFS EQUAL 1) - execute_process( - COMMAND bash -c "sed -i -E 's/^#define WASM_ENABLE_SGX_IPFS 0/#define WASM_ENABLE_SGX_IPFS 1/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Enclave/Enclave.edl" - COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_SGX_IPFS = 0/WAMR_BUILD_SGX_IPFS = 1/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Makefile" - OUTPUT_VARIABLE cmdOutput - ) -else() - execute_process( - COMMAND bash -c "sed -i -E 's/^#define WASM_ENABLE_SGX_IPFS 1/#define WASM_ENABLE_SGX_IPFS 0/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Enclave/Enclave.edl" - COMMAND bash -c "sed -i -E 's/^WAMR_BUILD_SGX_IPFS = 1/WAMR_BUILD_SGX_IPFS = 0/g' ${CMAKE_CURRENT_SOURCE_DIR}/enclave-sample/Makefile" - OUTPUT_VARIABLE cmdOutput - ) -endif() diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt deleted file mode 100644 index aa3de6dac..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 2.9) - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "linux-sgx") - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default - # Please install Intel SGX SDKv2.8 or later. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Enable multiple modules - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Enable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () - -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffunction-sections -fdata-sections \ - -Wall -Wno-unused-parameter -Wno-pedantic \ - -nostdinc -fvisibility=hidden -fpie" ) - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -add_custom_command ( - OUTPUT libvmlib_untrusted.a - COMMAND mkdir -p untrusted && cd untrusted && - ${CMAKE_C_COMPILER} -c ${PLATFORM_SHARED_SOURCE_UNTRUSTED} - COMMAND ${CMAKE_AR} rc libvmlib_untrusted.a untrusted/*.o) - -add_custom_target (vmlib_untrusted ALL DEPENDS libvmlib_untrusted.a) diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/enclave-sample/Makefile b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/enclave-sample/Makefile deleted file mode 100644 index b598aad54..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/enclave-sample/Makefile +++ /dev/null @@ -1,259 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -######## SGX SDK Settings ######## - -SGX_SDK ?= /opt/intel/sgxsdk -SGX_SSL ?= /opt/intel/sgxssl -SGX_MODE ?= SIM -SGX_ARCH ?= x64 -SGX_DEBUG ?= 0 -SPEC_TEST ?= 0 - -# These variables are automatically set by CMakeLists.txt -WAMR_BUILD_SGX_IPFS = 0 -WAMR_BUILD_LIB_RATS = 0 -WAMR_BUILD_GLOBAL_HEAP_POOL = 0 -WAMR_BUILD_GLOBAL_HEAP_SIZE = 10485760 - -VMLIB_BUILD_DIR ?= $(CURDIR)/../build -LIB_RATS_SRC ?= $(VMLIB_BUILD_DIR)/_deps/librats-build -LIB_RATS_INSTALL_DIR := $(VMLIB_BUILD_DIR)/librats/lib/librats -LIB_RATS_INCLUDE_DIR := $(VMLIB_BUILD_DIR)/librats/include - -ifeq ($(shell getconf LONG_BIT), 32) - SGX_ARCH := x86 -else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) - SGX_ARCH := x86 -endif - -ifeq ($(SGX_ARCH), x86) - SGX_COMMON_CFLAGS := -m32 - SGX_LIBRARY_PATH := $(SGX_SDK)/lib - SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign - SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r -else - SGX_COMMON_CFLAGS := -m64 - SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 - SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign - SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r -endif - -ifeq ($(SGX_DEBUG), 1) -ifeq ($(SGX_PRERELEASE), 1) -$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) -endif -endif - -ifeq ($(SGX_DEBUG), 1) - SGX_COMMON_CFLAGS += -O0 -g -else - SGX_COMMON_CFLAGS += -O2 -endif - -######## App Settings ######## - -ifneq ($(SGX_MODE), HW) - Urts_Library_Name := sgx_urts_sim -else - Urts_Library_Name := sgx_urts -endif - -App_Cpp_Files := App/App.cpp -App_Include_Paths := -IApp -I$(SGX_SDK)/include -ifeq ($(WAMR_BUILD_LIB_RATS), 1) - App_Include_Paths += -I$(LIB_RATS_INCLUDE_DIR) -endif - -App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) - -# Three configuration modes - Debug, prerelease, release -# Debug - Macro DEBUG enabled. -# Prerelease - Macro NDEBUG and EDEBUG enabled. -# Release - Macro NDEBUG enabled. -ifeq ($(SGX_DEBUG), 1) - App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG -else ifeq ($(SGX_PRERELEASE), 1) - App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG -else - App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG -endif - -ifeq ($(SPEC_TEST), 1) - App_C_Flags += -DWASM_ENABLE_SPEC_TEST=1 -else - App_C_Flags += -DWASM_ENABLE_SPEC_TEST=0 -endif - -App_Cpp_Flags := $(App_C_Flags) -std=c++11 -App_Link_Flags := $(SGX_COMMON_CFLAGS) libvmlib_untrusted.a -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread - -ifneq ($(SGX_MODE), HW) - App_Link_Flags += -lsgx_uae_service_sim -else - App_Link_Flags += -lsgx_uae_service -endif - -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 -endif - -App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) - -App_Name := iwasm - -######## Enclave Settings ######## - -ifneq ($(SGX_MODE), HW) - Trts_Library_Name := sgx_trts_sim - Service_Library_Name := sgx_tservice_sim -else - Trts_Library_Name := sgx_trts - Service_Library_Name := sgx_tservice -endif - -ifeq ($(WAMR_BUILD_SGX_IPFS), 1) - Intel_Ipfs_Trusted_Flag = -lsgx_tprotected_fs - App_Link_Flags += -lsgx_uprotected_fs -endif - -Crypto_Library_Name := sgx_tcrypto - -WAMR_ROOT := $(CURDIR)/../../../../ - -Enclave_Cpp_Files := Enclave/Enclave.cpp - -Enclave_Include_Paths := -IEnclave -I$(WAMR_ROOT)/core/iwasm/include \ - -I$(WAMR_ROOT)/core/shared/utils \ - -I$(WAMR_ROOT)/core/shared/platform/linux-sgx \ - -I$(SGX_SDK)/include \ - -I$(SGX_SDK)/include/tlibc \ - -I$(SGX_SDK)/include/stlport - -ifeq ($(WAMR_BUILD_LIB_RATS), 1) - Enclave_Include_Paths += -I$(LIB_RATS_INCLUDE_DIR) -I$(SGX_SSL)/include -endif - -Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) -DWASM_GLOBAL_HEAP_SIZE=$(WAMR_BUILD_GLOBAL_HEAP_SIZE) -DWASM_ENABLE_GLOBAL_HEAP_POOL=$(WAMR_BUILD_GLOBAL_HEAP_POOL) -DWASM_ENABLE_LIB_RATS=$(WAMR_BUILD_LIB_RATS) -ifeq ($(SPEC_TEST), 1) - Enclave_C_Flags += -DWASM_ENABLE_SPEC_TEST=1 -else - Enclave_C_Flags += -DWASM_ENABLE_SPEC_TEST=0 -endif - -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 - Rats_Lib_W_Link_libs := -lattester_nullattester -lattester_sgx_ecdsa -lattester_sgx_la \ - -lverifier_nullverifier -lverifier_sgx_ecdsa -lverifier_sgx_la -lverifier_sgx_ecdsa_qve \ - -lrats_lib -lsgx_tsgxssl - Rats_Lib_NW_Link_libs := -lsgx_dcap_tvl -lsgx_tsgxssl_crypto -endif - -Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++11 -nostdinc++ -Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) ${Rats_Lib_Link_Dirs} \ - -Wl,--whole-archive -l$(Trts_Library_Name) ${Rats_Lib_W_Link_libs} $(Intel_Ipfs_Trusted_Flag) -Wl,--no-whole-archive \ - -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_pthread -lsgx_tkey_exchange -l$(Crypto_Library_Name) -l$(Service_Library_Name) $(Rats_Lib_NW_Link_libs) -Wl,--end-group \ - -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ - -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ - -Wl,--defsym,__ImageBase=0 - -Enclave_Edl_Search_Path = --search-path ../Enclave \ - --search-path $(SGX_SDK)/include \ - --search-path $(WAMR_ROOT)/core/shared/platform/linux-sgx -ifeq ($(WAMR_BUILD_LIB_RATS), 1) - Enclave_Edl_Search_Path += --search-path $(LIB_RATS_INCLUDE_DIR)/librats/edl --search-path $(SGX_SSL)/include -endif - - -Enclave_Cpp_Objects := $(Enclave_Cpp_Files:.cpp=.o) - -Enclave_Name := enclave.so -Signed_Enclave_Name := enclave.signed.so -Enclave_Config_File := Enclave/Enclave.config.xml - -ifeq ($(SGX_MODE), HW) -ifneq ($(SGX_DEBUG), 1) -ifneq ($(SGX_PRERELEASE), 1) -Build_Mode = HW_RELEASE -endif -endif -endif - - -.PHONY: all run - -ifeq ($(Build_Mode), HW_RELEASE) -all: $(App_Name) $(Enclave_Name) - @echo "The project has been built in release hardware mode." - @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." - @echo "To sign the enclave use the command:" - @echo " $(SGX_ENCLAVE_SIGNER) sign -key <your key> -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" - @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." - @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." -else -all: $(App_Name) $(Signed_Enclave_Name) -endif - -run: all -ifneq ($(Build_Mode), HW_RELEASE) - @$(CURDIR)/$(App_Name) - @echo "RUN => $(App_Name) [$(SGX_MODE)|$(SGX_ARCH), OK]" -endif - -######## App Objects ######## -librats: -ifeq ($(WAMR_BUILD_LIB_RATS), 1) - @cd $(LIB_RATS_SRC) && make install - @echo "librats build success" -endif - -App/Enclave_u.c: $(SGX_EDGER8R) Enclave/Enclave.edl librats - @cd App && $(SGX_EDGER8R) --untrusted ../Enclave/Enclave.edl $(Enclave_Edl_Search_Path) - @echo "GEN => $@" - -App/Enclave_u.o: App/Enclave_u.c - @$(CC) $(App_C_Flags) -c $< -o $@ - @echo "CC <= $<" - -App/%.o: App/%.cpp - @$(CXX) $(App_Cpp_Flags) -c $< -o $@ - @echo "CXX <= $<" - -libvmlib_untrusted.a: $(VMLIB_BUILD_DIR)/libvmlib_untrusted.a - @cp $< $@ - @echo "CP $@ <= $<" - -$(App_Name): App/Enclave_u.o $(App_Cpp_Objects) libvmlib_untrusted.a - @$(CXX) $^ -o $@ $(App_Link_Flags) - @echo "LINK => $@" - - -######## Enclave Objects ######## -Enclave/Enclave_t.c: $(SGX_EDGER8R) Enclave/Enclave.edl librats - @cd Enclave && $(SGX_EDGER8R) --trusted ../Enclave/Enclave.edl $(Enclave_Edl_Search_Path) - @echo "GEN => $@" - -Enclave/Enclave_t.o: Enclave/Enclave_t.c - @$(CC) $(Enclave_C_Flags) -c $< -o $@ - @echo "CC <= $<" - -Enclave/%.o: Enclave/%.cpp - @$(CXX) $(Enclave_Cpp_Flags) -c $< -o $@ - @echo "CXX <= $<" - -libvmlib.a: $(VMLIB_BUILD_DIR)/libvmlib.a - @cp $< $@ - @echo "CP $@ <= $<" - -$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) libvmlib.a - @$(CXX) $^ -o $@ $(Enclave_Link_Flags) - @echo "LINK => $@" - -$(Signed_Enclave_Name): $(Enclave_Name) - @$(SGX_ENCLAVE_SIGNER) sign -key Enclave/Enclave_private.pem -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) - @echo "SIGN => $@" - -.PHONY: clean - -clean: - @rm -f $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* libvmlib.a libvmlib_untrusted.a diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/enclave-sample/Makefile_minimal b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/enclave-sample/Makefile_minimal deleted file mode 100644 index a64d57744..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux-sgx/enclave-sample/Makefile_minimal +++ /dev/null @@ -1,210 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -######## SGX SDK Settings ######## - -SGX_SDK ?= /opt/intel/sgxsdk -SGX_MODE ?= SIM -SGX_ARCH ?= x64 -SGX_DEBUG ?= 0 -SPEC_TEST ?= 0 - -ifeq ($(shell getconf LONG_BIT), 32) - SGX_ARCH := x86 -else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) - SGX_ARCH := x86 -endif - -ifeq ($(SGX_ARCH), x86) - SGX_COMMON_CFLAGS := -m32 - SGX_LIBRARY_PATH := $(SGX_SDK)/lib - SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign - SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r -else - SGX_COMMON_CFLAGS := -m64 - SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 - SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign - SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r -endif - -ifeq ($(SGX_DEBUG), 1) -ifeq ($(SGX_PRERELEASE), 1) -$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) -endif -endif - -ifeq ($(SGX_DEBUG), 1) - SGX_COMMON_CFLAGS += -O0 -g -else - SGX_COMMON_CFLAGS += -O2 -endif - -######## App Settings ######## - -ifneq ($(SGX_MODE), HW) - Urts_Library_Name := sgx_urts_sim -else - Urts_Library_Name := sgx_urts -endif - -App_Cpp_Files := App/App.cpp -App_Include_Paths := -IApp -I$(SGX_SDK)/include - -App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) - -# Three configuration modes - Debug, prerelease, release -# Debug - Macro DEBUG enabled. -# Prerelease - Macro NDEBUG and EDEBUG enabled. -# Release - Macro NDEBUG enabled. -ifeq ($(SGX_DEBUG), 1) - App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG -else ifeq ($(SGX_PRERELEASE), 1) - App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG -else - App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG -endif - -App_Cpp_Flags := $(App_C_Flags) -std=c++11 -App_Link_Flags := $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread - -ifneq ($(SGX_MODE), HW) - App_Link_Flags += -lsgx_uae_service_sim -else - App_Link_Flags += -lsgx_uae_service -endif - -App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) - -App_Name := iwasm - -######## Enclave Settings ######## - -ifneq ($(SGX_MODE), HW) - Trts_Library_Name := sgx_trts_sim - Service_Library_Name := sgx_tservice_sim -else - Trts_Library_Name := sgx_trts - Service_Library_Name := sgx_tservice -endif -Crypto_Library_Name := sgx_tcrypto - -WAMR_ROOT := $(CURDIR)/../../../../ - -Enclave_Cpp_Files := Enclave/Enclave.cpp - -Enclave_Include_Paths := -IEnclave -I$(WAMR_ROOT)/core/iwasm/include \ - -I$(WAMR_ROOT)/core/shared/utils \ - -I$(WAMR_ROOT)/core/shared/platform/linux-sgx \ - -I$(SGX_SDK)/include \ - -I$(SGX_SDK)/include/tlibc \ - -I$(SGX_SDK)/include/stlport - -Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) - -# disable wasi -Enclave_C_Flags += -DSGX_DISABLE_WASI - -ifeq ($(SPEC_TEST), 1) - Enclave_C_Flags += -DWASM_ENABLE_SPEC_TEST=1 -else - Enclave_C_Flags += -DWASM_ENABLE_SPEC_TEST=0 -endif -Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++03 -nostdinc++ -Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ - -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ - libvmlib.a \ - -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ - -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ - -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ - -Wl,--defsym,__ImageBase=0 - -Enclave_Cpp_Objects := $(Enclave_Cpp_Files:.cpp=.o) - -Enclave_Name := enclave.so -Signed_Enclave_Name := enclave.signed.so -Enclave_Config_File := Enclave/Enclave.config.xml - -ifeq ($(SGX_MODE), HW) -ifneq ($(SGX_DEBUG), 1) -ifneq ($(SGX_PRERELEASE), 1) -Build_Mode = HW_RELEASE -endif -endif -endif - - -.PHONY: all run - -ifeq ($(Build_Mode), HW_RELEASE) -all: $(App_Name) $(Enclave_Name) - @echo "The project has been built in release hardware mode." - @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." - @echo "To sign the enclave use the command:" - @echo " $(SGX_ENCLAVE_SIGNER) sign -key <your key> -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" - @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." - @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." -else -all: $(App_Name) $(Signed_Enclave_Name) -endif - -run: all -ifneq ($(Build_Mode), HW_RELEASE) - @$(CURDIR)/$(App_Name) - @echo "RUN => $(App_Name) [$(SGX_MODE)|$(SGX_ARCH), OK]" -endif - -######## App Objects ######## - -App/Enclave_u.c: $(SGX_EDGER8R) Enclave/Enclave.edl - @cd App && $(SGX_EDGER8R) --untrusted ../Enclave/Enclave.edl \ - --search-path ../Enclave \ - --search-path $(SGX_SDK)/include \ - --search-path $(WAMR_ROOT)/core/shared/platform/linux-sgx - @echo "GEN => $@" - -App/Enclave_u.o: App/Enclave_u.c - @$(CC) $(App_C_Flags) -c $< -o $@ - @echo "CC <= $<" - -App/%.o: App/%.cpp - @$(CXX) $(App_Cpp_Flags) -c $< -o $@ - @echo "CXX <= $<" - -$(App_Name): App/Enclave_u.o $(App_Cpp_Objects) - @$(CXX) $^ -o $@ $(App_Link_Flags) - @echo "LINK => $@" - - -######## Enclave Objects ######## - -Enclave/Enclave_t.c: $(SGX_EDGER8R) Enclave/Enclave.edl - @cd Enclave && $(SGX_EDGER8R) --trusted ../Enclave/Enclave.edl \ - --search-path ../Enclave \ - --search-path $(SGX_SDK)/include \ - --search-path $(WAMR_ROOT)/core/shared/platform/linux-sgx - @echo "GEN => $@" - -Enclave/Enclave_t.o: Enclave/Enclave_t.c - @$(CC) $(Enclave_C_Flags) -c $< -o $@ - @echo "CC <= $<" - -Enclave/%.o: Enclave/%.cpp - @$(CXX) $(Enclave_Cpp_Flags) -c $< -o $@ - @echo "CXX <= $<" - -libvmlib.a: ../build/libvmlib.a - @cp $< $@ - @echo "CP $@ <= $<" - -$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) libvmlib.a - @$(CXX) $^ -o $@ $(Enclave_Link_Flags) - @echo "LINK => $@" - -$(Signed_Enclave_Name): $(Enclave_Name) - @$(SGX_ENCLAVE_SIGNER) sign -key Enclave/Enclave_private.pem -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) - @echo "SIGN => $@" - -.PHONY: clean - -clean: - @rm -f $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* libvmlib.a diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/CMakeLists.txt deleted file mode 100644 index 4c6af78ea..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/CMakeLists.txt +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 3.14) - -include(CheckPIESupported) - -project (iwasm) - -set (CMAKE_VERBOSE_MAKEFILE OFF) - -set (WAMR_BUILD_PLATFORM "linux") - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -set (CMAKE_C_STANDARD 99) -set (CMAKE_CXX_STANDARD 14) - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", -# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)") - set (WAMR_BUILD_TARGET "AARCH64") - elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set (WAMR_BUILD_TARGET "RISCV64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_JIT) - # Disable Fast JIT by default - set (WAMR_BUILD_FAST_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Enable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Disable multiple modules by default - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_WASI_THREADS) - # Disable wasi threads library by default - set (WAMR_BUILD_LIB_WASI_THREADS 0) -endif() - - -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_REF_TYPES) - # Disable reference types by default - set (WAMR_BUILD_REF_TYPES 0) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") - -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") - -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused") - -if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") - if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mindirect-branch-register") - # UNDEFINED BEHAVIOR, refer to https://en.cppreference.com/w/cpp/language/ub - if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT WAMR_BUILD_JIT EQUAL 1) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined \ - -fno-sanitize=bounds,bounds-strict,alignment \ - -fno-sanitize-recover") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined \ - -fno-sanitize=bounds,bounds-strict,alignment \ - -fno-sanitize-recover") - endif() - else () - # UNDEFINED BEHAVIOR, refer to https://en.cppreference.com/w/cpp/language/ub - if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT WAMR_BUILD_JIT EQUAL 1) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined \ - -fno-sanitize=bounds,alignment \ - -fno-sanitize-recover") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined \ - -fno-sanitize=bounds,alignment \ - -fno-sanitize-recover") - endif() - endif () -endif () - -# The following flags are to enhance security, but it may impact performance, -# we disable them by default. -#if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -D_FORTIFY_SOURCE=2") -#endif () -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong --param ssp-buffer-size=4") -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now") - -include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) - -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) - -check_pie_supported() -set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) - -install (TARGETS iwasm DESTINATION bin) - -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/build_jit.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/build_jit.sh deleted file mode 100755 index f794a37c8..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/build_jit.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -rm -fr build && mkdir build -cd build -# By default LazyJIT is enabled, to disable it: -# cmake .. -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0 -cmake .. -DWAMR_BUILD_JIT=1 -make -j ${nproc} -cd .. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/build_llvm.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/build_llvm.sh deleted file mode 100755 index c5666b7f5..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/build_llvm.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2020 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -/usr/bin/env python3 -m pip install --user -r ../../../build-scripts/requirements.txt -/usr/bin/env python3 ../../../build-scripts/build_llvm.py "$@" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/main.c deleted file mode 100644 index 8f0e84a97..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/linux/main.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include "../posix/main.c" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/nuttx/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/nuttx/main.c deleted file mode 100644 index 8f0e84a97..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/nuttx/main.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include "../posix/main.c" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/nuttx/wamr.mk b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/nuttx/wamr.mk deleted file mode 100644 index 78cf3eea1..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/nuttx/wamr.mk +++ /dev/null @@ -1,364 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CORE_ROOT := wamr/core -IWASM_ROOT := wamr/core/iwasm -SHARED_ROOT := wamr/core/shared - -ifeq ($(CONFIG_ARCH_ARMV6M),y) -WAMR_BUILD_TARGET := THUMBV6M -else ifeq ($(CONFIG_ARCH_ARMV7A),y) -WAMR_BUILD_TARGET := THUMBV7 -else ifeq ($(CONFIG_ARCH_ARMV7M),y) -WAMR_BUILD_TARGET := THUMBV7EM -else ifeq ($(CONFIG_ARCH_ARMV8M),y) -WAMR_BUILD_TARGET := THUMBV8M -else ifeq ($(CONFIG_ARCH_X86),y) -WAMR_BUILD_TARGET := X86_32 -else ifeq ($(CONFIG_ARCH_X86_64),y) -WAMR_BUILD_TARGET := X86_64 -else ifeq ($(CONFIG_ARCH_XTENSA),y) -WAMR_BUILD_TARGET := XTENSA -# RV64GC and RV32IM used in older -# version NuttX -else ifeq ($(CONFIG_ARCH_RV64GC),y) -WAMR_BUILD_TARGET := RISCV64 -else ifeq ($(CONFIG_ARCH_RV32IM),y) -WAMR_BUILD_TARGET := RISCV32 -else ifeq ($(CONFIG_ARCH_RV64),y) -WAMR_BUILD_TARGET := RISCV64 -else ifeq ($(CONFIG_ARCH_RV32),y) -WAMR_BUILD_TARGET := RISCV32 -else ifeq ($(CONFIG_ARCH_SIM),y) -ifeq ($(CONFIG_SIM_M32),y) -WAMR_BUILD_TARGET := X86_32 -else ifeq ($(CONFIG_HOST_X86),y) -WAMR_BUILD_TARGET := X86_32 -else ifeq ($(CONFIG_HOST_ARM),y) -WAMR_BUILD_TARGET := ARM -else ifeq ($(CONFIG_HOST_ARM64),y) -WAMR_BUILD_TARGET := AARCH64 -else -WAMR_BUILD_TARGET := X86_64 -endif -ifeq ($(CONFIG_HOST_MACOS),y) -# Note: invokeNative_em64.s needs BH_PLATFORM_DARWIN -AFLAGS += -DBH_PLATFORM_DARWIN -endif -endif - -WAMR_BUILD_PLATFORM := nuttx - -CFLAGS += -DBH_MALLOC=wasm_runtime_malloc -CFLAGS += -DBH_FREE=wasm_runtime_free - -ifeq ($(WAMR_BUILD_TARGET), X86_32) - CFLAGS += -DBUILD_TARGET_X86_32 - INVOKE_NATIVE := invokeNative_ia32.s - AOT_RELOC := aot_reloc_x86_32.c -else ifeq ($(WAMR_BUILD_TARGET), X86_64) - CFLAGS += -DBUILD_TARGET_X86_64 - INVOKE_NATIVE := invokeNative_em64.s - AOT_RELOC := aot_reloc_x86_64.c -else ifeq ($(WAMR_BUILD_TARGET), AARCH64) - CFLAGS += -DBUILD_TARGET_AARCH64 - CFLAGS += -DBUILD_TARGET=\"$(WAMR_BUILD_TARGET)\" - INVOKE_NATIVE := invokeNative_aarch64.s - AOT_RELOC := aot_reloc_aarch64.c -else ifeq ($(findstring ARM,$(WAMR_BUILD_TARGET)), ARM) - CFLAGS += -DBUILD_TARGET_ARM - CFLAGS += -DBUILD_TARGET=\"$(WAMR_BUILD_TARGET)\" - INVOKE_NATIVE := invokeNative_arm.s - AOT_RELOC := aot_reloc_arm.c -else ifeq ($(findstring THUMB,$(WAMR_BUILD_TARGET)), THUMB) - CFLAGS += -DBUILD_TARGET=\"$(WAMR_BUILD_TARGET)\" - ifeq ($(CONFIG_ARCH_FPU),y) - CFLAGS += -DBUILD_TARGET_THUMB_VFP - INVOKE_NATIVE := invokeNative_thumb_vfp.s - else - CFLAGS += -DBUILD_TARGET_THUMB - INVOKE_NATIVE := invokeNative_thumb.s - endif - AOT_RELOC := aot_reloc_thumb.c -else ifeq (${WAMR_BUILD_TARGET}, MIPS) - CFLAGS += -DBUILD_TARGET_MIPS - INVOKE_NATIVE := invokeNative_mips.s - AOT_RELOC := aot_reloc_mips.c -else ifeq (${WAMR_BUILD_TARGET}, XTENSA) - CFLAGS += -DBUILD_TARGET_XTENSA - INVOKE_NATIVE := invokeNative_xtensa.s - AOT_RELOC := aot_reloc_xtensa.c -else ifeq (${WAMR_BUILD_TARGET}, RISCV64) - -ifeq (${CONFIG_ARCH_DPFPU},y) - CFLAGS += -DBUILD_TARGET_RISCV64_LP64D -else ifneq (${CONFIG_ARCH_FPU},y) - CFLAGS += -DBUILD_TARGET_RISCV64_LP64 -else - $(error riscv64 lp64f is unsupported) -endif - INVOKE_NATIVE += invokeNative_riscv.S - - AOT_RELOC := aot_reloc_riscv.c - -else ifeq (${WAMR_BUILD_TARGET}, RISCV32) - -ifeq (${CONFIG_ARCH_DPFPU},y) - CFLAGS += -DBUILD_TARGET_RISCV32_ILP32D -else ifneq (${CONFIG_ARCH_FPU},y) - CFLAGS += -DBUILD_TARGET_RISCV32_ILP32 -else - $(error riscv32 ilp32f is unsupported) -endif - - INVOKE_NATIVE += invokeNative_riscv.S - AOT_RELOC := aot_reloc_riscv.c - -else - $(error Build target is unsupported) -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_LOG),y) -CFLAGS += -DWASM_ENABLE_LOG=1 -else -CFLAGS += -DWASM_ENABLE_LOG=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_AOT),y) -CFLAGS += -I$(IWASM_ROOT)/aot -CFLAGS += -DWASM_ENABLE_AOT=1 -CSRCS += aot_loader.c \ - $(AOT_RELOC) \ - aot_intrinsic.c \ - aot_runtime.c -else -CFLAGS += -DWASM_ENABLE_AOT=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ),y) -CFLAGS += -DWASM_ENABLE_WORD_ALIGN_READ=1 -else -CFLAGS += -DWASM_ENABLE_WORD_ALIGN_READ=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_FAST), y) -CFLAGS += -DWASM_ENABLE_FAST_INTERP=1 -CFLAGS += -DWASM_ENABLE_INTERP=1 -CSRCS += wasm_interp_fast.c -CSRCS += wasm_runtime.c -else -CFLAGS += -DWASM_ENABLE_FAST_INTERP=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_CLASSIC), y) -CFLAGS += -DWASM_ENABLE_INTERP=1 -CSRCS += wasm_interp_classic.c -CSRCS += wasm_runtime.c -endif - -ifeq ($(findstring y,$(CONFIG_INTERPRETERS_WAMR_FAST)$(CONFIG_INTERPRETERS_WAMR_CLASSIC)), y) -ifeq ($(CONFIG_INTERPRETERS_WAMR_MINILOADER),y) -CFLAGS += -DWASM_ENABLE_MINI_LOADER=1 -CSRCS += wasm_mini_loader.c -else -CFLAGS += -DWASM_ENABLE_MINI_LOADER=0 -CSRCS += wasm_loader.c -endif -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_DEBUG_INTERP),y) -# Note: INTERPRETERS_WAMR_CLASSIC/INTERPRETERS_WAMR_THREAD_MGR -# dependencies are already handled in NuttX apps Kconfig -CFLAGS += -DWASM_ENABLE_DEBUG_INTERP=1 -CFLAGS += -I$(IWASM_ROOT)/libraries/debug-engine -CSRCS += debug_engine.c -CSRCS += gdbserver.c -CSRCS += handler.c -CSRCS += packets.c -CSRCS += utils.c -VPATH += $(IWASM_ROOT)/libraries/debug-engine -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE),) -CFLAGS += -DWASM_STACK_GUARD_SIZE=0 -else -CFLAGS += -DWASM_STACK_GUARD_SIZE=CONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_SHARED_MEMORY),y) -CFLAGS += -DWASM_ENABLE_SHARED_MEMORY=1 -CSRCS += wasm_shared_memory.c -else -CFLAGS += -DWASM_ENABLE_SHARED_MEMORY=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_BULK_MEMORY),y) -CFLAGS += -DWASM_ENABLE_BULK_MEMORY=1 -else -CFLAGS += -DWASM_ENABLE_BULK_MEMORY=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_PERF_PROFILING),y) -CFLAGS += -DWASM_ENABLE_PERF_PROFILING=1 -else -CFLAGS += -DWASM_ENABLE_PERF_PROFILING=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_MEMORY_PROFILING),y) -CFLAGS += -DWASM_ENABLE_MEMORY_PROFILING=1 -else -CFLAGS += -DWASM_ENABLE_MEMORY_PROFILING=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_MEMORY_TRACING),y) -CFLAGS += -DWASM_ENABLE_MEMORY_TRACING=1 -else -CFLAGS += -DWASM_ENABLE_MEMORY_TRACING=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_DUMP_CALL_STACK),y) -CFLAGS += -DWASM_ENABLE_DUMP_CALL_STACK=1 -else -CFLAGS += -DWASM_ENABLE_DUMP_CALL_STACK=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN),y) -CFLAGS += -DWASM_ENABLE_LIBC_BUILTIN=1 -CSRCS += libc_builtin_wrapper.c -VPATH += $(IWASM_ROOT)/libraries/libc-builtin -else -CFLAGS += -DWASM_ENABLE_LIBC_BUILTIN=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_LIBC_WASI),y) -CFLAGS += -DWASM_ENABLE_LIBC_WASI=1 -CFLAGS += -I$(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/src -CFLAGS += -I$(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/include -CSRCS += posix_socket.c -CSRCS += libc_wasi_wrapper.c -VPATH += $(IWASM_ROOT)/libraries/libc-wasi -CSRCS += posix.c -CSRCS += random.c -CSRCS += str.c -VPATH += $(IWASM_ROOT)/libraries/libc-wasi/sandboxed-system-primitives/src -else -CFLAGS += -DWASM_ENABLE_LIBC_WASI=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_MULTI_MODULE),y) -CFLAGS += -DWASM_ENABLE_MULTI_MODULE=1 -else -CFLAGS += -DWASM_ENABLE_MULTI_MODULE=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_THREAD_MGR),y) -CFLAGS += -DWASM_ENABLE_THREAD_MGR=1 -CSRCS += thread_manager.c -VPATH += $(IWASM_ROOT)/libraries/thread-mgr -else -CFLAGS += -DWASM_ENABLE_THREAD_MGR=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_LIB_PTHREAD),y) -CFLAGS += -DWASM_ENABLE_LIB_PTHREAD=1 -CSRCS += lib_pthread_wrapper.c -else -CFLAGS += -DWASM_ENABLE_LIB_PTHREAD=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_LIB_PTHREAD_SEMAPHORE),y) -CFLAGS += -DWASM_ENABLE_LIB_PTHREAD_SEMAPHORE=1 -else -CFLAGS += -DWASM_ENABLE_LIB_PTHREAD_SEMAPHORE=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_DISABLE_HW_BOUND_CHECK),y) -CFLAGS += -DWASM_DISABLE_HW_BOUND_CHECK=1 -CFLAGS += -DWASM_DISABLE_STACK_HW_BOUND_CHECK=1 -else -CFLAGS += -DWASM_DISABLE_HW_BOUND_CHECK=0 -CFLAGS += -DWASM_DISABLE_STACK_HW_BOUND_CHECK=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_CUSTOM_NAME_SECTIONS),y) -CFLAGS += -DWASM_ENABLE_CUSTOM_NAME_SECTION=1 -else -CFLAGS += -DWASM_ENABLE_CUSTOM_NAME_SECTION=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_GLOBAL_HEAP_POOL),y) -CFLAGS += -DWASM_ENABLE_GLOBAL_HEAP_POOL=1 -CFLAGS += -DWASM_GLOBAL_HEAP_SIZE="$(CONFIG_INTERPRETERS_WAMR_GLOBAL_HEAP_POOL_SIZE) * 1024" -else -CFLAGS += -DWASM_ENABLE_GLOBAL_HEAP_POOL=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST),y) -CFLAGS += -DWASM_ENABLE_SPEC_TEST=1 -else -CFLAGS += -DWASM_ENABLE_SPEC_TEST=0 -endif - -ifeq ($(CONFIG_INTERPRETERS_WAMR_REF_TYPES),y) -CFLAGS += -DWASM_ENABLE_REF_TYPES=1 -else -CFLAGS += -DWASM_ENABLE_REF_TYPES=0 -endif - -CFLAGS += -Wno-strict-prototypes -Wno-shadow -Wno-unused-variable -CFLAGS += -Wno-int-conversion -Wno-implicit-function-declaration - -CFLAGS += -I${CORE_ROOT} \ - -I${IWASM_ROOT}/include \ - -I${IWASM_ROOT}/interpreter \ - -I${IWASM_ROOT}/common \ - -I${IWASM_ROOT}/libraries/thread-mgr \ - -I${SHARED_ROOT}/include \ - -I${SHARED_ROOT}/platform/include \ - -I${SHARED_ROOT}/utils \ - -I${SHARED_ROOT}/utils/uncommon \ - -I${SHARED_ROOT}/mem-alloc \ - -I${SHARED_ROOT}/platform/nuttx - -ifeq ($(WAMR_BUILD_INTERP), 1) -CFLAGS += -I$(IWASM_ROOT)/interpreter -endif - -CSRCS += nuttx_platform.c \ - posix_thread.c \ - posix_time.c \ - mem_alloc.c \ - ems_kfc.c \ - ems_alloc.c \ - ems_hmu.c \ - bh_assert.c \ - bh_common.c \ - bh_hashmap.c \ - bh_list.c \ - bh_log.c \ - bh_queue.c \ - bh_vector.c \ - bh_read_file.c \ - runtime_timer.c \ - wasm_application.c \ - wasm_runtime_common.c \ - wasm_native.c \ - wasm_exec_env.c \ - wasm_memory.c \ - wasm_c_api.c - -ASRCS += $(INVOKE_NATIVE) - -VPATH += $(SHARED_ROOT)/platform/nuttx -VPATH += $(SHARED_ROOT)/platform/common/posix -VPATH += $(SHARED_ROOT)/mem-alloc -VPATH += $(SHARED_ROOT)/mem-alloc/ems -VPATH += $(SHARED_ROOT)/utils -VPATH += $(SHARED_ROOT)/utils/uncommon -VPATH += $(IWASM_ROOT)/common -VPATH += $(IWASM_ROOT)/interpreter -VPATH += $(IWASM_ROOT)/libraries -VPATH += $(IWASM_ROOT)/libraries/lib-pthread -VPATH += $(IWASM_ROOT)/common/arch -VPATH += $(IWASM_ROOT)/aot -VPATH += $(IWASM_ROOT)/aot/arch diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/posix/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/posix/main.c deleted file mode 100644 index 2e96ccddd..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/posix/main.c +++ /dev/null @@ -1,784 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "bh_platform.h" -#include "bh_read_file.h" -#include "wasm_export.h" - -#if BH_HAS_DLFCN -#include <dlfcn.h> -#endif - -static int app_argc; -static char **app_argv; - -/* clang-format off */ -static int -print_help() -{ - printf("Usage: iwasm [-options] wasm_file [args...]\n"); - printf("options:\n"); - printf(" -f|--function name Specify a function name of the module to run rather\n" - " than main\n"); -#if WASM_ENABLE_LOG != 0 - printf(" -v=n Set log verbose level (0 to 5, default is 2) larger\n" - " level with more log\n"); -#endif -#if WASM_ENABLE_INTERP != 0 - printf(" --interp Run the wasm app with interpreter mode\n"); -#endif -#if WASM_ENABLE_FAST_JIT != 0 - printf(" --fast-jit Run the wasm app with fast jit mode\n"); -#endif -#if WASM_ENABLE_JIT != 0 - printf(" --llvm-jit Run the wasm app with llvm jit mode\n"); -#endif -#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_FAST_JIT != 0 && WASM_ENABLE_LAZY_JIT != 0 - printf(" --multi-tier-jit Run the wasm app with multi-tier jit mode\n"); -#endif - printf(" --stack-size=n Set maximum stack size in bytes, default is 64 KB\n"); - printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB\n"); -#if WASM_ENABLE_FAST_JIT != 0 - printf(" --jit-codecache-size=n Set fast jit maximum code cache size in bytes,\n"); - printf(" default is %u KB\n", FAST_JIT_DEFAULT_CODE_CACHE_SIZE / 1024); -#endif -#if WASM_ENABLE_JIT != 0 - printf(" --llvm-jit-size-level=n Set LLVM JIT size level, default is 3\n"); - printf(" --llvm-jit-opt-level=n Set LLVM JIT optimization level, default is 3\n"); -#endif - printf(" --repl Start a very simple REPL (read-eval-print-loop) mode\n" - " that runs commands in the form of \"FUNC ARG...\"\n"); -#if WASM_ENABLE_LIBC_WASI != 0 - printf(" --env=<env> Pass wasi environment variables with \"key=value\"\n"); - printf(" to the program, for example:\n"); - printf(" --env=\"key1=value1\" --env=\"key2=value2\"\n"); - printf(" --dir=<dir> Grant wasi access to the given host directories\n"); - printf(" to the program, for example:\n"); - printf(" --dir=<dir1> --dir=<dir2>\n"); - printf(" --addr-pool=<addrs> Grant wasi access to the given network addresses in\n"); - printf(" CIRD notation to the program, seperated with ',',\n"); - printf(" for example:\n"); - printf(" --addr-pool=1.2.3.4/15,2.3.4.5/16\n"); - printf(" --allow-resolve=<domain> Allow the lookup of the specific domain name or domain\n"); - printf(" name suffixes using a wildcard, for example:\n"); - printf(" --allow-resolve=example.com # allow the lookup of the specific domain\n"); - printf(" --allow-resolve=*.example.com # allow the lookup of all subdomains\n"); - printf(" --allow-resolve=* # allow any lookup\n"); -#endif -#if BH_HAS_DLFCN - printf(" --native-lib=<lib> Register native libraries to the WASM module, which\n"); - printf(" are shared object (.so) files, for example:\n"); - printf(" --native-lib=test1.so --native-lib=test2.so\n"); -#endif -#if WASM_ENABLE_MULTI_MODULE != 0 - printf(" --module-path=<path> Indicate a module search path. default is current\n" - " directory('./')\n"); -#endif -#if WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 - printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n"); -#endif -#if WASM_ENABLE_DEBUG_INTERP != 0 - printf(" -g=ip:port Set the debug sever address, default is debug disabled\n"); - printf(" if port is 0, then a random port will be used\n"); -#endif - printf(" --version Show version information\n"); - return 1; -} -/* clang-format on */ - -static const void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - - wasm_application_execute_main(module_inst, app_argc, app_argv); - if ((exception = wasm_runtime_get_exception(module_inst))) - printf("%s\n", exception); - return exception; -} - -static const void * -app_instance_func(wasm_module_inst_t module_inst, const char *func_name) -{ - wasm_application_execute_func(module_inst, func_name, app_argc - 1, - app_argv + 1); - /* The result of wasm function or exception info was output inside - wasm_application_execute_func(), here we don't output them again. */ - return wasm_runtime_get_exception(module_inst); -} - -/** - * Split a space separated strings into an array of strings - * Returns NULL on failure - * Memory must be freed by caller - * Based on: http://stackoverflow.com/a/11198630/471795 - */ -static char ** -split_string(char *str, int *count) -{ - char **res = NULL, **res1; - char *p; - int idx = 0; - - /* split string and append tokens to 'res' */ - do { - p = strtok(str, " "); - str = NULL; - res1 = res; - res = (char **)realloc(res1, sizeof(char *) * (uint32)(idx + 1)); - if (res == NULL) { - free(res1); - return NULL; - } - res[idx++] = p; - } while (p); - - /** - * Due to the function name, - * res[0] might contain a '\' to indicate a space - * func\name -> func name - */ - p = strchr(res[0], '\\'); - while (p) { - *p = ' '; - p = strchr(p, '\\'); - } - - if (count) { - *count = idx - 1; - } - return res; -} - -static void * -app_instance_repl(wasm_module_inst_t module_inst) -{ - char *cmd = NULL; - size_t len = 0; - ssize_t n; - - while ((printf("webassembly> "), fflush(stdout), - n = getline(&cmd, &len, stdin)) - != -1) { - bh_assert(n > 0); - if (cmd[n - 1] == '\n') { - if (n == 1) - continue; - else - cmd[n - 1] = '\0'; - } - if (!strcmp(cmd, "__exit__")) { - printf("exit repl mode\n"); - break; - } - app_argv = split_string(cmd, &app_argc); - if (app_argv == NULL) { - LOG_ERROR("Wasm prepare param failed: split string failed.\n"); - break; - } - if (app_argc != 0) { - wasm_application_execute_func(module_inst, app_argv[0], - app_argc - 1, app_argv + 1); - } - free(app_argv); - } - free(cmd); - return NULL; -} - -#if WASM_ENABLE_LIBC_WASI != 0 -static bool -validate_env_str(char *env) -{ - char *p = env; - int key_len = 0; - - while (*p != '\0' && *p != '=') { - key_len++; - p++; - } - - if (*p != '=' || key_len == 0) - return false; - - return true; -} -#endif - -#if BH_HAS_DLFCN -typedef uint32 (*get_native_lib_func)(char **p_module_name, - NativeSymbol **p_native_symbols); - -static uint32 -load_and_register_native_libs(const char **native_lib_list, - uint32 native_lib_count, - void **native_handle_list) -{ - uint32 i, native_handle_count = 0, n_native_symbols; - NativeSymbol *native_symbols; - char *module_name; - void *handle; - - for (i = 0; i < native_lib_count; i++) { - /* open the native library */ - if (!(handle = dlopen(native_lib_list[i], RTLD_NOW | RTLD_GLOBAL)) - && !(handle = dlopen(native_lib_list[i], RTLD_LAZY))) { - LOG_WARNING("warning: failed to load native library %s", - native_lib_list[i]); - continue; - } - - /* lookup get_native_lib func */ - get_native_lib_func get_native_lib = dlsym(handle, "get_native_lib"); - if (!get_native_lib) { - LOG_WARNING("warning: failed to lookup `get_native_lib` function " - "from native lib %s", - native_lib_list[i]); - dlclose(handle); - continue; - } - - n_native_symbols = get_native_lib(&module_name, &native_symbols); - - /* register native symbols */ - if (!(n_native_symbols > 0 && module_name && native_symbols - && wasm_runtime_register_natives(module_name, native_symbols, - n_native_symbols))) { - LOG_WARNING("warning: failed to register native lib %s", - native_lib_list[i]); - dlclose(handle); - continue; - } - - native_handle_list[native_handle_count++] = handle; - } - - return native_handle_count; -} - -static void -unregister_and_unload_native_libs(uint32 native_lib_count, - void **native_handle_list) -{ - uint32 i, n_native_symbols; - NativeSymbol *native_symbols; - char *module_name; - void *handle; - - for (i = 0; i < native_lib_count; i++) { - handle = native_handle_list[i]; - - /* lookup get_native_lib func */ - get_native_lib_func get_native_lib = dlsym(handle, "get_native_lib"); - if (!get_native_lib) { - LOG_WARNING("warning: failed to lookup `get_native_lib` function " - "from native lib %p", - handle); - continue; - } - - n_native_symbols = get_native_lib(&module_name, &native_symbols); - if (n_native_symbols == 0 || module_name == NULL - || native_symbols == NULL) { - LOG_WARNING("warning: get_native_lib returned different values for " - "native lib %p", - handle); - continue; - } - - /* unregister native symbols */ - if (!wasm_runtime_unregister_natives(module_name, native_symbols)) { - LOG_WARNING("warning: failed to unregister native lib %p", handle); - continue; - } - - dlclose(handle); - } -} -#endif /* BH_HAS_DLFCN */ - -#if WASM_ENABLE_MULTI_MODULE != 0 -static char * -handle_module_path(const char *module_path) -{ - /* next character after = */ - return (strchr(module_path, '=')) + 1; -} - -static char *module_search_path = "."; - -static bool -module_reader_callback(const char *module_name, uint8 **p_buffer, - uint32 *p_size) -{ - const char *format = "%s/%s.wasm"; - int sz = strlen(module_search_path) + strlen("/") + strlen(module_name) - + strlen(".wasm") + 1; - char *wasm_file_name = BH_MALLOC(sz); - if (!wasm_file_name) { - return false; - } - - snprintf(wasm_file_name, sz, format, module_search_path, module_name); - - *p_buffer = (uint8_t *)bh_read_file_to_buffer(wasm_file_name, p_size); - - wasm_runtime_free(wasm_file_name); - return *p_buffer != NULL; -} - -static void -moudle_destroyer(uint8 *buffer, uint32 size) -{ - if (!buffer) { - return; - } - - wasm_runtime_free(buffer); - buffer = NULL; -} -#endif /* WASM_ENABLE_MULTI_MODULE */ - -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 -static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE] = { 0 }; -#endif - -int -main(int argc, char *argv[]) -{ - int32 ret = -1; - char *wasm_file = NULL; - const char *func_name = NULL; - uint8 *wasm_file_buf = NULL; - uint32 wasm_file_size; - uint32 stack_size = 64 * 1024, heap_size = 16 * 1024; -#if WASM_ENABLE_FAST_JIT != 0 - uint32 jit_code_cache_size = FAST_JIT_DEFAULT_CODE_CACHE_SIZE; -#endif -#if WASM_ENABLE_JIT != 0 - uint32 llvm_jit_size_level = 3; - uint32 llvm_jit_opt_level = 3; -#endif - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - RunningMode running_mode = 0; - RuntimeInitArgs init_args; - char error_buf[128] = { 0 }; -#if WASM_ENABLE_LOG != 0 - int log_verbose_level = 2; -#endif - bool is_repl_mode = false; - bool is_xip_file = false; -#if WASM_ENABLE_LIBC_WASI != 0 - const char *dir_list[8] = { NULL }; - uint32 dir_list_size = 0; - const char *env_list[8] = { NULL }; - uint32 env_list_size = 0; - const char *addr_pool[8] = { NULL }; - uint32 addr_pool_size = 0; - const char *ns_lookup_pool[8] = { NULL }; - uint32 ns_lookup_pool_size = 0; -#endif -#if BH_HAS_DLFCN - const char *native_lib_list[8] = { NULL }; - uint32 native_lib_count = 0; - void *native_handle_list[8] = { NULL }; - uint32 native_handle_count = 0; -#endif -#if WASM_ENABLE_DEBUG_INTERP != 0 - char *ip_addr = NULL; - int instance_port = 0; -#endif - - /* Process options. */ - for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) { - if (!strcmp(argv[0], "-f") || !strcmp(argv[0], "--function")) { - argc--, argv++; - if (argc < 2) { - return print_help(); - } - func_name = argv[0]; - } -#if WASM_ENABLE_INTERP != 0 - else if (!strcmp(argv[0], "--interp")) { - running_mode = Mode_Interp; - } -#endif -#if WASM_ENABLE_FAST_JIT != 0 - else if (!strcmp(argv[0], "--fast-jit")) { - running_mode = Mode_Fast_JIT; - } -#endif -#if WASM_ENABLE_JIT != 0 - else if (!strcmp(argv[0], "--llvm-jit")) { - running_mode = Mode_LLVM_JIT; - } -#endif -#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_FAST_JIT != 0 \ - && WASM_ENABLE_LAZY_JIT != 0 - else if (!strcmp(argv[0], "--multi-tier-jit")) { - running_mode = Mode_Multi_Tier_JIT; - } -#endif -#if WASM_ENABLE_LOG != 0 - else if (!strncmp(argv[0], "-v=", 3)) { - log_verbose_level = atoi(argv[0] + 3); - if (log_verbose_level < 0 || log_verbose_level > 5) - return print_help(); - } -#endif - else if (!strcmp(argv[0], "--repl")) { - is_repl_mode = true; - } - else if (!strncmp(argv[0], "--stack-size=", 13)) { - if (argv[0][13] == '\0') - return print_help(); - stack_size = atoi(argv[0] + 13); - } - else if (!strncmp(argv[0], "--heap-size=", 12)) { - if (argv[0][12] == '\0') - return print_help(); - heap_size = atoi(argv[0] + 12); - } -#if WASM_ENABLE_FAST_JIT != 0 - else if (!strncmp(argv[0], "--jit-codecache-size=", 21)) { - if (argv[0][21] == '\0') - return print_help(); - jit_code_cache_size = atoi(argv[0] + 21); - } -#endif -#if WASM_ENABLE_JIT != 0 - else if (!strncmp(argv[0], "--llvm-jit-size-level=", 22)) { - if (argv[0][22] == '\0') - return print_help(); - llvm_jit_size_level = atoi(argv[0] + 22); - if (llvm_jit_size_level < 1) { - printf("LLVM JIT size level shouldn't be smaller than 1, " - "setting it to 1\n"); - llvm_jit_size_level = 1; - } - else if (llvm_jit_size_level > 3) { - printf("LLVM JIT size level shouldn't be greater than 3, " - "setting it to 3\n"); - llvm_jit_size_level = 3; - } - } - else if (!strncmp(argv[0], "--llvm-jit-opt-level=", 21)) { - if (argv[0][21] == '\0') - return print_help(); - llvm_jit_opt_level = atoi(argv[0] + 21); - if (llvm_jit_opt_level < 1) { - printf("LLVM JIT opt level shouldn't be smaller than 1, " - "setting it to 1\n"); - llvm_jit_opt_level = 1; - } - else if (llvm_jit_opt_level > 3) { - printf("LLVM JIT opt level shouldn't be greater than 3, " - "setting it to 3\n"); - llvm_jit_opt_level = 3; - } - } -#endif -#if WASM_ENABLE_LIBC_WASI != 0 - else if (!strncmp(argv[0], "--dir=", 6)) { - if (argv[0][6] == '\0') - return print_help(); - if (dir_list_size >= sizeof(dir_list) / sizeof(char *)) { - printf("Only allow max dir number %d\n", - (int)(sizeof(dir_list) / sizeof(char *))); - return 1; - } - dir_list[dir_list_size++] = argv[0] + 6; - } - else if (!strncmp(argv[0], "--env=", 6)) { - char *tmp_env; - - if (argv[0][6] == '\0') - return print_help(); - if (env_list_size >= sizeof(env_list) / sizeof(char *)) { - printf("Only allow max env number %d\n", - (int)(sizeof(env_list) / sizeof(char *))); - return 1; - } - tmp_env = argv[0] + 6; - if (validate_env_str(tmp_env)) - env_list[env_list_size++] = tmp_env; - else { - printf("Wasm parse env string failed: expect \"key=value\", " - "got \"%s\"\n", - tmp_env); - return print_help(); - } - } - /* TODO: parse the configuration file via --addr-pool-file */ - else if (!strncmp(argv[0], "--addr-pool=", strlen("--addr-pool="))) { - /* like: --addr-pool=100.200.244.255/30 */ - char *token = NULL; - - if ('\0' == argv[0][12]) - return print_help(); - - token = strtok(argv[0] + strlen("--addr-pool="), ","); - while (token) { - if (addr_pool_size >= sizeof(addr_pool) / sizeof(char *)) { - printf("Only allow max address number %d\n", - (int)(sizeof(addr_pool) / sizeof(char *))); - return 1; - } - - addr_pool[addr_pool_size++] = token; - token = strtok(NULL, ";"); - } - } - else if (!strncmp(argv[0], "--allow-resolve=", 16)) { - if (argv[0][16] == '\0') - return print_help(); - if (ns_lookup_pool_size - >= sizeof(ns_lookup_pool) / sizeof(ns_lookup_pool[0])) { - printf( - "Only allow max ns lookup number %d\n", - (int)(sizeof(ns_lookup_pool) / sizeof(ns_lookup_pool[0]))); - return 1; - } - ns_lookup_pool[ns_lookup_pool_size++] = argv[0] + 16; - } -#endif /* WASM_ENABLE_LIBC_WASI */ -#if BH_HAS_DLFCN - else if (!strncmp(argv[0], "--native-lib=", 13)) { - if (argv[0][13] == '\0') - return print_help(); - if (native_lib_count >= sizeof(native_lib_list) / sizeof(char *)) { - printf("Only allow max native lib number %d\n", - (int)(sizeof(native_lib_list) / sizeof(char *))); - return 1; - } - native_lib_list[native_lib_count++] = argv[0] + 13; - } -#endif -#if WASM_ENABLE_MULTI_MODULE != 0 - else if (!strncmp(argv[0], - "--module-path=", strlen("--module-path="))) { - module_search_path = handle_module_path(argv[0]); - if (!strlen(module_search_path)) { - return print_help(); - } - } -#endif -#if WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 - else if (!strncmp(argv[0], "--max-threads=", 14)) { - if (argv[0][14] == '\0') - return print_help(); - wasm_runtime_set_max_thread_num(atoi(argv[0] + 14)); - } -#endif -#if WASM_ENABLE_DEBUG_INTERP != 0 - else if (!strncmp(argv[0], "-g=", 3)) { - char *port_str = strchr(argv[0] + 3, ':'); - char *port_end; - if (port_str == NULL) - return print_help(); - *port_str = '\0'; - instance_port = strtoul(port_str + 1, &port_end, 10); - if (port_str[1] == '\0' || *port_end != '\0') - return print_help(); - ip_addr = argv[0] + 3; - } -#endif - else if (!strncmp(argv[0], "--version", 9)) { - uint32 major, minor, patch; - wasm_runtime_get_version(&major, &minor, &patch); - printf("iwasm %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", major, minor, - patch); - return 0; - } - else - return print_help(); - } - - if (argc == 0) - return print_help(); - - wasm_file = argv[0]; - app_argc = argc; - app_argv = argv; - - memset(&init_args, 0, sizeof(RuntimeInitArgs)); - - init_args.running_mode = running_mode; -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 - init_args.mem_alloc_type = Alloc_With_Pool; - init_args.mem_alloc_option.pool.heap_buf = global_heap_buf; - init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf); -#else - init_args.mem_alloc_type = Alloc_With_Allocator; - init_args.mem_alloc_option.allocator.malloc_func = malloc; - init_args.mem_alloc_option.allocator.realloc_func = realloc; - init_args.mem_alloc_option.allocator.free_func = free; -#endif - -#if WASM_ENABLE_FAST_JIT != 0 - init_args.fast_jit_code_cache_size = jit_code_cache_size; -#endif - -#if WASM_ENABLE_JIT != 0 - init_args.llvm_jit_size_level = llvm_jit_size_level; - init_args.llvm_jit_opt_level = llvm_jit_opt_level; -#endif - -#if WASM_ENABLE_DEBUG_INTERP != 0 - init_args.instance_port = instance_port; - if (ip_addr) - strcpy(init_args.ip_addr, ip_addr); -#endif - - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - printf("Init runtime environment failed.\n"); - return -1; - } - -#if WASM_ENABLE_LOG != 0 - bh_log_set_verbose_level(log_verbose_level); -#endif - -#if BH_HAS_DLFCN - native_handle_count = load_and_register_native_libs( - native_lib_list, native_lib_count, native_handle_list); -#endif - - /* load WASM byte buffer from WASM bin file */ - if (!(wasm_file_buf = - (uint8 *)bh_read_file_to_buffer(wasm_file, &wasm_file_size))) - goto fail1; - -#if WASM_ENABLE_AOT != 0 - if (wasm_runtime_is_xip_file(wasm_file_buf, wasm_file_size)) { - uint8 *wasm_file_mapped; - int map_prot = MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC; - int map_flags = MMAP_MAP_32BIT; - - if (!(wasm_file_mapped = - os_mmap(NULL, (uint32)wasm_file_size, map_prot, map_flags))) { - printf("mmap memory failed\n"); - wasm_runtime_free(wasm_file_buf); - goto fail1; - } - - bh_memcpy_s(wasm_file_mapped, wasm_file_size, wasm_file_buf, - wasm_file_size); - wasm_runtime_free(wasm_file_buf); - wasm_file_buf = wasm_file_mapped; - is_xip_file = true; - } -#endif - -#if WASM_ENABLE_MULTI_MODULE != 0 - wasm_runtime_set_module_reader(module_reader_callback, moudle_destroyer); -#endif - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail2; - } - -#if WASM_ENABLE_LIBC_WASI != 0 - wasm_runtime_set_wasi_args(wasm_module, dir_list, dir_list_size, NULL, 0, - env_list, env_list_size, argv, argc); - - wasm_runtime_set_wasi_addr_pool(wasm_module, addr_pool, addr_pool_size); - wasm_runtime_set_wasi_ns_lookup_pool(wasm_module, ns_lookup_pool, - ns_lookup_pool_size); -#endif - - /* instantiate the module */ - if (!(wasm_module_inst = - wasm_runtime_instantiate(wasm_module, stack_size, heap_size, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail3; - } - -#if WASM_ENABLE_DEBUG_INTERP != 0 - if (ip_addr != NULL) { - wasm_exec_env_t exec_env = - wasm_runtime_get_exec_env_singleton(wasm_module_inst); - uint32_t debug_port; - if (exec_env == NULL) { - printf("%s\n", wasm_runtime_get_exception(wasm_module_inst)); - goto fail4; - } - debug_port = wasm_runtime_start_debug_instance(exec_env); - if (debug_port == 0) { - printf("Failed to start debug instance\n"); - goto fail4; - } - } -#endif - - ret = 0; - if (is_repl_mode) { - app_instance_repl(wasm_module_inst); - } - else if (func_name) { - if (app_instance_func(wasm_module_inst, func_name)) { - /* got an exception */ - ret = 1; - } - } - else { - if (app_instance_main(wasm_module_inst)) { - /* got an exception */ - ret = 1; - } - } - -#if WASM_ENABLE_LIBC_WASI != 0 - if (ret == 0) { - /* wait for threads to finish and propagate wasi exit code. */ - ret = wasm_runtime_get_wasi_exit_code(wasm_module_inst); - if (wasm_runtime_get_exception(wasm_module_inst)) { - /* got an exception in spawned thread */ - ret = 1; - } - } -#endif - -#if WASM_ENABLE_DEBUG_INTERP != 0 -fail4: -#endif - /* destroy the module instance */ - wasm_runtime_deinstantiate(wasm_module_inst); - -fail3: - /* unload the module */ - wasm_runtime_unload(wasm_module); - -fail2: - /* free the file buffer */ - if (!is_xip_file) - wasm_runtime_free(wasm_file_buf); - else - os_munmap(wasm_file_buf, wasm_file_size); - -fail1: -#if BH_HAS_DLFCN - /* unload the native libraries */ - unregister_and_unload_native_libs(native_handle_count, native_handle_list); -#endif - - /* destroy runtime environment */ - wasm_runtime_destroy(); - - return ret; -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/CMakeLists.txt deleted file mode 100644 index 003283262..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# Copyright (C) 2020 TU Bergakademie Freiberg Karl Fessel -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required(VERSION 3.8.2) - -set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") - -project(NONE) - -enable_language (ASM) - -set (WAMR_BUILD_PLATFORM "riot") - -# Build as X86_32 by default, change to "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS" or "XTENSA" -# if we want to support arm, thumb, mips or xtensa - - -if (NOT DEFINED WAMR_BUILD_TARGET) - set (WAMR_BUILD_TARGET "X86_32") -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Disable AOT by default. - set (WAMR_BUILD_AOT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Disable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 0) -endif () - -if (NOT DEFINED WAMR_ROOT_DIR) - # this assumption is true if this file is copied to WAMR_ROOT - set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -endif () - -# Override the global heap size for small devices -if (NOT DEFINED WAMR_BUILD_GLOBAL_HEAP_SIZE) - add_definitions (-DWASM_GLOBAL_HEAP_SIZE=262144) # 256 kB -endif () - - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) - -# need includes from RIOT prepare them as a cmake list -string(REGEX MATCHALL "([^\ ]+\ |[^\ ]+$)" RIOT_INCLUDES_LIST "${RIOT_INCLUDES}") - -include_directories(SYSTEM ${RIOT_INCLUDES_LIST}) - -# target_sources( ${WAMR_RUNTIME_LIB_SOURCE} ) -# executable linking is done by RIOT build system - -add_library( wamr ${WAMR_RUNTIME_LIB_SOURCE}) diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/Makefile b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/Makefile deleted file mode 100644 index 8c7aef30c..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -APPLICATION = wamr-mini -# If no BOARD is defined in the environment, use this default: -BOARD ?= native - -# This has to be the absolute path to the RIOT base directory: -RIOTBASE ?= $(CURDIR)/../../../../RIOT - -USEMODULE += ztimer64_msec -USEMODULE += ztimer_usec -USEMODULE += sema - -WPEDANTIC := 0 -WERROR := 0 - -# Comment this out to disable code in RIOT that does safety checking -# which is not needed in a production environment but helps in the -# development process: -DEVELHELP ?= 1 - -# Change this to 0 show compiler invocation lines by default: -QUIET ?= 1 - -ARCHIVES += $(BINDIR)/libwamr.a - -#Load the usual RIOT make infastructure - -include $(RIOTBASE)/Makefile.include - - -WAMR_SOURCE = $(CURDIR)/../../.. -WAMR_BUILD_DIR = $(BINDIR)/wamr - -#less Wall TODO: get things fixed -CFLAGS := $(filter-out -pedantic, $(CFLAGS)) -CFLAGS += -Wno-format -CFLAGS += -Wno-strict-prototypes -CFLAGS += -Wno-old-style-definition -CFLAGS += -Wno-cast-function-type - -WAMR_CORE = $(WAMR_SOURCE)/core -IWASM_ROOT = $(WAMR_CORE)/iwasm -SHARED_LIB_ROOT = $(WAMR_CORE)/shared - -IWASM_INCLUDES += ${IWASM_ROOT}/include \ - ${SHARED_LIB_ROOT}/platform/include \ - ${SHARED_LIB_ROOT}/platform/riot \ - - -INCLUDES += $(addprefix -I,${IWASM_INCLUDES}) - - - -RIOT_INCLUDES = $(filter-out -%,$(subst -I,,$(INCLUDES))) - -#WAMR_BUILD_TARGET is "X86_32" "AARCH64[sub]", "ARM[sub]", -# "THUMB[sub]", "MIPS" or "XTENSA" -#no msp430, no AVR support for now - -#translate (CPU_ARCH) to Build Target -ifeq ($(CPU),native) -#$(CPU) is defined for every CPU -#Riot native is x86_32 - WAMR_BUILD_TARGET = X86_32 -else ifeq ($(findstring arm,$(CPU_ARCH)),arm) - WAMR_BUILD_TARGET = THUMB -else ifeq ($(CPU_ARCH),mips32r2) - WAMR_BUILD_TARGET = MIPS -else ifeq ($(CPU_ARCH),xtensa) - WAMR_BUILD_TARGET = XTENSA -endif - -ifeq ($(QUIET), 0) - CMAKEMAKEFLAGS += VERBOSE=1 -endif - - -$(BINDIR)/libwamr.a: $(WAMR_BUILD_DIR)/libwamr.a - cp $< $@ - -$(WAMR_BUILD_DIR)/libwamr.a: $(WAMR_BUILD_DIR)/Makefile - $(MAKE) -C $(WAMR_BUILD_DIR) $(CMAKEMAKEFLAGS) - -$(WAMR_BUILD_DIR)/Makefile: CMakeLists.txt - cmake -B$(WAMR_BUILD_DIR) \ - "-DRIOT_INCLUDES=$(RIOT_INCLUDES)"\ - -DWAMR_ROOT_DIR=$(WAMR_SOURCE)\ - -DWAMR_BUILD_TARGET=$(WAMR_BUILD_TARGET)\ - -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_SYSTEM_PROCESSOR="$(MCPU)" \ - -DCMAKE_C_COMPILER=$(CC) \ - -DCMAKE_C_COMPILER_WORKS=TRUE \ - -print_build_target: - @echo CPU_ARCH: $(CPU_ARCH) - @echo CPU: $(CPU) - @echo CFLAGS: $(CFLAGS) - @echo WAMR_BUILD_TARGET: $(WAMR_BUILD_TARGET) diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/iwasmt.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/iwasmt.c deleted file mode 100644 index 633b2b405..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/iwasmt.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * Copyright (C) 2020 TU Bergakademie Freiberg Karl Fessel - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <stdlib.h> -#include <stdio.h> -#include <stdint.h> - -#include <string.h> - -#include "wasm_export.h" - -#include <thread.h> - -/* provide some test program */ -#include "test_wasm.h" - -#define DEFAULT_THREAD_STACKSIZE (6 * 1024) -#define DEFAULT_THREAD_PRIORITY 50 - -static int app_argc; -static char **app_argv; - -static void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - - wasm_application_execute_main(module_inst, app_argc, app_argv); - if ((exception = wasm_runtime_get_exception(module_inst))) { - puts(exception); - } - return NULL; -} - -void * -iwasm_t(void *arg1) -{ - wasm_module_t wasm_module = (wasm_module_t)arg1; - wasm_module_inst_t wasm_module_inst = NULL; - char error_buf[128]; - - /* instantiate the module */ - if (!(wasm_module_inst = wasm_runtime_instantiate( - wasm_module, 8 * 1024, 8 * 1024, error_buf, sizeof(error_buf)))) { - puts(error_buf); - } - else { - app_instance_main(wasm_module_inst); - /* destroy the module instance */ - wasm_runtime_deinstantiate(wasm_module_inst); - } - return NULL; -} - -/* enable FUNC_ALLOC to use custom memory allocation functions */ -#define FUNC_ALLOC - -void * -iwasm_main(void *arg1) -{ - (void)arg1; /* unused */ - uint8_t *wasm_file_buf = NULL; - unsigned wasm_file_buf_size = 0; - wasm_module_t wasm_module = NULL; - char error_buf[128]; - - RuntimeInitArgs init_args; - - memset(&init_args, 0, sizeof(RuntimeInitArgs)); -#if defined(FUNC_ALLOC) && WASM_ENABLE_GLOBAL_HEAP_POOL == 0 - init_args.mem_alloc_type = Alloc_With_Allocator; - init_args.mem_alloc_option.allocator.malloc_func = malloc; - init_args.mem_alloc_option.allocator.realloc_func = realloc; - init_args.mem_alloc_option.allocator.free_func = free; -#elif WASM_ENABLE_GLOBAL_HEAP_POOL != 0 - static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE] = { 0 }; - - init_args.mem_alloc_type = Alloc_With_Pool; - init_args.mem_alloc_option.pool.heap_buf = global_heap_buf; - init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf); -#else - init_args.mem_alloc_type = Alloc_With_System_Allocator; -#endif - - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - puts("Init runtime environment failed."); - return NULL; - } - - /* load WASM byte buffer from byte buffer of include file */ - wasm_file_buf = (uint8_t *)wasm_test_file; - wasm_file_buf_size = sizeof(wasm_test_file); - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_buf_size, - error_buf, sizeof(error_buf)))) { - puts(error_buf); - } - else { - iwasm_t(wasm_module); - wasm_runtime_unload(wasm_module); - } - - wasm_runtime_destroy(); - return NULL; -} - -bool -iwasm_init(void) -{ - /* clang-format off */ - struct { - char *stack; - int stacksize; - uint8_t priority; - int flags; - thread_task_func_t task_func; - void *arg; - const char *name; - } b = { - .stacksize = DEFAULT_THREAD_STACKSIZE, - .priority = 8, - .flags = 0, - .task_func = iwasm_main, - .arg = NULL, - .name = "simple_wamr" - }; - /* clang-format on */ - - b.stack = malloc(b.stacksize); - kernel_pid_t tpid = thread_create(b.stack, b.stacksize, b.priority, b.flags, - b.task_func, b.arg, b.name); - - return tpid != 0 ? true : false; - ; -} - -#define telltruth(X) ((X) ? "true" : "false") - -int -main(void) -{ - printf("iwasm_initilised: %s\n", telltruth(iwasm_init())); -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/test_wasm.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/test_wasm.h deleted file mode 100644 index 0c343024a..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/riot/test_wasm.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -/** - * The byte array buffer is the file content of a test wasm binary file, - * which is compiled by wasi-sdk toolchain from C source file of: - * product-mini/app-samples/hello-world/main.c. - */ -unsigned char wasm_test_file[] = { - 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, - 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01, - 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75, - 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C, - 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66, - 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01, - 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x13, 0x03, - 0x7F, 0x01, 0x41, 0xC0, 0x28, 0x0B, 0x7F, 0x00, 0x41, 0xBA, 0x08, 0x0B, - 0x7F, 0x00, 0x41, 0xC0, 0x28, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, - 0x6D, 0x6F, 0x72, 0x79, 0x02, 0x00, 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74, - 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x03, 0x02, 0x04, 0x6D, 0x61, - 0x69, 0x6E, 0x00, 0x04, 0x0A, 0xB2, 0x01, 0x01, 0xAF, 0x01, 0x01, 0x03, - 0x7F, 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, - 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x88, 0x80, 0x80, 0x00, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, - 0x80, 0x08, 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, - 0x41, 0xA8, 0x88, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, - 0x1A, 0x41, 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x10, 0x41, 0x80, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41, - 0x10, 0x6A, 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21, - 0x04, 0x20, 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x88, - 0x80, 0x80, 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, - 0x8D, 0x88, 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x00, 0x41, 0x93, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10, - 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80, - 0x80, 0x00, 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80, - 0x80, 0x00, 0x20, 0x04, 0x0B, 0x0B, 0x41, 0x01, 0x00, 0x41, 0x80, 0x08, - 0x0B, 0x3A, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25, - 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66, - 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, - 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, - 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00 -}; diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/SConscript b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/SConscript deleted file mode 100644 index 4f7ffe63e..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# -# Copyright (c) 2021, RT-Thread Development Team -# -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') - -group = DefineGroup('iwasm', src, depend = ['PKG_USING_WAMR']) - -Return('group') diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/iwasm.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/iwasm.c deleted file mode 100644 index 8ae4da761..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/iwasm.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <rtthread.h> -#include "wasm_export.h" -#include "platform_api_vmcore.h" -#include <dfs.h> -#include <dfs_file.h> -#include <dfs_fs.h> -#include <dfs_posix.h> - -#ifdef WAMR_ENABLE_RTT_EXPORT - -#ifdef WAMR_RTT_EXPORT_VPRINTF -static int -wasm_vprintf(wasm_exec_env_t env, const char *fmt, va_list va) -{ - return vprintf(fmt, va); -} - -static int -wasm_vsprintf(wasm_exec_env_t env, char *buf, const char *fmt, va_list va) -{ - return vsprintf(buf, fmt, va); -} - -static int -wasm_vsnprintf(wasm_exec_env_t env, char *buf, int n, const char *fmt, - va_list va) -{ - return vsnprintf(buf, n, fmt, va); -} - -#endif /* WAMR_RTT_EXPORT_VPRINTF */ - -#ifdef WAMR_RTT_EXPORT_DEVICE_OPS -static rt_device_t -wasm_rt_device_find(wasm_exec_env_t env, const char *name) -{ - return rt_device_find(name); -} - -static rt_err_t -wasm_rt_device_open(wasm_exec_env_t env, rt_device_t dev, rt_uint16_t o_flag) -{ - return rt_device_open(dev, o_flag); -} - -static rt_size_t -wasm_rt_device_write(wasm_exec_env_t env, rt_device_t dev, rt_off_t offset, - const void *buf, rt_size_t size) -{ - return rt_device_write(dev, offset, buf, size); -} - -static rt_size_t -wasm_rt_device_read(wasm_exec_env_t env, rt_device_t dev, rt_off_t offset, - void *buf, rt_size_t size) -{ - return rt_device_read(dev, offset, buf, size); -} - -static rt_err_t -wasm_rt_device_close(wasm_exec_env_t env, rt_device_t dev) -{ - return rt_device_close(dev); -} - -static rt_err_t -wasm_rt_device_control(wasm_exec_env_t env, rt_device_t dev, int cmd, void *arg) -{ - return rt_device_control(dev, cmd, arg); -} - -#endif /* WAMR_RTT_EXPORT_DEVICE_OPS */ - -/* clang-format off */ -static NativeSymbol native_export_symbols[] = { -#ifdef WAMR_RTT_EXPORT_VPRINTF - { - "vprintf", - wasm_vprintf, - "($*)i" - }, - { - "vsprintf", - wasm_vsprintf, - "($$*)i" - }, - { - "vsnprintf", - wasm_vsnprintf, - "($i$*)i" - }, -#endif /* WAMR_RTT_EXPORT_VPRINTF */ - -#ifdef WAMR_RTT_EXPORT_DEVICE_OPS - { - "rt_device_find", - wasm_rt_device_find, - "($)i" - }, - { - "rt_device_open", - wasm_rt_device_open, - "(ii)i" - }, - { - "rt_device_write", - wasm_rt_device_write, - "(ii*~)i" - }, - { - "rt_device_read", - wasm_rt_device_read, - "(ii*~)i" - }, - { - "rt_device_close", - wasm_rt_device_close, - "(i)i" - }, - { - "rt_device_control", - wasm_rt_device_control, - "(ii*)i" - }, -#ifdef WAMR_RTT_EXPORT_DEVICE_OPS_CPP - { - "_Z15rt_device_closeP9rt_device", - wasm_rt_device_close, - "(i)i" - }, - { - "_Z14rt_device_readP9rt_devicejPvj", - wasm_rt_device_read, - "(ii*~)i" - }, - { - "_Z15rt_device_writeP9rt_devicejPKvj", - wasm_rt_device_write, - "(ii*~)i" - }, - { - "_Z14rt_device_openP9rt_devicet", - wasm_rt_device_open, - "(ii)i" - }, - { - "_Z14rt_device_findPKc", - wasm_rt_device_find, - "($)i" - }, -#endif /* WAMR_RTT_EXPORT_DEVICE_OPS_CPP */ -#endif /* WAMR_RTT_EXPORT_DEVICE_OPS */ -}; -/* clang-format on */ - -#endif /* WAMR_ENABLE_RTT_EXPORT */ - -/** - * run WASM module instance. - * @param module_inst instance of wasm module - * @param app_argc wasm argument count - * @param app_argv wasm arguments - * @return NULL - */ -static void * -app_instance_main(wasm_module_inst_t module_inst, int app_argc, char **app_argv) -{ - const char *exception; - - wasm_application_execute_main(module_inst, app_argc, app_argv); - if ((exception = wasm_runtime_get_exception(module_inst))) - rt_kprintf("%s\n", exception); - return NULL; -} - -rt_uint8_t * -my_read_file_to_buffer(char *filename, rt_uint32_t *size) -{ - struct stat f_stat; - dfs_file_stat(filename, &f_stat); - struct dfs_fd fd; - - rt_uint8_t *buff = rt_malloc(f_stat.st_size); - *size = 0; - if (!buff) { - rt_set_errno(-ENOMEM); - return RT_NULL; - } - - int ret = dfs_file_open(&fd, filename, O_RDONLY); - if (ret) { - rt_free(buff); - rt_set_errno(ret); - return RT_NULL; - } - - *size = dfs_file_read(&fd, buff, f_stat.st_size); - - dfs_file_close(&fd); - - if (*size != f_stat.st_size) { - rt_free(buff); - rt_set_errno(-EBADF); - return RT_NULL; - } - - return buff; -} - -void -iwasm_help(void) -{ -#ifdef WAMR_ENABLE_IWASM_PARAMS - rt_kputs("wrong input: iwasm [-t] [-m] [-s] <*.wasm> <wasm_args ...>\n" - " iwasm [-h]\n"); - rt_kputs("\t -h: show this tips.\n"); - rt_kputs("\t -t: show time taking to run this app.\n"); - rt_kputs("\t -m: show memory taking to run this app\n"); - rt_kputs("\t wasm file name and exec params must behind of all vm-param\n"); -#else - rt_kputs("wrong input: iwasm <*.wasm> <wasm_args ...>\n"); -#endif /* WAMR_ENABLE_PARAMS */ -} - -int -iwasm(int argc, char **argv) -{ - rt_uint8_t *wasm_file_buf = NULL; - rt_uint32_t wasm_file_size; - rt_uint32_t stack_size = 4 * 1024, heap_size = 4 * 1024; - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - RuntimeInitArgs init_args; - static char error_buf[128] = { 0 }; - /* avoid stack overflow */ - -#ifdef WAMR_ENABLE_IWASM_PARAMS - int i_arg_begin; - bool show_mem = false; - bool show_stack = false; - bool show_time_exec = false; - for (i_arg_begin = 1; i_arg_begin < argc; i_arg_begin++) { - if (argv[i_arg_begin][0] != '-') { - break; - } - - if (argv[i_arg_begin][1] == 'm') { - show_mem = true; - } - else if (argv[i_arg_begin][1] == 's') { - show_stack = true; - } - else if (argv[i_arg_begin][1] == 't') { - show_time_exec = true; - } - else if (argv[i_arg_begin][1] == 'h') { - iwasm_help(); - return 0; - } - else if (argv[i_arg_begin][1] == 0x00) { - continue; - } - else { - rt_kprintf("[iwasm] unknown param: %s\n", argv[i_arg_begin]); - } - } -#else /* WAMR_ENABLE_PARAMS */ -#define i_arg_begin 1 -#endif /* WAMR_ENABLE_PARAMS */ - - if (argc - i_arg_begin < 1) { - iwasm_help(); - return -1; - } - - rt_memset(&init_args, 0, sizeof(RuntimeInitArgs)); - init_args.mem_alloc_type = Alloc_With_Allocator; - init_args.mem_alloc_option.allocator.malloc_func = os_malloc; - init_args.mem_alloc_option.allocator.realloc_func = os_realloc; - init_args.mem_alloc_option.allocator.free_func = os_free; -#ifdef WAMR_ENABLE_RTT_EXPORT - init_args.native_symbols = native_export_symbols; - init_args.n_native_symbols = - sizeof(native_export_symbols) / sizeof(NativeSymbol); - init_args.native_module_name = "env"; -#endif /* WAMR_ENABLE_RTT_EXPORT */ - -#ifdef WAMR_ENABLE_IWASM_PARAMS -#if defined(RT_USING_HEAP) && defined(RT_USING_MEMHEAP_AS_HEAP) - extern long list_memheap(void); - if (show_mem) { - list_memheap(); - } -#else - rt_uint32_t total, max, used; - if (show_mem) { - rt_memory_info(&total, &used, &max); - } -#endif - rt_thread_t tid; - if (show_stack) { - tid = rt_thread_self(); - printf("thread stack addr: %p, size: %u, sp: %p\n", tid->stack_addr, - tid->stack_size, tid->sp); - } -#endif /* WAMR_ENABLE_PARAMS */ - - if (wasm_runtime_full_init(&init_args) == false) { - rt_kprintf("Init WASM runtime environment failed.\n"); - return -1; - } - - wasm_file_buf = my_read_file_to_buffer(argv[i_arg_begin], &wasm_file_size); - if (!wasm_file_buf) { - rt_err_t err = rt_get_errno(); - rt_kprintf("WASM load file to RAM failed: %d\n", err); - goto fail1; - } - rt_memset(error_buf, 0x00, sizeof(error_buf)); - wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size, error_buf, - sizeof(error_buf)); - if (!wasm_module) { - rt_kprintf("%s\n", error_buf); - goto fail2; - } - rt_memset(error_buf, 0x00, sizeof(error_buf)); - wasm_module_inst = wasm_runtime_instantiate( - wasm_module, stack_size, heap_size, error_buf, sizeof(error_buf)); - if (!wasm_module_inst) { - rt_kprintf("%s\n", error_buf); - goto fail3; - } - -#ifdef WAMR_ENABLE_IWASM_PARAMS - rt_tick_t ticks_exec; - if (show_time_exec) { - ticks_exec = rt_tick_get(); - } -#endif /* WAMR_ENABLE_PARAMS */ - - app_instance_main(wasm_module_inst, argc - i_arg_begin, &argv[i_arg_begin]); - -#ifdef WAMR_ENABLE_IWASM_PARAMS - if (show_time_exec) { - ticks_exec = rt_tick_get() - ticks_exec; - printf("[iwasm] execute ticks took: %u [ticks/s = %u]\n", ticks_exec, - RT_TICK_PER_SECOND); - } -#if defined(RT_USING_HEAP) && defined(RT_USING_MEMHEAP_AS_HEAP) - if (show_mem) { - list_memheap(); - } -#else - rt_uint32_t total_after, max_after, used_after; - if (show_mem) { - rt_memory_info(&total_after, &used_after, &max_after); - rt_kprintf("[iwasm] memory took: %u\n", used_after - used); - } -#endif - if (show_stack) { - printf("[iwasm] thread stack addr: %p, size: %u, sp: %p\n", - tid->stack_addr, tid->stack_size, tid->sp); - } - -#endif /* WAMR_ENABLE_PARAMS */ - - /* destroy the module instance */ - wasm_runtime_deinstantiate(wasm_module_inst); - -fail3: - /* unload the module */ - wasm_runtime_unload(wasm_module); - -fail2: - /* free the file buffer */ - rt_free(wasm_file_buf); - -fail1: - /* destroy runtime environment */ - wasm_runtime_destroy(); - return 0; -} -MSH_CMD_EXPORT(iwasm, Embeded VM of WebAssembly); diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/iwasm.cmake b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/iwasm.cmake deleted file mode 100644 index 0ec54ae6b..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/rt-thread/iwasm.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright (c) 2021, RT-Thread Development Team -# -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -set(CMAKE_ASM_COMPILER_WORKS 1) - -set(WAMR_BUILD_PLATFORM "rt-thread") -set(WAMR_BUILD_TARGET "ARM") - -#set(WAMR_BUILD_INTERP 1) -#set(WAMR_BUILD_FAST_INTERP 1) -#set(WAMR_BUILD_AOT 0) -#set(WAMR_BUILD_JIT 0) -#set(WAMR_BUILD_LIBC_BUILTIN 1) -#set(WAMR_BUILD_LIBC_WASI 0) - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 0) -endif () - -# Disable JIT by default. -set (WAMR_BUILD_JIT 0) - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -set (WAMR_BUILD_LIBC_WASI 0) - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -set (WAMR_BUILD_MULTI_MODULE 0) -set (WAMR_BUILD_LIB_PTHREAD 0) -set (WAMR_BUILD_MINI_LOADER 0) -set (WAMR_BUILD_SIMD 0) - - -set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) - -set(CMAKE_ASM_COMPILER_WORKS 1) - -include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) - -file (GLOB wamr_entry_src - ${WAMR_ROOT_DIR}/product-mini/platforms/rt-thread/rtt_wamr_entry.c - ) - -set(WAMR_SOURCE ${wamr_entry_src} ${WAMR_RUNTIME_LIB_SOURCE}) - - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/vxworks/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/vxworks/CMakeLists.txt deleted file mode 100644 index 0dc5d9699..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/vxworks/CMakeLists.txt +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 2.9) - -project (iwasm) - -set (WAMR_BUILD_PLATFORM "vxworks") - -# Specify the compiler driver provided in the VSB -SET(CMAKE_C_COMPILER vx-cc) -SET(CMAKE_AR vx-ar) -SET(CMAKE_RANLIB vx-ranlib) - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA" -#set (WAMR_BUILD_TARGET "X86_64") - -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(SEND_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Disable AOT by default. - set (WAMR_BUILD_AOT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Disable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 0) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) - -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) - -install (TARGETS iwasm DESTINATION bin) - -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix) - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix) - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/vxworks/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/vxworks/main.c deleted file mode 100644 index 8f0e84a97..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/vxworks/main.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include "../posix/main.c" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/CMakeLists.txt deleted file mode 100644 index db88f42bc..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/CMakeLists.txt +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required (VERSION 2.9) - -project (iwasm C ASM CXX) -enable_language(ASM_MASM) -# set (CMAKE_VERBOSE_MAKEFILE 1) - -set (WAMR_BUILD_PLATFORM "windows") - -# Reset default linker flags -set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - -set (CMAKE_C_STANDARD 99) - -add_definitions(-DCOMPILING_WASM_RUNTIME_API=1) - -# Set WAMR_BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS", "XTENSA" -if (NOT DEFINED WAMR_BUILD_TARGET) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - # Build as X86_64 by default in 64-bit platform - set (WAMR_BUILD_TARGET "X86_64") - elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) - # Build as X86_32 by default in 32-bit platform - set (WAMR_BUILD_TARGET "X86_32") - else () - message(FATAL_ERROR "Unsupported build target platform!") - endif () -endif () - -if (NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_JIT) - # Disable JIT by default. - set (WAMR_BUILD_JIT 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_UVWASI) - # Enable libc uvwasi support by default - set (WAMR_BUILD_LIBC_UVWASI 1) -endif () - -if (NOT DEFINED WAMR_BUILD_FAST_INTERP) - # Enable fast interpreter - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_MULTI_MODULE) - # Enable multiple modules - set (WAMR_BUILD_MULTI_MODULE 0) -endif () - -if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD) - # Disable pthread library by default - set (WAMR_BUILD_LIB_PTHREAD 0) -endif () - -if (NOT DEFINED WAMR_BUILD_MINI_LOADER) - # Disable wasm mini loader by default - set (WAMR_BUILD_MINI_LOADER 0) -endif () - -if (NOT DEFINED WAMR_BUILD_SIMD) - # Enable SIMD by default - set (WAMR_BUILD_SIMD 1) -endif () - -if (NOT DEFINED WAMR_BUILD_DEBUG_INTERP) - # Disable Debug feature by default - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () - -if (WAMR_BUILD_DEBUG_INTERP EQUAL 1) - set (WAMR_BUILD_FAST_INTERP 0) - set (WAMR_BUILD_MINI_LOADER 0) - set (WAMR_BUILD_SIMD 0) -endif () - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) -add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) - -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") -if (NOT MINGW) - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") -endif () - -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion") - -if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") - if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" OR MSVC)) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register") - endif () -endif () - -# The following flags are to enhance security, but it may impact performance, -# we disable them by default. -#if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") -# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -D_FORTIFY_SOURCE=2") -#endif () -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong --param ssp-buffer-size=4") -#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now") - -include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) - -add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) - -install (TARGETS iwasm DESTINATION bin) - -target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) - -if (MINGW) - target_link_libraries (iwasm ws2_32) -endif () - -add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) - -install (TARGETS libiwasm DESTINATION lib) - -set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm) - -target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) - -if (MINGW) - target_link_libraries (libiwasm ws2_32) -endif () diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/build_llvm.py b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/build_llvm.py deleted file mode 100644 index 9325a0209..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/build_llvm.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# - -import pathlib -import subprocess -import sys - -script = ( - pathlib.Path(__file__) - .parent.joinpath("../../../build-scripts/build_llvm.py") - .resolve() -) -subprocess.check_call([sys.executable, script]) diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/main.c deleted file mode 100644 index 26fa7dcc9..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/windows/main.c +++ /dev/null @@ -1,583 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <stdlib.h> -#include <string.h> - -#include "bh_platform.h" -#include "bh_read_file.h" -#include "wasm_export.h" - -static int app_argc; -static char **app_argv; - -#define MODULE_PATH ("--module-path=") - -/* clang-format off */ -static int -print_help() -{ - printf("Usage: iwasm [-options] wasm_file [args...]\n"); - printf("options:\n"); - printf(" -f|--function name Specify a function name of the module to run rather\n" - " than main\n"); -#if WASM_ENABLE_LOG != 0 - printf(" -v=n Set log verbose level (0 to 5, default is 2) larger\n" - " level with more log\n"); -#endif -#if WASM_ENABLE_INTERP != 0 - printf(" --interp Run the wasm app with interpreter mode\n"); -#endif -#if WASM_ENABLE_FAST_JIT != 0 - printf(" --fast-jit Run the wasm app with fast jit mode\n"); -#endif -#if WASM_ENABLE_JIT != 0 - printf(" --llvm-jit Run the wasm app with llvm jit mode\n"); -#endif -#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_FAST_JIT != 0 && WASM_ENABLE_LAZY_JIT != 0 - printf(" --multi-tier-jit Run the wasm app with multi-tier jit mode\n"); -#endif - printf(" --stack-size=n Set maximum stack size in bytes, default is 64 KB\n"); - printf(" --heap-size=n Set maximum heap size in bytes, default is 16 KB\n"); -#if WASM_ENABLE_JIT != 0 - printf(" --llvm-jit-size-level=n Set LLVM JIT size level, default is 3\n"); - printf(" --llvm-jit-opt-level=n Set LLVM JIT optimization level, default is 3\n"); -#endif - printf(" --repl Start a very simple REPL (read-eval-print-loop) mode\n" - " that runs commands in the form of `FUNC ARG...`\n"); -#if WASM_ENABLE_LIBC_WASI != 0 - printf(" --env=<env> Pass wasi environment variables with \"key=value\"\n"); - printf(" to the program, for example:\n"); - printf(" --env=\"key1=value1\" --env=\"key2=value2\"\n"); - printf(" --dir=<dir> Grant wasi access to the given host directories\n"); - printf(" to the program, for example:\n"); - printf(" --dir=<dir1> --dir=<dir2>\n"); -#endif -#if WASM_ENABLE_MULTI_MODULE != 0 - printf(" --module-path=<path> Indicate a module search path. default is current\n" - " directory('./')\n"); -#endif -#if WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 - printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n"); -#endif -#if WASM_ENABLE_DEBUG_INTERP != 0 - printf(" -g=ip:port Set the debug sever address, default is debug disabled\n"); - printf(" if port is 0, then a random port will be used\n"); -#endif - printf(" --version Show version information\n"); - return 1; -} -/* clang-format on */ - -static const void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - - wasm_application_execute_main(module_inst, app_argc, app_argv); - if ((exception = wasm_runtime_get_exception(module_inst))) - printf("%s\n", exception); - return exception; -} - -static const void * -app_instance_func(wasm_module_inst_t module_inst, const char *func_name) -{ - wasm_application_execute_func(module_inst, func_name, app_argc - 1, - app_argv + 1); - /* The result of wasm function or exception info was output inside - wasm_application_execute_func(), here we don't output them again. */ - return wasm_runtime_get_exception(module_inst); -} - -/** - * Split a space separated strings into an array of strings - * Returns NULL on failure - * Memory must be freed by caller - * Based on: http://stackoverflow.com/a/11198630/471795 - */ -static char ** -split_string(char *str, int *count) -{ - char **res = NULL, **res1; - char *p, *next_token; - int idx = 0; - - /* split string and append tokens to 'res' */ - do { - p = strtok_s(str, " ", &next_token); - str = NULL; - res1 = res; - res = (char **)realloc(res1, sizeof(char *) * (uint32)(idx + 1)); - if (res == NULL) { - free(res1); - return NULL; - } - res[idx++] = p; - } while (p); - - /** - * Due to the function name, - * res[0] might contain a '\' to indicate a space - * func\name -> func name - */ - p = strchr(res[0], '\\'); - while (p) { - *p = ' '; - p = strchr(p, '\\'); - } - - if (count) { - *count = idx - 1; - } - return res; -} - -static void * -app_instance_repl(wasm_module_inst_t module_inst) -{ - char buffer[4096]; - char *cmd; - size_t n; - - while ((printf("webassembly> "), cmd = fgets(buffer, sizeof(buffer), stdin)) - != NULL) { - bh_assert(cmd); - n = strlen(cmd); - if (cmd[n - 1] == '\n') { - if (n == 1) - continue; - else - cmd[n - 1] = '\0'; - } - if (!strcmp(cmd, "__exit__")) { - printf("exit repl mode\n"); - break; - } - app_argv = split_string(cmd, &app_argc); - if (app_argv == NULL) { - LOG_ERROR("Wasm prepare param failed: split string failed.\n"); - break; - } - if (app_argc != 0) { - wasm_application_execute_func(module_inst, app_argv[0], - app_argc - 1, app_argv + 1); - } - free(app_argv); - } - - return NULL; -} - -#if WASM_ENABLE_LIBC_WASI != 0 -static bool -validate_env_str(char *env) -{ - char *p = env; - int key_len = 0; - - while (*p != '\0' && *p != '=') { - key_len++; - p++; - } - - if (*p != '=' || key_len == 0) - return false; - - return true; -} -#endif - -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 -static char global_heap_buf[WASM_GLOBAL_HEAP_SIZE] = { 0 }; -#endif - -#if WASM_ENABLE_MULTI_MODULE != 0 -static char * -handle_module_path(const char *module_path) -{ - /* next character after '=' */ - return (strchr(module_path, '=')) + 1; -} - -static char *module_search_path = "."; -static bool -module_reader_callback(const char *module_name, uint8 **p_buffer, - uint32 *p_size) -{ - const char *format = "%s/%s.wasm"; - uint32 sz = (uint32)(strlen(module_search_path) + strlen("/") - + strlen(module_name) + strlen(".wasm") + 1); - char *wasm_file_name = BH_MALLOC(sz); - if (!wasm_file_name) { - return false; - } - - snprintf(wasm_file_name, sz, format, module_search_path, module_name); - - *p_buffer = (uint8 *)bh_read_file_to_buffer(wasm_file_name, p_size); - - wasm_runtime_free(wasm_file_name); - return *p_buffer != NULL; -} - -static void -moudle_destroyer(uint8 *buffer, uint32 size) -{ - if (!buffer) { - return; - } - - wasm_runtime_free(buffer); - buffer = NULL; -} -#endif /* WASM_ENABLE_MULTI_MODULE */ - -int -main(int argc, char *argv[]) -{ - int32 ret = -1; - char *wasm_file = NULL; - const char *func_name = NULL; - uint8 *wasm_file_buf = NULL; - uint32 wasm_file_size; - uint32 stack_size = 64 * 1024, heap_size = 16 * 1024; -#if WASM_ENABLE_JIT != 0 - uint32 llvm_jit_size_level = 3; - uint32 llvm_jit_opt_level = 3; -#endif - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - RunningMode running_mode = 0; - RuntimeInitArgs init_args; - char error_buf[128] = { 0 }; -#if WASM_ENABLE_LOG != 0 - int log_verbose_level = 2; -#endif - bool is_repl_mode = false; - bool is_xip_file = false; -#if WASM_ENABLE_LIBC_WASI != 0 - const char *dir_list[8] = { NULL }; - uint32 dir_list_size = 0; - const char *env_list[8] = { NULL }; - uint32 env_list_size = 0; -#endif -#if WASM_ENABLE_DEBUG_INTERP != 0 - char *ip_addr = NULL; - int instance_port = 0; -#endif - - /* Process options. */ - for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) { - if (!strcmp(argv[0], "-f") || !strcmp(argv[0], "--function")) { - argc--, argv++; - if (argc < 2) { - return print_help(); - } - func_name = argv[0]; - } -#if WASM_ENABLE_INTERP != 0 - else if (!strcmp(argv[0], "--interp")) { - running_mode = Mode_Interp; - } -#endif -#if WASM_ENABLE_FAST_JIT != 0 - else if (!strcmp(argv[0], "--fast-jit")) { - running_mode = Mode_Fast_JIT; - } -#endif -#if WASM_ENABLE_JIT != 0 - else if (!strcmp(argv[0], "--llvm-jit")) { - running_mode = Mode_LLVM_JIT; - } -#endif -#if WASM_ENABLE_JIT != 0 && WASM_ENABLE_FAST_JIT != 0 - else if (!strcmp(argv[0], "--multi-tier-jit")) { - running_mode = Mode_Multi_Tier_JIT; - } -#endif -#if WASM_ENABLE_LOG != 0 - else if (!strncmp(argv[0], "-v=", 3)) { - log_verbose_level = atoi(argv[0] + 3); - if (log_verbose_level < 0 || log_verbose_level > 5) - return print_help(); - } -#endif - else if (!strcmp(argv[0], "--repl")) { - is_repl_mode = true; - } - else if (!strncmp(argv[0], "--stack-size=", 13)) { - if (argv[0][13] == '\0') - return print_help(); - stack_size = atoi(argv[0] + 13); - } - else if (!strncmp(argv[0], "--heap-size=", 12)) { - if (argv[0][12] == '\0') - return print_help(); - heap_size = atoi(argv[0] + 12); - } -#if WASM_ENABLE_JIT != 0 - else if (!strncmp(argv[0], "--llvm-jit-size-level=", 22)) { - if (argv[0][22] == '\0') - return print_help(); - llvm_jit_size_level = atoi(argv[0] + 22); - if (llvm_jit_size_level < 1) { - printf("LLVM JIT size level shouldn't be smaller than 1, " - "setting it to 1\n"); - llvm_jit_size_level = 1; - } - else if (llvm_jit_size_level > 3) { - printf("LLVM JIT size level shouldn't be greater than 3, " - "setting it to 3\n"); - llvm_jit_size_level = 3; - } - } - else if (!strncmp(argv[0], "--llvm-jit-opt-level=", 21)) { - if (argv[0][21] == '\0') - return print_help(); - llvm_jit_opt_level = atoi(argv[0] + 21); - if (llvm_jit_opt_level < 1) { - printf("LLVM JIT opt level shouldn't be smaller than 1, " - "setting it to 1\n"); - llvm_jit_opt_level = 1; - } - else if (llvm_jit_opt_level > 3) { - printf("LLVM JIT opt level shouldn't be greater than 3, " - "setting it to 3\n"); - llvm_jit_opt_level = 3; - } - } -#endif -#if WASM_ENABLE_LIBC_WASI != 0 - else if (!strncmp(argv[0], "--dir=", 6)) { - if (argv[0][6] == '\0') - return print_help(); - if (dir_list_size >= sizeof(dir_list) / sizeof(char *)) { - printf("Only allow max dir number %d\n", - (int)(sizeof(dir_list) / sizeof(char *))); - return 1; - } - dir_list[dir_list_size++] = argv[0] + 6; - } - else if (!strncmp(argv[0], "--env=", 6)) { - char *tmp_env; - - if (argv[0][6] == '\0') - return print_help(); - if (env_list_size >= sizeof(env_list) / sizeof(char *)) { - printf("Only allow max env number %d\n", - (int)(sizeof(env_list) / sizeof(char *))); - return 1; - } - tmp_env = argv[0] + 6; - if (validate_env_str(tmp_env)) - env_list[env_list_size++] = tmp_env; - else { - printf("Wasm parse env string failed: expect \"key=value\", " - "got \"%s\"\n", - tmp_env); - return print_help(); - } - } -#endif /* WASM_ENABLE_LIBC_WASI */ -#if WASM_ENABLE_MULTI_MODULE != 0 - else if (!strncmp(argv[0], MODULE_PATH, strlen(MODULE_PATH))) { - module_search_path = handle_module_path(argv[0]); - if (!strlen(module_search_path)) { - return print_help(); - } - } -#endif -#if WASM_ENABLE_LIB_PTHREAD != 0 || WASM_ENABLE_LIB_WASI_THREADS != 0 - else if (!strncmp(argv[0], "--max-threads=", 14)) { - if (argv[0][14] == '\0') - return print_help(); - wasm_runtime_set_max_thread_num(atoi(argv[0] + 14)); - } -#endif -#if WASM_ENABLE_DEBUG_INTERP != 0 - else if (!strncmp(argv[0], "-g=", 3)) { - char *port_str = strchr(argv[0] + 3, ':'); - char *port_end; - if (port_str == NULL) - return print_help(); - *port_str = '\0'; - instance_port = strtoul(port_str + 1, &port_end, 10); - if (port_str[1] == '\0' || *port_end != '\0') - return print_help(); - ip_addr = argv[0] + 3; - } -#endif - else if (!strncmp(argv[0], "--version", 9)) { - uint32 major, minor, patch; - wasm_runtime_get_version(&major, &minor, &patch); - printf("iwasm %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", major, minor, - patch); - return 0; - } - else - return print_help(); - } - - if (argc == 0) - return print_help(); - - wasm_file = argv[0]; - app_argc = argc; - app_argv = argv; - - memset(&init_args, 0, sizeof(RuntimeInitArgs)); - - init_args.running_mode = running_mode; -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 - init_args.mem_alloc_type = Alloc_With_Pool; - init_args.mem_alloc_option.pool.heap_buf = global_heap_buf; - init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf); -#else - init_args.mem_alloc_type = Alloc_With_Allocator; - init_args.mem_alloc_option.allocator.malloc_func = malloc; - init_args.mem_alloc_option.allocator.realloc_func = realloc; - init_args.mem_alloc_option.allocator.free_func = free; -#endif - -#if WASM_ENABLE_JIT != 0 - init_args.llvm_jit_size_level = llvm_jit_size_level; - init_args.llvm_jit_opt_level = llvm_jit_opt_level; -#endif - -#if WASM_ENABLE_DEBUG_INTERP != 0 - init_args.instance_port = instance_port; - if (ip_addr) - strcpy(init_args.ip_addr, ip_addr); -#endif - - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - printf("Init runtime environment failed.\n"); - return -1; - } - -#if WASM_ENABLE_LOG != 0 - bh_log_set_verbose_level(log_verbose_level); -#endif - - /* load WASM byte buffer from WASM bin file */ - if (!(wasm_file_buf = - (uint8 *)bh_read_file_to_buffer(wasm_file, &wasm_file_size))) - goto fail1; - -#if WASM_ENABLE_AOT != 0 - if (wasm_runtime_is_xip_file(wasm_file_buf, wasm_file_size)) { - uint8 *wasm_file_mapped; - int map_prot = MMAP_PROT_READ | MMAP_PROT_WRITE | MMAP_PROT_EXEC; - int map_flags = MMAP_MAP_32BIT; - - if (!(wasm_file_mapped = - os_mmap(NULL, (uint32)wasm_file_size, map_prot, map_flags))) { - printf("mmap memory failed\n"); - wasm_runtime_free(wasm_file_buf); - goto fail1; - } - - bh_memcpy_s(wasm_file_mapped, wasm_file_size, wasm_file_buf, - wasm_file_size); - wasm_runtime_free(wasm_file_buf); - wasm_file_buf = wasm_file_mapped; - is_xip_file = true; - } -#endif - -#if WASM_ENABLE_MULTI_MODULE != 0 - wasm_runtime_set_module_reader(module_reader_callback, moudle_destroyer); -#endif - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail2; - } - -#if WASM_ENABLE_LIBC_WASI != 0 - wasm_runtime_set_wasi_args(wasm_module, dir_list, dir_list_size, NULL, 0, - env_list, env_list_size, argv, argc); -#endif - - /* instantiate the module */ - if (!(wasm_module_inst = - wasm_runtime_instantiate(wasm_module, stack_size, heap_size, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail3; - } - -#if WASM_ENABLE_DEBUG_INTERP != 0 - if (ip_addr != NULL) { - wasm_exec_env_t exec_env = - wasm_runtime_get_exec_env_singleton(wasm_module_inst); - uint32_t debug_port; - if (exec_env == NULL) { - printf("%s\n", wasm_runtime_get_exception(wasm_module_inst)); - goto fail4; - } - debug_port = wasm_runtime_start_debug_instance(exec_env); - if (debug_port == 0) { - printf("Failed to start debug instance\n"); - goto fail4; - } - } -#endif - - ret = 0; - if (is_repl_mode) { - app_instance_repl(wasm_module_inst); - } - else if (func_name) { - if (app_instance_func(wasm_module_inst, func_name)) { - /* got an exception */ - ret = 1; - } - } - else { - if (app_instance_main(wasm_module_inst)) { - /* got an exception */ - ret = 1; - } - } - -#if WASM_ENABLE_LIBC_WASI != 0 - if (ret == 0) { - /* wait for threads to finish and propagate wasi exit code. */ - ret = wasm_runtime_get_wasi_exit_code(wasm_module_inst); - if (wasm_runtime_get_exception(wasm_module_inst)) { - /* got an exception in spawned thread */ - ret = 1; - } - } -#endif - -#if WASM_ENABLE_DEBUG_INTERP != 0 -fail4: -#endif - /* destroy the module instance */ - wasm_runtime_deinstantiate(wasm_module_inst); - -fail3: - /* unload the module */ - wasm_runtime_unload(wasm_module); - -fail2: - /* free the file buffer */ - if (!is_xip_file) - wasm_runtime_free(wasm_file_buf); - else - os_munmap(wasm_file_buf, wasm_file_size); - -fail1: - /* destroy runtime environment */ - wasm_runtime_destroy(); - - return ret; -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt deleted file mode 100644 index 8b2af15eb..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -cmake_minimum_required(VERSION 3.8.2) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(wamr) - -enable_language (ASM) - -set (WAMR_BUILD_PLATFORM "zephyr") - -# Build as X86_32 by default, change to "AARCH64[sub]", "ARM[sub]", "THUMB[sub]", "MIPS" or "XTENSA" -# if we want to support arm, thumb, mips or xtensa -if (NOT DEFINED WAMR_BUILD_TARGET) - set (WAMR_BUILD_TARGET "X86_32") -endif () - -if (NOT DEFINED WAMR_BUILD_INTERP) - # Enable Interpreter by default - set (WAMR_BUILD_INTERP 1) -endif () - -if (NOT DEFINED WAMR_BUILD_AOT) - # Enable AOT by default. - set (WAMR_BUILD_AOT 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN) - # Enable libc builtin support by default - set (WAMR_BUILD_LIBC_BUILTIN 1) -endif () - -if (NOT DEFINED WAMR_BUILD_LIBC_WASI) - # Disable libc wasi support by default - set (WAMR_BUILD_LIBC_WASI 0) -endif () - -if (WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64" OR WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32") - set (WAMR_BUILD_FAST_INTERP 1) -endif () - -# Override the global heap usage -if (NOT DEFINED WAMR_BUILD_GLOBAL_HEAP_POOL) - set (WAMR_BUILD_GLOBAL_HEAP_POOL 1) -endif () - -# Override the global heap size for small devices -if (NOT DEFINED WAMR_BUILD_GLOBAL_HEAP_SIZE) - set (WAMR_BUILD_GLOBAL_HEAP_SIZE 131072) # 128 KB -endif () - -set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) - -include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) - -target_sources(app PRIVATE - ${WAMR_RUNTIME_LIB_SOURCE} - src/main.c) - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md deleted file mode 100644 index e02398b0b..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/README_docker.md +++ /dev/null @@ -1,25 +0,0 @@ -# Build with Docker - -To have a quicker start, a Docker container of the Zephyr setup can be generated. - -## Build Docker container - -``` Bash -docker build --build-arg DOCKER_UID=$(id -u) . -t wamr-zephyr -``` - -## Run Docker container to build images - -Enter the docker container (maps the toplevel wasm-micro-runtime repo as volume): - -``` Bash -docker run -ti -v $PWD/../../../..:/home/wamr/source --device=/dev/ttyUSB0 wamr-zephyr -``` - -Adopt the device or remove if not needed. - -And then in the docker container: - -``` Bash -./build_and_run.sh esp32c3 -```
\ No newline at end of file diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf deleted file mode 100644 index 5d6a67f9d..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/esp32.conf +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=y -CONFIG_HAVE_CUSTOM_LINKER_SCRIPT=y -CONFIG_CUSTOM_LINKER_SCRIPT="esp32_custom_linker.ld" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf deleted file mode 100644 index c495644b7..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/nucleo767zi.conf +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_ARM_MPU=y -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=y diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf deleted file mode 100644 index 7f4a32832..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_arc.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=y diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf deleted file mode 100644 index d248565fa..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_cortex_a53.conf +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_ARM_MMU=n -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=y diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf deleted file mode 100644 index f3705504b..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv32.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=n diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf deleted file mode 100644 index f3705504b..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_riscv64.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=n diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf deleted file mode 100644 index 7f4a32832..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_x86_nommu.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=y diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf deleted file mode 100644 index 7f4a32832..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/boards/qemu_xtensa.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -CONFIG_STACK_SENTINEL=y -CONFIG_PRINTK=y -CONFIG_LOG=y diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh deleted file mode 100755 index 921f88363..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/build_and_run.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -X86_TARGET="x86" -STM32_TARGET="stm32" -ESP32_TARGET="esp32" -ESP32C3_TARGET="esp32c3" -PARTICLE_ARGON_TARGET="particle_argon" -QEMU_CORTEX_A53="qemu_cortex_a53" -QEMU_XTENSA_TARGET="qemu_xtensa" -QEMU_RISCV64_TARGET="qemu_riscv64" -QEMU_RISCV32_TARGET="qemu_riscv32" -QEMU_ARC_TARGET="qemu_arc" - -usage () -{ - echo "USAGE:" - echo "$0 $X86_TARGET|$STM32_TARGET|$ESP32_TARGET|$ESP32C3_TARGET|$PARTICLE_ARGON_TARGET|$QEMU_CORTEX_A53|$QEMU_XTENSA_TARGET|$QEMU_RISCV64_TARGET|$QEMU_RISCV32_TARGET|$QEMU_ARC_TARGET" - echo "Example:" - echo " $0 $X86_TARGET" - echo " $0 $STM32_TARGET" - echo " $0 $ESP32_TARGET" - echo " $0 $ESP32C3_TARGET" - echo " $0 $PARTICLE_ARGON_TARGET" - echo " $0 $QEMU_CORTEX_A53" - echo " $0 $QEMU_XTENSA_TARGET" - echo " $0 $QEMU_RISCV64_TARGET" - echo " $0 $QEMU_RISCV32_TARGET" - echo " $0 $QEMU_ARC_TARGET" - exit 1 -} - -if [ $# != 1 ] ; then - usage -fi - -TARGET=$1 - -case $TARGET in - $X86_TARGET) - west build -b qemu_x86_nommu \ - . -p always -- \ - -DWAMR_BUILD_TARGET=X86_32 - west build -t run - ;; - $STM32_TARGET) - west build -b nucleo_f767zi \ - . -p always -- \ - -DWAMR_BUILD_TARGET=THUMBV7 - west flash - ;; - $ESP32_TARGET) - export ZEPHYR_TOOLCHAIN_VARIANT="espressif" - if [[ -z "${ESPRESSIF_TOOLCHAIN_PATH}" ]]; then - echo "Set ESPRESSIF_TOOLCHAIN_PATH to your espressif toolchain" - exit 1 - fi - west build -b esp32 \ - . -p always -- \ - -DWAMR_BUILD_TARGET=XTENSA - # west flash will discover the device - west flash - ;; - $ESP32C3_TARGET) - export ZEPHYR_TOOLCHAIN_VARIANT="espressif" - if [[ -z "${ESPRESSIF_TOOLCHAIN_PATH}" ]]; then - echo "Set ESPRESSIF_TOOLCHAIN_PATH to your espressif toolchain" - exit 1 - fi - west build -b esp32c3_devkitm \ - . -p always -- \ - -DWAMR_BUILD_TARGET=RISCV32_ILP32 - # west flash will discover the device - west flash - ;; - $PARTICLE_ARGON_TARGET) - west build -b particle_argon \ - . -p always -- \ - -DWAMR_BUILD_TARGET=THUMBV7 - # west flash will discover the device - west flash - ;; - $QEMU_XTENSA_TARGET) - west build -b qemu_xtensa \ - . -p always -- \ - -DWAMR_BUILD_TARGET=XTENSA - west build -t run - ;; - $QEMU_CORTEX_A53) - west build -b qemu_cortex_a53 \ - . -p always -- \ - -DWAMR_BUILD_TARGET=AARCH64 - west build -t run - ;; - $QEMU_RISCV64_TARGET) - west build -b qemu_riscv64 \ - . -p always -- \ - -DWAMR_BUILD_TARGET=RISCV64_LP64 \ - -DWAMR_BUILD_AOT=0 - west build -t run - ;; - $QEMU_RISCV32_TARGET) - west build -b qemu_riscv32 \ - . -p always -- \ - -DWAMR_BUILD_TARGET=RISCV32_ILP32 \ - -DWAMR_BUILD_AOT=0 - west build -t run - ;; - $QEMU_ARC_TARGET) - west build -b qemu_arc_em \ - . -p always -- \ - -DWAMR_BUILD_TARGET=ARC \ - -DWAMR_BUILD_AOT=0 - west build -t run - ;; - *) - echo "unsupported target: $TARGET" - usage - exit 1 - ;; -esac - diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld deleted file mode 100644 index 35932050f..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/esp32_custom_linker.ld +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2016 Cadence Design Systems, Inc. - * Copyright (c) 2017 Intel Corporation - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * @brief Linker command/script file - * - * Linker script for the Xtensa platform. - */ - -#include <devicetree.h> -#include <autoconf.h> -#include <linker/sections.h> -#include <linker/linker-defs.h> -#include <linker/linker-tool.h> - -#define RAMABLE_REGION dram0_0_seg :dram0_0_phdr -#define RAMABLE_REGION1 dram0_1_seg :dram0_0_phdr -#define ROMABLE_REGION iram0_0_seg :iram0_0_phdr - -PROVIDE ( __stack = 0x3ffe3f20 ); - -PROVIDE ( esp32_rom_uart_tx_one_char = 0x40009200 ); -PROVIDE ( esp32_rom_uart_rx_one_char = 0x400092d0 ); -PROVIDE ( esp32_rom_uart_attach = 0x40008fd0 ); -PROVIDE ( esp32_rom_intr_matrix_set = 0x4000681c ); -PROVIDE ( esp32_rom_gpio_matrix_in = 0x40009edc ); -PROVIDE ( esp32_rom_gpio_matrix_out = 0x40009f0c ); -PROVIDE ( esp32_rom_Cache_Flush = 0x40009a14 ); -PROVIDE ( esp32_rom_Cache_Read_Enable = 0x40009a84 ); -PROVIDE ( esp32_rom_ets_set_appcpu_boot_addr = 0x4000689c ); - -MEMORY -{ - iram0_0_seg(RX): org = 0x40080000, len = 0x20000 - iram0_2_seg(RX): org = 0x400D0018, len = 0x330000 - dram0_0_seg(RW): org = 0x3FFB0000, len = 0x30000 - dram0_1_seg(RWX):org = 0x400A0000, len = 0x20000 - drom0_0_seg(R): org = 0x3F400010, len = 0x800000 - rtc_iram_seg(RWX): org = 0x400C0000, len = 0x2000 - rtc_slow_seg(RW): org = 0x50000000, len = 0x1000 -#ifdef CONFIG_GEN_ISR_TABLES - IDT_LIST(RW): org = 0x3ebfe010, len = 0x2000 -#endif -} - -PHDRS -{ - iram0_0_phdr PT_LOAD; - dram0_0_phdr PT_LOAD; -} - -/* Default entry point: */ -PROVIDE ( _ResetVector = 0x40000400 ); -ENTRY(CONFIG_KERNEL_ENTRY) - -_rom_store_table = 0; - -PROVIDE(_memmap_vecbase_reset = 0x40000450); -PROVIDE(_memmap_reset_vector = 0x40000400); - -SECTIONS -{ - -#include <linker/rel-sections.ld> - - /* RTC fast memory holds RTC wake stub code, - including from any source file named rtc_wake_stub*.c - */ - .rtc.text : - { - . = ALIGN(4); - *(.rtc.literal .rtc.text) - *rtc_wake_stub*.o(.literal .text .literal.* .text.*) - } >rtc_iram_seg - - /* RTC slow memory holds RTC wake stub - data/rodata, including from any source file - named rtc_wake_stub*.c - */ - .rtc.data : - { - _rtc_data_start = ABSOLUTE(.); - *(.rtc.data) - *(.rtc.rodata) - *rtc_wake_stub*.o(.data .rodata .data.* .rodata.* .bss .bss.*) - _rtc_data_end = ABSOLUTE(.); - } > rtc_slow_seg - - /* RTC bss, from any source file named rtc_wake_stub*.c */ - .rtc.bss (NOLOAD) : - { - _rtc_bss_start = ABSOLUTE(.); - *rtc_wake_stub*.o(.bss .bss.*) - *rtc_wake_stub*.o(COMMON) - _rtc_bss_end = ABSOLUTE(.); - } > rtc_slow_seg - - /* Send .iram0 code to iram */ - .iram0.vectors : ALIGN(4) - { - /* Vectors go to IRAM */ - _init_start = ABSOLUTE(.); - /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */ - . = 0x0; - KEEP(*(.WindowVectors.text)); - . = 0x180; - KEEP(*(.Level2InterruptVector.text)); - . = 0x1c0; - KEEP(*(.Level3InterruptVector.text)); - . = 0x200; - KEEP(*(.Level4InterruptVector.text)); - . = 0x240; - KEEP(*(.Level5InterruptVector.text)); - . = 0x280; - KEEP(*(.DebugExceptionVector.text)); - . = 0x2c0; - KEEP(*(.NMIExceptionVector.text)); - . = 0x300; - KEEP(*(.KernelExceptionVector.text)); - . = 0x340; - KEEP(*(.UserExceptionVector.text)); - . = 0x3C0; - KEEP(*(.DoubleExceptionVector.text)); - . = 0x400; - *(.*Vector.literal) - - *(.UserEnter.literal); - *(.UserEnter.text); - . = ALIGN (16); - *(.entry.text) - *(.init.literal) - *(.init) - _init_end = ABSOLUTE(.); - - /* This goes here, not at top of linker script, so addr2line finds it last, - and uses it in preference to the first symbol in IRAM */ - _iram_start = ABSOLUTE(0); - } GROUP_LINK_IN(ROMABLE_REGION) - -#include <linker/common-ram.ld> -#include <linker/common-rom.ld> - - SECTION_PROLOGUE(_TEXT_SECTION_NAME, , ALIGN(4)) - { - /* Code marked as running out of IRAM */ - _iram_text_start = ABSOLUTE(.); - *(.iram1 .iram1.*) - *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text) - *(.literal .text .literal.* .text.*) - _iram_text_end = ABSOLUTE(.); - } GROUP_LINK_IN(ROMABLE_REGION) - - .dram0.text : - { - _data_start = ABSOLUTE(.); - *(.aot_code_buf) - _data_end = ABSOLUTE(.); - . = ALIGN(4); - } GROUP_LINK_IN(RAMABLE_REGION1) - - - .dram0.data : - { - _data_start = ABSOLUTE(.); - *(.data) - *(.data.*) - *(.gnu.linkonce.d.*) - *(.data1) - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) - *(.gnu.linkonce.s2.*) - KEEP(*(.jcr)) - *(.dram1 .dram1.*) - _data_end = ABSOLUTE(.); - . = ALIGN(4); - } GROUP_LINK_IN(RAMABLE_REGION) - - SECTION_PROLOGUE(_RODATA_SECTION_NAME,,ALIGN(4)) - { - _rodata_start = ABSOLUTE(.); - *(.rodata) - *(.rodata.*) - *(.gnu.linkonce.r.*) - *(.rodata1) - __XT_EXCEPTION_TABLE__ = ABSOLUTE(.); - KEEP (*(.xt_except_table)) - KEEP (*(.gcc_except_table .gcc_except_table.*)) - *(.gnu.linkonce.e.*) - *(.gnu.version_r) - KEEP (*(.eh_frame)) - /* C++ constructor and destructor tables, properly ordered: */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - /* C++ exception handlers table: */ - __XT_EXCEPTION_DESCS__ = ABSOLUTE(.); - *(.xt_except_desc) - *(.gnu.linkonce.h.*) - __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); - *(.xt_except_desc_end) - *(.dynamic) - *(.gnu.version_d) - . = ALIGN(4); /* this table MUST be 4-byte aligned */ - _rodata_end = ABSOLUTE(.); - } GROUP_LINK_IN(RAMABLE_REGION) - - - /* Shared RAM */ - SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD),) - { - . = ALIGN (8); - _bss_start = ABSOLUTE(.); - *(.dynsbss) - *(.sbss) - *(.sbss.*) - *(.gnu.linkonce.sb.*) - *(.scommon) - *(.sbss2) - *(.sbss2.*) - *(.gnu.linkonce.sb2.*) - *(.dynbss) - *(.bss) - *(.bss.*) - *(.share.mem) - *(.gnu.linkonce.b.*) - *(COMMON) - . = ALIGN (8); - _bss_end = ABSOLUTE(.); - } GROUP_LINK_IN(RAMABLE_REGION) - - - SECTION_DATA_PROLOGUE(_APP_NOINIT_SECTION_NAME, (NOLOAD),) - { - . = ALIGN (8); - *(.app_noinit) - *("app_noinit.*") - . = ALIGN (8); - _app_end = ABSOLUTE(.); - } GROUP_LINK_IN(RAMABLE_REGION) - - - SECTION_DATA_PROLOGUE(_NOINIT_SECTION_NAME, (NOLOAD),) - { - . = ALIGN (8); - *(.noinit) - *(".noinit.*") - . = ALIGN (8); - _heap_start = ABSOLUTE(.); - } GROUP_LINK_IN(RAMABLE_REGION) - -#ifdef CONFIG_GEN_ISR_TABLES -#include <linker/intlist.ld> -#endif - -#include <linker/debug-sections.ld> - - SECTION_PROLOGUE(.xtensa.info, 0,) - { - *(.xtensa.info) - } - -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c deleted file mode 100644 index 8799e737a..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/main.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <stdlib.h> -#include <string.h> -#include "bh_platform.h" -#include "bh_assert.h" -#include "bh_log.h" -#include "wasm_export.h" -#if defined(BUILD_TARGET_RISCV64_LP64) || defined(BUILD_TARGET_RISCV32_ILP32) -#include "test_wasm_riscv64.h" -#else -#include "test_wasm.h" -#endif /* end of BUILD_TARGET_RISCV64_LP64 || BUILD_TARGET_RISCV32_ILP32 */ - -#if defined(BUILD_TARGET_RISCV64_LP64) || defined(BUILD_TARGET_RISCV32_ILP32) -#if defined(BUILD_TARGET_RISCV64_LP64) -#define CONFIG_GLOBAL_HEAP_BUF_SIZE 4360 -#define CONFIG_APP_STACK_SIZE 288 -#define CONFIG_MAIN_THREAD_STACK_SIZE 2400 -#else -#define CONFIG_GLOBAL_HEAP_BUF_SIZE 5120 -#define CONFIG_APP_STACK_SIZE 512 -#define CONFIG_MAIN_THREAD_STACK_SIZE 4096 -#endif -#define CONFIG_APP_HEAP_SIZE 256 -#else /* else of BUILD_TARGET_RISCV64_LP64 || BUILD_TARGET_RISCV32_ILP32 */ - -#define CONFIG_GLOBAL_HEAP_BUF_SIZE WASM_GLOBAL_HEAP_SIZE -#define CONFIG_APP_STACK_SIZE 8192 -#define CONFIG_APP_HEAP_SIZE 8192 - -#ifdef CONFIG_NO_OPTIMIZATIONS -#define CONFIG_MAIN_THREAD_STACK_SIZE 8192 -#else -#define CONFIG_MAIN_THREAD_STACK_SIZE 4096 -#endif - -#endif /* end of BUILD_TARGET_RISCV64_LP64 || BUILD_TARGET_RISCV32_ILP32 */ - -static int app_argc; -static char **app_argv; - -/** - * Find the unique main function from a WASM module instance - * and execute that function. - * - * @param module_inst the WASM module instance - * @param argc the number of arguments - * @param argv the arguments array - * - * @return true if the main function is called, false otherwise. - */ -bool -wasm_application_execute_main(wasm_module_inst_t module_inst, int argc, - char *argv[]); - -static void * -app_instance_main(wasm_module_inst_t module_inst) -{ - const char *exception; - wasm_function_inst_t func; - wasm_exec_env_t exec_env; - unsigned argv[2] = { 0 }; - - if (wasm_runtime_lookup_function(module_inst, "main", NULL) - || wasm_runtime_lookup_function(module_inst, "__main_argc_argv", - NULL)) { - LOG_VERBOSE("Calling main funciton\n"); - wasm_application_execute_main(module_inst, app_argc, app_argv); - } - else if ((func = wasm_runtime_lookup_function(module_inst, "app_main", - NULL))) { - exec_env = - wasm_runtime_create_exec_env(module_inst, CONFIG_APP_HEAP_SIZE); - if (!exec_env) { - os_printf("Create exec env failed\n"); - return NULL; - } - - LOG_VERBOSE("Calling app_main funciton\n"); - wasm_runtime_call_wasm(exec_env, func, 0, argv); - - if (!wasm_runtime_get_exception(module_inst)) { - os_printf("result: 0x%x\n", argv[0]); - } - - wasm_runtime_destroy_exec_env(exec_env); - } - else { - os_printf("Failed to lookup function main or app_main to call\n"); - return NULL; - } - - if ((exception = wasm_runtime_get_exception(module_inst))) - os_printf("%s\n", exception); - - return NULL; -} - -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 -static char global_heap_buf[CONFIG_GLOBAL_HEAP_BUF_SIZE] = { 0 }; -#endif - -#ifdef CONFIG_BOARD_ESP32 -#include "mem_alloc.h" -/* -esp32_technical_reference_manual: -" -The capacity of Internal SRAM 1 is 128 KB. Either CPU can read and write this -memory at addresses 0x3FFE_0000 ~ 0x3FFF_FFFF of the data bus, and also at -addresses 0x400A_0000 ~ 0x400B_FFFF of the instruction bus. -" - -The custom linker script defines dram0_1_seg and map it to 0x400A_0000 ~ -0x400B_FFFF for instruction bus access. Here we define the buffer that will be -placed to dram0_1_seg. -*/ -static char esp32_executable_memory_buf[100 * 1024] - __attribute__((section(".aot_code_buf"))) = { 0 }; - -/* the poll allocator for executable memory */ -static mem_allocator_t esp32_exec_mem_pool_allocator; - -static int -esp32_exec_mem_init() -{ - if (!(esp32_exec_mem_pool_allocator = - mem_allocator_create(esp32_executable_memory_buf, - sizeof(esp32_executable_memory_buf)))) - return -1; - - return 0; -} - -static void -esp32_exec_mem_destroy() -{ - mem_allocator_destroy(esp32_exec_mem_pool_allocator); -} - -static void * -esp32_exec_mem_alloc(unsigned int size) -{ - return mem_allocator_malloc(esp32_exec_mem_pool_allocator, size); -} - -static void -esp32_exec_mem_free(void *addr) -{ - mem_allocator_free(esp32_exec_mem_pool_allocator, addr); -} -#endif /* end of #ifdef CONFIG_BOARD_ESP32 */ - -void -iwasm_main(void *arg1, void *arg2, void *arg3) -{ - int start, end; - start = k_uptime_get_32(); - uint8 *wasm_file_buf = NULL; - uint32 wasm_file_size; - wasm_module_t wasm_module = NULL; - wasm_module_inst_t wasm_module_inst = NULL; - RuntimeInitArgs init_args; - char error_buf[128]; -#if WASM_ENABLE_LOG != 0 - int log_verbose_level = 2; -#endif - - (void)arg1; - (void)arg2; - (void)arg3; - - memset(&init_args, 0, sizeof(RuntimeInitArgs)); - -#if WASM_ENABLE_GLOBAL_HEAP_POOL != 0 - init_args.mem_alloc_type = Alloc_With_Pool; - init_args.mem_alloc_option.pool.heap_buf = global_heap_buf; - init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf); -#else -#error Another memory allocation scheme than global heap pool is not implemented yet for Zephyr. -#endif - - /* initialize runtime environment */ - if (!wasm_runtime_full_init(&init_args)) { - printf("Init runtime environment failed.\n"); - return; - } - -#ifdef CONFIG_BOARD_ESP32 - /* Initialize executable memory */ - if (esp32_exec_mem_init() != 0) { - printf("Init executable memory failed.\n"); - goto fail1; - } - /* Set hook functions for executable memory management */ - set_exec_mem_alloc_func(esp32_exec_mem_alloc, esp32_exec_mem_free); -#endif - -#if WASM_ENABLE_LOG != 0 - bh_log_set_verbose_level(log_verbose_level); -#endif - - /* load WASM byte buffer from byte buffer of include file */ - wasm_file_buf = (uint8 *)wasm_test_file; - wasm_file_size = sizeof(wasm_test_file); - - /* load WASM module */ - if (!(wasm_module = wasm_runtime_load(wasm_file_buf, wasm_file_size, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); -#ifdef CONFIG_BOARD_ESP32 - goto fail1_1; -#else - goto fail1; -#endif - } - - /* instantiate the module */ - if (!(wasm_module_inst = wasm_runtime_instantiate( - wasm_module, CONFIG_APP_STACK_SIZE, CONFIG_APP_HEAP_SIZE, - error_buf, sizeof(error_buf)))) { - printf("%s\n", error_buf); - goto fail2; - } - - /* invoke the main function */ - app_instance_main(wasm_module_inst); - - /* destroy the module instance */ - wasm_runtime_deinstantiate(wasm_module_inst); - -fail2: - /* unload the module */ - wasm_runtime_unload(wasm_module); - -#ifdef CONFIG_BOARD_ESP32 -fail1_1: - /* destroy executable memory */ - esp32_exec_mem_destroy(); -#endif - -fail1: - /* destroy runtime environment */ - wasm_runtime_destroy(); - - end = k_uptime_get_32(); - - printf("elpase: %d\n", (end - start)); -} - -#define MAIN_THREAD_STACK_SIZE (CONFIG_MAIN_THREAD_STACK_SIZE) -#define MAIN_THREAD_PRIORITY 5 - -K_THREAD_STACK_DEFINE(iwasm_main_thread_stack, MAIN_THREAD_STACK_SIZE); -static struct k_thread iwasm_main_thread; - -bool -iwasm_init(void) -{ - k_tid_t tid = k_thread_create( - &iwasm_main_thread, iwasm_main_thread_stack, MAIN_THREAD_STACK_SIZE, - iwasm_main, NULL, NULL, NULL, MAIN_THREAD_PRIORITY, 0, K_NO_WAIT); - return tid ? true : false; -} -void -main(void) -{ - iwasm_init(); -} diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h deleted file mode 100644 index a729cadef..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -/** - * The byte array buffer is the file content of a test wasm binary file, - * which is compiled by wasi-sdk toolchain from C source file of: - * product-mini/app-samples/hello-world/main.c. - */ -unsigned char __aligned(4) wasm_test_file[] = { - 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, - 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01, - 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75, - 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C, - 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66, - 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01, - 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x13, 0x03, - 0x7F, 0x01, 0x41, 0xC0, 0x28, 0x0B, 0x7F, 0x00, 0x41, 0xBA, 0x08, 0x0B, - 0x7F, 0x00, 0x41, 0xC0, 0x28, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, - 0x6D, 0x6F, 0x72, 0x79, 0x02, 0x00, 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74, - 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65, - 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x03, 0x02, 0x04, 0x6D, 0x61, - 0x69, 0x6E, 0x00, 0x04, 0x0A, 0xB2, 0x01, 0x01, 0xAF, 0x01, 0x01, 0x03, - 0x7F, 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, - 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x88, 0x80, 0x80, 0x00, - 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, - 0x80, 0x08, 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, - 0x41, 0xA8, 0x88, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, - 0x1A, 0x41, 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x10, 0x41, 0x80, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41, - 0x10, 0x6A, 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21, - 0x04, 0x20, 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x88, - 0x80, 0x80, 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, - 0x8D, 0x88, 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, - 0x36, 0x02, 0x00, 0x41, 0x93, 0x88, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10, - 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80, - 0x80, 0x00, 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80, - 0x80, 0x00, 0x20, 0x04, 0x0B, 0x0B, 0x41, 0x01, 0x00, 0x41, 0x80, 0x08, - 0x0B, 0x3A, 0x62, 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25, - 0x70, 0x0A, 0x00, 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66, - 0x3A, 0x20, 0x25, 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, - 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, - 0x20, 0x62, 0x75, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00 -}; diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h deleted file mode 100644 index 1b45211d7..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/test_wasm_riscv64.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -unsigned char __aligned(4) wasm_test_file[] = { - 0x00, 0x61, 0x73, 0x6D, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x03, 0x60, - 0x01, 0x7F, 0x01, 0x7F, 0x60, 0x02, 0x7F, 0x7F, 0x01, 0x7F, 0x60, 0x01, - 0x7F, 0x00, 0x02, 0x31, 0x04, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x70, 0x75, - 0x74, 0x73, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x6D, 0x61, 0x6C, - 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x03, 0x65, 0x6E, 0x76, 0x06, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x00, 0x01, 0x03, 0x65, 0x6E, 0x76, 0x04, 0x66, - 0x72, 0x65, 0x65, 0x00, 0x02, 0x03, 0x02, 0x01, 0x01, 0x04, 0x05, 0x01, - 0x70, 0x01, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x12, 0x03, - 0x7F, 0x01, 0x41, 0xC0, 0x01, 0x0B, 0x7F, 0x00, 0x41, 0x3A, 0x0B, 0x7F, - 0x00, 0x41, 0xC0, 0x01, 0x0B, 0x07, 0x2C, 0x04, 0x06, 0x6D, 0x65, 0x6D, - 0x6F, 0x72, 0x79, 0x02, 0x00, 0x04, 0x6D, 0x61, 0x69, 0x6E, 0x00, 0x04, - 0x0A, 0x5F, 0x5F, 0x64, 0x61, 0x74, 0x61, 0x5F, 0x65, 0x6E, 0x64, 0x03, - 0x01, 0x0B, 0x5F, 0x5F, 0x68, 0x65, 0x61, 0x70, 0x5F, 0x62, 0x61, 0x73, - 0x65, 0x03, 0x02, 0x0A, 0xB1, 0x01, 0x01, 0xAE, 0x01, 0x01, 0x03, 0x7F, - 0x23, 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x20, 0x6B, 0x22, 0x02, 0x24, - 0x80, 0x80, 0x80, 0x80, 0x00, 0x41, 0x9B, 0x80, 0x80, 0x80, 0x00, 0x10, - 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x02, 0x40, 0x02, 0x40, 0x41, 0x10, - 0x10, 0x81, 0x80, 0x80, 0x80, 0x00, 0x22, 0x03, 0x0D, 0x00, 0x41, 0xA8, - 0x80, 0x80, 0x80, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, - 0x7F, 0x21, 0x04, 0x0C, 0x01, 0x0B, 0x20, 0x02, 0x20, 0x03, 0x36, 0x02, - 0x10, 0x41, 0x80, 0x80, 0x80, 0x80, 0x00, 0x20, 0x02, 0x41, 0x10, 0x6A, - 0x10, 0x82, 0x80, 0x80, 0x80, 0x00, 0x1A, 0x41, 0x00, 0x21, 0x04, 0x20, - 0x03, 0x41, 0x04, 0x6A, 0x41, 0x00, 0x2F, 0x00, 0x91, 0x80, 0x80, 0x80, - 0x00, 0x3B, 0x00, 0x00, 0x20, 0x03, 0x41, 0x00, 0x28, 0x00, 0x8D, 0x80, - 0x80, 0x80, 0x00, 0x36, 0x00, 0x00, 0x20, 0x02, 0x20, 0x03, 0x36, 0x02, - 0x00, 0x41, 0x93, 0x80, 0x80, 0x80, 0x00, 0x20, 0x02, 0x10, 0x82, 0x80, - 0x80, 0x80, 0x00, 0x1A, 0x20, 0x03, 0x10, 0x83, 0x80, 0x80, 0x80, 0x00, - 0x0B, 0x20, 0x02, 0x41, 0x20, 0x6A, 0x24, 0x80, 0x80, 0x80, 0x80, 0x00, - 0x20, 0x04, 0x0B, 0x0B, 0x40, 0x01, 0x00, 0x41, 0x00, 0x0B, 0x3A, 0x62, - 0x75, 0x66, 0x20, 0x70, 0x74, 0x72, 0x3A, 0x20, 0x25, 0x70, 0x0A, 0x00, - 0x31, 0x32, 0x33, 0x34, 0x0A, 0x00, 0x62, 0x75, 0x66, 0x3A, 0x20, 0x25, - 0x73, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, - 0x64, 0x21, 0x00, 0x6D, 0x61, 0x6C, 0x6C, 0x6F, 0x63, 0x20, 0x62, 0x75, - 0x66, 0x20, 0x66, 0x61, 0x69, 0x6C, 0x65, 0x64, 0x00 -}; diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh deleted file mode 100755 index 73e734935..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/build.sh +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -WAMR_DIR=${PWD}/../../.. - -echo "Build wasm app .." -/opt/wasi-sdk/bin/clang -O3 \ - -z stack-size=128 -Wl,--initial-memory=65536 \ - -Wl,--global-base=0 \ - -o test.wasm main.c \ - -Wl,--export=main -Wl,--export=__main_argc_argv \ - -Wl,--export=__data_end -Wl,--export=__heap_base \ - -Wl,--strip-all,--no-entry \ - -Wl,--allow-undefined \ - -nostdlib \ - -echo "Build binarydump tool .." -rm -fr build && mkdir build && cd build -cmake ../../../../../../../test-tools/binarydump-tool -make -cd .. - -echo "Generate test_wasm.h .." -./build/binarydump -o test_wasm.h -n wasm_test_file test.wasm -cp -a test_wasm.h ../test_wasm_riscv64.h - -echo "Done" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c deleted file mode 100644 index 026cb8fd1..000000000 --- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/product-mini/platforms/zephyr/simple/src/wasm-app-riscv64/main.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2019 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include <stdio.h> -#include <stdlib.h> - -int -main(int argc, char **argv) -{ - char *buf; - - printf("Hello world!\n"); - - buf = malloc(16); - if (!buf) { - printf("malloc buf failed\n"); - return -1; - } - - printf("buf ptr: %p\n", buf); - - snprintf(buf, 1024, "%s", "1234\n"); - printf("buf: %s", buf); - - free(buf); - return 0; -} |