From patchwork Fri Sep 13 11:41:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rutherther X-Patchwork-Id: 67924 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A049327BBE2; Fri, 13 Sep 2024 12:43:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CD73827BBEA for ; Fri, 13 Sep 2024 12:43:09 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp4hU-0003kH-W4; Fri, 13 Sep 2024 07:42:57 -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 1sp4hS-0003it-4J for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:54 -0400 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 1sp4hR-0005Od-Is for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=u9a7tmO2OQCa+j2f/z26Njg4BxVEv/gtyXgKJey4WJc=; b=pXfiVTYeyqDkBVaXYYeMIESFbAg+OZ/W2lSfgMLIe0DXTn3vhE5Mn6OoreoLZNd0Yp+ZQZiFVs2/bGgXP+5zoaw2jzWJ9LtLfG0h3J6RpRVcJVOYtats6h2UkG2W0btrlcjWpouxR8P0NAKbc2aEkUffZJhl/S/YB+3gz1DzrrmszM2Nz4FKErCLLGBvhatInTGL/2q2lhcunxs2WudmB06p03bup694aphpdaakVzB9ezWeTe3UtOciELEVBDZlz494tXGGF/LGYYB0MfTTorDJVxkUiYTttwhK9cq/ligrpN0bQ9lIW1JArx4F2UsoEzrgbSKhHbEkQsxPonFIUg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp4ha-0008Hi-J1 for guix-patches@gnu.org; Fri, 13 Sep 2024 07:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73118] [PATCH v2 1/5] gnu: make-gcc-arm-none-eabi: reorder C++ native search paths Resent-From: Rutherther Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 13 Sep 2024 11:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73118@debbugs.gnu.org Cc: Rutherther Received: via spool by 73118-submit@debbugs.gnu.org id=B73118.172622773931711 (code B ref 73118); Fri, 13 Sep 2024 11:43:02 +0000 Received: (at 73118) by debbugs.gnu.org; 13 Sep 2024 11:42:19 +0000 Received: from localhost ([127.0.0.1]:42608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4gs-0008FP-Ii for submit@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:18 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:18621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4gr-0008Ex-0o for 73118@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726227721; x=1726486921; bh=u9a7tmO2OQCa+j2f/z26Njg4BxVEv/gtyXgKJey4WJc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=zM8EInemAmihmE0YCSdX615jipNTApB8Jz2bO8ikR6hKGr25s0Mf7bY7rgIIS4e7v PvO5+bwd7oENbhEMc38VGL7ZVrIobNaMDn5mfIqRiiqqm+ilfSjSiqn3yK5DFMmtli h/mnLNHkLIUuAUETCabvVipjUZr1ExYUFg6nWZ/4j8WkSWW06Wdo1lbRaaMC1ucuKV QiSt/izMvWevo3X7G36P33YXNeKO4iifxhCUAVddzSgnAWnNG2UXmKrOwJUARGGu57 uv6fYWaOoFNHaqZcLDYxPP9Q0QpV2J8/s1fk9k7wjM4p6IEREJtrItaowBFDBOXopM +BmuQPy1u/Jhg== Date: Fri, 13 Sep 2024 11:41:57 +0000 Message-ID: In-Reply-To: References: Feedback-ID: 8107604:user:proton X-Pm-Message-ID: 95377a280749f52788ea634a3baaad8b13e31c0f MIME-Version: 1.0 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: , Reply-to: Rutherther X-ACL-Warn: , Rutherther via Guix-patches X-Patchwork-Original-From: Rutherther via Guix-patches via From: Rutherther Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This fixes native-search-paths of arm-none-eabi toolchains The toolchains CROSS_CPLUS_INCLUDE_PATH had C include directory first, and the C++ as second. Since does #include_next , the toolchains could not build anything using . The C include has to come later than C++ one. This is already fixed in xgcc search-path. * gnu/packages/embedded.scm (make-gcc-arm-none-eabi-4.9, make-gcc-arm-none-eabi-7-2018-q2-update): [native-search-paths]: Put C include path as last. Change-Id: Ib7e36e57e510ac87960375cad40ff0b9e749101c --- gnu/packages/embedded.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index bee65663b6..a7ba9ebe98 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -201,9 +201,9 @@ (define make-gcc-arm-none-eabi-4.9 (files '("arm-none-eabi/include"))) (search-path-specification (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("arm-none-eabi/include" - "arm-none-eabi/include/c++" - "arm-none-eabi/include/c++/arm-none-eabi"))) + (files '("arm-none-eabi/include/c++" + "arm-none-eabi/include/c++/arm-none-eabi" + "arm-none-eabi/include"))) (search-path-specification (variable "CROSS_LIBRARY_PATH") (files '("arm-none-eabi/lib"))))))))) @@ -423,9 +423,9 @@ (define make-gcc-arm-none-eabi-7-2018-q2-update (files '("arm-none-eabi/include"))) (search-path-specification (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("arm-none-eabi/include" - "arm-none-eabi/include/c++" - "arm-none-eabi/include/c++/arm-none-eabi"))) + (files '("arm-none-eabi/include/c++" + "arm-none-eabi/include/c++/arm-none-eabi" + "arm-none-eabi/include"))) (search-path-specification (variable "CROSS_LIBRARY_PATH") (files '("arm-none-eabi/lib"))))))))) From patchwork Fri Sep 13 11:42:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rutherther X-Patchwork-Id: 67923 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 38EAE27BBEC; Fri, 13 Sep 2024 12:43:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8B9EA27BBE2 for ; Fri, 13 Sep 2024 12:43:09 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp4hW-0003kX-EI; Fri, 13 Sep 2024 07:42:58 -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 1sp4hS-0003j1-Bb for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:54 -0400 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 1sp4hS-0005Ok-1R for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=qA4hs0GthMdQ1Un2d95javi0kmnE+aYlZjcfQSkbXlU=; b=T1nE3XTPPoQKwQRNy5DD0PbOAb4AhMxTkn57HOFNQK0ZFktkbp6P53BWm0lW7ZYXQ5Bb8qiFyE3CPkn2/0T+gNy+KXMgtGykNbUCA/mI4Lf8Iy/sij1vt/aaSKmDPA3W19Uw9SabsEi0wa2zgoAZ+Sdc1SiWlPSLaAa1j/fmmNGrrY4IoeJgpaMA+4lk/zm4m7pzF4KMgi5X8ZJkIoqcmW0/LmdYQwIEn+1QYDa7tBA59pFyl0nH2eVXdhARvwfCx0nlNL5d00UuLof3/2HRjUeUqd3AC+aRh8uM0V2RQEMGZgbZXeY5+eMg9AiQ6rWBg4wcWG6M0iiJAEqbOSuKsg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp4hb-0008Hq-2H for guix-patches@gnu.org; Fri, 13 Sep 2024 07:43:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73118] [PATCH v2 2/5] gnu: make-libstdc++-arm-none-eabi: output libstdc++ to arm-none-eabi. Resent-From: Rutherther Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 13 Sep 2024 11:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73118@debbugs.gnu.org Cc: Rutherther Received: via spool by 73118-submit@debbugs.gnu.org id=B73118.172622774831737 (code B ref 73118); Fri, 13 Sep 2024 11:43:03 +0000 Received: (at 73118) by debbugs.gnu.org; 13 Sep 2024 11:42:28 +0000 Received: from localhost ([127.0.0.1]:42612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4h2-0008Fm-24 for submit@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:28 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:26743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4h0-0008FY-38 for 73118@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726227731; x=1726486931; bh=qA4hs0GthMdQ1Un2d95javi0kmnE+aYlZjcfQSkbXlU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Aa1sH7chLN476jvs3NTAnripyrTOLV3jXvKUnpuyd7EvP8sBDTobw4sf6Tpu/2OAq uCRMMom1OAwYsR0aAO/AAed8bodDXgcf3rDDC6PIpPnee03AfaPcdzTlegIkz1J4dM e4r8HY9bm8A2VlxpI1+SDehkJ4ST0ts8ljeJtubkFVG6krVj3lVmQFh0o7MIdwWUfN 5pxaUlp/lFJ/jBH5omV+yshcKVrA0HxhtAAZ3zqHn86PndipT9nHIG8MQLjeivMjYp sVWGPrUucwn8B8emhKkvDMIe4BVnivUJDnGgH++QvVIlq1IGKxAsHvQwaZppB9L09v nar89AWLeswIA== Date: Fri, 13 Sep 2024 11:42:04 +0000 Message-ID: <9db92cc94fd199a5b640a30a1e62c5e2b023df66.1726227323.git.rutherther@protonmail.com> In-Reply-To: References: Feedback-ID: 8107604:user:proton X-Pm-Message-ID: 46a5523f9054c562a077edd9655659aec9950321 MIME-Version: 1.0 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: , Reply-to: Rutherther X-ACL-Warn: , Rutherther via Guix-patches X-Patchwork-Original-From: Rutherther via Guix-patches via From: Rutherther Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The libstdc++ made for arm-none-eabi puts the contents into "lib" folder, but that's unexpected when the resulting toolchain is a cross toolchain. The folder should be "arm-none-eabi/lib", that's the path added to CROSS_C_LIBRARY_PATH * gnu/packages/embedded.scm (make-libstdc++-arm-none-eabi): [arguments]<#:configure-flags>: Point --libdir to arm-none-eabi/lib. [arguments]<#:strip-directories>: Set to arm-none-eabi/lib. Change-Id: Ia8b867a1c6ebeedeae9564e0a6a1e0401b35bd5b --- gnu/packages/embedded.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index a7ba9ebe98..2a482f7e52 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -493,9 +493,14 @@ (define make-libstdc++-arm-none-eabi "--disable-tls" "--disable-plugin" "--with-newlib" + ,(string-append "--libdir=" + (assoc-ref %outputs "out") + "/arm-none-eabi/lib") ,(string-append "--with-gxx-include-dir=" (assoc-ref %outputs "out") - "/arm-none-eabi/include/c++"))))) + "/arm-none-eabi/include/c++"))) + ((#:strip-directories _ #f) + ''("arm-none-eabi/lib")))) (native-inputs `(("newlib" ,newlib) ("xgcc" ,xgcc) From patchwork Fri Sep 13 11:42:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rutherther X-Patchwork-Id: 67926 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9CC4627BBE2; Fri, 13 Sep 2024 12:43:50 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7827427BBE9 for ; Fri, 13 Sep 2024 12:43:49 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp4hY-0003ky-57; Fri, 13 Sep 2024 07:43:00 -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 1sp4hS-0003jC-Ro for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:54 -0400 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 1sp4hS-0005Ot-Fn for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=udNLGGB43c/llyPSb0aRfTXB/VmsjqG9YagA65wfidk=; b=IWpVtr2HfeEpmt2P3F8nFeRHYJ2cjt1VdOB2kdp5kzmgPnOZzUovCU7N0Rwy53Y+MxN1GnyvCD4cq6DxFjbOCpbqPtIdVADzzaOPMgx8mFVnCfcJp118tStvF4hZ5a0cU/noMM/C7ovgytNxFc1j5sswDpmkU5JMyM/YXweu9VZGL/RRL4eGYhYzuyJGibrbsouGRCUukhv2nbmGGvBLPZ3xgNz5Zmvrwbuo9gV1Ns2DC18rJrmhLNeLFceNtv3NQC6C6cjLmG2ks9Y2lPPtBcN21szx4UBeU5xdmwTcBNWOSgIcgMUBwMurbBzZEKcJ2MKPuD/MZQp6/QeNnJIIyA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp4hb-0008Hx-Fy for guix-patches@gnu.org; Fri, 13 Sep 2024 07:43:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73118] [PATCH v2 3/5] gnu: make-libstdc++-arm-none-eabi: add nano variant Resent-From: Rutherther Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 13 Sep 2024 11:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73118@debbugs.gnu.org Cc: Rutherther Received: via spool by 73118-submit@debbugs.gnu.org id=B73118.172622775431755 (code B ref 73118); Fri, 13 Sep 2024 11:43:03 +0000 Received: (at 73118) by debbugs.gnu.org; 13 Sep 2024 11:42:34 +0000 Received: from localhost ([127.0.0.1]:42616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4h7-0008G6-Dd for submit@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:33 -0400 Received: from mail-40133.protonmail.ch ([185.70.40.133]:57895) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4h5-0008Ff-Vw for 73118@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726227736; x=1726486936; bh=udNLGGB43c/llyPSb0aRfTXB/VmsjqG9YagA65wfidk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=OwBBoF9w9RwSPOYGanI53lly0gDHMP2Q3W37Y+0HrLZh1ogzhomP1+SZHkUVLmtL8 9nd/JnraJrXfk/4FNMgQBrsTL1+qUd7MPivv0k5pyg0apnK8H3zsP1Mj7J/oExc9ay cpdSywv141v7qh6WJYP+ju+niZf5sKsO5NO/UyH/PlthxwmkSo5ujEhMCdAHiYTlvd FlHXg804KyuQgez116pLqAtL6MkO9vBhbbPNYOjCY4lEoRarr+25M8laV6p0Q7E1fz OERkv0eaQcZaObSUVD/MQXTprmiY7iDC6/1GSN8V0TZ/EVbTO1Pxvo+qmAmxz5d+9L 5LWgXp+Qs42tA== Date: Fri, 13 Sep 2024 11:42:12 +0000 Message-ID: <1b301413ec52ea11d7e2cc603b506966abd63b72.1726227323.git.rutherther@protonmail.com> In-Reply-To: References: Feedback-ID: 8107604:user:proton X-Pm-Message-ID: 9fb46bd22dfc3ec3b727c27345841ca8a245c7ae MIME-Version: 1.0 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: , Reply-to: Rutherther X-ACL-Warn: , Rutherther via Guix-patches X-Patchwork-Original-From: Rutherther via Guix-patches via From: Rutherther Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The arm-none-eabi nano toolchain had same libstdc++ as the non-nano variant. The libstdc++ should be compiled with -fno-exceptions to make a nano toolchain. Additionally, since the "_nano.a" variants were not present, it was impossible to compile C++ programs with libstdc++ using --specs=nano.specs, since libstdc++_nano.a was not found. The `--with-target-subdir="."` flag is a preparation for gcc-12 introduction since the libstdc++ doesn't build without that, failing on GCC_NO_EXECUTABLES error in configure stage. I have not been able to find out another workaround. * gnu/packages/embedded.scm (make-libstdc++-arm-none-eabi): [arguments]<#:make-flags>: Add CFLAGS and CXXFLAGS. [arguments]<#:configure-flags>: Add --with-target-subdir. * gnu/packages/embedded.scm (make-libstdc++-nano-arm-none-eabi): Add variable. Change-Id: I06a507fef07352a4ec80d84e4d97065343fc2295 --- gnu/packages/embedded.scm | 74 +++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index 2a482f7e52..847eb8059c 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -483,8 +483,17 @@ (define make-libstdc++-arm-none-eabi (name "libstdc++-arm-none-eabi") (arguments (substitute-keyword-arguments (package-arguments libstdc++) + ((#:make-flags flags #f) + #~(cons* "CFLAGS=-g -O2 -fdata-sections -ffunction-sections" + "CXXFLAGS=-g -O2 -fdata-sections -ffunction-sections" + (or #$flags '()))) ((#:configure-flags _) - ``("--target=arm-none-eabi" + ``(; This is more of a hack. This option doesn't really seem + ; to change what subdir is used eventually, but without it there is + ; error: Link tests are not allowed after GCC_NO_EXECUTABLES with + ; The 12.3 toolchain + "--with-target-subdir=\".\"" + "--target=arm-none-eabi" "--host=arm-none-eabi" "--disable-libstdcxx-pch" "--enable-multilib" @@ -506,21 +515,64 @@ (define make-libstdc++-arm-none-eabi ("xgcc" ,xgcc) ,@(package-native-inputs libstdc++))))))) +(define make-libstdc++-nano-arm-none-eabi + (mlambda (xgcc newlib-nano) + (let ((base (make-libstdc++-arm-none-eabi xgcc newlib-nano))) + (package + (inherit base) + (name "libstdc++-nano-arm-none-eabi") + (arguments (substitute-keyword-arguments (package-arguments base) + ((#:make-flags flags) + #~(map (lambda (flag) + (if (or (string-prefix? "CFLAGS=" flag) + (string-prefix? "CXXFLAGS=" flag)) + (string-append flag " -fno-exceptions") + flag)) + #$flags)) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'install 'hardlink-libstdc++ + ;; XXX: Most arm toolchains offer both *.a and *_nano.a as + ;; newlib and newlib-nano respectively. The headers are + ;; usually arm-none-eabi/include/newlib.h for newlib and + ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano. + ;; We have two different toolchain packages for each which + ;; works but is a little strange. + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + ;; The nano.specs file says that newlib-nano files should + ;; end in "_nano.a" instead of just ".a". Note that this + ;; applies to all the multilib folders too. + (for-each + (lambda (file) + (link file + (string-append + ;; Strip ".a" off the end + (substring file 0 (- (string-length file) 2)) + ;; Add "_nano.a" onto the end + "_nano.a"))) + (find-files + out "^(libstdc\\+\\+.a|libsupc\\+\\+.a)$"))))))))))))) + (define make-arm-none-eabi-toolchain (mlambda (xgcc newlib) "Produce a cross-compiler toolchain package with the compiler XGCC and the C library variant NEWLIB." - (let ((newlib-with-xgcc - (package - (inherit newlib) - (native-inputs - (alist-replace "xgcc" (list xgcc) - (package-native-inputs newlib)))))) + (let* ((nano? (string=? (package-name newlib) + "newlib-nano")) + (newlib-with-xgcc + (package + (inherit newlib) + (native-inputs + (alist-replace "xgcc" (list xgcc) + (package-native-inputs newlib))))) + (libstdc++ + (if nano? + (make-libstdc++-nano-arm-none-eabi xgcc newlib-with-xgcc) + (make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc)))) (package (name (string-append "arm-none-eabi" - (if (string=? (package-name newlib-with-xgcc) - "newlib-nano") - "-nano" "") + (if nano? "-nano" "") "-toolchain")) (version (package-version xgcc)) (source #f) @@ -537,7 +589,7 @@ (define make-arm-none-eabi-toolchain directories)))))) (propagated-inputs `(("binutils" ,(cross-binutils "arm-none-eabi")) - ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc)) + ("libstdc++" ,libstdc++) ("gcc" ,xgcc) ("newlib" ,newlib-with-xgcc))) (synopsis "Complete GCC tool chain for ARM bare metal development") From patchwork Fri Sep 13 11:42:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rutherther X-Patchwork-Id: 67927 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5938827BBEA; Fri, 13 Sep 2024 12:43:51 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0039527BBE2 for ; Fri, 13 Sep 2024 12:43:51 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp4hY-0003l3-HL; Fri, 13 Sep 2024 07:43:00 -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 1sp4hT-0003jT-Ib for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:55 -0400 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 1sp4hT-0005Oy-0k for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=KpKZ0skQugrRbPEV570E1FIljw3H/AHNGpR/HHlv+Ig=; b=BfkaAENklbZVV681vFqi7O6MGtFLci4i0WP6d2Yggh9D1iZSmnx1nkzso+tMy4fAFjOgVy0Mb9VuNLou+zh5jxLlnyoSnKw1TXD2wwVUZ0FD2qnNRcKz3rHXeBpwqpry0bH7wP2ffE4Hz5l2jc5LIZvA0l7l4cgkP4xbBpiO8Qrj9NYY0UHEl6yTeJ1+JrVFRvLa+MftDkLTzqQfwnm968Mpqi3I+JDYzJFM1HqgwgNQud49RpIOuEviGkDMGbONAGXFXBy1ziFlkxsMiGdm74WuII8Q7oWI3aAgmjwaSTwTXnOkjBIukTBRp8MP8swiI6NXwJJNPmkX+xHpFefxFg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp4hc-0008I5-1A for guix-patches@gnu.org; Fri, 13 Sep 2024 07:43:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73118] [PATCH v2 4/5] gnu: newlib arm-none-eabi-7-2018-q2-update: Add proper newlib-nano variant. Resent-From: Rutherther Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 13 Sep 2024 11:43:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73118@debbugs.gnu.org Cc: Rutherther Received: via spool by 73118-submit@debbugs.gnu.org id=B73118.172622776231783 (code B ref 73118); Fri, 13 Sep 2024 11:43:04 +0000 Received: (at 73118) by debbugs.gnu.org; 13 Sep 2024 11:42:42 +0000 Received: from localhost ([127.0.0.1]:42620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4hG-0008GZ-0y for submit@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:42 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]:43575) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4hD-0008GE-Mc for 73118@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726227744; x=1726486944; bh=KpKZ0skQugrRbPEV570E1FIljw3H/AHNGpR/HHlv+Ig=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=o/rcFGTmlV9rqvZMMVNOaGJrcLk9nO3MYZRjDB7B+4p7j2PaiUwkJv6d4V0Yoq9vB 7Kbmx5cuMCvPoMEVGE1yhRkXAAmyi+UczqQpGcKhEAawTOyhFhS/+v0PWxdtIZC70v 18F70F0CwXYLI6F7apjVGzfOBOYVGVypYU8c01vXKcIMX+6381hmACionqtNHoVm1s m5ag72JqVav5X3WeKwx3XKANwTgXvfm/PKVjjcj3SEcYJdYJa6k5vjFRdrt/ZILaDC X3pPFwOCpHzbYeeIxI6jHy3MG3wGGnbIB5bBw4PJfcJErnBzKVPLMGZPK6oicUceSM wy8dkXYCuGHOQ== Date: Fri, 13 Sep 2024 11:42:19 +0000 Message-ID: In-Reply-To: References: Feedback-ID: 8107604:user:proton X-Pm-Message-ID: 010e5a775c7143f7969a38871d0352cd84632895 MIME-Version: 1.0 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: , Reply-to: Rutherther X-ACL-Warn: , Rutherther via Guix-patches X-Patchwork-Original-From: Rutherther via Guix-patches via From: Rutherther Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The nano variant for was not nano. It was just a copy of the original one with different name. This meant there were no _nano.a files present at all, and the flags were the same, not producing a smaller library. * gnu/packages/embedded.scm (make-base-newlib-arm-none-eabi-7-2018-q2-update): Rename variable from make-newlib-arm-none-eabi-7-2018-q2-update. * gnu/packages/embedded.scm (make-newlib-nano-arm-none-eabi-7-2018-q2-update): Add variable. * gnu/packages/embedded.scm (make-newlib-arm-none-eabi-7-2018-q2-update): Inherit from make-base-newlib-arm-none-eabi-7-2018-q2-update. Change-Id: I01517ed860dfb2b6a9c7e912fd724832f5a0500a --- gnu/packages/embedded.scm | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index 847eb8059c..4b9da1f529 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -247,10 +247,7 @@ (define make-newlib-arm-none-eabi (modify-phases %standard-phases (add-after 'unpack 'fix-references-to-/bin/sh (lambda _ - (substitute* '("libgloss/arm/cpu-init/Makefile.in" - "libgloss/arm/Makefile.in" - "libgloss/libnosys/Makefile.in" - "libgloss/Makefile.in") + (substitute* (find-files "libgloss" "^Makefile\\.in$") (("/bin/sh") (which "sh"))) #t))))) (native-inputs @@ -430,12 +427,11 @@ (define make-gcc-arm-none-eabi-7-2018-q2-update (variable "CROSS_LIBRARY_PATH") (files '("arm-none-eabi/lib"))))))))) -(define make-newlib-arm-none-eabi-7-2018-q2-update +(define make-base-newlib-arm-none-eabi-7-2018-q2-update ;; This is the same commit as used for the 7-2018-q2-update release ;; according to the release.txt. - (mlambda () - (let ((base (make-newlib-arm-none-eabi)) - (commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4") + (mlambda (base) + (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4") (revision "0")) (package (inherit base) @@ -464,15 +460,13 @@ (define make-newlib-arm-none-eabi-7-2018-q2-update ("xgcc" ,(make-gcc-arm-none-eabi-7-2018-q2-update)) ("texinfo" ,texinfo))))))) -(define-public make-newlib-nano-arm-none-eabi-7-2018-q2-update +(define make-newlib-arm-none-eabi-7-2018-q2-update (mlambda () - (let ((base (make-newlib-arm-none-eabi-7-2018-q2-update))) - (package - (inherit base) - (name "newlib-nano") - (arguments - (package-arguments base)) - (synopsis "Newlib variant for small systems with limited memory"))))) + (make-base-newlib-arm-none-eabi-7-2018-q2-update (make-newlib-arm-none-eabi)))) + +(define make-newlib-nano-arm-none-eabi-7-2018-q2-update + (mlambda () + (make-base-newlib-arm-none-eabi-7-2018-q2-update (make-newlib-nano-arm-none-eabi)))) (define make-libstdc++-arm-none-eabi From patchwork Fri Sep 13 11:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rutherther X-Patchwork-Id: 67925 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id EEFD227BBEA; Fri, 13 Sep 2024 12:43:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E5A2027BBE2 for ; Fri, 13 Sep 2024 12:43:40 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp4hY-0003lO-Oe; Fri, 13 Sep 2024 07:43:00 -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 1sp4hU-0003jc-0a for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:56 -0400 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 1sp4hT-0005P4-HY for guix-patches@gnu.org; Fri, 13 Sep 2024 07:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=dQfOtroz/cKOcxKYujls6p9M94cFfNe+0KsuIwtG7lo=; b=JiyHUEHwSq+K5ENRgBe7AZlgzxHrW8UqVHflkYbI1CUbGZOWLpIneq1VnzbIEqCNQ2lyPmX1uY/MKDt1VGMf4F+AwttbmvSDz9uF+BFmTUugN4lfm+P3LLko1gQVCTfKigH3XntD5vgt9wFJIJ2AQRbvSGisN8UEc35p+P5CNKDQtxckVF/svJP8xph7LLN5mIY7csEVXJjVRmTud774taU1uTbfiZyiGMMylVd+bwrgxXFYgfzMsz9GVdA3N/uH6UhMV5Hn2Kb2WlBv7DVumva9KP09urxiUu4oxmoRWoU4q9D1PmuvzWIGrySFgdFk/I6a7deaBXb2krvY7HsALQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sp4hc-0008IC-IN for guix-patches@gnu.org; Fri, 13 Sep 2024 07:43:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73118] [PATCH v2 5/5] gnu: arm-none-eabi toolchain 12.3.rel1 Resent-From: Rutherther Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 13 Sep 2024 11:43:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73118 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73118@debbugs.gnu.org Cc: Rutherther Received: via spool by 73118-submit@debbugs.gnu.org id=B73118.172622776931808 (code B ref 73118); Fri, 13 Sep 2024 11:43:04 +0000 Received: (at 73118) by debbugs.gnu.org; 13 Sep 2024 11:42:49 +0000 Received: from localhost ([127.0.0.1]:42624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4hM-0008Gv-FV for submit@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:49 -0400 Received: from mail-40131.protonmail.ch ([185.70.40.131]:24443) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sp4hJ-0008GO-Sr for 73118@debbugs.gnu.org; Fri, 13 Sep 2024 07:42:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1726227750; x=1726486950; bh=dQfOtroz/cKOcxKYujls6p9M94cFfNe+0KsuIwtG7lo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=OKmX0f7gZxg6WDiqzlGZeHEVzI8yAX+Dk/zTDqbVnysPGlxix5e1xBPheuppRMVTY fV00UCnvbm0sTjbOTdV5rjhvgSNxy2JdUw+wC8BYwPSFgA9gGEZrkfmggiq4ICyf8w SL1GuZDqNIiiEiaoocJFqH5eTY27p10IhTrTJJfpWSChuvAEdNYj5J+A0MqNLB9gXD 7ciNhsAHkt1fXaq7vr7RuH9qjqv/4UShisvbWjZo9d4Swn47oN/nEcDRvqVX+K2SPa PAluuXA917JXsXEE5rr1dF6UNTK/SmjjqDO75to8JdqrP9J+IOM4qv6f5HNOk4me91 iI23BRbMAwbqw== Date: Fri, 13 Sep 2024 11:42:26 +0000 Message-ID: <19457873ffa7dc65eef642a8e791fa37a4ba16c4.1726227323.git.rutherther@protonmail.com> In-Reply-To: References: Feedback-ID: 8107604:user:proton X-Pm-Message-ID: 4a93e7b4bcab4960833702400869b524a5829211 MIME-Version: 1.0 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: , Reply-to: Rutherther X-ACL-Warn: , Rutherther via Guix-patches X-Patchwork-Original-From: Rutherther via Guix-patches via From: Rutherther Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Introduces arm-none-eabi 12.3.rel1 toolchain The arguments for this toolchain are taken mostly out of here https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads/12-3-rel1 * gnu/packages/patches/newlib-getentropy.patch: Add a patch. * gnu/local.mk: Register it. * gnu/packages/embedded.scm (make-gcc-arm-none-eabi-12.3.rel1): Add variable. * gnu/packages/embedded.scm (make-newlib-arm-none-eabi-12.3.rel1): Add variable. * gnu/packages/embedded.scm (make-newlib-nano-arm-none-eabi-12.3.rel1): Add variable. * gnu/packages/embedded.scm (make-arm-none-eabi-toolchain-12.3.rel1): Add variable. * gnu/packages/embedded.scm (make-arm-none-eabi-toolchain-nano-12.3.rel1): Add variable. Change-Id: If4220c6bc7b1def240cbb9d5d245758f7c51a8a0 --- gnu/local.mk | 1 + gnu/packages/embedded.scm | 110 +++++- gnu/packages/patches/newlib-getentropy.patch | 380 +++++++++++++++++++ 3 files changed, 490 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/newlib-getentropy.patch diff --git a/gnu/local.mk b/gnu/local.mk index ed630041ff..ce40b7e28b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1800,6 +1800,7 @@ dist_patch_DATA = \ %D%/packages/patches/ngircd-handle-zombies.patch \ %D%/packages/patches/network-manager-plugin-path.patch \ %D%/packages/patches/network-manager-meson.patch \ + %D%/packages/patches/newlib-getentropy.patch \ %D%/packages/patches/nginx-socket-cloexec.patch \ %D%/packages/patches/nickle-man-release-date.patch \ %D%/packages/patches/nnpack-system-libraries.patch \ diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index 4b9da1f529..cc999d35f8 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -78,22 +78,27 @@ (define-module (gnu packages embedded) #:export (make-gcc-arm-none-eabi-4.9 make-gcc-arm-none-eabi-6 make-gcc-arm-none-eabi-7-2018-q2-update + make-gcc-arm-none-eabi-12.3.rel1 make-gcc-vc4 make-newlib-arm-none-eabi make-newlib-arm-none-eabi-7-2018-q2-update + make-newlib-arm-none-eabi-12.3.rel1 make-newlib-nano-arm-none-eabi make-newlib-nano-arm-none-eabi-7-2018-q2-update + make-newlib-nano-arm-none-eabi-12.3.rel1 make-arm-none-eabi-toolchain-4.9 make-arm-none-eabi-toolchain-6 make-arm-none-eabi-toolchain-7-2018-q2-update + make-arm-none-eabi-toolchain-12.3.rel1 make-arm-none-eabi-nano-toolchain-4.9 make-arm-none-eabi-nano-toolchain-6 make-arm-none-eabi-nano-toolchain-7-2018-q2-update + make-arm-none-eabi-nano-toolchain-12.3.rel1 make-gdb-arm-none-eabi @@ -468,12 +473,103 @@ (define make-newlib-nano-arm-none-eabi-7-2018-q2-update (mlambda () (make-base-newlib-arm-none-eabi-7-2018-q2-update (make-newlib-nano-arm-none-eabi)))) + +;;; The following definitions are for the "12.3.rel1" variant of the +;;; ARM cross toolchain as offered on https://developer.arm.com +(define-public make-gcc-arm-none-eabi-12.3.rel1 + (mlambda () + (let ((base (make-gcc-arm-none-eabi-7-2018-q2-update)) + (xgcc-base (cross-gcc "arm-none-eabi" + #:xgcc gcc-12 + #:xbinutils (cross-binutils "arm-none-eabi")))) + (package + (inherit base) + (version "12.3.rel1") + (source + (origin + (inherit (package-source xgcc-base)) + (method git-fetch) + (uri (git-reference + (url "git://gcc.gnu.org/git/gcc.git") + (commit "0f54a73b998b72f7c8452a63730ec3b16fc47854"))) + (sha256 + (base32 "0r6q0m3d8g3k3rkmnqjw8aw5fcnsrmywf4ispdkxmk1al3whk1vk")))) + (arguments + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + #~(modify-phases #$phases + (replace 'expand-version-string + (lambda _ + (make-file-writable "gcc/DEV-PHASE") + (with-output-to-file "gcc/DEV-PHASE" + (lambda () + (display "12.3.rel1"))))))) + ((#:configure-flags flags) + #~(cons* "--with-multilib-list=aprofile,rmprofile" + "--with-headers=yes" + "--enable-checking=release" + "--with-gnu-as" + "--with-gnu-ld" + (filter + (lambda (flag) + (not (member flag + '("--with-multilib-list=rmprofile" + "--enable-plugins" + "--disable-libffi")))) + #$flags))))))))) + +(define make-base-newlib-arm-none-eabi-12.3.rel1 + (mlambda (original-base) + (let ((base (make-base-newlib-arm-none-eabi-7-2018-q2-update original-base)) + (commit "4c7d0dfec5793cbf5cf3930b91f930479126d8ce") + (revision "0")) + (package + (inherit base) + (version (git-version "4.3.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "http://sourceware.org/git/newlib-cygwin.git") + (commit commit))) + (sha256 + (base32 + "0drs9v8avh4y2h5bs0ixjn9x662jzkkikx8z034wgl41dxmn6786")))) + (arguments (substitute-keyword-arguments (package-arguments base) + ((#:configure-flags flags) + #~(cons* "--enable-newlib-mb" + "--enable-newlib-reent-check-verify" + "--enable-newlib-register-fini" + #$flags)))))))) + +(define make-newlib-arm-none-eabi-12.3.rel1 + (mlambda () + (make-base-newlib-arm-none-eabi-12.3.rel1 (make-newlib-arm-none-eabi)))) + +(define make-newlib-nano-arm-none-eabi-12.3.rel1 + (mlambda () + (make-base-newlib-arm-none-eabi-12.3.rel1 (make-newlib-nano-arm-none-eabi)))) + (define make-libstdc++-arm-none-eabi (mlambda (xgcc newlib) - (let ((libstdc++ (make-libstdc++ xgcc))) + (let* ((libstdc++ (make-libstdc++ xgcc)) + (src (package-source libstdc++))) (package (inherit libstdc++) + (source + (origin + (inherit src) + (patches (append + ; libstdc++ cannot be linked with since the configure phase + ; cannot detect properly the presence of getentropy function. + ; The function is inside of a header, but it's not present in the resulting + ; newlib. configure will conclude getentropy is present, + ; random will use getentropy, and any linking with random will fail. + (if (version>=? (package-version xgcc) "12.0") + (search-patches "newlib-getentropy.patch") + '()) + (origin-patches src))))) (name "libstdc++-arm-none-eabi") (arguments (substitute-keyword-arguments (package-arguments libstdc++) @@ -626,6 +722,18 @@ (define make-arm-none-eabi-nano-toolchain-7-2018-q2-update (make-gcc-arm-none-eabi-7-2018-q2-update) (make-newlib-nano-arm-none-eabi-7-2018-q2-update)))) +(define make-arm-none-eabi-toolchain-12.3.rel1 + (mlambda () + (make-arm-none-eabi-toolchain + (make-gcc-arm-none-eabi-12.3.rel1) + (make-newlib-arm-none-eabi-12.3.rel1)))) + +(define make-arm-none-eabi-nano-toolchain-12.3.rel1 + (mlambda () + (make-arm-none-eabi-toolchain + (make-gcc-arm-none-eabi-12.3.rel1) + (make-newlib-nano-arm-none-eabi-12.3.rel1)))) + (define make-gdb-arm-none-eabi (mlambda () (package diff --git a/gnu/packages/patches/newlib-getentropy.patch b/gnu/packages/patches/newlib-getentropy.patch new file mode 100644 index 0000000000..a4137d81f0 --- /dev/null +++ b/gnu/packages/patches/newlib-getentropy.patch @@ -0,0 +1,380 @@ +Patch-Source: https://github.com/zephyrproject-rtos/gcc/pull/8 + +From 55addb0c0c5ff5e0aab85574aa26abf175af85c8 Mon Sep 17 00:00:00 2001 +From: Stephanos Ioannidis +Date: Mon, 25 Jul 2022 23:10:41 +0900 +Subject: [PATCH] libstdc++: Do not check getentropy and arc4random for cross builds + +The "getentropy" and "arc4random" check may not yield a correct result +for the cross compile builds because linking is often not available for +them and the C library headers (notoriously, newlib) may still declare +these function prototypes even if they are not actually part of the +final library -- for this reason, this commit disables the "getentropy" +and "arc4random" checks for non-native builds. + +This effectively prevents the std::random_device from making use of +these functions when `--with-newlib` is specified, which is indeed a +correct behaviour because the newlib does not provide a default stub +for the "getentropy" function (also note that the newlib "arc4random" +implementation internally calls the missing "getentropy" function). + +For other C libraries, the `GLIBCXX_CROSSCONFIG` function may hard-code +the availability of these functions by manually defining +`HAVE_GETENTROPY` and `HAVE_ARC4RANDOM`, or by calling the +`GLIBCXX_CHECK_GETENTROPY` and `GLIBCXX_CHECK_ARC4RANDOM` functions. + +libstdc++-v3: + * configure.ac: Relocate GLIBCXX_CHECK_GETENTROPY and + GLIBCXX_CHECK_ARC4RANDOM + * configure: Regenerate. + +Signed-off-by: Stephanos Ioannidis +--- + libstdc++-v3/configure | 300 +++++++++++++++++++------------------- + libstdc++-v3/configure.ac | 8 +- + 2 files changed, 154 insertions(+), 154 deletions(-) + +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 0ce74e8202443..5d43b56b03ffa 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -28088,6 +28088,156 @@ $as_echo "#define _GLIBCXX_USE_RANDOM_TR1 1" >>confdefs.h + + + ++ # Check for other random number APIs ++ ++ ++ ++ ac_ext=cpp ++ac_cpp='$CXXCPP $CPPFLAGS' ++ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getentropy" >&5 ++$as_echo_n "checking for getentropy... " >&6; } ++if ${glibcxx_cv_getentropy+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ++ if test x$gcc_no_link = xyes; then ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++int ++main () ++{ ++unsigned i; ++ ::getentropy(&i, sizeof(i)); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_cxx_try_compile "$LINENO"; then : ++ glibcxx_cv_getentropy=yes ++else ++ glibcxx_cv_getentropy=no ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++else ++ if test x$gcc_no_link = xyes; then ++ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 ++fi ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++int ++main () ++{ ++unsigned i; ++ ::getentropy(&i, sizeof(i)); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_cxx_try_link "$LINENO"; then : ++ glibcxx_cv_getentropy=yes ++else ++ glibcxx_cv_getentropy=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_getentropy" >&5 ++$as_echo "$glibcxx_cv_getentropy" >&6; } ++ ++ if test $glibcxx_cv_getentropy = yes; then ++ ++$as_echo "#define HAVE_GETENTROPY 1" >>confdefs.h ++ ++ fi ++ ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ ++ ++ ++ ++ ac_ext=cpp ++ac_cpp='$CXXCPP $CPPFLAGS' ++ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random" >&5 ++$as_echo_n "checking for arc4random... " >&6; } ++if ${glibcxx_cv_arc4random+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ++ if test x$gcc_no_link = xyes; then ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++int ++main () ++{ ++unsigned i = ::arc4random(); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_cxx_try_compile "$LINENO"; then : ++ glibcxx_cv_arc4random=yes ++else ++ glibcxx_cv_arc4random=no ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++else ++ if test x$gcc_no_link = xyes; then ++ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 ++fi ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include ++int ++main () ++{ ++unsigned i = ::arc4random(); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_cxx_try_link "$LINENO"; then : ++ glibcxx_cv_arc4random=yes ++else ++ glibcxx_cv_arc4random=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_arc4random" >&5 ++$as_echo "$glibcxx_cv_arc4random" >&6; } ++ ++ if test $glibcxx_cv_arc4random = yes; then ++ ++$as_echo "#define HAVE_ARC4RANDOM 1" >>confdefs.h ++ ++ fi ++ ac_ext=c ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ++ac_compiler_gnu=$ac_cv_c_compiler_gnu ++ ++ ++ + # For TLS support. + + +@@ -75519,156 +75669,6 @@ $as_echo "#define _GLIBCXX_X86_RDSEED 1" >>confdefs.h + fi + + +-# Check for other random number APIs +- +- +- +- ac_ext=cpp +-ac_cpp='$CXXCPP $CPPFLAGS' +-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getentropy" >&5 +-$as_echo_n "checking for getentropy... " >&6; } +-if ${glibcxx_cv_getentropy+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- +- if test x$gcc_no_link = xyes; then +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include +-int +-main () +-{ +-unsigned i; +- ::getentropy(&i, sizeof(i)); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_cxx_try_compile "$LINENO"; then : +- glibcxx_cv_getentropy=yes +-else +- glibcxx_cv_getentropy=no +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +-else +- if test x$gcc_no_link = xyes; then +- as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +-fi +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include +-int +-main () +-{ +-unsigned i; +- ::getentropy(&i, sizeof(i)); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_cxx_try_link "$LINENO"; then : +- glibcxx_cv_getentropy=yes +-else +- glibcxx_cv_getentropy=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +-fi +- +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_getentropy" >&5 +-$as_echo "$glibcxx_cv_getentropy" >&6; } +- +- if test $glibcxx_cv_getentropy = yes; then +- +-$as_echo "#define HAVE_GETENTROPY 1" >>confdefs.h +- +- fi +- ac_ext=c +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- +- +- +- +- ac_ext=cpp +-ac_cpp='$CXXCPP $CPPFLAGS' +-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random" >&5 +-$as_echo_n "checking for arc4random... " >&6; } +-if ${glibcxx_cv_arc4random+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- +- if test x$gcc_no_link = xyes; then +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include +-int +-main () +-{ +-unsigned i = ::arc4random(); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_cxx_try_compile "$LINENO"; then : +- glibcxx_cv_arc4random=yes +-else +- glibcxx_cv_arc4random=no +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +-else +- if test x$gcc_no_link = xyes; then +- as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +-fi +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include +-int +-main () +-{ +-unsigned i = ::arc4random(); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_cxx_try_link "$LINENO"; then : +- glibcxx_cv_arc4random=yes +-else +- glibcxx_cv_arc4random=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +-fi +- +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_arc4random" >&5 +-$as_echo "$glibcxx_cv_arc4random" >&6; } +- +- if test $glibcxx_cv_arc4random = yes; then +- +-$as_echo "#define HAVE_ARC4RANDOM 1" >>confdefs.h +- +- fi +- ac_ext=c +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- +- + # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE. + + # Do checks for resource limit functions. +diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac +index e59bcdb29441f..05cdfcddbc43b 100644 +--- a/libstdc++-v3/configure.ac ++++ b/libstdc++-v3/configure.ac +@@ -269,6 +269,10 @@ if $GLIBCXX_IS_NATIVE; then + # For /dev/random and /dev/urandom for std::random_device. + GLIBCXX_CHECK_DEV_RANDOM + ++ # Check for other random number APIs ++ GLIBCXX_CHECK_GETENTROPY ++ GLIBCXX_CHECK_ARC4RANDOM ++ + # For TLS support. + GCC_CHECK_TLS + +@@ -474,10 +478,6 @@ GLIBCXX_CHECK_X86_RDRAND + # Check if assembler supports rdseed opcode. + GLIBCXX_CHECK_X86_RDSEED + +-# Check for other random number APIs +-GLIBCXX_CHECK_GETENTROPY +-GLIBCXX_CHECK_ARC4RANDOM +- + # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE. + GLIBCXX_CONFIGURE_TESTSUITE +