LLVM-STRIP(1)

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

okay bestie, welcome to the llvm-strip page from the LLVM manual set β€” yes, the whole squad is at version 14, and this is the glow-up guide to making your object files lose some weight. πŸŽ€


✨ NAME ✨

llvm-strip β€” the object stripping tool. it takes stuff OUT. that's the whole job. πŸ’…


🌸 SYNOPSIS 🌸

llvm-strip [options] inputs…

πŸ¦‹ DESCRIPTION πŸ¦‹

so llvm-strip is the tool that strips sections and symbols out of object files. like, it's giving "declutter your room" but for binaries. if you don't pass any other stripping or remove options, --strip-all just turns itself on. it's the default. it chose violence. πŸ”₯

by default, the input files get modified in-place β€” yes, right where they live, no copy, no backup, no mercy. if you specify - as the input file, it reads from the program's standard input stream instead. ✨

if your input is an archive, every requested operation gets applied to each archive member individually. one by one. like a little assembly line. πŸ‘‘

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 totally agnostic of the file format, or they work across multiple formats. equal opportunity options. 🌈

  • --disable-deterministic-archives, -U β€” use real values for UIDs, GIDs and timestamps when updating archive member headers. the truth, the whole truth. ⭐
  • --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. bye boo πŸ‘‹
  • --enable-deterministic-archives, -D β€” turn on deterministic mode when stripping archives, i.e. use 0 for archive member header UIDs, GIDs and timestamp fields. on by default, so it's already serving. πŸ’…
  • --help, -h β€” print a summary of command line options. the menu, basically. πŸ“
  • --no-strip-all β€” disable --strip-all. the anti-default. the plot twist. πŸ™ˆ
  • -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 given 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. πŸ‘‘
  • --strip-all-gnu β€” remove all symbols, debug sections and relocations from the output. this option is equivalent to GNU strip's --strip-all switch. same energy, different font. ✨
  • --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, -d, -g, -S β€” remove all debug sections from the output. four aliases, one mission. πŸ’€
  • --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 remove all debug sections. ruthless. πŸ”₯
  • --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. 😭
  • @<FILE> β€” read command-line options and commands from response file <FILE>. πŸ’–

okay so about that wildcard syntax β€” it 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 exclusion eats everything else, iconic. πŸ‘‘

and the order of wildcards does not matter. for example -w -N '*' -N '!x' is the same as -w -N '!x' -N '*'. chaos-proof. ✨


β˜• COFF-SPECIFIC OPTIONS β˜•

these ones are implemented only for COFF objects. if you use them with other objects, llvm-strip will either emit an error or silently ignore them. it's giving "depends on its mood". πŸ™ˆ

  • --only-keep-debug β€” remove the contents of non-debug sections from the output, but keep the section headers. the shells stay, the insides dip. πŸ’…

🧚 ELF-SPECIFIC OPTIONS 🧚

these ones are implemented only for ELF objects. if you use them with other objects, llvm-strip will either emit an error or silently ignore them. same deal, 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. risky, but make it fashion. πŸ”₯
  • --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. protected. 🫢
  • --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. the VIP list. πŸ‘‘
  • --preserve-dates, -p β€” preserve access and modification timestamps in the output. respect the origin story. ⭐
  • --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, yes you can, but consider whether you should. πŸ’€
  • -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. ✨


πŸ“ BUGS πŸ“

to report bugs, please visit <https://github.com/llvm/llvm-project/labels/tools:llvm-objcopy%2Fstrip>. tell them everything bestie, they want the details. πŸ’–


🌸 SEE ALSO 🌸

llvm-objcopy(1) β€” its sibling, its partner in crime, its other half. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (<https://llvm.org/>). the collective. the group chat admins. πŸ’œ


2003-2025, LLVM Project. that's a long-running era, honestly. πŸŽ€


and that's the whole page bestie!! this was the llvm-strip manual from LLVM, dated 2025-05-22, manual page release 14. go forth and strip responsibly, mwah πŸ’…πŸ’–βœ¨
πŸ“¦ where this page comes from