Today I learned how to strip files. It is kinda doing what you think – removing redundant stuff from the file.
Binary executable files in Linux are machine language files containing recipes of how to do certain things. When we compile our code the compiler (or interpreter) translates it from “human” language into a machine language. In most cases when it is being done, the compiler will add a symbol table to the output file.
symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier (or symbols), constants, procedures and functions in a program’s source code is associated with information relating to its declaration or appearance in the source. In other words, the entries of a symbol table store the information related to the entry’s corresponding symbol.
Wikipedia
This symbol information is crucial when debugging the program. However, it is adding to the size of the file and from the computer perspective, it is redundant. If we’ll remove this data we can achieve 2 advantages:
- Decrease in the file size, with no impact of the actual program performance.
- Making the compiled code more difficult for reverse-engineering
How can we strip the binary file? simply by running-
strip <your_file>
That’s it, now your file is a little bit smaller but harder to understand for unwanted people. Note that this command overwrites your file and maybe you’ll still want to keep the non-striped version for, well, actual debugging.
Read more:
Wikipedia: https://en.wikipedia.org/wiki/Symbol_table
Computer hope (how to use): https://www.computerhope.com/unix/strip.htm