LLVM-STRIP(1)

πŸ“¦
version 12.0.1 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– LLVM-STRIP(1) πŸ’–

okay bestie, welcome to the LLVM manual, page one and only, and she is serving utility. sit down, grab a strawberry πŸ“, and let's strip some objects together.


✨ NAME ✨

llvm-strip β€” object stripping tool 🧚

✨ SYNOPSIS ✨

llvm-strip [options] inputs...

✨ DESCRIPTION ✨

so llvm-strip is literally the tool for stripping sections and symbols out of object files. and here's the tea: if you don't specify any other stripping or remove options, --strip-all just turns itself on by default. it's giving self-sufficient πŸ’…

By default, the input files get modified in-place. and if you pass - as the input file, it reads from the program's standard input stream instead. cute.

If your input is an archive, any requested operations get applied to each archive member individually. one by one, no cutting corners.

ngl, the tool is still in active development, but in most scenarios it works as a drop-in replacement for GNU's strip. no cap. πŸ”₯


🌈 GENERIC AND CROSS-PLATFORM OPTIONS 🌈

these ones are either agnostic of the file format, or they apply to multiple file formats. versatile queens πŸ‘‘

  • --disable-deterministic-archives, -U β€” use real values for UIDs, GIDs and timestamps when updating archive member headers.
  • --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. (ELF said "not today" πŸ’€)
  • --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.
  • --help, -h β€” print a summary of command line options.
  • --no-strip-all β€” disable --strip-all. (yes, you can just… turn it back off. icon behavior)
  • -o <file> β€” write output to <file>. Multiple input files cannot be used in combination with -o. pick a lane bestie.
  • --regex β€” if specified, symbol and section names specified by other switches are treated as extended POSIX regular expression patterns.
  • --remove-section <section>, -R β€” remove the specified section from the output. can be specified multiple times to remove multiple sections simultaneously. stack 'em πŸ“š
  • --strip-all-gnu β€” remove all symbols, debug sections and relocations from the output. this option is equivalent to GNU strip's --strip-all switch.
  • --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.

  • --strip-debug, -g β€” remove all debug sections from the output.
  • --strip-symbol <symbol>, -N β€” remove all symbols named <symbol> from the output. can be specified multiple times to remove multiple symbols.
  • --strip-unneeded β€” remove from the output all local or undefined symbols that are not required by relocations. also removes all debug sections. double duty πŸ’…
  • --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:

  • * β€” any number of characters. equivalent to .*
  • ? β€” any single character. equivalent to .
  • \ β€” escape the next character. equivalent to \
  • [a-z] β€” character class. equivalent to [a-z]
  • [!a-z], [^a-z] β€” negated character class. equivalent to [^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. she said "everyone but x, get out" πŸ™ˆ

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

  • @<FILE> β€” read command-line options and commands from response file <FILE>.

πŸŽ€ COFF-SPECIFIC OPTIONS πŸŽ€

these are implemented only for COFF objects. if you use them with other objects, llvm-strip will either emit an error or silently ignore them. (silently. rude but okay.)

  • --only-keep-debug β€” remove the contents of non-debug sections from the output, but keep the section headers. the headers stay for the vibes ✨

πŸ¦‹ ELF-SPECIFIC OPTIONS πŸ¦‹

these are implemented only for ELF objects. if you use them with other objects, llvm-strip will either emit an error or silently ignore them.

  • --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.
  • --discard-locals, -X β€” remove local symbols starting with ".L" from the output.
  • --keep-file-symbols β€” keep symbols of type STT_FILE, even if they would otherwise be stripped. protection spell cast 🫢
  • --keep-section <section> β€” when removing sections from the output, do not remove sections named <section>. can be specified multiple times to keep multiple 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 symbols.
  • --preserve-dates, -p β€” preserve access and modification timestamps in the output.
  • --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. so like, proceed with caution bestie.
  • -T β€” remove Swift symbols.

πŸ’€ EXIT STATUS πŸ’€

llvm-strip exits with a non-zero exit code if there is an error. otherwise, it exits with code 0. simple as that. zero means slay, non-zero means something went wrong 😭

πŸ› BUGS πŸ›

To report bugs, please visit <https://bugs.llvm.org/>. tell them everything, they can handle it.

πŸ‘€ SEE ALSO πŸ‘€

llvm-objcopy(1) β€” her sister, her bestie, her other half πŸ’œ

πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/). the ones keeping the whole operation running.

2003-2024, LLVM Project


okay that's the whole page!! this was LLVM-STRIP(1), coming to you from the LLVM manual, volume 12, dated 2024-07-18. thanks for reading, bestie β€” now go strip something responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from