Opening even "Hello Word" a.out file by any hex editor shows us that it is usually overcrowded with non-informative areas. | SoloLearn: Learn to code for FREE!

0

Opening even "Hello Word" a.out file by any hex editor shows us that it is usually overcrowded with non-informative areas.

Would you suggest typical sequence of operations to extremally squeeze it, throwing away all stuff, unnecrssery for normal launch and work this file? Which way may be more efficient: editing executable by hex editor or editing intermediate assembly file?

5/25/2020 12:49:38 PM

John

2 Answers

New Answer

+1

When you compile your program it is linked against some standard libraries that include startup code. It does not only include the code you have written. The printf function itself is a large function since it has to be able to handle a variable length of arguments with multiple data types. One way to reduce the size of a binary on linux is to run the strip command. On Unix-like operating systems, the strip command discards symbols from compiled object files. This includes stuff like debugging information. try.... ls -l a.out strip --strip-unneeded a.out ls -l a.out and compare the results See: https://linux.die.net/man/1/strip

0