Enable sample/simple for aarch64 (#616)

Fixed a typo in aot_reloc_aarch64.c.
Remove -m32 option in host tool CMakeLists.txt and change data type of structure fields to make host tool work in 64-bit.

Signed-off-by: Bao Haojun <baohaojun@lixiang.com>
This commit is contained in:
Bao Haojun 2021-04-25 19:12:49 +08:00 committed by GitHub
parent 684d766e2b
commit a332a49a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 94 additions and 8 deletions

View File

@ -60,7 +60,7 @@ get_current_target(char *target_buf, uint32 target_buf_size)
char *d = target_buf;
/* Set to "aarch64v8" by default if sub version isn't specified */
if (strcmp(s, "AARACH64") == 0) {
if (strcmp(s, "AARCH64") == 0) {
s = BUILD_TARGET_AARCH64_DEFAULT;
s_size = sizeof(BUILD_TARGET_AARCH64_DEFAULT);
}
@ -385,4 +385,3 @@ overflow_check_fail:
"target address out of range.");
return false;
}

View File

@ -0,0 +1,36 @@
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Linux) # this one is important
SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
message(STATUS "*** ARM A7 toolchain file ***")
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
endif ()
if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
endif ()
message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-g++)
# this is the file system root of the target
SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -0,0 +1,10 @@
set (WAMR_BUILD_PLATFORM "linux")
set (WAMR_BUILD_TARGET AARCH64)
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_AOT 1)
set (WAMR_BUILD_JIT 0)
set (WAMR_BUILD_SIMD 0)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 0)
set (WAMR_BUILD_APP_FRAMEWORK 1)
set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)

View File

@ -0,0 +1,36 @@
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Linux) # this one is important
SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
message(STATUS "*** ARM A7 toolchain file ***")
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
if (NOT $ENV{ARM_A7_COMPILER_DIR} STREQUAL "")
SET (toolchain_sdk_dir $ENV{ARM_A7_COMPILER_DIR}/)
endif ()
if (NOT $ENV{ARM_A7_SDKTARGETSYSROOT} STREQUAL "")
SET(SDKTARGETSYSROOT $ENV{ARM_A7_SDKTARGETSYSROOT})
endif ()
message(STATUS "SDKTARGETSYSROOT=${SDKTARGETSYSROOT}")
message(STATUS "toolchain_sdk_dir=${toolchain_sdk_dir}")
SET(CMAKE_C_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-gcc)
SET(CMAKE_CXX_COMPILER ${toolchain_sdk_dir}aarch64-linux-gnu-g++)
# this is the file system root of the target
SET(CMAKE_FIND_ROOT_PATH ${SDKTARGETSYSROOT})
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -0,0 +1,10 @@
set (WAMR_BUILD_PLATFORM "linux")
set (WAMR_BUILD_TARGET AARCH64)
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_AOT 0)
set (WAMR_BUILD_JIT 0)
set (WAMR_BUILD_SIMD 0)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 0)
set (WAMR_BUILD_APP_FRAMEWORK 1)
set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)

View File

@ -34,11 +34,6 @@ include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
include (${CJSON_DIR}/cjson.cmake)
include (${SHARED_DIR}/coap/lib_coap.cmake)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
endif ()
add_definitions(-Wall -Wno-pointer-sign)
include_directories(

View File

@ -13,7 +13,7 @@ extern "C" {
/* IMRT link message between host and WAMR */
typedef struct {
unsigned short message_type;
unsigned long payload_size;
unsigned int payload_size;
char *payload;
} imrt_link_message_t;