Subject: [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 09 Jun 2023 23:12:28 +0200

Hi,

Z572 <[email-masked]> skribis:

> +(define* (system->llvm-target-arch #:optional
> +                                   (system (or (and=> (%current-target-system)
> +                                                      gnu-triplet->nix-system)
> +                                               (%current-system))))
> +  "Return the LLVM target arch name that corresponds to SYSTEM, a system type such
> +as \"x86_64-linux\"."
> +  ;; See the 'cmake/config-ix.cmake' file of LLVM for a list of supported targets arch.
> +  ;; start with # Determine the native architecture.
> +  (letrec-syntax ((matches (syntax-rules (=>)
> +                             ((_ (system-prefix => target) rest ...)
> +                              (if (string-prefix? system-prefix system)
> +                                  target
> +                                  (matches rest ...)))
> +                             ((_)
> +                              (error "LLVM target arch for system is unknown" system)))))
> +    (matches ("aarch64"     => "AArch64")
> +             ("armhf"       => "ARM")
> +             ("mips64el"    => "Mips")
> +             ("powerpc"     => "PowerPC")
> +             ("riscv64"     => "RISCV64")
> +             ("x86_64"      => "X86_64")
> +             ("i686"        => "X86")
> +             ("i586"        => "X86"))))

The only different compared to ‘system->llvm-target’ is “riscv64”
instead of “riscv”.  Why not add that line to ‘system->llvm-target’
instead of duplicating it?

Thanks,
Ludo’.