Implement native function pointer check, addr conversion and register, update documents (#185)
Modified WASM runtime API: - wasm_runtime_module_malloc() - wasm_runtime_lookup_function() Introduced runtime API - wasm_runtime_register_natives()
This commit is contained in:
@ -92,7 +92,7 @@ $(NAME)_SOURCES := ${SHARED_ROOT}/platform/alios/bh_assert.c \
|
||||
${IWASM_ROOT}/common/wasm_native.c \
|
||||
${IWASM_ROOT}/common/wasm_exec_env.c \
|
||||
${IWASM_ROOT}/common/arch/${INVOKE_NATIVE} \
|
||||
src/main.c src/ext_lib_export.c
|
||||
src/main.c
|
||||
|
||||
ifeq (${WAMR_BUILD_INTERP}, 1)
|
||||
$(NAME)_SOURCES += ${IWASM_ROOT}/interpreter/wasm_interp.c \
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
@ -4,22 +4,23 @@
|
||||
cmake_minimum_required (VERSION 3.4.1)
|
||||
|
||||
set (CMAKE_VERBOSE_MAKEFILE on)
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
|
||||
set (CMAKE_TOOLCHAIN_FILE "$ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")
|
||||
set (ANDROID_NDK $ENV{ANDROID_NDK_HOME})
|
||||
set (ANDROID_SDK $ENV{ANDROID_SDK_HOME})
|
||||
set (ANDROID_ABI "armeabi-v7a")
|
||||
set (ANDROID_ABI "x86")
|
||||
set (ANDROID_LD lld)
|
||||
|
||||
project (iwasm)
|
||||
|
||||
set (WAMR_BUILD_PLATFORM "android")
|
||||
set (WAMR_BUILD_TARGET "ARMv7")
|
||||
set (WAMR_BUILD_TYPE Debug)
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
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 0)
|
||||
set (CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
# Reset default linker flags
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
@ -89,8 +90,12 @@ 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} ext_lib_export.c)
|
||||
add_library (iwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE})
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
target_link_libraries (iwasm ${LLVM_AVAILABLE_LIBS} -lm -ldl -landroid -llog -s)
|
||||
else()
|
||||
target_link_libraries (iwasm ${LLVM_AVAILABLE_LIBS} -lm -ldl -landroid -llog)
|
||||
endif()
|
||||
|
||||
set (distribution_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/distribution)
|
||||
set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib")
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
@ -62,7 +62,7 @@ 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_executable (iwasm main.c ext_lib_export.c)
|
||||
add_executable (iwasm main.c)
|
||||
|
||||
install (TARGETS iwasm DESTINATION bin)
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
@ -113,4 +113,3 @@ add_library (vmlib
|
||||
${IWASM_AOT_SOURCE}
|
||||
${IWASM_COMPL_SOURCE})
|
||||
|
||||
add_library (extlib ext_lib_export.c)
|
||||
|
||||
@ -96,7 +96,7 @@ Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fst
|
||||
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 libextlib.a \
|
||||
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 \
|
||||
@ -174,11 +174,7 @@ libvmlib.a: ../build/libvmlib.a
|
||||
@cp $< $@
|
||||
@echo "CP $@ <= $<"
|
||||
|
||||
libextlib.a: ../build/libextlib.a
|
||||
@cp $< $@
|
||||
@echo "CP $@ <= $<"
|
||||
|
||||
$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) libvmlib.a libextlib.a
|
||||
$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) libvmlib.a
|
||||
@$(CXX) $^ -o $@ $(Enclave_Link_Flags)
|
||||
@echo "LINK => $@"
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
@ -76,7 +76,7 @@ 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_executable (iwasm main.c ext_lib_export.c)
|
||||
add_executable (iwasm main.c)
|
||||
|
||||
install (TARGETS iwasm DESTINATION bin)
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
@ -66,7 +66,7 @@ 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_executable (iwasm main.c ext_lib_export.c)
|
||||
add_executable (iwasm main.c)
|
||||
|
||||
install (TARGETS iwasm DESTINATION bin)
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
@ -80,6 +80,5 @@ set (VM_LIB_SRCS
|
||||
|
||||
target_sources(app PRIVATE
|
||||
${VM_LIB_SRCS}
|
||||
src/main.c
|
||||
src/ext_lib_export.c)
|
||||
src/main.c)
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "lib_export.h"
|
||||
|
||||
static NativeSymbol extended_native_symbol_defs[] = { };
|
||||
|
||||
#include "ext_lib_export.h"
|
||||
Reference in New Issue
Block a user