https://github.com/gentoo/gentoo/pull/33996
To be used in support of dev-lang/rust under crossdev. Cross-compiled
rust needs LLVM with support for both host and destination targets.
Bug:
https://bugs.gentoo.org/680652
Signed-off-by: Matoro Mahri <
matoro_gentoo@matoro.tk>
---
eclass/llvm.eclass | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 57faa48819db..c54fea1b8c50 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -174,6 +174,37 @@ get_llvm_prefix() {
echo "${prefix}/usr/lib/llvm/$(get_llvm_slot "${@}")"
}
+# @FUNCTION: get_llvm_target
+# @USAGE: [<tuple>]
+# @DESCRIPTION:
+# Translate a tuple into a target suitable for LLVM_TARGETS.
+# Defaults to ${CHOST} if not specified.
+get_llvm_target() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ case "${1:-${CHOST}}" in
+ aarch64*) echo "AArch64";;
+ amdgcn*) echo "AMDGPU";;
+ arc*) echo "ARC";;
+ arm*) echo "ARM";;
+ avr*) echo "AVR";;
+ bpf*) echo "BPF";;
+ csky*) echo "CSKY";;
+ loong*) echo "LoongArch";;
+ m68k*) echo "M68k";;
+ mips*) echo "Mips";;
+ msp430*) echo "MSP430";;
+ nvptx*) echo "NVPTX";;
+ powerpc*) echo "PowerPC";;
+ riscv*) echo "RISCV";;
+ sparc*) echo "Sparc"