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