From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WB80E+8SIl92egAA0tVLHw (envelope-from ) for ; Thu, 30 Jul 2020 00:23:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EOYYD+8SIl++PgAAB5/wlQ (envelope-from ) for ; Thu, 30 Jul 2020 00:23:11 +0000 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 BC8E59400E1 for ; Thu, 30 Jul 2020 00:23:10 +0000 (UTC) Received: from localhost ([::1]:50782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0wLk-00030u-CS for larch@yhetil.org; Wed, 29 Jul 2020 20:23:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0wLe-00030Y-Fa for guix-patches@gnu.org; Wed, 29 Jul 2020 20:23:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0wLe-0001JN-5G for guix-patches@gnu.org; Wed, 29 Jul 2020 20:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k0wLd-00049H-Uh for guix-patches@gnu.org; Wed, 29 Jul 2020 20:23:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42555] [PATCH v2 core-updates] build-system/gnu: strip with --strip-unneeded References: <20200726233850.12321-1-kuba@kadziolka.net> In-Reply-To: <20200726233850.12321-1-kuba@kadziolka.net> Resent-From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 30 Jul 2020 00:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42555 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42555@debbugs.gnu.org Received: via spool by 42555-submit@debbugs.gnu.org id=B42555.159606853115864 (code B ref 42555); Thu, 30 Jul 2020 00:23:01 +0000 Received: (at 42555) by debbugs.gnu.org; 30 Jul 2020 00:22:11 +0000 Received: from localhost ([127.0.0.1]:34027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0wKp-00047o-Fo for submit@debbugs.gnu.org; Wed, 29 Jul 2020 20:22:11 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:51898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0wKm-00047a-15 for 42555@debbugs.gnu.org; Wed, 29 Jul 2020 20:22:09 -0400 Received: (qmail 14182 invoked by uid 1009); 30 Jul 2020 02:22:05 +0200 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25887. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.056218 secs); 30 Jul 2020 00:22:05 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 30 Jul 2020 02:22:05 +0200 From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Date: Thu, 30 Jul 2020 02:21:54 +0200 Message-Id: <20200730002154.5704-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmailux-2.08st: added fake Content-Type header Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 2.49 X-TUID: j/w6r9+zw0n9 Apart from debug information, one can also strip some symbols. This can be a significant difference, the closure of gcc-toolchain@7 got reduced by 15 MB in my tests. As per [1], --strip-debug is included in --strip-unneeded, and the debug files created also contain a copy of the information removed by --strip-unneeded. Linux From Scratch suggests that this option shouldn't be used on static libraries [2], however other sources [3] indicate otherwise. Building a toolchain with this patch succeeds, and the result works fine for 'gcc -static hello-world.c'. [1]: https://stackoverflow.com/a/52555093 [2]: http://www.linuxfromscratch.org/lfs/view/9.1/chapter05/stripping.html [3]: https://www.technovelty.org/linux/stripping-shared-libraries.html * guix/build/gnu-build-system.scm (strip): Use --strip-unneeded. * guix/build-system/gnu.scm (static-package, gnu-build, gnu-cross-build): Likewise. --- I have realized that my previous patch was a no-op due to default values for arguments being scattered across files. I ran my builds again and now I can observe results in the earlier stages of the toolchain, accessible to a testing core-updates build. guix/build-system/gnu.scm | 6 +++--- guix/build/gnu-build-system.scm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index 6b481ad45c..2c23197e77 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -215,7 +215,7 @@ use `--strip-all' as the arguments to `strip'." (arguments (let ((a (default-keyword-arguments (package-arguments p) '(#:configure-flags '() - #:strip-flags '("--strip-debug"))))) + #:strip-flags '("--strip-unneeded"))))) (substitute-keyword-arguments a ((#:configure-flags flags) `(cons* "--disable-shared" "LDFLAGS=-static" ,flags)) @@ -337,7 +337,7 @@ standard packages used as implicit inputs of the GNU build system." (parallel-tests? #t) (patch-shebangs? #t) (strip-binaries? #t) - (strip-flags ''("--strip-debug" + (strip-flags ''("--strip-unneeded" "--enable-deterministic-archives")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) @@ -492,7 +492,7 @@ is one of `host' or `target'." (parallel-build? #t) (parallel-tests? #t) (patch-shebangs? #t) (strip-binaries? #t) - (strip-flags ''("--strip-debug" + (strip-flags ''("--strip-unneeded" "--enable-deterministic-archives")) (strip-directories ''("lib" "lib64" "libexec" "bin" "sbin")) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 2e7dff2034..d3347c9518 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -425,7 +425,7 @@ makefiles." (objcopy-command (if target (string-append target "-objcopy") "objcopy")) - (strip-flags '("--strip-debug" + (strip-flags '("--strip-unneeded" "--enable-deterministic-archives")) (strip-directories '("lib" "lib64" "libexec" "bin" "sbin")) -- 2.28.0