Opened 18 years ago

Closed 18 years ago

#1719 closed defect (wontfix)

'Chapter 6.61. Stripping Again' is wrong, --strip-all could be used on shared lib, not on kernel modules

Reported by: Gilles Espinasse Owned by: lfs-book@…
Priority: normal Milestone:
Component: Book Version: SVN
Severity: normal Keywords: strip
Cc:

Description

Chapter '6.61. Stripping Again' stable and devel LSF book state that:

"If disk space is very tight, the --strip-all option can be used on the binaries in /{,usr/}{bin,sbin} to gain several more megabytes. Do not use this option on libraries—they will be destroyed."

--strip-all can't be used on kernel modules, but can be used on shared lib.

So the rule can't be the compact /tools/bin/find /{,usr/}{bin,lib,sbin} and need some rewrite.

I do /tools/bin/find /lib /usr/lib /usr/share/rrdtool-* \

-type f \( -name '*.so' -o -name '*.so[\.0-9]*' \) \ -ls -exec /tools/bin/strip --strip-all {} \; #2>/dev/null

/tools/bin/find /{,s}bin /usr/{,s}bin /usr/local/{,s}bin \

-type f \ -exec /tools/bin/strip --strip-all {} \; 2>/dev/null

2>/dev/null allow to suppress the warning on .so scripts -ls allow to see what files are stripped

Those stripping instructions work with LFS5.1 derivated build (using strip 2.15.90.0.3 20040415) But it sometime fail with LFS6 derivated build (but using a different binutils with strip 2.16.91.0.5 ). In this case, it rarely fail during libc stripping with this log ( I had to repeat the strip script in a loop to reproduce the problem).

/tools/bin/find /lib /usr/lib /usr/share/rrdtool-* /install/initrd/lib \

-type f \( -name '*.so' -o -name '*.so[\.0-9]*' \) \ -ls -exec /tools/bin/strip --strip-all {} \; #2>/dev/null

1126081 1028 -rwxr-xr-x 1 root root 1044920 Feb 25 10:28 /lib/libc-2.3.5.so /tools/bin/find: /tools/bin/strip terminated by signal 11 1126087 84 -rwxr-xr-x 1 root root 80716 Feb 25 10:30 /lib/ld-2.3.5.so 1126088 8 -rwxr-xr-x 1 root root 5528 Feb 25 10:30 /lib/libBrokenLocale-2.3.5.so 1126084 140 -rwxr-xr-x 1 root root 137848 Feb 25 10:30 /lib/libm-2.3.5.so 1126085 12 -rwxr-xr-x 1 root root 9828 Feb 25 10:30 /lib/libdl-2.3.5.so ...

So all files but libc-2.3.5.so are correclty stripped. Any later attempt to strip again fail on libc-2.3.5.so the file look corrupted as I have to rebuild the lib to suppress the error.

I had supposed this is because a running binary can't be stripped As find and strip are not statically build, they use shared lib. Could it be the reason sometime strip fail to work on libc with signal 11? Alernately, as it work on LFS5.1, it may be a bug in strip 2.16.91.0.5.

Change History (1)

comment:1 by archaic@…, 18 years ago

Resolution: wontfix
Status: newclosed

The book gives a general guideline for safely stripping along with commands that work. No attempts are made at tweaking the commands to squeeze out every last byte.

Note: See TracTickets for help on using tickets.