diff options
author | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2017-04-26 03:01:26 +0000 |
---|---|---|
committer | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2017-04-26 03:01:26 +0000 |
commit | c32384e4cd6671e5a2b4461bf36c659db61554dc (patch) | |
tree | 1d510f029d3eba83742d4342aa73a9e653bcc04a /chapter06/strippingagain.xml | |
parent | 8a5a68d455b0ee06e7692aa26a1ba5467e8cc78f (diff) |
Update to vim-8.0.586.
Update to eudev-3.2.2.
Update to linux-4.10.12.
Update to gperf-3.1.
Improve instructions to save debugging information for selected
libraries when stripping at the end of Chapter 6.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11230 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter06/strippingagain.xml')
-rw-r--r-- | chapter06/strippingagain.xml | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/chapter06/strippingagain.xml b/chapter06/strippingagain.xml index fcd0c2a49..a90f477ec 100644 --- a/chapter06/strippingagain.xml +++ b/chapter06/strippingagain.xml @@ -10,7 +10,8 @@ <title>Stripping Again</title> - <para>If the intended user is not a programmer and does not plan to do + <para>This section is optional. If the intended user is not a + programmer and does not plan to do any debugging on the system software, the system size can be decreased by about 90 MB by removing the debugging symbols from binaries and libraries. This causes no inconvenience other than not being able to @@ -22,20 +23,38 @@ <command>strip</command> command, it is a good idea to make a backup of the LFS system in its current state.</para> - <para>First back up some libraries whose debug symbols are needed when - running regression tests in BLFS packages:</para> + <para>First place the debugging sysmbols for selected libraries + in separate files. This debugging information is needed if running + regression tests that use <ulink + url='&blfs-book;/general/prog/valgrind.html'>valgrind</ulink> or <ulink + url='&blfs-book;/general/prog/gdb.html'>gdb</ulink> later in BLFS. + </para> <!-- also of interest are libgfortan, libgo, libgomp, and libobjc from gcc --> -<screen><userinput>save_libs="ld- libatomic libc- libcilkrts libitm libmpx libpthread" -save_libs="$save_libs libquadmath libsanitizer libstdc++ libthread_db libvtv" -mkdir -p /var/dbg/lib /var/dbg/usr/lib +<screen><userinput>save_lib="ld-2.25.so libc-2.25.so libpthread-2.25.so libthread_db-1.0.so" -for lib in $save_libs -do - find /usr/lib -name ${lib}*so* -type f -exec cp {} /var/dbg/usr/lib \; - find /lib -name ${lib}*so* -type f -exec cp {} /var/dbg/lib \; -done</userinput></screen> +cd /lib + +for LIB in $save_lib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done + +save_usrlib="libquadmath.o.0.0.0 libstdc++.so.6.0.22 + libmpx.so.2.0.0 libmpxwrappers.so.2.0.0 libitm.so.1.0.0 + libcilkrts.so.5.0.0 libatomic.so.1.2.0" + +cd /usr/lib + +for LIB in $save_usrlib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done + +unset LIB save_lib save_usrlib</userinput></screen> <para>Before performing the stripping, take special care to ensure that none of the binaries that are about to be stripped are running. If @@ -57,7 +76,7 @@ done</userinput></screen> <screen><userinput>/tools/bin/find /usr/lib -type f -name \*.a \ -exec /tools/bin/strip --strip-debug {} ';' -/tools/bin/find /lib /usr/lib -type f -name \*.so* \ +/tools/bin/find /lib /usr/lib -type f \(-name \*.so* -a ! -name \*dbg\) \ -exec /tools/bin/strip --strip-unneeded {} ';' /tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ @@ -68,13 +87,4 @@ done</userinput></screen> warnings indicate that those files are scripts instead of binaries.</para> - <para>If desired, restore the saved libraries with the debug data - intact. The files can restored now or just held for later use. Note - that several of the files cannot be copied directly after rebooting - to the new LFS system. Later use requires booting to another system, - mounting the LFS partition, and then copying the files.</para> - -<screen><userinput>cp -av /var/dbg/lib/* /lib -cp -av /var/dbg/usr/lib/* /usr/lib</userinput></screen> - </sect1> |