From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id MHDSLXUl5GZYEgAAe85BDQ:P1 (envelope-from ) for ; Fri, 13 Sep 2024 11:43:50 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id MHDSLXUl5GZYEgAAe85BDQ (envelope-from ) for ; Fri, 13 Sep 2024 13:43:49 +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=IWpVtr2H; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=OwBBoF9w; 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=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726227829; 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=udNLGGB43c/llyPSb0aRfTXB/VmsjqG9YagA65wfidk=; b=s2D9iOQZnY3mx+Aiq3L/ukmfbh3a/QT5LJf9QF80E1aoWbL04esQS4A+MvLTF2cpTJUQmu 985d1wFUcwWXjRWrN4q4k0jBArFgElYv8Gqxyy69lRjJ+OSqTbdfelUTiR+q7sg9NOaCua +3N6/zXBimE6G4WkViKePfvw+liticPh7SOA8pd8JikpL82zox8Xc2364dePbLoVyb++f/ XLi3t6tETx//62YFV/IXkBDUIyI0bcoLeofBS7lis0i3m9XuItm/2hAofUHU2fmAf2kcnj aj4vAQJEuBW+uW3d7TYleAKJzmxyjNX0DxQolFEbwAu7wEOKjY2PmjNuoKgI7A== 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=IWpVtr2H; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=OwBBoF9w; 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=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726227829; a=rsa-sha256; cv=none; b=e/C84NFgmYoT4p38LhXq8Hs5Hdd7MFOgT54v4mIi6fYvCDrBprvY22WFLQDMtAaEkHsHNp MZqcfd3/cNGWMzTzUUhA6KVJt9V6wEwjj0jcRbp3Uv6hDPbMihNspAYj+h0k+C3pOU/yK6 iIhIR2/Bx20/ol2ZQmoPcbAHNZkZ5QIINlPAXjEAiL0ylk0tg/5uegvjDRuYdGz246ZSwy XQtQN3Nb0fD8Kq2yZURMvgtfbYwRryz867Ea5E5Ofh+2ObmRnMmn2cq3D2DRQ7LpCDy0OG DfcPFUcmIYpoEBicR09vK/ZKgB56N45Q0akqnbBwhtiwe8e1W0NLWM5QrvnOKg== 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 7A42937842 for ; Fri, 13 Sep 2024 13:43:49 +0200 (CEST) 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 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: -4.91 X-Spam-Score: -4.91 X-Migadu-Queue-Id: 7A42937842 X-Migadu-Scanner: mx10.migadu.com X-TUID: c/kH+EcoXTIm 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. The `--with-target-subdir=3D"."` flag is a preparation for gcc-12 introduct= ion since the libstdc++ doesn't build without that, failing on GCC_NO_EXECUTABL= ES error in configure stage. I have not been able to find out another workarou= nd. * 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 variab= le. 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=3D-g -O2 -fdata-sections -ffunction-sections" + "CXXFLAGS=3D-g -O2 -fdata-sections -ffunction-section= s" + (or #$flags '()))) ((#:configure-flags _) - ``("--target=3Darm-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_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 +515,64 @@ (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) + ((#:make-flags flags) + #~(map (lambda (flag) + (if (or (string-prefix? "CFLAGS=3D" flag) + (string-prefix? "CXXFLAGS=3D" 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 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,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-xg= cc)) + ("libstdc++" ,libstdc++) ("gcc" ,xgcc) ("newlib" ,newlib-with-xgcc))) (synopsis "Complete GCC tool chain for ARM bare metal development"= ) --=20 2.46.0