what is the point of stripping a binary/elf program?

I'm just wondering if stripping a program file has more benefits than just saving disk space.


Solution 1:

The primary benefit, for the vast majority of cases, is just to save disk space. A secondary, and much more dubious benefit, is that it also makes the binary more difficult to disassemble or reverse engineer. It may also reduce the memory footprint a little, though in many cases it'll be a negligible savings.

The biggest detriment is that it makes debugging significantly more difficult if you run into a problem.

On a modern system with CPU speeds what they are, and memory/disk quantities what they are, stripping a binary will have very little practical impact on performance in any way. It's really about debugging, "cleanliness", and personal preferences. Some people prefer to always used stripped binaries for production or "shipped" software. Some people prefer to always leave the symbols included, "just in case".

Personally, I prefer to have symbols included. I've had a couple of really frustrating situations over the year where a commercial application was segfaulting (or otherwise crashing) and I had no ability to pinpoint where the problem was, because the binaries were stripped. In at least a few of those cases, the vendor ended up sending me a non-stripped version to run with, until it crashed again, so we could get more useful debugging information. Had they provided the non-stripped version in the beginning, we could have resolved the problem faster and with less downtime.

Solution 2:

you can compile software with debug symbols for testing and then just strip them out for deployment. if your debugging symbols expose something you would rather not expose, this might be of use to you