This article needs more citations. (December 2020) |
| strip | |
|---|---|
| Original authors | Dennis Ritchie (AT&T Bell Laboratories) |
| Developers | Various open-source and commercial developers |
| Release | June 12, 1972 |
| Written in | C |
| Operating system | Unix, Unix-like, Plan 9, Microsoft Windows |
| Platform | Cross-platform |
| Type | Command |
| License | Plan 9: MIT License |
strip is a shell command for removing information from binary executable programs and object files that is not required for execution – typically including debugging data, symbol tables, relocation information, and other metadata. The resulting file will have a smaller size. This is also known as a stripped binary.
Using strip can enhance the security of an executable by making it more difficult to reverse-engineer. The absence of symbol and debugging information complicates the program analysis of the binary.
The effect of strip can also be achieved via a compiler or linker to perform the same process. For example, in the GNU C compiler (gcc), this is done via the -s option.
strip (without any options) has been standardized under POSIX since X/Open Portability Guide Issue 2 (1987). The command is available in Unix, Plan 9, and Unix-like systems. The GNU Project includes an implementation in the GNU Binutils package. The command has been implemented in to other operating systems including Windows.
POSIX defines the action of strip as "remove from strippable files named by the file operands any information the implementor deems unnecessary for execution of those files", which is intentionally vague. To resolve this vagueness, common implementations of strip (LLVM as used by FreeBSD and GNU Binutils as used by Linux) have the following options:
--strip-debug.--strip-unneeded.--debug-local.--discard-all.--strip-all in GNU and --strip-all-gnu in LLVM.There are also additional features such as:
--only-keep-debug).Many of these options can be used together when not contradictory (e.g. --strip-debug --discard-local).
Distinctions of global vs local and relocated vs non-relocated symbols are important in maintaining the functioning of dynamic libraries.