From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id cDRPNPiHmWS6aQEASxT56A (envelope-from ) for ; Mon, 26 Jun 2023 14:43:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id uDYjNPiHmWR8HwEA9RJhRA (envelope-from ) for ; Mon, 26 Jun 2023 14:43:36 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6E3831720 for ; Mon, 26 Jun 2023 14:43:36 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDlWI-00006o-Jg; Mon, 26 Jun 2023 08:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDlVr-0008K8-6Z for guix-patches@gnu.org; Mon, 26 Jun 2023 08:40:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDlVo-0005y5-LO; Mon, 26 Jun 2023 08:40:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDlVl-0004J5-C4; Mon, 26 Jun 2023 08:40:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64188] [PATCH v2 7/7] transformations: Allow tuning go packages. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 12:40:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64188 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64188@debbugs.gnu.org Cc: Efraim Flashner , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 64188-submit@debbugs.gnu.org id=B64188.168778316416418 (code B ref 64188); Mon, 26 Jun 2023 12:40:05 +0000 Received: (at 64188) by debbugs.gnu.org; 26 Jun 2023 12:39:24 +0000 Received: from localhost ([127.0.0.1]:44772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlV6-0004Gf-0v for submit@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:24 -0400 Received: from mail-wm1-f41.google.com ([209.85.128.41]:44404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDlUw-0004FZ-WB for 64188@debbugs.gnu.org; Mon, 26 Jun 2023 08:39:16 -0400 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-3f9c88ac077so41425995e9.1 for <64188@debbugs.gnu.org>; Mon, 26 Jun 2023 05:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687783149; x=1690375149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=LwwwmFpvBIVIQtMswvyyZ/l54M3FmQmhCc8uvh4HwKQ=; b=cNqi6EQ+EjpT7nfyvz6SJvbVomnel9zomIW7We+5DbC2C0N/sWn4f+RtCJ5rbQnWsM RWzx1hH2kJVe3nrL2QGAgJ5Fo3QNrUiKFYQzJtVQlbPBXhw0axXpkuo295iriUcCzzKT YSpNcfW9EDISkIB4/wx5OdBSb1i3Rpqhfo9PcN5oMOAIhIpoEAS60Uzn7en6jtVjCsk9 /fG6G/g51OVx8yd8zbwI7mEo9i59MUDZf9nf8SBNgWk6ecZhYIPS8fn1IuacSPisLR6G 83NVzRD8jYrsA30wkDzFTb2jD14jlA988y5a6p9v7+VMc4WkdUQ6s7BFRI/3bPy2q/AM LnKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687783149; x=1690375149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LwwwmFpvBIVIQtMswvyyZ/l54M3FmQmhCc8uvh4HwKQ=; b=jDjbOyxwwuBw8HKgYGwDm6MoxrcaBJlja02icgi5sK5miBIg79b+Ozx4Lez1Oqyb0a qiLIC/Ewydz2UCAJH3a3KlmmYEWXA3jpBRj5wfoMvOA11Ku02MT8MPpjHqiF/TX2fiel gi6NUgo1G14+iClSvF9PzUYI4822L1rcjh1mIANYA6YxX2v+BG4nemcAl3CS9VZecisC N04wx5XPv8oO7wrFZEzaLjRik9NpM3OSkJHjt4SuEPq1hIcTAexGFtLE6NemothLwhWI JQLoP7X7jCJxENSX3c+L/x1iRBAGfhQkpwR46Uv5l+Nw3+g1YCBsfTr9DPnhhlt7NY/t 0pow== X-Gm-Message-State: AC+VfDxV7Um/lXmjoYN0PkYbUktR0+LMLX5qmswnMcH1zcp6HmPyVboh cPeaQdypOFpBL5aA/QlQduIpAKgo031PFg== X-Google-Smtp-Source: ACHHUZ6ZwC4qkP/idR54wraMKv6S+lEzBbNFztc0utt8snU6QFGiYZqmfvmADYh0yAEj5TN1jdE2ZQ== X-Received: by 2002:a05:600c:231a:b0:3f9:b430:199b with SMTP id 26-20020a05600c231a00b003f9b430199bmr16149326wmo.15.1687783149085; Mon, 26 Jun 2023 05:39:09 -0700 (PDT) Received: from localhost ([188.120.129.124]) by smtp.gmail.com with ESMTPSA id j9-20020a5d4649000000b0030aefa3a957sm7284253wrs.28.2023.06.26.05.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 05:39:08 -0700 (PDT) From: Efraim Flashner Date: Mon, 26 Jun 2023 15:38:43 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1687783416; a=rsa-sha256; cv=none; b=M2PC+wfXoyi+OFvdEGF7cpkwUUazrX5ROOuhbyTExs9d0uV5GJpAxsUYWpI2XBqd1D1lBZ bV+iPE0HviFjJ4vShyroIhda+m/WJgc7h99c7ncPp0Z65N20WFWIMj6T2muE+UYeGLIffW WujawIKG8xwJDxagD4ePvDqO19U26Px1J+bggQh2p6XC3s8WRJaPq1dsjBoxIXti4tVbiZ L70+cCJFa+c1MNSxPrnQaAO+wg1ZscIHrFhYpQJNVqBR2n/iFimr6ZUQNU0lM+VzCYC9Rw 41QpgUxOGr8x4xiZrC74jOCz5CV6NRvt4KZQBy2yrtayURDQkOoSAud4UIuvpw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=cNqi6EQ+; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687783416; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=LwwwmFpvBIVIQtMswvyyZ/l54M3FmQmhCc8uvh4HwKQ=; b=f/+poCe6cpm7+nm6m6VjOf63/CGtwAoW/tDcslG9eMg0eLw3oWiPk3usIW/4l+Z7m6pfQM XngUiX5TIoP7NzaW6GQp7MusjDaXVNjFtBKSuhBhHheg932/FrtCJ0RzL9AV0oyvPvlJ9m cXyj2UOo9ektBCiw4b3qQOqW+STBzQu2PYgOdPkEZIjxkf20fVyw0WhjEbjZ97blmn6ir+ AwHMMoygriksouGZyCozrqsEfbxkX5GLFvGmrSvWtETWBi5wmT0W9PGFcmNtW3ei5YJilM b/urgWQ8SVmC+z21WC4XgJaGl6PdgbEH1Y5hbDkcmwTKxsQaRa9NyfuMNItORw== Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=cNqi6EQ+; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -0.55 X-Spam-Score: -0.55 X-Migadu-Queue-Id: 6E3831720 X-TUID: MVYazk8U4hZd * guix/transformations.scm (build-system-with-tuning-compiler): When checking if a microarchitecture is supported by the compiler, also check if it is a go compiler which supports that psabi. Add a phase after 'setup-go-environment to set the go microarchitecture. --- guix/transformations.scm | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/guix/transformations.scm b/guix/transformations.scm index a289f81219..92d9c89c0e 100644 --- a/guix/transformations.scm +++ b/guix/transformations.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016-2023 Ludovic Courtès ;;; Copyright © 2021 Marius Bakke ;;; Copyright © 2023 Sarthak Shah +;;; Copyright © 2023 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -32,7 +33,9 @@ (define-module (guix transformations) #:autoload (guix upstream) (package-latest-release upstream-source-version upstream-source-signature-urls) - #:autoload (guix cpu) (current-cpu cpu->gcc-architecture) + #:autoload (guix cpu) (current-cpu + cpu->gcc-architecture + gcc-architecture->micro-architecture-level) #:use-module (guix utils) #:use-module (guix memoization) #:use-module (guix gexp) @@ -516,7 +519,9 @@ (define (build-system-with-tuning-compiler bs micro-architecture) 'compiler-cpu-architectures) p)) (_ #f)) - (bag-build-inputs lowered)))) + (bag-build-inputs lowered))) + (psabi (gcc-architecture->micro-architecture-level + micro-architecture))) (unless compiler (raise (formatted-message (G_ "failed to determine which compiler is used")))) @@ -528,8 +533,11 @@ (define (build-system-with-tuning-compiler bs micro-architecture) (G_ "failed to determine whether ~a supports ~a") (package-full-name compiler) micro-architecture))) - (unless (member micro-architecture - (or (assoc-ref lst architecture) '())) + (unless (or (member micro-architecture + (or (assoc-ref lst architecture) '())) + (and (string=? (package-name compiler) "go") + (member psabi + (or (assoc-ref lst architecture) '())))) (raise (make-compound-condition (formatted-message @@ -556,6 +564,27 @@ (define (build-system-with-tuning-compiler bs micro-architecture) (bag (inherit lowered) + (arguments + (substitute-keyword-arguments (bag-arguments lowered) + ;; We add the tuning parameter after the default GO flags are set. + ((#:phases phases '%standard-phases) + #~(modify-phases #$phases + (add-after 'setup-go-environment 'set-microarchitecture + (lambda _ + (cond + ((string-prefix? "arm" #$psabi) + (setenv "GOARM" (string-take-right #$psabi 1)) + (format #t "Setting GOARM to ~s." + (getenv "GOARM"))) + ((string-prefix? "powerpc" #$psabi) + (setenv "GOPPC64" #$psabi) + (format #t "Setting GOPPC64 to ~s." + (getenv "GOPPC64"))) + ((string-prefix? "x86_64" #$psabi) + (setenv "GOAMD" (string-take-right #$psabi 2)) + (format #t "Setting GOAMD to ~s.\n" + (getenv "GOAMD"))) + (else #t)))))))) (build-inputs ;; Arrange so that the compiler wrapper comes first in $PATH. `(("tuning-compiler" ,(tuning-compiler micro-architecture)) -- Efraim Flashner רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted