[KLUG Programming] strip'ing
Robert G. Brown
programming@kalamazoolinux.org
Tue, 28 Oct 2003 16:50:52 -0500
On Tue, 28 Oct 2003 16:29:29 -0500, Adam Williams <adam@morrison-ind.com> wrote:
>> >The "strip" command has some different options:
>> > --strip-all to remove all symbols
>> > --strip-debug to only remove debugging symbols
>> > --strip-unneeded ...
>> >If I'm trying to save space on a bunch of binaries, is there any reason
>> >NOT to use --strip-all? Is there any chance it could cause problems
>> >with program execution?
>> I believe you want "strip unneeded"; I'm not up on what symbols may be
>> used by all the run-time loaders, especially for dynamic library usse.
>> Also, use the -o option so you keep the original executable while testing
>> the stripped binary. You can also compare file sizes to see how much room
>> you're stripping.
>
>I've read about this before, and think Bob is right. But I also don't
>think your going to gain anything much.
He might be building his own stuff... it happens, you know. :)
I do it all the time (not stripping executables, but building 'em). It's
also HIGHLY variable. A fairly small executable with LOTS of symbols may
be reduced significantly.
>[awilliam@estate2 awilliam]$ ls -l /usr/sbin/smbd
>-rwxr-xr-x 1 root root 2489908 Sep 30 11:01 /usr/sbin/smbd
>[root@estate2 awilliam]# strip --strip-unneeded /usr/sbin/smbd
>[root@estate2 awilliam]# ls -l /usr/sbin/smbd
>-rwxr-xr-x 1 root root 2489908 Oct 28 16:27 /usr/sbin/smbd
Nope, ya didn't pick up much there!
>Most build routines these days either build unsymbol'd binaries or strip
>after building. You'll see the strip step in lots of SPEC files,
>etc... So it's pretty hard to find an unstripped binary.
Yeah, smbd is a poor example, since it's so large (a buch of little executables
collectively make a better example), and it's likely to have a very mature
makefile set (with strip commands).