LLVM-STRIP(1)

πŸ’– LLVM-STRIP πŸ’–

okay so bestie, welcome to the manual for llvm-strip β€” the object stripping tool that's literally the main character of binary cleanup. this page is from the LLVM Project, and we're gonna get into all of it. no cap. 🫢


✨ NAME ✨

llvm-strip β€” object stripping tool. that's the whole vibe. it strips sections and symbols from object files like it's decluttering its closet. πŸ’…


🌟 SYNOPSIS 🌟

llvm-strip [options] inputs…

πŸ¦‹ DESCRIPTION πŸ¦‹

llvm-strip is a tool to strip sections and symbols from object files. if you don't specify any other stripping or remove options, --strip-all gets enabled automatically. it's giving "i got you" energy. ✨

by default, the input files are modified in-place. if you specify - for the input file, the input is read from the program's standard input stream. so you can pipe stuff in like it's a juice cleanse. πŸ§ƒ

if the input is an archive, any requested operations will be applied to each archive member individually. yes, it goes through them one by one. thorough queen. πŸ‘‘

the tool is still in active development, but in most scenarios it works as a drop-in replacement for GNU's strip. so you can lowkey just use it. iykyk. πŸ’œ


🌈 GENERIC AND CROSS-PLATFORM OPTIONS 🌈

the following options are either agnostic of the file format, or apply to multiple file formats. they're flexible like that. πŸŽ€

  • --disable-deterministic-archives, -U β€” use real values for UIDs, GIDs and timestamps when updating archive member headers. this is the "keep it real" option. no fake zeroes. πŸ™ˆ
  • --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 not everything, but a lot. πŸ’…
  • --enable-deterministic-archives, -D β€” enable deterministic mode when stripping archives, i.e. use 0 for archive member header UIDs, GIDs and timestamp fields. this is on by default. so zeroes are the default vibe. ✨
  • --help, -h β€” print a summary of command line options. you know, the classic "what does this thing do again?" button. 🫢
  • --no-strip-all β€” disable --strip-all. sometimes you don't want to go all the way. and that's valid. πŸ’–
  • -o <file> β€” write output to <file>. multiple input files cannot be used in combination with -o. it's a one-on-one situation. no group projects. 😭
  • --only-keep-debug β€” produce a debug file as the output that only preserves contents of sections useful for debugging purposes.

for ELF objects, this removes the contents of SHF_ALLOC sections that are not SHT_NOTE by making them SHT_NOBITS and shrinking the program headers where possible. it's like keeping only the receipts you actually need. 🧾

  • --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. if you're coming from GNU, it's the same energy. πŸ‘‘
  • --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. it's the full send. πŸ”₯

  • --strip-debug, -d, -g, -S β€” remove all debug sections from the output. bye bye debug info. πŸ’€
  • --strip-symbol <symbol>, -N β€” remove all symbols named <symbol> from the output. can be specified multiple times to remove multiple symbols. targeted removal. 🎯
  • --strip-unneeded β€” remove from the output all local or undefined symbols that are not required by relocations. also remove all debug sections. if it's not needed, it's gone. periodt. πŸ’…
  • --version, -V β€” display the version of the llvm-strip executable. know your queen's era. 🌸
  • --wildcard, -w β€” allow wildcard syntax for symbol-related flags. on by default for section-related flags. incompatible with –regex. so you can't have both. pick a lane, bestie. 😭

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. exclusion era. 🚫

the order of wildcards does not matter. for example, -w -N '*' -N '!x' is the same as -w -N '!x' -N '*'. so don't stress about the order. it's not that deep. πŸ¦‹

  • @<FILE> β€” read command-line options and commands from response file <FILE>. it's like a little note that tells you what to do. πŸŽ€

🧚 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. so if you're not on ELF, it might just ghost you. πŸ’€

  • --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. it's giving "messy but make it work". 🫢
  • --discard-locals, -X β€” remove local symbols starting with .L from the output. specifically the .L girlies. ✨
  • --keep-file-symbols β€” keep symbols of type STT_FILE, even if they would otherwise be stripped. protect the file symbols 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. protect your faves. πŸ’–
  • --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. same energy. πŸ’…
  • --preserve-dates, -p β€” preserve access and modification timestamps in the output. time is precious. ⏰
  • --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, be careful. this can break things. πŸ’€
  • -T β€” remove Swift symbols. swifties, look away. 😭

πŸ‘‘ EXIT STATUS πŸ‘‘

llvm-strip exits with a non-zero exit code if there is an error. otherwise, it exits with code 0. so 0 is the slay outcome. ✨


πŸ“ BUGS πŸ“

to report bugs, please visit the link below. don't suffer in silence, bestie. 🫢

<‐ https://github.com/llvm/llvm-project/labels/tools:llvm-objcopy%2Fstrip>

🌸 SEE ALSO 🌸

llvm-objcopy(1) β€” the sibling icon. go check it out. πŸ’œ


🌟 AUTHOR 🌟

maintained by the LLVM Team (https://llvm.org/). they're the ones keeping this whole thing going. πŸ‘‘


2003-2023, LLVM Project


and that's the whole page, bestie. this manual is from the LLVM Project, version 15, dated 2023-07-14. iconic. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from