wamr: Add support for thumb target triple in Toolchain.defs

Before WAMR 1.3.0, eabihf in wamrc is `gnueabihf`, so without
this patch call wamrc will failed with target abi was `eabihf`,
we should convert the standard llvm target to wamrc required.

Both `eabihf` and `gnueabihf` supported after WAMR 1.3.0.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2023-11-10 15:26:26 +08:00 committed by Xiang Xiao
parent 3129b7a465
commit f55b8face6

View File

@ -37,16 +37,35 @@ else ifeq ($(CONFIG_ARCH_SIM),y)
else
WTARGET = x86_64
endif
else
else ifeq ($(findstring thumb,$(LLVM_ARCHTYPE)),thumb)
# Flags for other architectures (arm or riscv)
WTARGET = $(LLVM_ARCHTYPE)
WCPU = $(LLVM_CPUTYPE)
# target triple of thumb may very complex, such as thumbv8m.main+dsp+mve.fp+fp.dp
# so we just use the target name before the first plus sign
WTARGET = $(shell echo $(LLVM_ARCHTYPE) | cut -d'+' -f1)
endif
RCFLAGS += --target=$(WTARGET) --target-abi=$(LLVM_ABITYPE) --cpu=$(WCPU)
# If WTARGET is not defined, then use the same as LLVM_ARCHTYPE
ifeq ($(WTARGET),)
WTARGET = $(LLVM_ARCHTYPE)
endif
# If WCPU is not defined, then use the same as LLVM_CPU
ifeq ($(WCPU),)
WCPU = $(LLVM_CPUTYPE)
endif
# If LLVM_ABITYPE is eabihf, then convert it to gnueabihf which is used by wamrc
ifeq ($(LLVM_ABITYPE),eabihf)
WABITYPE = gnueabihf
else
WABITYPE = $(LLVM_ABITYPE)
endif
RCFLAGS += --target=$(WTARGET) --target-abi=$(WABITYPE) --cpu=$(WCPU)
define WAMR_AOT_COMPILE
$(if $(wildcard $(APPDIR)$(DELIM)wasm$(DELIM)*.wo), \