What is the difference between “gcc -s” and a “strip” command?

gcc being a compiler/linker, its -s option is something done while linking. It’s also not configurable – it has a set of information which it removes, no more no less.

strip is something which can be run on an object file which is already compiled. It also has a variety of command-line options which you can use to configure which information will be removed. For example, -g strips only the debug information which gcc -g adds.

Note that strip is not a bash command, though you may be running it from a bash shell. It is a command totally separate from bash, part of the GNU binary utilities suite.

Leave a Comment