Skip to content

Commit

Permalink
Merge pull request #299 from bytecodealliance/main
Browse files Browse the repository at this point in the history
Enable to build wamrc with custom llvm and fix some compile warnings …
  • Loading branch information
wenyongh authored Jul 26, 2021
2 parents 75e44dc + 5867527 commit 1db2554
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion core/iwasm/common/wasm_c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,7 @@ wasm_func_call(const wasm_func_t *func,
param_count = wasm_func_param_arity(func);
result_count = wasm_func_result_arity(func);
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))) {
goto failed;
}
Expand Down
8 changes: 3 additions & 5 deletions core/shared/platform/common/posix/posix_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ static os_thread_local_attribute uint8 *sigalt_stack_base_addr;

#if defined(__clang__)
#pragma clang optimize off
#endif
#if defined(__GNUC__)
#elif defined(__GNUC__)
#pragma GCC push_options
#pragma GCC optimize("O0")
__attribute__((no_sanitize_address))
Expand All @@ -361,11 +360,10 @@ touch_pages(uint8 *stack_min_addr, uint32 page_size)
}
return sum;
}
#if defined(__GNUC__)
#pragma GCC pop_options
#endif
#if defined(__clang__)
#pragma clang optimize on
#elif defined(__GNUC__)
#pragma GCC pop_options
#endif

static bool
Expand Down
4 changes: 2 additions & 2 deletions core/shared/utils/runtime_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct _app_timer {
bool is_periodic;
} app_timer_t;

typedef struct _timer_ctx {
struct _timer_ctx {
app_timer_t *app_timers;
app_timer_t *idle_timers;
app_timer_t *free_timers;
Expand All @@ -33,7 +33,7 @@ typedef struct _timer_ctx {

timer_callback_f timer_callback;
check_timer_expiry_f refresh_checker;
} *timer_ctx_t;
};

uint64
bh_get_tick_ms()
Expand Down
26 changes: 16 additions & 10 deletions wamr-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ if (NOT WAMR_BUILD_TARGET)
if (("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32"))
set (WAMR_BUILD_TARGET "X86_32")
endif()
elseif (WAMR_BUILD_PLATFORM STREQUAL "darwin")
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set (WAMR_BUILD_TARGET "AARCH64")
endif ()
endif()
endif ()

Expand Down Expand Up @@ -107,17 +111,19 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif ()

# Enable LLVM
set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm")
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
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")
if (NOT WAMR_BUILD_WITH_CUSTOM_LLVM)
set (LLVM_SRC_ROOT "${PROJECT_SOURCE_DIR}/../core/deps/llvm")
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
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 ()
set (CMAKE_PREFIX_PATH "${LLVM_SRC_ROOT}/build;${CMAKE_PREFIX_PATH}")
endif ()

find_package(LLVM REQUIRED CONFIG)
Expand Down

0 comments on commit 1db2554

Please sign in to comment.