Add BUILD_TARGET setting in makefile (#135)
This commit is contained in:
@ -52,7 +52,7 @@ extend_vector(Vector *vector, uint32 length)
|
||||
}
|
||||
|
||||
memcpy(data, vector->data, vector->size_elem * vector->max_elements);
|
||||
free(vector->data);
|
||||
wasm_free(vector->data);
|
||||
vector->data = data;
|
||||
vector->max_elements = length;
|
||||
return true;
|
||||
|
||||
@ -15,9 +15,14 @@
|
||||
*/
|
||||
.text
|
||||
.align 2
|
||||
#ifndef OS_MACOSX
|
||||
.globl invokeNative
|
||||
.type invokeNative, @function
|
||||
invokeNative:
|
||||
#else
|
||||
.globl _invokeNative
|
||||
_invokeNative:
|
||||
#endif /* end of OS_MACOSX */
|
||||
/* rdi - function ptr */
|
||||
/* rsi - argv */
|
||||
/* rdx - n_stacks */
|
||||
|
||||
@ -16,9 +16,14 @@
|
||||
|
||||
.text
|
||||
.align 2
|
||||
#ifndef OS_MACOSX
|
||||
.globl invokeNative
|
||||
.type invokeNative, @function
|
||||
invokeNative:
|
||||
#else
|
||||
.globl _invokeNative
|
||||
_invokeNative:
|
||||
#endif /* end of OS_MACOSX */
|
||||
push %ebp
|
||||
movl %esp, %ebp
|
||||
movl 16(%ebp), %ecx /* ecx = argc */
|
||||
|
||||
@ -20,10 +20,18 @@ include_directories(${VMCORE_LIB_DIR}/../include)
|
||||
file (GLOB_RECURSE c_source_all ${VMCORE_LIB_DIR}/*.c)
|
||||
list (REMOVE_ITEM c_source_all ${VMCORE_LIB_DIR}/invokeNative_general.c)
|
||||
|
||||
if (${BUILD_AS_64BIT_SUPPORT} STREQUAL "YES")
|
||||
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_em64.s)
|
||||
if (${BUILD_TARGET} STREQUAL "X86_64" OR ${BUILD_TARGET} STREQUAL "AMD_64")
|
||||
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_em64.s)
|
||||
elseif (${BUILD_TARGET} STREQUAL "X86_32")
|
||||
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_ia32.s)
|
||||
elseif (${BUILD_TARGET} STREQUAL "ARM_32")
|
||||
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_arm.s)
|
||||
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)
|
||||
else ()
|
||||
set (source_all ${c_source_all} ${VMCORE_LIB_DIR}/invokeNative_ia32.s)
|
||||
message (FATAL_ERROR "Build target isn't set")
|
||||
endif ()
|
||||
|
||||
set (VMCORE_LIB_SOURCE ${source_all})
|
||||
|
||||
@ -1458,7 +1458,7 @@ word_copy(uint32 *dest, uint32 *src, unsigned num)
|
||||
(addr)[1] = u.parts[1]; \
|
||||
} while (0)
|
||||
|
||||
#if !defined(__x86_64__) && !defined(__amd_64__)
|
||||
#if !defined(BUILD_TARGET_X86_64) && !defined(BUILD_TARGET_AMD_64)
|
||||
|
||||
typedef void (*GenericFunctionPointer)();
|
||||
int64 invokeNative(GenericFunctionPointer f, uint32 *args, uint32 sz);
|
||||
@ -1483,7 +1483,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
|
||||
uint32 argv_buf[32], *argv1 = argv_buf, argc1, i, j = 0;
|
||||
uint64 size;
|
||||
|
||||
#if !defined(__arm__) && !defined(__mips__)
|
||||
#if !defined(BUILD_TARGET_ARM_32) && !defined(BUILD_TARGET_MIPS_32)
|
||||
argc1 = argc + 2;
|
||||
#else
|
||||
argc1 = func_type->param_count * 2 + 2;
|
||||
@ -1501,7 +1501,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
|
||||
for (i = 0; i < sizeof(WASMModuleInstance*) / sizeof(uint32); i++)
|
||||
argv1[j++] = ((uint32*)&module_inst)[i];
|
||||
|
||||
#if !defined(__arm__) && !defined(__mips__)
|
||||
#if !defined(BUILD_TARGET_ARM_32) && !defined(BUILD_TARGET_MIPS_32)
|
||||
word_copy(argv1 + j, argv, argc);
|
||||
j += argc;
|
||||
#else
|
||||
@ -1526,7 +1526,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* end of !defined(BUILD_TARGET_ARM_32) && !defined(BUILD_TARGET_MIPS_32) */
|
||||
|
||||
argc1 = j;
|
||||
if (func_type->result_count == 0) {
|
||||
@ -1557,7 +1557,7 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
|
||||
return true;
|
||||
}
|
||||
|
||||
#else /* else of !defined(__x86_64__) && !defined(__amd_64__) */
|
||||
#else /* else of !defined(BUILD_TARGET_X86_64) && !defined(BUILD_TARGET_AMD_64) */
|
||||
|
||||
typedef void (*GenericFunctionPointer)();
|
||||
int64 invokeNative(GenericFunctionPointer f, uint64 *args, uint64 n_stacks);
|
||||
@ -1675,5 +1675,5 @@ wasm_runtime_invoke_native(void *func_ptr, WASMType *func_type,
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* end of !defined(__x86_64__) && !defined(__amd_64__) */
|
||||
#endif /* end of !defined(BUILD_TARGET_X86_64) && !defined(BUILD_TARGET_AMD_64) */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user