xref: /openbsd-src/gnu/usr.bin/clang/llvm-objcopy/strip.1 (revision 1ad61ae0a79a724d2d3ec69e69c8e1d1ff6b53a0)
Man page generated from reStructuredText.
. . .nr rst2man-indent-level 0 . \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .rstReportMargin pre:
. RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .rstReportMargin post:
.. . RE indent \\n[an-margin]
old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1 new: \\n[rst2man-indent\\n[rst2man-indent-level]]
..
"LLVM-STRIP" "1" "2023-10-21" "16" "LLVM"
NAME
llvm-strip - object stripping tool
SYNOPSIS
llvm-strip [options] inputs...
DESCRIPTION
llvm-strip is a tool to strip sections and symbols from object files. If no other stripping or remove options are specified, \%--strip-all will be enabled. By default, the input files are modified in-place. If \(dq-\(dq is specified for the input file, the input is read from the program\(aqs standard input stream. If the input is an archive, any requested operations will be applied to each archive member individually. The tool is still in active development, but in most scenarios it works as a drop-in replacement for GNU\(aqs strip.
GENERIC AND CROSS-PLATFORM OPTIONS
The following options are either agnostic of the file format, or apply to multiple file formats. NDENT 0.0

--disable-deterministic-archives, -U Use real values for UIDs, GIDs and timestamps when updating archive member headers. NINDENT NDENT 0.0

--discard-all, -x Remove most local symbols from the output. Different file formats may limit this to a subset of the local symbols. For example, file and section symbols in ELF objects will not be discarded. Additionally, remove all debug sections. NINDENT NDENT 0.0

--enable-deterministic-archives, -D Enable deterministic mode when stripping archives, i.e. use 0 for archive member header UIDs, GIDs and timestamp fields. On by default. NINDENT NDENT 0.0

--help, -h Print a summary of command line options. NINDENT NDENT 0.0

--no-strip-all Disable \%--strip-all. NINDENT NDENT 0.0

-o <file> Write output to <file>. Multiple input files cannot be used in combination with -o. NINDENT NDENT 0.0

--only-keep-debug Produce a debug file as the output that only preserves contents of sections useful for debugging purposes. For ELF objects, this removes the contents of SHF_ALLOC sections that are not SHT_NOTE by making them SHT_NOBITS and shrinking the program headers where possible. NINDENT NDENT 0.0

--regex If specified, symbol and section names specified by other switches are treated as extended POSIX regular expression patterns. NINDENT NDENT 0.0

--remove-section <section>, -R Remove the specified section from the output. Can be specified multiple times to remove multiple sections simultaneously. NINDENT NDENT 0.0

--strip-all-gnu Remove all symbols, debug sections and relocations from the output. This option is equivalent to GNU strip\(aqs --strip-all switch. NINDENT NDENT 0.0

--strip-all, -s For ELF objects, remove from the output all symbols and non-alloc sections not within segments, except for .gnu.warning, .ARM.attribute sections and the section name table. For COFF objects, remove all symbols, debug sections, and relocations from the output. NINDENT NDENT 0.0

--strip-debug, -d, -g, -S Remove all debug sections from the output. NINDENT NDENT 0.0

--strip-symbol <symbol>, -N Remove all symbols named <symbol> from the output. Can be specified multiple times to remove multiple symbols. NINDENT NDENT 0.0

--strip-unneeded Remove from the output all local or undefined symbols that are not required by relocations. Also remove all debug sections. NINDENT NDENT 0.0

--version, -V Display the version of the llvm-strip executable. NINDENT NDENT 0.0

--wildcard, -w Allow wildcard syntax for symbol-related flags. On by default for section-related flags. Incompatible with --regex. Wildcard syntax allows the following special symbols:

Character
Meaning
Equivalent
*
Any number of characters
.*
?
Any single character
.
\e
Escape the next character
\e
[a-z]
Character class
[a-z]
[!a-z], [^a-z]
Negated character class
[^a-z]
Additionally, starting a wildcard with \(aq!\(aq will prevent a match, even if another flag matches. For example -w -N \(aq*\(aq -N \(aq!x\(aq will strip all symbols except for x. The order of wildcards does not matter. For example, -w -N \(aq*\(aq -N \(aq!x\(aq is the same as -w -N \(aq!x\(aq -N \(aq*\(aq. NINDENT NDENT 0.0

@<FILE> Read command-line options and commands from response file <FILE>. NINDENT

ELF-SPECIFIC OPTIONS
The following options are implemented only for ELF objects. If used with other objects, llvm-strip will either emit an error or silently ignore them. NDENT 0.0

--allow-broken-links Allow llvm-strip to remove sections even if it would leave invalid section references. Any invalid sh_link fields will be set to zero. NINDENT NDENT 0.0

--discard-locals, -X Remove local symbols starting with \(dq.L\(dq from the output. NINDENT NDENT 0.0

--keep-file-symbols Keep symbols of type STT_FILE, even if they would otherwise be stripped. NINDENT NDENT 0.0

--keep-section <section> When removing sections from the output, do not remove sections named <section>. Can be specified multiple times to keep multiple sections. NINDENT NDENT 0.0

--keep-symbol <symbol>, -K When removing symbols from the output, do not remove symbols named <symbol>. Can be specified multiple times to keep multiple symbols. NINDENT NDENT 0.0

--preserve-dates, -p Preserve access and modification timestamps in the output. NINDENT NDENT 0.0

--strip-sections Remove from the output all section headers and all section data not within segments. Note that many tools will not be able to use an object without section headers. NINDENT NDENT 0.0

-T Remove Swift symbols. NINDENT

EXIT STATUS
llvm-strip exits with a non-zero exit code if there is an error. Otherwise, it exits with code 0.
BUGS
To report bugs, please visit <\%https://github.com/llvm/llvm-project/labels/tools:llvm-objcopy%2Fstrip>.
SEE ALSO
llvm-objcopy(1)
AUTHOR
Maintained by the LLVM Team (https://llvm.org/).
COPYRIGHT
2003-2023, LLVM Project Generated by docutils manpage writer.
.