package/llvm: Support for RISC-V on the LLVM package

The initial support for the LLVM package did not include RISC-V, and
needed to be added. Some special casing is needed for the
LLVM_TARGETS_TO_BUILD variable, which expects a RISCV value regardless
of whether riscv32 or riscv64 is chosen.

Signed-off-by: Abel Bernabeu <abel@x-silicon.com>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Abel Bernabeu 2022-07-04 10:55:51 +02:00 committed by Thomas Petazzoni
parent b265fa5c7f
commit 88cac04de3
2 changed files with 9 additions and 1 deletions

View File

@ -4,12 +4,15 @@ config BR2_PACKAGE_LLVM_ARCH_SUPPORTS
default y if BR2_x86_64
default y if BR2_aarch64
default y if BR2_arm || BR2_armeb
default y if BR2_riscv
config BR2_PACKAGE_LLVM_TARGET_ARCH
string
default "AArch64" if BR2_aarch64
default "ARM" if BR2_arm || BR2_armeb
default "X86" if BR2_i386 || BR2_x86_64
default "riscv32" if BR2_riscv && !BR2_ARCH_IS_64
default "riscv64" if BR2_riscv && BR2_ARCH_IS_64
config BR2_PACKAGE_LLVM
bool "llvm"

View File

@ -41,8 +41,13 @@ HOST_LLVM_CONF_OPTS += -DCMAKE_INSTALL_RPATH="$(HOST_DIR)/lib"
# Get target architecture
LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
# Build backend for target architecture. This include backends like AMDGPU.
# Build backend for target architecture. This include backends like
# AMDGPU. We need to special case RISCV.
ifneq ($(filter riscv%,$(LLVM_TARGET_ARCH)),)
LLVM_TARGETS_TO_BUILD = RISCV
else
LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH)
endif
HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"
LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"