mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 15:05:19 +00:00
Enable to build wamrc with custom llvm and fix some compile warnings (#672)
Enable to build wamrc with custom llvm, enable to auto detect processor on apple silicon, and fix some compile warnings. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
28f104036c
commit
586752735b
|
@ -2479,7 +2479,7 @@ wasm_func_call(const wasm_func_t *func,
|
||||||
param_count = wasm_func_param_arity(func);
|
param_count = wasm_func_param_arity(func);
|
||||||
result_count = wasm_func_result_arity(func);
|
result_count = wasm_func_result_arity(func);
|
||||||
alloc_count = (param_count > result_count) ? param_count : result_count;
|
alloc_count = (param_count > result_count) ? param_count : result_count;
|
||||||
if (alloc_count > sizeof(argv_buf) / sizeof(uint64)) {
|
if (alloc_count > (size_t)sizeof(argv_buf) / sizeof(uint64)) {
|
||||||
if (!(argv = malloc_internal(sizeof(uint64) * alloc_count))) {
|
if (!(argv = malloc_internal(sizeof(uint64) * alloc_count))) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,8 +339,7 @@ static os_thread_local_attribute uint8 *sigalt_stack_base_addr;
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#pragma clang optimize off
|
#pragma clang optimize off
|
||||||
#endif
|
#elif defined(__GNUC__)
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC push_options
|
#pragma GCC push_options
|
||||||
#pragma GCC optimize("O0")
|
#pragma GCC optimize("O0")
|
||||||
__attribute__((no_sanitize_address))
|
__attribute__((no_sanitize_address))
|
||||||
|
@ -361,11 +360,10 @@ touch_pages(uint8 *stack_min_addr, uint32 page_size)
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
#if defined(__GNUC__)
|
|
||||||
#pragma GCC pop_options
|
|
||||||
#endif
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#pragma clang optimize on
|
#pragma clang optimize on
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC pop_options
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
@ -19,7 +19,7 @@ typedef struct _app_timer {
|
||||||
bool is_periodic;
|
bool is_periodic;
|
||||||
} app_timer_t;
|
} app_timer_t;
|
||||||
|
|
||||||
typedef struct _timer_ctx {
|
struct _timer_ctx {
|
||||||
app_timer_t *app_timers;
|
app_timer_t *app_timers;
|
||||||
app_timer_t *idle_timers;
|
app_timer_t *idle_timers;
|
||||||
app_timer_t *free_timers;
|
app_timer_t *free_timers;
|
||||||
|
@ -33,7 +33,7 @@ typedef struct _timer_ctx {
|
||||||
|
|
||||||
timer_callback_f timer_callback;
|
timer_callback_f timer_callback;
|
||||||
check_timer_expiry_f refresh_checker;
|
check_timer_expiry_f refresh_checker;
|
||||||
} *timer_ctx_t;
|
};
|
||||||
|
|
||||||
uint64
|
uint64
|
||||||
bh_get_tick_ms()
|
bh_get_tick_ms()
|
||||||
|
|
|
@ -50,6 +50,10 @@ if (NOT WAMR_BUILD_TARGET)
|
||||||
if (("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32"))
|
if (("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32"))
|
||||||
set (WAMR_BUILD_TARGET "X86_32")
|
set (WAMR_BUILD_TARGET "X86_32")
|
||||||
endif()
|
endif()
|
||||||
|
elseif (WAMR_BUILD_PLATFORM STREQUAL "darwin")
|
||||||
|
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||||
|
set (WAMR_BUILD_TARGET "AARCH64")
|
||||||
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -107,17 +111,19 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Enable LLVM
|
# Enable LLVM
|
||||||
set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm")
|
if (NOT WAMR_BUILD_WITH_CUSTOM_LLVM)
|
||||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm")
|
||||||
if (NOT EXISTS "${LLVM_SRC_ROOT}/win32build")
|
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||||
message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_SRC_ROOT}/win32build")
|
if (NOT EXISTS "${LLVM_SRC_ROOT}/win32build")
|
||||||
|
message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_SRC_ROOT}/win32build")
|
||||||
|
endif ()
|
||||||
|
set (CMAKE_PREFIX_PATH "${LLVM_SRC_ROOT}/win32build;${CMAKE_PREFIX_PATH}")
|
||||||
|
else()
|
||||||
|
if (NOT EXISTS "${LLVM_SRC_ROOT}/build")
|
||||||
|
message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_SRC_ROOT}/build")
|
||||||
|
endif ()
|
||||||
|
set (CMAKE_PREFIX_PATH "${LLVM_SRC_ROOT}/build;${CMAKE_PREFIX_PATH}")
|
||||||
endif ()
|
endif ()
|
||||||
set (CMAKE_PREFIX_PATH "${LLVM_SRC_ROOT}/win32build;${CMAKE_PREFIX_PATH}")
|
|
||||||
else()
|
|
||||||
if (NOT EXISTS "${LLVM_SRC_ROOT}/build")
|
|
||||||
message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_SRC_ROOT}/build")
|
|
||||||
endif ()
|
|
||||||
set (CMAKE_PREFIX_PATH "${LLVM_SRC_ROOT}/build;${CMAKE_PREFIX_PATH}")
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
find_package(LLVM REQUIRED CONFIG)
|
find_package(LLVM REQUIRED CONFIG)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user