Implement AOT support for RISCV (#649)

Enable RISCV AOT support, the supported ABIs are LP64 and LP64D for riscv64, ILP32 and ILP32D for riscv32.
For wamrc:
    use --target=riscv64/riscv32 to specify the target arch of output AOT file,
    use --target-abi=lp64d/lp64/ilp32d/ilp32 to specify the target ABI,
    if --target-abi isn't specified, by default lp64d is used for riscv64, and ilp32d is used for riscv32.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Co-authored-by: wenyongh <wenyong.huang@intel.com>
This commit is contained in:
Huang Qi
2021-07-22 11:16:47 +08:00
committed by GitHub
parent ea06c19a9d
commit e4023c8e02
29 changed files with 667 additions and 459 deletions

View File

@ -72,27 +72,25 @@ ifeq (${CONFIG_ARCH_FPU},y)
$(error riscv64 lp64f is unsupported)
else ifeq (${CONFIG_ARCH_DPFPU}, y)
CFLAGS += -DBUILD_TARGET_RISCV64_LP64D
INVOKE_NATIVE += invokeNative_riscv64_lp64d.s
else
CFLAGS += -DBUILD_TARGET_RISCV64_LP64
INVOKE_NATIVE += invokeNative_riscv64_lp64.s
endif
INVOKE_NATIVE += invokeNative_riscv.S
AOT_RELOC :=
AOT_RELOC := aot_reloc_riscv.c
else ifeq (${WAMR_BUILD_TARGET}, RISCV32)
ifeq (${CONFIG_ARCH_FPU}, y)
$(error riscv32 ilp32f is unsupported)
else ifeq (${CONFIG_ARCH_DPFPU}, y)
CFLAGS += -DBUILD_TARGET_RISCV64_ILP32D
INVOKE_NATIVE += invokeNative_riscv32_ilp32d.s
CFLAGS += -DBUILD_TARGET_RISCV32_ILP32D
else
CFLAGS += -DBUILD_TARGET_RISCV64_ILP32
INVOKE_NATIVE += invokeNative_riscv32_ilp32.s
CFLAGS += -DBUILD_TARGET_RISCV32_ILP32
endif
AOT_RELOC :=
INVOKE_NATIVE += invokeNative_riscv.S
AOT_RELOC := aot_reloc_riscv.c
else
$(error Build target is unsupported)
@ -182,7 +180,8 @@ CFLAGS += -Wno-strict-prototypes -Wno-shadow -Wno-unused-variable
CFLAGS += -Wno-int-conversion -Wno-implicit-function-declaration
CFLAGS += -I${CORE_ROOT} \
-I${IWASM_ROOT}/include \
-I${IWASM_ROOT}/include \
-I${IWASM_ROOT}/interpreter \
-I${IWASM_ROOT}/common \
-I${IWASM_ROOT}/libraries/thread-mgr \
-I${SHARED_ROOT}/include \
@ -218,7 +217,8 @@ CSRCS += nuttx_platform.c \
wasm_runtime_common.c \
wasm_native.c \
wasm_exec_env.c \
wasm_memory.c
wasm_memory.c \
wasm_c_api.c
ASRCS += ${INVOKE_NATIVE}