From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id uJkzOTYxmGUu6gAAkFu2QA (envelope-from ) for ; Fri, 05 Jan 2024 17:41:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WOL9NTYxmGURqAAA62LTzQ (envelope-from ) for ; Fri, 05 Jan 2024 17:41:26 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1704472886; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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; bh=VZTn3rhcAax/r3GYhYfa3McO4U0kd8QHxtlfHlkc2vA=; b=H4kpTh9eE7/nQSmWgx+yBFm/noxiZ6azNvF6XSB9Khzd1iyzJlCW8tIOVv+fuPabHQzYjU nTacgpfjp0VRFDgHJwRw9xJJLe1POGAA/JtbAv6o+pdURNZx/TjGz+2RLXUFvGoN6fx+O6 svLhwuf0Ov/C6IQetH6djJHewBboQET3+9BXubQ26fF6UfSnhyMbsGuoFI8kdDFoIOOxoq vw0XX9go0ih3mf57JQsSeBcD9TmsDNUwFhKtHCX3x22Gk40rpswsyO6Bq0HZ9VlvG1S4bW vstIMuaDmgRA7sKmHwKiThUbIHecZBb7Nb6lSVT0II5kZ6tbxseSm5eq+354dQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1704472886; a=rsa-sha256; cv=none; b=QdYBIn0TBmCXMtWKKq0LYAU9Xx8Cih1W6mI5xfzFiBAw2WrAxFJd9nF0uagHyks3z+yTGv e3pIwnqDOBNW66WpFFwU0dtQFD2ZclkUyXfwhiFRcE+nnstCG7nl0CH5V3rB2ysjzQhsA5 1an57fHYHBuNO57eEcC0XtNC5ujs6FJNxdKJiUCGXhzQYtzM+GxeEcZB1Z7Ng6IVnV4f/Z FxRirr1RkmiWhNzoQs/sEGzxzcNczcpjDyMe1BO7lwvIu80HDs1isNrk3bupVZos4gwX4T ou0ybrRQkrwnP5ALhOdU88V5Hd9rgwysIcF9iLrAb2wo1OihdICAo/Nuu2/t2w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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"; dmarc=none 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 876A21D9B9 for ; Fri, 5 Jan 2024 17:41:26 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLnFk-0006oW-C4; Fri, 05 Jan 2024 11:41:00 -0500 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 1rLnFi-0006nD-ON for guix-patches@gnu.org; Fri, 05 Jan 2024 11:40:58 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLnFi-0002hE-49; Fri, 05 Jan 2024 11:40:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLnFm-0003tT-FM; Fri, 05 Jan 2024 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68266] [PATCH 2/7] gnu: Memozise cross-binutils results. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, guix-patches@gnu.org Resent-Date: Fri, 05 Jan 2024 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68266@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 68266-submit@debbugs.gnu.org id=B68266.170447286114940 (code B ref 68266); Fri, 05 Jan 2024 16:41:02 +0000 Received: (at 68266) by debbugs.gnu.org; 5 Jan 2024 16:41:01 +0000 Received: from localhost ([127.0.0.1]:57725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFk-0003si-64 for submit@debbugs.gnu.org; Fri, 05 Jan 2024 11:41:00 -0500 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:57531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLnFg-0003rx-EC for 68266@debbugs.gnu.org; Fri, 05 Jan 2024 11:40:58 -0500 Received: from localhost (unknown [217.155.61.229]) by mira.cbaines.net (Postfix) with ESMTPSA id 37E7C27BBE9 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 8ed7c751 for <68266@debbugs.gnu.org>; Fri, 5 Jan 2024 16:40:51 +0000 (UTC) From: Christopher Baines Date: Fri, 5 Jan 2024 16:40:44 +0000 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> References: <13f83a0db585e81572240e35dfef473aa73fe996.1704472849.git.mail@cbaines.net> MIME-Version: 1.0 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.79 X-Spam-Score: -4.79 X-Migadu-Queue-Id: 876A21D9B9 X-Migadu-Scanner: mx12.migadu.com X-TUID: 5+th0kEDX84z To ensure that it just returns a single package record for some given arguments, as this helps to avoid poor performance of the store connection object cache. * gnu/packages/cross-base.scm (cross-binutils*): Move code to cross-binutils/implementation and call it. (cross-binutils/implementation) New procedure. (cross-binutils/deprecated): Call cross-binutils/implementation. Change-Id: Ic7a493177026c7a699108ab6d75482ff3c189340 --- gnu/packages/cross-base.scm | 92 +++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 6ee7b315d8..a04e4f9c9e 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -89,56 +89,60 @@ (define (contains-keyword? args) (find keyword? args)) (define* (cross-binutils . args) + "Return a cross-Binutils for TARGET using BINUTILS." (if (or (= (length args) 1) (contains-keyword? args)) (apply cross-binutils* args) (apply cross-binutils/deprecated args))) +(define* (cross-binutils* target #:key (binutils binutils)) + (cross-binutils/implementation target binutils)) + (define* (cross-binutils/deprecated target #:optional (binutils binutils)) (warning (G_ "'cross-binutils' must be used with keyword arguments~%")) - (cross-binutils* target #:binutils binutils)) - -(define* (cross-binutils* target #:key (binutils binutils)) - "Return a cross-Binutils for TARGET using BINUTILS." - (let ((binutils (package - (inherit binutils) - (arguments - (substitute-keyword-arguments (package-arguments - binutils) - ((#:configure-flags flags) - ;; Build with `--with-sysroot' so that ld honors - ;; DT_RUNPATH entries when searching for a needed - ;; library. This works because as a side effect - ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells - ;; elf32.em to use DT_RUNPATH in its search list. - ;; See . - ;; - ;; In theory choosing / as the sysroot could lead ld - ;; to pick up native libs instead of target ones. In - ;; practice the RUNPATH of target libs only refers to - ;; target libs, not native libs, so this is safe. - `(cons "--with-sysroot=/" ,flags))))))) - - ;; For Xtensa, apply Qualcomm's patch. - (cross (cond ((string-prefix? "xtensa-" target) - (package-with-patches binutils - (search-patches - "ath9k-htc-firmware-binutils.patch"))) - ((target-mingw? target) - (package-with-extra-patches - (package-with-extra-configure-variable - ;; mingw binutils does not work correctly when configured - ;; with `--enable-compressed-debug-sections`. An error - ;; like the following will occur whenever you try to link: - ;; - ;; x86_64-w64-mingw32-ld: final link failed: bad value - ;; - ;; TODO: This seems like a deeper problem that warrants - ;; deeper investigation. - binutils "--enable-compressed-debug-sections" "no") - (search-patches "binutils-mingw-w64-timestamp.patch" - "binutils-mingw-w64-deterministic.patch"))) - (else binutils)) - target))) + (cross-binutils/implementation target binutils)) + +(define cross-binutils/implementation + (mlambda (target binutils) + (let ((binutils (package + (inherit binutils) + (arguments + (substitute-keyword-arguments (package-arguments + binutils) + ((#:configure-flags flags) + ;; Build with `--with-sysroot' so that ld honors + ;; DT_RUNPATH entries when searching for a needed + ;; library. This works because as a side effect + ;; `genscripts.sh' sets `USE_LIBPATH=yes', which tells + ;; elf32.em to use DT_RUNPATH in its search list. + ;; See . + ;; + ;; In theory choosing / as the sysroot could lead ld + ;; to pick up native libs instead of target ones. In + ;; practice the RUNPATH of target libs only refers to + ;; target libs, not native libs, so this is safe. + `(cons "--with-sysroot=/" ,flags))))))) + + ;; For Xtensa, apply Qualcomm's patch. + (cross (cond ((string-prefix? "xtensa-" target) + (package-with-patches binutils + (search-patches + "ath9k-htc-firmware-binutils.patch"))) + ((target-mingw? target) + (package-with-extra-patches + (package-with-extra-configure-variable + ;; mingw binutils does not work correctly when configured + ;; with `--enable-compressed-debug-sections`. An error + ;; like the following will occur whenever you try to link: + ;; + ;; x86_64-w64-mingw32-ld: final link failed: bad value + ;; + ;; TODO: This seems like a deeper problem that warrants + ;; deeper investigation. + binutils "--enable-compressed-debug-sections" "no") + (search-patches "binutils-mingw-w64-timestamp.patch" + "binutils-mingw-w64-deterministic.patch"))) + (else binutils)) + target)))) (define (cross-gcc-arguments target xgcc libc) "Return build system arguments for a cross-gcc for TARGET, using XGCC as the -- 2.41.0