Changeset 08f72423


Ignore:
Timestamp:
07/28/2021 10:46:22 AM (3 years ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
46e4486
Parents:
79902f4
git-author:
Xi Ruoyao <xry111@…> (07/28/2021 09:00:25 AM)
git-committer:
Xi Ruoyao <xry111@…> (07/28/2021 10:46:22 AM)
Message:

always use --strip-unneeded for stripping

The behavior of --strip-unneeded and --strip-all are same for
executables and shared libraries. For static libraries,
--strip-unneeded keeps the symbols needed for relocation processing so
it won't break static archives.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chapter01/changelog.xml

    r79902f4 r08f72423  
    4848      <itemizedlist>
    4949        <listitem>
     50          <para>[xry111] - Always use --strip-unneeded for stripping.</para>
     51        </listitem>
     52      </itemizedlist>
     53    </listitem>
     54
     55    <listitem>
     56    <listitem>
     57      <para>2021-07-27</para>
     58      <itemizedlist>
     59        <listitem>
    5060          <para>[xry111] - Use workaround for Glibc NSS modules during
    5161          stripping, to prevent bash from crash.</para>
  • chapter07/stripping.xml

    r79902f4 r08f72423  
    8888
    8989    <para>Strip off debugging symbols from binaries:</para>
    90 <screen role="nodump"><userinput>strip --strip-debug $LFS/usr/lib/*
     90<screen role="nodump"><userinput>strip --strip-unneeded $LFS/usr/lib/*
    9191strip --strip-unneeded $LFS/usr/{,s}bin/*
    9292strip --strip-unneeded $LFS/tools/bin/*</userinput></screen>
     
    9797    <quote>Binutils pass 2</quote>, since it is the one that knows how to strip
    9898    our cross-compiled programs.--></para>
    99 
    100     <para>Take care <emphasis>NOT</emphasis> to use
    101     <parameter>--strip-unneeded</parameter> on the libraries. The static
    102     ones would be destroyed and the toolchain packages would need to be
    103     built all over again.</para>
    10499
    105100    <para>At this point, you should have at least 5 GB of free space on the
  • chapter08/strippingagain.xml

    r79902f4 r08f72423  
    6868for BIN in $online_usrbin; do
    6969    cp /usr/bin/$BIN /tmp/$BIN
    70     strip --strip-all /tmp/$BIN
     70    strip --strip-unneeded /tmp/$BIN
    7171    install -vm755 /tmp/$BIN /usr/bin
    7272    rm /tmp/$BIN
     
    8080done
    8181
    82 find /usr/lib -type f -name \*.a \
    83    -exec strip --strip-debug {} ';'
    84 
    85 for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg); do
    86     case "$online_usrlib $save_usrlib" in
     82for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \
     83         $(find /usr/lib -type f -name \*.a)                 \
     84         $(find /usr/{bin,sbin,libexec} -type f); do
     85    case "$online_usrbin $online_usrlib $save_usrlib" in
    8786        *$(basename $i)* )
    8887            ;;
     
    9190    esac
    9291done
    93 
    94 for i in $(find /usr/bin -type f); do
    95     case "$online_usrbin" in
    96         *$(basename $i)* )
    97             ;;
    98         * ) strip --strip-all $i
    99             ;;
    100     esac
    101 done
    102 
    103 find /usr/{sbin,libexec} -type f \
    104     -exec strip --strip-all {} ';'
    10592
    10693unset BIN LIB save_usrlib online_usrbin online_usrlib
Note: See TracChangeset for help on using the changeset viewer.