Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022

llvm-strip (1)


llvm-strip - object stripping tool


llvm-strip [options] inputs...


LLVM-STRIP(1)                        LLVM                        LLVM-STRIP(1)

       llvm-strip - object stripping tool

       llvm-strip [options] inputs...

       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 "-" is specified
       for the input file, the input is read from the program's standard input

       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 strip.

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

       --disable-deterministic-archives, -U
              Use real values for UIDs, GIDs and timestamps when updating  ar-
              chive member headers.

       --discard-all, -x
              Remove  most  local symbols from the output. Different file for-
              mats may limit this to a subset of the local symbols. For  exam-
              ple,  file  and  section symbols in ELF objects will not be dis-

       --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

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

              Disable --strip-all.

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

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

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

              Remove all symbols, debug sections and relocations from the out-
              put.  This  option  is  equivalent  to  GNU  strip's --strip-all

       --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  relo-
              cations from the output.

       --strip-debug, -g
              Remove all debug sections from the output.

       --strip-symbol <symbol>, -N
              Remove all symbols named <symbol> from the output. Can be speci-
              fied multiple times to remove multiple symbols.

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

       --version, -V
              Display the version of the llvm-strip executable.

       --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 char- | .*         |
                    |               | acters              |            |
                    |?              | Any  single charac- | .          |
                    |               | ter                 |            |
                    |\              | Escape   the   next | \          |
                    |               | character           |            |
                    |[a-z]          | Character class     | [a-z]      |
                    |[!a-z], [^a-z] | Negated   character | [^a-z]     |
                    |               | class               |            |

              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 '*'.

              Read  command-line  options  and  commands  from  response  file

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

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

       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.

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

       --discard-locals, -X
              Remove local symbols starting with ".L" from the output.

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

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

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

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

              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.

       -T     Remove Swift symbols.

       llvm-strip exits with a non-zero exit code if there is an error.   Oth-
       erwise, it exits with code 0.

       To report bugs, please visit <https://bugs.llvm.org/>.

       See attributes(7) for descriptions of the following attributes:

       |Availability   | developer/llvm/llvm |
       |Stability      | Uncommitted         |


       Maintained by the LLVM Team (https://llvm.org/).

       2003-2022, LLVM Project

       Source  code  for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-

       This     software     was    built    from    source    available    at
       https://github.com/oracle/solaris-userland.   The  original   community
       source     was     downloaded    from     https://github.com/llvm/llvm-

       Further information about this software can be found on the open source
       community website at https://llvm.org/.

11                                2022-06-28                     LLVM-STRIP(1)