Posted on | February 25, 2010 | 3 Comments
It is a common misconception that the “strip” command does some kind of magic optimization to an executable resulting in it running faster. Its also a common misconception that the smaller an executable is in size, the less memory it will consume.
Neither case is correct. I could write a program in 10 lines that allocates and leaks all available memory. Stripping all symbols from that executable (including debugging) just makes it harder for someone to figure out why that program is behaving so badly. The end result is now you have the same buggy code in a slightly smaller package, but now its much more difficult to debug.
Stripping a file is useful in two instances:
- You have very limited storage space, common when discussing hand held devices. Bash’s symbol table occupies more room than any three stripped programs put together, so you would naturally want to strip them in order to make everything fit (or, compile bash differently)
- You are releasing proprietary software and want to conceal what you link against, as well as the symbols you use. In this case, you often see huge statically l inked executables (bad idea) stripped to compensate for the bloat of static linkage. In this case, its just better to run the code through obfuscation prior to compiling it, then strip the symbols for good measure. You then take advantage of the same libraries already in shared memory, while hiding your already obfuscated symbols.
Stripping an executable became popular in the days where people used whatever spare parts they could to put together a “*nix box” to play with. I fondly remember a 486 DX with a 120 MB IDE drive. Just the core utils, libc and compiler tool chain would eat that up. I remember builds failing because I would run out of disk space while compiling. I also remember the sheer hell of debugging without symbols, it was a trade off.
In this day and age, there is really no good reason for stripping executables, but I see so many makefiles doing it automatically. All it does is make things harder on the people who are actually able to squash bugs for you and send patches, while the rest of the users with 500 gig drives don’t notice that you saved them a meg or two of useful bloat.
Besides, what would your mother say if she knew you were a stripper?