@@ -4,12 +4,22 @@ 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_TARGETS_TO_BUILD
+ string
+ default "AArch64" if BR2_aarch64
+ default "ARM" if BR2_arm || BR2_armeb
+ default "X86" if BR2_i386 || BR2_x86_64
+ default "RISCV" if BR2_riscv
config BR2_PACKAGE_LLVM
bool "llvm"
@@ -42,7 +42,7 @@ HOST_LLVM_CONF_OPTS +=
-DCMAKE_INSTALL_RPATH="$(HOST_DIR)/lib"
LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
# Build backend for target architecture. This include backends like AMDGPU.
-LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH)
+LLVM_TARGETS_TO_BUILD = $(BR2_PACKAGE_LLVM_TARGETS_TO_BUILD)
HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst
$(space),;,$(LLVM_TARGETS_TO_BUILD))"
LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst
From 254bc67341f9180a1068551a5beeeaab0be06301 Mon Sep 17 00:00:00 2001 From: Abel Bernabeu <abel@x-silicon.com> Date: Mon, 4 Jul 2022 00:32:47 +0200 Subject: [PATCH 1/2] 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. There is a new configuration parameter added (BR2_PACKAGE_LLVM_TARGETS_TO_BUILD) for dealing with the fact that the LLVM target and the architecture have different naming for RISC-V. While the target for RISC-V is "RISCV" irrespective of the ISA being 32 or 64 bits, the architecture does contain the number of bits leading to "riscv32" and "riscv64". For previously supported architectures the naming for target and architecture matched and thus this parameter had not been needed, but it is now needed for RISC-V. --- package/llvm/Config.in | 10 ++++++++++ package/llvm/llvm.mk | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) $(space),;,$(LLVM_TARGETS_TO_BUILD))"