guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#42555] [PATCH v2 core-updates] build-system/gnu: strip with --strip


From: Ludovic Courtès
Subject: [bug#42555] [PATCH v2 core-updates] build-system/gnu: strip with --strip-unneeded
Date: Sat, 19 Sep 2020 14:49:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi Jakub,

Jakub Kądziołka <kuba@kadziolka.net> skribis:

> 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.

Nice!  Now’s a good time to get that patch in on ‘core-updates’.

> 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.

Hmm the Binutils manual suggests otherwise (info "(binutils) objcopy"):

--8<---------------cut here---------------start------------->8---
'-g'
'--strip-debug'
     Do not copy debugging symbols or sections from the source file.

'--strip-unneeded'
     Strip all symbols that are not needed for relocation processing.
--8<---------------cut here---------------end--------------->8---

… but objcopy.c reads this:

--8<---------------cut here---------------start------------->8---
      else if ((flags & BSF_DEBUGGING) != 0)    /* Debugging symbol.  */
        keep = (strip_symbols != STRIP_DEBUG
                && strip_symbols != STRIP_UNNEEDED
                && ! convert_debugging);
--8<---------------cut here---------------end--------------->8---

… confirming that ‘--strip-unneeded’ includes ‘--strip-debug’.

I submitted a patch for the Binutils manual.

> 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'.

OK.

> [1]: https://stackoverflow.com/a/52555093

Perhaps we can omit this one.  In general, I think it’s safer to refer
to “primary sources” as Wikipedians would say.

> [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.

LGTM!

For the record, I tried ‘--strip-all’ before, but that was problematic
for some reason:

  https://lists.gnu.org/archive/html/guix-devel/2018-03/msg00135.html

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]