package/llvm: Support for RISC-V on the LLVM package
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(-)
package/llvm/Config.in +10 -0
@@ -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"
package/llvm/llvm.mk +1 -1
@@ -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 $(space),;,$(LLVM_TARGETS_TO_BUILD))"
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 arch/riscv: Added support for RISC-V vector extension on the architecture menu.
This new setting will allow to test new toolchains already available that support the vector extension (more patches coming soon).
--- arch/Config.in.riscv | 7 +++++++ arch/arch.mk.riscv | 4 ++++ 2 files changed, 11 insertions(+)
arch/Config.in.riscv +7 -0
@@ -18,6 +18,9 @@ config BR2_RISCV_ISA_RVD config BR2_RISCV_ISA_RVC bool +config BR2_RISCV_ISA_RVV + bool + choice prompt "Target Architecture Variant" default BR2_riscv_g
@@ -63,6 +66,10 @@ config BR2_RISCV_ISA_CUSTOM_RVD config BR2_RISCV_ISA_CUSTOM_RVC bool "Compressed Instructions (C)" select BR2_RISCV_ISA_RVC + +config BR2_RISCV_ISA_CUSTOM_RVV + bool "Vector Instructions (V)" + select BR2_RISCV_ISA_RVV endif choice
arch/arch.mk.riscv +4 -0
@@ -26,5 +26,9 @@ endif ifeq ($(BR2_RISCV_ISA_RVC),y) GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c endif +ifeq ($(BR2_RISCV_ISA_RVV),y) +GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)v +endif + endif
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] arch/riscv: Added support for RISC-V vector extension on the architecture menu.
Hello Adel,
Le 04/07/2022 à 10:55, Abel Bernabeu a écrit :
Quoted 2 lines
This new setting will allow to test new toolchains already available that support the vector extension (more patches coming soon).
We received a similar patch [1] from another contributor. Actually this is the same content with the same missing dependency on gcc-12.
See also a comment [2]:
"Yes, V definitely needs an option, as there will clearly be Linux-capable RISC-V cores that do not implement the V extension.
The option for the V extension will have to select BR2_ARCH_NEEDS_GCC_AT_LEAST_12."
[1] http://lists.busybox.net/pipermail/buildroot/2022-June/645381.html
[2] http://lists.busybox.net/pipermail/buildroot/2022-July/646724.html
See how to review patches:
https://nightly.buildroot.org/manual.html#_reviewing_and_testing_patches
I have marked this patch as "Changes Requested".
Best regards,
Romain
Quoted 37 lines
Signed-off-by Abel Bernabeu <[email protected]>--- arch/Config.in.riscv | 7 +++++++ arch/arch.mk.riscv | 4 ++++ 2 files changed, 11 insertions(+)arch/Config.in.riscv +7
-0@@ -18,6 +18,9 @@ config BR2_RISCV_ISA_RVD config BR2_RISCV_ISA_RVC bool +config BR2_RISCV_ISA_RVV + bool + choice prompt "Target Architecture Variant" default BR2_riscv_g@@ -63,6 +66,10 @@ config BR2_RISCV_ISA_CUSTOM_RVD config BR2_RISCV_ISA_CUSTOM_RVC bool "Compressed Instructions (C)" select BR2_RISCV_ISA_RVC + +config BR2_RISCV_ISA_CUSTOM_RVV + bool "Vector Instructions (V)" + select BR2_RISCV_ISA_RVV endif choicearch/arch.mk.riscv +0
-0
arch/arch.mk.riscv endif · line 34
Quoted 9 lines
arch/arch.mk.riscv +4
-0@@ -26,5 +26,9 @@ endif ifeq ($(BR2_RISCV_ISA_RVC),y) GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c endif +ifeq ($(BR2_RISCV_ISA_RVV),y) +GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)v +endif + endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Abel,
Le 04/07/2022 à 10:55, Abel Bernabeu a écrit :
Quoted 2 lines
The initial support for the LLVM package did not include RISC-V, and needed to be added.
Indeed, at the time LLVM package was added to Buildroot there was no RISC-V support yet.
Quoted 25 lines
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.
Signed-off-by Abel Bernabeu <[email protected]>--- package/llvm/Config.in | 10 ++++++++++ package/llvm/llvm.mk | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)package/llvm/Config.in +0
-0@@ -4,12 +4,22 @@ config BR2_PACKAGE_LLVM_ARCH_SUPPORTS default y if BR2_x86_64 default y if BR2_aarch64
package/llvm/Config.in config BR2_PACKAGE_LLVM_ARCH_SUPPORTS · line 15
Quoted 10 lines
package/llvm/Config.in +3
-0default 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
Indentation issue, please use one tab.
package/llvm/Config.in config BR2_PACKAGE_LLVM_ARCH_SUPPORTS · line 22
Quoted 7 lines
package/llvm/Config.in +7
-0+ +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
Having to duplicate BR2_PACKAGE_LLVM_TARGET_ARCH for the sake of one architecture is a pity.
Maybe we can try to use $(subst ...) to replace riscv32|64 by RISCV but it's not really a clean solution either....
Best regards,
Romain
Quoted 8 lines
package/llvm/Config.in +0
-0config BR2_PACKAGE_LLVM bool "llvm"package/llvm/llvm.mk +0
-0
package/llvm/llvm.mk HOST_LLVM_CONF_OPTS += -DCMAKE_INSTALL_RPATH="$(HOST_DIR)/lib" · line 48
Quoted 8 lines
package/llvm/llvm.mk +1
-1@@ -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 $(space),;,$(LLVM_TARGETS_TO_BUILD))"
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot