From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 6II0GktX3WayewAAe85BDQ:P1 (envelope-from ) for ; Sun, 08 Sep 2024 07:50:35 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 6II0GktX3WayewAAe85BDQ (envelope-from ) for ; Sun, 08 Sep 2024 09:50:35 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=b8jD4Y5M; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=UaBhqppb; dmarc=pass (policy=none) header.from=gnu.org; 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=1725781835; h=from:from:sender:sender:reply-to: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=TO1d8LAx4NBodzD/lsog50q7upsI+qRUCEZTW+3Z5vo=; b=eCQ1WqySwA+OxOeSWE6ibmxIsqu2vCOHO/AgTa0g8qU8/ENfwnmU+n1eY+WPYQcaEVPSED nEaCft1I/LQtnolRttHQAGI3lq+bFRtWbIfgJ+vtGJ4F1zjRqtTpd6L2tUBx63jV9opDcV 4WZJWDr0bT5ejmCrLk81mTEIh1wbiUpDOr6xk+7bABc/Bh1bsSpRL6zpt4rO26yASyr74i VMIl8VQ3YZ+RUWM6eSTm+3LnUFqwswaxRwnHHSWVanivMS5blOQQlvmlJHnWwgUw7ecRI8 GAfmQAxdOERUpqKv/9EWnCbvrYp1NIH1ZoxrxsEDoDcGoiCo229TSemhcWcbzw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1725781835; a=rsa-sha256; cv=none; b=pVyWYWqZS1RDW5XK/e+SdfQl4KJfwcXOs+ToXkGOylhlugkP2VI0vjSA18t1Fs1Tp1dVor Z3WcJ5tvvza78OADyJKNjjzzMHIsUspmPk/iswdzyqkmfGA8BCgIq1ohGZX1P9XcAwSxlE Ma1/z9vduty834P+IjAwhZXLMIw+ydLVYX//fDisBqMuYApxHj8+VPi43xrt6itHYC75QE 9p4NefA/G1RpGHhzfzGuXBuo5V3njQbxJcj/KZJZL8Lq9TzgXOdahquCimJ3MSwMuP3gl+ i4hj5IZdbd12yqSDpoYp/XW/WpS9pgxvyNh6d7Bj3BYMeoCZ5UCuSIr9pSnnxg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=b8jD4Y5M; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=UaBhqppb; dmarc=pass (policy=none) header.from=gnu.org; 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" 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 37ABA7E4F0 for ; Sun, 08 Sep 2024 09:50:35 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snCgQ-0001D1-82; Sun, 08 Sep 2024 03:50:06 -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 1snCgO-0001BI-4Y for guix-patches@gnu.org; Sun, 08 Sep 2024 03:50:04 -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 1snCgL-0003IA-5n for guix-patches@gnu.org; Sun, 08 Sep 2024 03:50:01 -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=TO1d8LAx4NBodzD/lsog50q7upsI+qRUCEZTW+3Z5vo=; b=b8jD4Y5MPWqx4ryy7n5KNHI2gv9YuAECv/uKnV9KROd+PEqQzUxc9sladiaotS8XPV8NKWwZids9wMXNynsXnTqSx4z9YpZMO90lFuu73zJ98ok0PnnnlRr5F28+Q4DN6Nc8lnH4M+Tejs5Qnp6auPaWhza34FM4mv/+JzzdIVb9ufdHBoWRHMdhJjpkc3RRsV8KC4eGdQ7h/nAhgE59eXyPCCRHE0w5jar+CZhnYg2t35r0zVC7FTD4OHM+nn80uVQ10/ysxWTzTna1jOSjbS1pCcICze+57pvKwwOM3ZjX264yIayN7jGKqKEZbLOZtwS8wr8CKkGZc8ZkKMuaxg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snCgN-0003yl-05 for guix-patches@gnu.org; Sun, 08 Sep 2024 03:50:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73118] [PATCH 3/5] Add libstdc++-nano for arm-none-eabi Resent-From: Rutherther Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 Sep 2024 07:50: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.172578176015168 (code B ref 73118); Sun, 08 Sep 2024 07:50:02 +0000 Received: (at 73118) by debbugs.gnu.org; 8 Sep 2024 07:49:20 +0000 Received: from localhost ([127.0.0.1]:57938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snCff-0003wY-FX for submit@debbugs.gnu.org; Sun, 08 Sep 2024 03:49:19 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:58093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snCfd-0003wA-RC for 73118@debbugs.gnu.org; Sun, 08 Sep 2024 03:49:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1725781750; x=1726040950; bh=TO1d8LAx4NBodzD/lsog50q7upsI+qRUCEZTW+3Z5vo=; 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=UaBhqppbwGjCfO/XYI9/T4Qsy4fV0HVxFM2Gp8uoSKWkU+TLCwQteq1pRyP+CQ4Ku pEL5fX+9SYoqKe6sT+jp7km1jMJbwDk2RLlJ3h/JV0fDM165yJ7oOm8XQ7A9OXsWnX zvaFeRwlodbVZM10oS2ZdM8ed5fHuIggieKTko6a7O6Zh0YuFoq4K7uQR9OMVlhqPN ebxVhXPW71bZ0m07eTKg8h+Yu25aih6BVMnNFJutiD729NeS3b/axHaXZ8Aowcnyfk bpxAPPJu2/oZhVudqldDtO1kIbdoALZvsTG/7WUMfYZq2zOJVTbo7F2EFgnpXnhPjk qnzHyxYhHxMpg== Date: Sun, 08 Sep 2024 07:49:06 +0000 Message-ID: <8682f4da5b051491de57a27081d150fda7af9688.1725779196.git.rutherther@protonmail.com> In-Reply-To: References: Feedback-ID: 8107604:user:proton X-Pm-Message-ID: db7457a70345b80937e7b7bfb14d1191575638f8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 From: Rutherther via Guix-patches via 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: -3.99 X-Spam-Score: -3.99 X-Migadu-Queue-Id: 37ABA7E4F0 X-Migadu-Scanner: mx11.migadu.com X-TUID: 526UwobCOB3E 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 impossi= ble to compile C++ programs with libstdc++ using --specs=3Dnano.specs, since libstdc++_nano.a was not found. --- gnu/packages/embedded.scm | 76 ++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 12 deletions(-) diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index 59ffd9a661..1ea794724c 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -486,7 +486,14 @@ (define make-libstdc++-arm-none-eabi (arguments (substitute-keyword-arguments (package-arguments libstdc++) ((#:configure-flags _) - ``("--target=3Darm-none-eabi" + ``("CFLAGS=3D-ffunction-sections -fdata-sections" + "CXXFLAGS=3D-ffunction-sections -fdata-sections" + ; 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_EXECUTABLE= S with + ; The 12.3 toolchain + "--with-target-subdir=3D\".\"" + "--target=3Darm-none-eabi" "--host=3Darm-none-eabi" "--disable-libstdcxx-pch" "--enable-multilib" @@ -506,21 +513,65 @@ (define make-libstdc++-arm-none-eabi ("xgcc" ,xgcc) ,@(package-native-inputs libstdc++))))))) =20 +(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) + ((#:configure-flags flags) + #~(cons* "CFLAGS=3D-ffunction-sections -fdata-sectio= ns -fno-exceptions" + "CXXFLAGS=3D-ffunction-sections -fdata-sect= ions -fno-exceptions" + (filter + (lambda (flag) + (not (or (string-prefix? "CFLAGS=3D" f= lag) + (string-prefix? "CXXFLAGS=3D"= 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 h= eaders 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 fo= r 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-na= no 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-len= gth 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=3D? (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=3D? (package-name newlib-with-xgc= c) - "newlib-nano") - "-nano" "") + (if nano? "-nano" "") "-toolchain")) (version (package-version xgcc)) (source #f) @@ -537,9 +588,10 @@ (define make-arm-none-eabi-toolchain directories)))))) (propagated-inputs `(("binutils" ,(cross-binutils "arm-none-eabi")) - ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xg= cc)) + ("libstdc++" ,libstdc++) ("gcc" ,xgcc) - ("newlib" ,newlib-with-xgcc))) + ("newlib" ,newlib-with-xgcc) + )) (synopsis "Complete GCC tool chain for ARM bare metal development"= ) (description "This package provides a complete GCC tool chain for = ARM bare metal development. This includes the GCC arm-none-eabi cross compile= r --=20 2.45.2