LLVM-STRIP(1)

πŸ“¦
version 13.0.1 Β· 5 versions
, in ubuntu jammy

πŸ’… LLVM-STRIP(1) β€” the LLVM manual, bestie edition πŸŽ€

okay so this is llvm-strip, and it lives in the LLVM manual section 1. yes we're doing this, grab a drink πŸ“


✨ NAME ✨

llvm-strip β€” object stripping tool. that's it, that's the whole vibe check: it strips stuff out of object files πŸ’…


🌸 SYNOPSIS 🌸

llvm-strip [options] inputs…

πŸ¦‹ DESCRIPTION πŸ¦‹

so llvm-strip is a tool to strip sections and symbols from object files. literally its whole personality. and listen β€” if you don't specify any other stripping or remove options, --strip-all gets enabled automatically. the tool just goes "say less" and strips everything πŸ’€

By default, the input files are modified in-place (yes, the original files, no undo, be careful bestie 😭). If - is specified for the input file, the input is read from the program's standard input stream instead.

If the input is an archive, any requested operations will be applied to each archive member individually. every single one. no member left behind 🫢

The tool is still in active development, but in most scenarios it works as a drop-in replacement for GNU's strip. highkey iconic behavior ngl πŸ‘‘


⭐ GENERIC AND CROSS-PLATFORM OPTIONS ⭐

these ones are either agnostic of the file format, or apply to multiple file formats. equal opportunity options, we love to see it 🌈

  • --disable-deterministic-archives, -U β€” Use real values for UIDs, GIDs and timestamps when updating archive member headers. i.e. the actual real-world values, not the fakey zeros ✨
  • --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. Additionally, remove all debug sections. so it's "most", not "all", the flag name is lowkey lying to you πŸ™ˆ
  • --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. yes bestie it's already on, you're fine πŸ’–
  • --help, -h β€” Print a summary of command line options. your lil cheat sheet πŸŽ€
  • --no-strip-all β€” Disable --strip-all. the anti-strip-all button, for when you need to chill πŸ’…
  • -o <file> β€” Write output to <file>. Multiple input files cannot be used in combination with -o. one file in, one file out, that's the rule 🚫
  • --regex β€” If specified, symbol and section names specified by other switches are treated as extended POSIX regular expression patterns. regex girlies rise πŸ”₯
  • --remove-section <section>, -R β€” Remove the specified section from the output. Can be specified multiple times to remove multiple sections simultaneously. stack 'em up 🧚
  • --strip-all-gnu β€” Remove all symbols, debug sections and relocations from the output. This option is equivalent to GNU strip's --strip-all switch. for the GNU stans 🫢
  • --strip-all, -s β€” okay this one's the big one:
    • 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, -d, -g, -S β€” Remove all debug sections from the output. four whole flags for one job, she's flexible πŸ’…
  • --strip-symbol <symbol>, -N β€” Remove all symbols named <symbol> from the output. Can be specified multiple times to remove multiple symbols. bye bye to whoever you name πŸ‘‹
  • --strip-unneeded β€” Remove from the output all local or undefined symbols that are not required by relocations. Also remove all debug sections. if nothing needs it, it's gone, periodt ✨
  • --version, -V β€” Display the version of the llvm-strip executable. which girlboss era are we in πŸ‘‘
  • --wildcard, -w β€” Allow wildcard syntax for symbol-related flags. On by default for section-related flags. Incompatible with --regex (pick a lane bestie, they can't both be main character 😀).

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. the ! is the bodyguard of the group chat πŸ’€

The order of wildcards does not matter. For example, -w -N '*' -N '!x' is the same as -w -N '!x' -N '*'. order? never heard of her 🌸

  • *@<FILE*> β€” Read command-line options and commands from response file <FILE>. the "here's my whole list, don't @ me" option, except... do @ it πŸ“©

πŸ”₯ COFF-SPECIFIC OPTIONS πŸ”₯

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. it's giving exclusive club, no cap πŸ’…

  • --only-keep-debug β€” Remove the contents of non-debug sections from the output, but keep the section headers. keep the skeleton, drop the meat 🦴

πŸ‘‘ ELF-SPECIFIC OPTIONS πŸ‘‘

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. same exclusive-energy, different format πŸ’œ

  • --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. letting her break things on purpose, we respect the chaos 😭
  • --discard-locals, -X β€” Remove local symbols starting with .L from the output. .L symbols are SO last season πŸ—‘οΈ
  • --keep-file-symbols β€” Keep symbols of type STT_FILE, even if they would otherwise be stripped. protect them at all costs 🫢
  • --keep-section <section> β€” When removing sections from the output, do not remove sections named <section>. Can be specified multiple times to keep multiple sections. the protected list ✨
  • --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. VIP pass for symbols 🎟️
  • --preserve-dates, -p β€” Preserve access and modification timestamps in the output. her memory is impeccable πŸ’–
  • --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. ⚠️ like, for real for real, a lot of tools will just give you the πŸ’€ face
  • -T β€” Remove Swift symbols. swifties getting removed, sorry not sorry 🐍

🌟 EXIT STATUS 🌟

llvm-strip exits with a non-zero exit code if there is an error. Otherwise, it exits with code 0. so 0 means slay, anything else means something went wrong 😭


πŸ’€ BUGS πŸ’€

To report bugs, please visit <https://bugs.llvm.org/>. tell them everything, they want the tea 🍡


🧚 SEE ALSO 🧚


🌈 AUTHOR 🌈

Maintained by the LLVM Team (https://llvm.org/). collectively iconic πŸ‘‘


2003-2023, LLVM Project


okay that's the whole page bestie, go strip something responsibly 🫢✨

sign-off: this masterpiece of a manual page is version 13, dated 2023-07-14, and yeah β€” it's LLVM-STRIP(1) all day, every day πŸ’…πŸŽ€

πŸ“¦ where this page comes from