From patchwork Thu Jul 30 00:21:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 23453 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 43DEF27BBE1; Thu, 30 Jul 2020 01:23:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 1374F27BBE3 for ; Thu, 30 Jul 2020 01:23:08 +0100 (BST) Received: from localhost ([::1]:50782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0wLj-00030u-J4 for patchwork@mira.cbaines.net; Wed, 29 Jul 2020 20:23:07 -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?b?S8SFZHppb8WCa2E=?= 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?b?S8SFZHppb8WCa2E=?= 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 X-Qmailux-2.08st: added fake Content-Type header 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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"))