Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21bdd25399097fe

Jump to content

strip (Unix)

From Wikipedia, the free encyclopedia
(Redirected from Stripped binary)
strip
Original authorsDennis Ritchie
(AT&T Bell Laboratories)
DevelopersVarious open-source and commercial developers
ReleaseJune 12, 1972; 54 years ago (1972-06-12)
Written inC
Operating systemUnix, Unix-like, Plan 9, Microsoft Windows
PlatformCross-platform
TypeCommand
LicensePlan 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.[1]

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.[2] For example, in the GNU C compiler (gcc), this is done via the -s option.[2]

strip (without any options) has been standardized under POSIX since X/Open Portability Guide Issue 2 (1987).[3] 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.

Levels

[edit]

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.[3] To resolve this vagueness, common implementations of strip (LLVM as used by FreeBSD and GNU Binutils as used by Linux) have the following options:[4][5]

  • To strip all debug sections but preserve everything else. This is --strip-debug.
  • To strip symbols unneeded for relocation processing, most commonly relevant with libraries and position-independent executables, and all debug sections. This is --strip-unneeded.
  • To strip compiler-generated local symbols indicated by a special naming convention. This is --debug-local.
  • To strip all non-global symbols. This is --discard-all.
  • To strip all symbols, debug sections and relocations. This is --strip-all in GNU and --strip-all-gnu in LLVM.

There are also additional features such as:

  • To remove or keep a symbol or section of a specific name, or having a name that matches a specific regular expression.
  • To only keep the debug information, allowing the result to serve as a dedicated debugging-information file (--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.

See also

[edit]
  • Dead code elimination – Compiler optimization to remove code which does not affect the program results
  • Debug symbol – Information to facilitate code debugging
  • Executable compression – Means of compressing an executable file
  • List of POSIX commands
  • strings (Unix) – Shell command for extracting printable text from a binary file
  • Symbol table – Data structure used by a language translator such as a compiler or interpreter

References

[edit]
  1. "Linux Strip Command". www.computerhope.com. Archived from the original on 2024-09-13. Retrieved 2024-10-01.
  2. 1 2 "What is the difference between "gcc -s" and a "strip" command?". Stack Overflow. Archived from the original on 2024-09-25. Retrieved 2024-10-01.
  3. 1 2 strip  Shell and Utilities Reference, The Single UNIX Specification, Version 5 from The Open Group
  4. "llvm-strip - object stripping tool — LLVM 24.0.0git documentation". llvm.org.
  5. strip(1)  Linux User Manual – User Commands from Manned.org
[edit]