LLVM-STRIP(1)
π LLVM-STRIP: the manual (LLVM's own, bestie edition) π
okay so this is the llvm-strip(1) page from the LLVM manual set, and I'm gonna walk you through it like we're texting at 2am. it's giving "underrated utility, main character energy" fr fr.
β¨ NAME β¨
llvm-strip β object stripping tool. that's the whole vibe. it strips stuff. out of objects. slay.
πΈ SYNOPSIS πΈ
llvm-strip [options] inputs...
π DESCRIPTION π
so llvm-strip is a tool that strips sections and symbols from object files. that's its whole thing, and it does it well π
lowkey important: if you don't specify any other stripping or remove options, then --strip-all gets enabled automatically. it's the default. it just happens.
by default, the input files are modified in-place π«Ά. and if you pass "-" as the input file, it reads the input from the program's standard input stream instead. cute.
if the input is an archive, any requested operations get applied to each archive member individually. every single one. no member left behind π
and ngl, the tool is still in active development, but like β in most scenarios it works as a drop-in replacement for GNU's strip. iconic behavior honestly.
π¦ GENERIC AND CROSS-PLATFORM OPTIONS π¦
these ones are either agnostic of the file format, or they apply to multiple file formats. equal opportunity options β¨
--disable-deterministic-archives,-Uβ use real values for UIDs, GIDs and timestamps when updating archive member headers. no fakey zeros, the actual real ones.--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, it removes all debug sections.--enable-deterministic-archives,-Dβ enable deterministic mode when stripping archives, i.e. use0for archive member header UIDs, GIDs and timestamp fields. this one's on by default π--help,-hβ print a summary of command line options. when you're lost, this is your bestie.--no-strip-allβ disable--strip-all. yeah. that's it. it un-defaults the default.-o <file>β write output to<file>. heads up: multiple input files cannot be used in combination with-o. it's one or the other, babe π--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. fancy but precise.
--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.--strip-all-gnuβ remove all symbols, debug sections and relocations from the output. this option is equivalent to GNUstrip's--strip-allswitch. same energy, different name.--strip-all,-sβ for ELF objects, remove from the output all symbols and non-alloc sections not within segments, except for.gnu.warning,.ARM.attributesections 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 spellings, one job π«Ά--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.--version,-Vβ display the version of thellvm-stripexecutable. π--wildcard,-wβ allow wildcard syntax for symbol-related flags. on by default for section-related flags. incompatible with--regexβ οΈ pick a lane.
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. not me protecting x with my life π
the order of wildcards does not matter. for example -w -N '*' -N '!x' is the same as -w -N '!x' -N '*'. no cap, order is irrelevant here.
@<FILE>β read command-line options and commands from response file<FILE>. like a little note passed in class π
π§ 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. (yes, silently. rude but real π)
--allow-broken-linksβ allowllvm-stripto remove sections even if it would leave invalid section references. any invalidsh_linkfields will be set to zero. chaotic but consensual π--discard-locals,-Xβ remove local symbols starting with".L"from the output.--keep-file-symbolsβ keep symbols of typeSTT_FILE, even if they would otherwise be stripped. protection squad π«Ά--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. time is a construct but we respect it β--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, seriously, be careful.-Tβ remove Swift symbols. that's it. one letter, big job π¦
π EXIT STATUS π
llvm-strip exits with a non-zero exit code if there is an error. otherwise, it exits with code 0. clean and simple, the way we like it β¨
π BUGS π
to report bugs, please visit:
https://github.com/llvm/llvm-project/labels/tools:llvm-objcopy%2Fstrip
π SEE ALSO π
llvm-objcopy(1) β go read that one next bestie, it's the sibling π«Ά
πΈ AUTHOR πΈ
maintained by the LLVM Team (https://llvm.org/). shoutout to the whole team honestly π
π COPYRIGHT π
2003-2023, LLVM Project
and that's the page!! this one's from the LLVM manual, volume 17, dated 2023-12-01 β so if you're citing it in your essay, that's the version, periodt π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms