STRIP(1)
π STRIP(1) β GNU Development Tools π
okay bestie, sit down, hydrate, and let me tell you about strip, from the GNU Development Tools set. this is the manual page, but make it make sense. π«Ά
β¨ NAME β¨
strip β Discard symbols from object files.
no fr, that's the whole gig. it takes your object files and throws away the symbols. brutal. iconic. π
πΈ SYNOPSIS πΈ
strip [-F bfdname βͺ--target=bfdname]
[-I bfdname βͺ--input-target=bfdname]
[-O bfdname βͺ--output-target=bfdname]
[-sβͺ--strip-all]
[-Sβͺ-gβͺ-dβͺ--strip-debug]
[-K symbolname βͺ--keep-symbol=symbolname]
[-N symbolname βͺ--strip-symbol=symbolname]
[-wβͺ--wildcard]
[-xβͺ--discard-all] [-X βͺ--discard-locals]
[-R sectionname βͺ--remove-section=sectionname]
[-o file] [-pβͺ--preserve-dates]
[--only-keep-debug]
[-v βͺ--verbose] [-Vβͺ--version]
[--help] [--info]
objfile...
π¦ DESCRIPTION π¦
GNU strip discards all symbols from object files objfile. and the list of object files? it can include archives too, not just plain object files. but bestie, you gotta give it at least one object file. at least one. it's not gonna guess. π
and here's the plot twist: strip modifies the files named in its argument β it does not write modified copies under different names. it's editing your file in place. no little -copy file to save you. so maybe, like, have a backup. just saying. π
π OPTIONS π
-F bfdname,--target=bfdnameβ treat the original objfile as a file with the object code format bfdname, and rewrite it in the same format. same in, same out, just fresh. β¨--helpβ show a summary of the options tostripand exit. your little cheat sheet. π--infoβ display a list showing all architectures and object formats available. like a vibe check for what your machine can actually handle. π-I bfdname,--input-target=bfdnameβ treat the original objfile as a file with the object code format bfdname. that's the input side of the story. π«Ά-O bfdname,--output-target=bfdnameβ replace objfile with a file in the output format bfdname. that's the output side. π-R sectionname,--remove-section=sectionnameβ remove any section named sectionname from the output file. you can give this option more than once, collect them all.
β οΈ but heads up: using this option inappropriately may make the output file unusable. so like... know what you're removing, bestie. this is not a "yolo" situation. π
-s,--strip-allβ remove all symbols. everything. gone. nuclear option. β’οΈ-g,-S,-d,--strip-debugβ remove debugging symbols only. just the debug ones. the rest get to stay. π--strip-unneededβ remove all symbols that are not needed for relocation processing. if it's not needed for that, it's out. bye. π-K symbolname,--keep-symbol=symbolnameβ keep only symbol symbolname from the source file. can be given more than once. this is the "protect this one" flag. π‘οΈ-N symbolname,--strip-symbol=symbolnameβ remove symbol symbolname from the source file. this one can be given more than once too, and it can be combined with strip options other than-K. (so like, not-K. them's the rules.) π«-o fileβ put the stripped output in file, rather than replacing the existing file. finally, a version that doesn't body-slam your original. but: when you use this argument, only one objfile argument may be specified. one. uno. that's it. 1οΈβ£-p,--preserve-datesβ preserve the access and modification dates of the file. time traveler behaviour. keep those timestamps exactly where you found them. β°-w,--wildcardβ permit regular expressions in symbolnames used in other command line options. the question mark (?), asterisk (*), backslash (\) and square brackets ([]) operators can be used anywhere in the symbol name. and if the first character of the symbol name is the exclamation point (!), then the sense of the switch is reversed for that symbol. for example:
-w -K !foo -K fo*
would cause strip to only keep symbols that start with the letters "fo", but to discard the symbol "foo". sneaky little ! doing so much work. π
-x,--discard-allβ remove non-global symbols. π-X,--discard-localsβ remove compiler-generated local symbols. (these usually start withLor.) π€--only-keep-debugβ strip a file, removing any sections that would be stripped by--strip-debugand leaving the debugging sections.
the intention is that this option will be used in conjunction with --add-gnu-debuglink to create a two part executable. one: a stripped binary which will occupy less space in RAM and in a distribution. two: a debugging information file which is only needed if debugging abilities are required. the suggested procedure to create these files is as follows:
- Link the executable as normal. assuming that it is called
"foo"then... - Run
objcopy --only-keep-debug foo foo.dbgto create a file containing the debugging info. - Run
objcopy --strip-debug footo create a stripped executable. - Run
objcopy --add-gnu-debuglink=foo.dbg footo add a link to the debugging info into the stripped executable.
π note β the choice of".dbg"as an extension for the debug info file is arbitrary. also the"--only-keep-debug"step is optional. you could instead do this:
- Link the executable as normal.
- Copy
"foo"to"foo.full" - Run
strip --strip-debug foo - Run
objcopy --add-gnu-debuglink=foo.full foo
ie the file pointed to by the --add-gnu-debuglink can be the full executable. it does not have to be a file created by the --only-keep-debug switch. so you've got options, bestie. π¦
-V,--versionβ show the version number forstrip. π·οΈ-v,--verboseβ verbose output: list all object files modified. and in the case of archives,strip -vlists all members of the archive. so chatty. we love that for us. π£οΈ
π SEE ALSO π
- the Info entries for
binutils.
π COPYRIGHT π
Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
okay that's the whole page, we ate, no crumbs left. πβ¨ this one's from binutils-2.15.97, dated 2005-04-20 β so like, vintage. period piece. and you just read STRIP(1) like a scholar. slay. ππ«Ά
π¦ where this page comes from
- debian bookworm: binutils-h8300-hms 2.16.1-10+b2
- debian trixie: binutils-h8300-hms 2.16.1-13
- ubuntu jammy: binutils-h8300-hms 2.16.1-10build1
- ubuntu noble: binutils-h8300-hms 2.16.1-10build1
- ubuntu resolute: binutils-h8300-hms 2.16.1-15
- ubuntu stonking: binutils-h8300-hms 2.16.1-15
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms