From 88cac04de3c256cfdb629a181c5e0d5d4b3725c2 Mon Sep 17 00:00:00 2001 From: Abel Bernabeu Date: Mon, 4 Jul 2022 10:55:51 +0200 Subject: [PATCH] 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 Reviewed-by: Romain Naour Signed-off-by: Thomas Petazzoni --- package/llvm/Config.in | 3 +++ package/llvm/llvm.mk | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package/llvm/Config.in b/package/llvm/Config.in index c1887e36dd..768af4971e 100644 --- a/package/llvm/Config.in +++ b/package/llvm/Config.in @@ -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" diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index 4670773ca3..977c0a08c2 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -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))"