1 llvm-strip - object stripping tool
2 ==================================
4 .. program:: llvm-strip
9 :program:`llvm-strip` [*options*] *inputs...*
14 :program:`llvm-strip` is a tool to strip sections and symbols from object files.
15 If no other stripping or remove options are specified, :option:`--strip-all`
18 By default, the input files are modified in-place. If "-" is specified for the
19 input file, the input is read from the program's standard input stream.
21 If the input is an archive, any requested operations will be applied to each
22 archive member individually.
24 The tool is still in active development, but in most scenarios it works as a
25 drop-in replacement for GNU's :program:`strip`.
27 GENERIC AND CROSS-PLATFORM OPTIONS
28 ----------------------------------
30 The following options are either agnostic of the file format, or apply to
31 multiple file formats.
33 .. option:: --disable-deterministic-archives, -U
35 Use real values for UIDs, GIDs and timestamps when updating archive member
38 .. option:: --discard-all, -x
40 Remove most local symbols from the output. Different file formats may limit
41 this to a subset of the local symbols. For example, file and section symbols in
42 ELF objects will not be discarded.
44 .. option:: --enable-deterministic-archives, -D
46 Enable deterministic mode when stripping archives, i.e. use 0 for archive member
47 header UIDs, GIDs and timestamp fields. On by default.
49 .. option:: --help, -h
51 Print a summary of command line options.
53 .. option:: --no-strip-all
55 Disable :option:`--strip-all`.
59 Write output to <file>. Multiple input files cannot be used in combination
64 If specified, symbol and section names specified by other switches are treated
65 as extended POSIX regular expression patterns.
67 .. option:: --remove-section <section>, -R
69 Remove the specified section from the output. Can be specified multiple times
70 to remove multiple sections simultaneously.
72 .. option:: --strip-all-gnu
74 Remove all symbols, debug sections and relocations from the output. This option
75 is equivalent to GNU :program:`strip`'s ``--strip-all`` switch.
77 .. option:: --strip-all, -S
79 For ELF objects, remove from the output all symbols and non-alloc sections not
80 within segments, except for .gnu.warning sections and the section name table.
82 For COFF objects, remove all symbols, debug sections, and relocations from the
85 .. option:: --strip-debug, -g
87 Remove all debug sections from the output.
89 .. option:: --strip-symbol <symbol>, -N
91 Remove all symbols named ``<symbol>`` from the output. Can be specified
92 multiple times to remove multiple symbols.
94 .. option:: --strip-unneeded
96 Remove from the output all local or undefined symbols that are not required by
97 relocations. Also remove all debug sections.
99 .. option:: --version, -V
101 Display the version of the :program:`llvm-strip` executable.
105 Read command-line options and commands from response file `<FILE>`.
107 .. option:: --wildcard, -w
109 Allow wildcard syntax for symbol-related flags. On by default for
110 section-related flags. Incompatible with --regex.
112 Wildcard syntax allows the following special symbols:
114 ====================== ========================= ==================
115 Character Meaning Equivalent
116 ====================== ========================= ==================
117 ``*`` Any number of characters ``.*``
118 ``?`` Any single character ``.``
119 ``\`` Escape the next character ``\``
120 ``[a-z]`` Character class ``[a-z]``
121 ``[!a-z]``, ``[^a-z]`` Negated character class ``[^a-z]``
122 ====================== ========================= ==================
124 Additionally, starting a wildcard with '!' will prevent a match, even if
125 another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols
128 The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is
129 the same as ``-w -N '!x' -N '*'``.
131 COFF-SPECIFIC OPTIONS
132 ---------------------
134 The following options are implemented only for COFF objects. If used with other
135 objects, :program:`llvm-strip` will either emit an error or silently ignore
138 .. option:: --only-keep-debug
140 Remove the contents of non-debug sections from the output, but keep the section
146 The following options are implemented only for ELF objects. If used with other
147 objects, :program:`llvm-strip` will either emit an error or silently ignore
150 .. option:: --allow-broken-links
152 Allow :program:`llvm-strip` to remove sections even if it would leave invalid
153 section references. Any invalid sh_link fields will be set to zero.
155 .. option:: --discard-locals, -X
157 Remove local symbols starting with ".L" from the output.
159 .. option:: --keep-file-symbols
161 Keep symbols of type `STT_FILE`, even if they would otherwise be stripped.
163 .. option:: --keep-section <section>
165 When removing sections from the output, do not remove sections named
166 ``<section>``. Can be specified multiple times to keep multiple sections.
168 .. option:: --keep-symbol <symbol>, -K
170 When removing symbols from the output, do not remove symbols named
171 ``<symbol>``. Can be specified multiple times to keep multiple symbols.
173 .. option:: --preserve-dates, -p
175 Preserve access and modification timestamps in the output.
177 .. option:: --strip-sections
179 Remove from the output all section headers and all section data not within
180 segments. Note that many tools will not be able to use an object without
186 :program:`llvm-strip` exits with a non-zero exit code if there is an error.
187 Otherwise, it exits with code 0.
192 To report bugs, please visit <http://llvm.org/bugs/>.
197 :manpage:`llvm-objcopy(1)`