gnu: go-1.23: Add aarch64 micro-architecture compiler support.

* gnu/packages/golang.scm (%go-1.23-arm64-micro-architectures): New
variable.
(go-1.23)[compiler-cpu-architectures]: Add aarch64 micro-architectures.
* guix/transformations.scm (tuning-compiler): Update the go optimizer to
also support GOARM64.

Change-Id: I8825f9857e07c1634ea346d5a16ae9550f340e65
This commit is contained in:
Efraim Flashner 2025-07-11 16:37:48 +03:00
parent 681f70737e
commit 86a7cd424e
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351
2 changed files with 32 additions and 4 deletions

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016-2024 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2016-2025 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com> ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
;;; Copyright © 2016 Andy Wingo <wingo@igalia.com> ;;; Copyright © 2016 Andy Wingo <wingo@igalia.com>
;;; Copyright © 2016, 2019, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
@ -1012,6 +1012,17 @@ in the style of communicating sequential processes (@dfn{CSP}).")
;; as the bootstrap toolchain. ;; as the bootstrap toolchain.
(alist-replace "go" (list go-1.21) (package-native-inputs go-1.21))))) (alist-replace "go" (list go-1.21) (package-native-inputs go-1.21)))))
(define %go-1.23-arm64-micro-architectures
;; https://go.dev/wiki/MinimumRequirements#arm64
;; Allowed values are v8.{0-9} and v9.{0-5}. This may be followed by an option
;; specifying extensions implemented by target hardware. Valid options are
;; ,lse and ,crypto.
;; Match Guix's specifications and then rewrite in (guix transformations).
(append (map (lambda (suffix) (string-append "armv8" suffix "-a"))
'("" ".1" ".2" ".3" ".4" ".5" ".6" ".7" ".8" ".9"))
(map (lambda (suffix) (string-append "armv9" suffix "-a"))
'("" ".1" ".2" ".3" ".4" ".5"))))
(define-public go-1.23 (define-public go-1.23
(package (package
(inherit go-1.22) (inherit go-1.22)
@ -1025,7 +1036,13 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(commit (string-append "go" version)))) (commit (string-append "go" version))))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 "06c5cjjqk95p16cb6p8fgqqsddc1a1kj3w2m0na5v91gvwxbd0pq")))))) (base32 "06c5cjjqk95p16cb6p8fgqqsddc1a1kj3w2m0na5v91gvwxbd0pq"))))
(properties
`((compiler-cpu-architectures
("aarch64" ,@%go-1.23-arm64-micro-architectures)
("armhf" ,@%go-1.17-arm-micro-architectures)
("powerpc64le" ,@%go-1.17-powerpc64le-micro-architectures)
("x86_64" ,@%go-1.18-x86_64-micro-architectures))))))
(define-public go-1.24 (define-public go-1.24
(package (package

View file

@ -2,7 +2,7 @@
;;; Copyright © 2016-2024 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2023 Sarthak Shah <shahsarthakw@gmail.com> ;;; Copyright © 2023 Sarthak Shah <shahsarthakw@gmail.com>
;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2023-2025 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech> ;;; Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -500,7 +500,18 @@ actual compiler."
(string=? next (search-next "go"))) (string=? next (search-next "go")))
(cond (cond
((string-prefix? "arm" psabi) ((string-prefix? "arm" psabi)
(setenv "GOARM" (string-take-right psabi 1))) ;; Parse the psabi to set the correct value
(cond ((= 5 (string-length psabi))
(setenv "GOARM" (string-take-right psabi 1)))
((string=? "a" (string-take-right psabi 1))
(let ((version
(string-filter
(string->char-set ".v" char-set:digit)
psabi)))
(setenv "GOARM64"
(if (= 2 (string-length version))
(string-append version ".0")
version))))))
((string-prefix? "powerpc" psabi) ((string-prefix? "powerpc" psabi)
(setenv "GOPPC64" psabi)) (setenv "GOPPC64" psabi))
((string-prefix? "x86_64" psabi) ((string-prefix? "x86_64" psabi)