From 3245d4fec858b55053ccaf44bf30f5f4f9d1d4e8 Mon Sep 17 00:00:00 2001 From: wenyongh Date: Tue, 5 Nov 2019 08:54:19 +0800 Subject: [PATCH] Add build target general --- core/iwasm/products/vxworks/CMakeLists.txt | 14 +++++++++++++- core/iwasm/runtime/vmcore-wasm/vmcore.cmake | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/iwasm/products/vxworks/CMakeLists.txt b/core/iwasm/products/vxworks/CMakeLists.txt index 31618df7e..53aa42788 100644 --- a/core/iwasm/products/vxworks/CMakeLists.txt +++ b/core/iwasm/products/vxworks/CMakeLists.txt @@ -32,13 +32,17 @@ if (NOT ("$ENV{VALGRIND}" STREQUAL "YES")) endif () # Set BUILD_TARGET, currently values supported: -# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32" +# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32", "GENERAL" +#set (BUILD_TARGET "X86_64") + if (NOT BUILD_TARGET) if (CMAKE_SIZEOF_VOID_P EQUAL 8) # Build as X86_64 by default in 64-bit platform + # if BUILD_TARGET isn't set set (BUILD_TARGET "X86_64") else () # Build as X86_32 by default in 32-bit platform + # if BUILD_TARGET isn't set set (BUILD_TARGET "X86_32") endif () endif () @@ -58,6 +62,14 @@ elseif (BUILD_TARGET STREQUAL "MIPS_32") add_definitions(-DBUILD_TARGET_MIPS_32) elseif (BUILD_TARGET STREQUAL "XTENSA_32") add_definitions(-DBUILD_TARGET_XTENSA_32) +elseif (BUILD_TARGET STREQUAL "GENERAL") + # Will use invokeNative_general.c instead of assembly code, + # but the maximum number of native arguments is limited to 20, + # and there are possible issues when passing arguments to + # native function for some cpus, e.g. int64 and double arguments + # in arm and mips need to be 8-bytes aligned, and some arguments + # of x86_64 are passed by registers but not stack + add_definitions(-DBUILD_TARGET_GENERAL) else () message (FATAL_ERROR "-- Build target isn't set") endif () diff --git a/core/iwasm/runtime/vmcore-wasm/vmcore.cmake b/core/iwasm/runtime/vmcore-wasm/vmcore.cmake index cf3d4e0b5..ff69c003d 100644 --- a/core/iwasm/runtime/vmcore-wasm/vmcore.cmake +++ b/core/iwasm/runtime/vmcore-wasm/vmcore.cmake @@ -30,6 +30,8 @@ elseif (${BUILD_TARGET} STREQUAL "MIPS_32") set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_mips.s) elseif (${BUILD_TARGET} STREQUAL "XTENSA_32") set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_xtensa.s) +elseif (${BUILD_TARGET} STREQUAL "GENERAL") + set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_general.c) else () message (FATAL_ERROR "Build target isn't set") endif ()