reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
llvm-strip - object stripping tool
==================================

.. program:: llvm-strip

SYNOPSIS
--------

:program:`llvm-strip` [*options*] *inputs...*

DESCRIPTION
-----------

:program:`llvm-strip` is a tool to strip sections and symbols from object files.
If no other stripping or remove options are specified, :option:`--strip-all`
will be enabled.

By default, the input files are modified in-place. If "-" is specified for the
input file, the input is read from the program's 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's :program:`strip`.

GENERIC AND CROSS-PLATFORM OPTIONS
----------------------------------

The following options are either agnostic of the file format, or apply to
multiple file formats.

.. option:: --disable-deterministic-archives, -U

 Use real values for UIDs, GIDs and timestamps when updating archive member
 headers.

.. option:: --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.

.. option::  --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.

.. option:: --help, -h

 Print a summary of command line options.

.. option::  --no-strip-all

 Disable :option:`--strip-all`.

.. option::  -o <file>

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

.. option:: --regex

 If specified, symbol and section names specified by other switches are treated
 as extended POSIX regular expression patterns.

.. option:: --remove-section <section>, -R

 Remove the specified section from the output. Can be specified multiple times
 to remove multiple sections simultaneously.

.. option:: --strip-all-gnu

 Remove all symbols, debug sections and relocations from the output. This option
 is equivalent to GNU :program:`strip`'s ``--strip-all`` switch.

.. option:: --strip-all, -S

 For ELF objects, remove from the output all symbols and non-alloc sections not
 within segments, except for .gnu.warning sections and the section name table.

 For COFF objects, remove all symbols, debug sections, and relocations from the
 output.

.. option:: --strip-debug, -g

 Remove all debug sections from the output.

.. option:: --strip-symbol <symbol>, -N

 Remove all symbols named ``<symbol>`` from the output. Can be specified
 multiple times to remove multiple symbols.

.. option:: --strip-unneeded

 Remove from the output all local or undefined symbols that are not required by
 relocations. Also remove all debug sections.

.. option:: --version, -V

 Display the version of the :program:`llvm-strip` executable.

.. option:: @<FILE>

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

.. option:: --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      ``.``
  ``\``                  Escape the next character ``\``
  ``[a-z]``              Character class           ``[a-z]``
  ``[!a-z]``, ``[^a-z]`` Negated character class   ``[^a-z]``
  ====================== ========================= ==================

  Additionally, starting a wildcard with '!' will prevent a match, even if
  another flag matches. For example ``-w -N '*' -N '!x'`` will strip all symbols
  except for ``x``.

  The order of wildcards does not matter. For example, ``-w -N '*' -N '!x'`` is
  the same as ``-w -N '!x' -N '*'``.

COFF-SPECIFIC OPTIONS
---------------------

The following options are implemented only for COFF objects. If used with other
objects, :program:`llvm-strip` will either emit an error or silently ignore
them.

.. option:: --only-keep-debug

 Remove the contents of non-debug sections from the output, but keep the section
 headers.

ELF-SPECIFIC OPTIONS
--------------------

The following options are implemented only for ELF objects. If used with other
objects, :program:`llvm-strip` will either emit an error or silently ignore
them.

.. option:: --allow-broken-links

 Allow :program:`llvm-strip` to remove sections even if it would leave invalid
 section references. Any invalid sh_link fields will be set to zero.

.. option:: --discard-locals, -X

 Remove local symbols starting with ".L" from the output.

.. option:: --keep-file-symbols

 Keep symbols of type `STT_FILE`, even if they would otherwise be stripped.

.. option:: --keep-section <section>

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

.. option:: --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.

.. option::  --preserve-dates, -p

 Preserve access and modification timestamps in the output.

.. option:: --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.

EXIT STATUS
-----------

:program:`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 <http://llvm.org/bugs/>.

SEE ALSO
--------

:manpage:`llvm-objcopy(1)`