2019-08-09 21:10:55 +02:00
|
|
|
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`
|
2019-09-24 15:41:39 +02:00
|
|
|
will be enabled.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
2019-09-24 15:41:39 +02:00
|
|
|
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.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-09-25 15:09:12 +02:00
|
|
|
Disable :option:`--strip-all`.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
.. 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
|
2019-10-31 12:53:33 +01:00
|
|
|
within segments, except for .gnu.warning, .ARM.attribute sections and the
|
|
|
|
section name table.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
For COFF objects, remove all symbols, debug sections, and relocations from the
|
|
|
|
output.
|
|
|
|
|
|
|
|
.. option:: --strip-debug, -g
|
|
|
|
|
2019-09-25 15:09:12 +02:00
|
|
|
Remove all debug sections from the output.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
.. 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
|
|
|
|
|
2019-09-13 15:26:52 +02:00
|
|
|
Remove from the output all local or undefined symbols that are not required by
|
|
|
|
relocations. Also remove all debug sections.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
.. option:: --version, -V
|
|
|
|
|
2019-09-17 13:43:42 +02:00
|
|
|
Display the version of the :program:`llvm-strip` executable.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
2019-09-14 03:14:43 +02:00
|
|
|
.. option:: @<FILE>
|
|
|
|
|
2019-09-17 13:43:42 +02:00
|
|
|
Read command-line options and commands from response file `<FILE>`.
|
2019-09-14 03:14:43 +02:00
|
|
|
|
[llvm-objcopy] Add support for shell wildcards
Summary: GNU objcopy accepts the --wildcard flag to allow wildcard matching on symbol-related flags. (Note: it's implicitly true for section flags).
The basic syntax is to allow *, ?, \, and [] which work similarly to how they work in a shell. Additionally, starting a wildcard with ! causes that wildcard to prevent it from matching a flag.
Use an updated GlobPattern in libSupport to handle these patterns. It does not fully match the `fnmatch` used by GNU objcopy since named character classes (e.g. `[[:digit:]]`) are not supported, but this should support most existing use cases (mostly just `*` is what's used anyway).
Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap
Reviewed By: MaskRay
Subscribers: nickdesaulniers, emaste, arichardson, hiraditya, jakehehrlich, abrachet, seiya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66613
llvm-svn: 375169
2019-10-17 22:51:00 +02:00
|
|
|
.. 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 '*'``.
|
|
|
|
|
2019-08-09 21:10:55 +02:00
|
|
|
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
|
|
|
|
|
2019-09-24 15:41:39 +02:00
|
|
|
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.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
.. 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.
|
|
|
|
|
2019-08-09 21:41:13 +02:00
|
|
|
.. option:: --keep-section <section>
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-09-25 15:09:12 +02:00
|
|
|
When removing symbols from the output, do not remove symbols named
|
|
|
|
``<symbol>``. Can be specified multiple times to keep multiple symbols.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
.. option:: --preserve-dates, -p
|
|
|
|
|
2019-09-25 15:09:12 +02:00
|
|
|
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.
|
2019-08-09 21:10:55 +02:00
|
|
|
|
|
|
|
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)`
|