STRIP(1)
๐ STRIP(1) โ GNU Development Tools ๐ธ
okay bestie, welcome to the strip page, we're doing this in parts so buckle up ๐
โจ NAME โจ
strip โ the icon that discards symbols and other data from object files, no cap ๐๏ธโจ
๐ฆ SYNOPSIS ๐ฆ
strip [-F bfdname |--target=bfdname]
[-I bfdname |--input-target=bfdname]
[-O bfdname |--output-target=bfdname]
[-s|--strip-all]
[-S|-g|-d|--strip-debug]
[--strip-dwo]
[-K symbolname|--keep-symbol=symbolname]
[-M|--merge-notes][--no-merge-notes]
[-N symbolname |--strip-symbol=symbolname]
[-w|--wildcard]
[-x|--discard-all] [-X |--discard-locals]
[-R sectionname |--remove-section=sectionname]
[--keep-section=sectionpattern]
[--remove-relocations=sectionpattern]
[--strip-section-headers]
[-o file] [-p|--preserve-dates]
[-D|--enable-deterministic-archives]
[-U|--disable-deterministic-archives]
[--keep-section-symbols]
[--keep-file-symbols]
[--only-keep-debug]
[--plugin name]
[-v |--verbose] [-V|--version]
[--help] [--info]
objfile...
likeโฆ look at her. so many options. she's serving options ๐
๐ DESCRIPTION ๐
GNU strip justโฆ discards all symbols from object files, and those object files are your objfile besties. it's giving "we don't need the lore, we need the vibes" ๐ง
so basically the list of object files? it may include archives. and at least one object file must be given โ like, you can't just show up with nothing, that's not the move ๐
strip modifies the files named in its argument, rather than writing modified copies under different names.
โ ๏ธ okay this part matters, fr fr: strip doesn't make a cute little copy for you. she edits the actual files you named. in place. that's it. so if you wanted a backup, that's on you, bestie ๐ญ
and that's part one, there's more coming so don't go anywhere ๐ซถ
okay bestie, this is the part where we get into the actual flags ๐ Like, this is the whole toolkit. Read it slow, it's giving โจreference materialโจ.
-F bfdname,--target=bfdnameโ treat the original objfile as if it were a file in the object code format bfdname, and then rewrite it right back out in that same format. Same in, same out. ๐--helpโ show a lil summary of the optionsstriptakes, then bounce. โจ--infoโ display a list of every architecture and every object format that's available. Like a menu of your options, fr.-I bfdname,--input-target=bfdnameโ treat the original objfile as a file with the object code format bfdname. That's the "what am I reading" one ๐ฆ-O bfdname,--output-target=bfdnameโ replace objfile with a file in the output format bfdname. That's the "what am I writing" one. Iconic duo, honestly.-R sectionname,--remove-section=sectionnameโ remove any section named sectionname from the output file, on top of whatever sections would've gotten removed anyway. You can pass this one more than once. ๐ธ
โ ๏ธ bestie, real talk: using this option inappropriately may make the output file unusable. No cap.
The wildcard character * may be given at the end of sectionname. If you do that, then any section starting with sectionname gets removed.
And here's the plot twist: if the first character of sectionpattern is the exclamation point (!), then matching sections will not be removed โ even if an earlier use of --remove-section on the same command line would've otherwise removed it. For example:
--remove-section=.text.* --remove-section=!.text.foo
will remove all sections matching the pattern .text.*, but will not remove the section .text.foo. Sneaky, but make it make sense ๐
--keep-section=sectionpatternโ when you're removing sections from the output file, keep the sections that match sectionpattern. The "actually no, not that one" flag ๐ซถ--remove-relocations=sectionpatternโ remove relocations from the output file for any section matching sectionpattern. May be given more than once. ๐
โ ๏ธ again: using this option inappropriately may make the output file unusable. We're not kidding around here.
Wildcard characters are accepted in sectionpattern. For example:
--remove-relocations=.text.*
will remove the relocations for all sections matching the pattern .text.*.
And yes, the ! thing works here too: if the first character of sectionpattern is the exclamation point (!), then matching sections will not have their relocations removed โ even if an earlier use of --remove-relocations on the same command line would've otherwise caused the relocations to be removed. Example:
--remove-relocations=.text.* --remove-relocations=!.text.foo
will remove all relocations for sections matching the pattern .text.*, but will not remove relocations for the section .text.foo. Periodt. ๐
--strip-section-headersโ strip section headers. This one is specific to ELF files. It implies--strip-alland--merge-notes. โจ-s,--strip-allโ remove all symbols. All of them. Gone. ๐-g,-S,-d,--strip-debugโ remove debugging symbols only. (yes, three whole short flags for this one vibe, slay)--strip-dwoโ remove the contents of all DWARF.dwosections, leaving the remaining debugging sections and all symbols intact. See the description of this option in theobjcopysection for more info. ๐ฆ--strip-unneededโ remove all symbols that aren't needed for relocation processing, plus the debugging symbols and sections that--strip-debugalready strips. Double cleanse ๐ง-K symbolname,--keep-symbol=symbolnameโ when stripping symbols, keep the symbol symbolname even if it would normally get stripped. May be given more than once. The "not this one tho" list ๐-M,--merge-notes,--no-merge-notesโ for ELF files, attempt (or do not attempt) to shrink anySHT_NOTEtype sections by removing duplicate notes. The default is to attempt this reduction โ unless you're stripping debug or DWO information. ๐-N symbolname,--strip-symbol=symbolnameโ remove the symbol symbolname from the source file. May be given more than once, and may be combined with strip options other than-K. โ๏ธ-o fileโ put the stripped output in file, instead of replacing the existing file. Heads up: when you use this argument, only one objfile argument may be specified. ๐ธ-p,--preserve-datesโ preserve the access and modification dates of the file. Time travel, but legal. โญ-D,--enable-deterministic-archivesโ operate in deterministic mode. When copying archive members and writing the archive index, use zero for UIDs, GIDs, timestamps, and use consistent file modes for all files. So same input = same output, every time. ๐
If binutils was configured with --enable-deterministic-archives, then this mode is on by default. It can be disabled with the -U option, below. ๐
-U,--disable-deterministic-archivesโ do not operate in deterministic mode. This is the inverse of the-Doption above: when copying archive members and writing the archive index, use their actual UID, GID, timestamp, and file mode values. ๐
This is the default โ unless binutils was configured with --enable-deterministic-archives.
-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. 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". Chaos but make it intentional ๐ญ
-x,--discard-allโ remove non-global symbols. ๐ฅ-X,--discard-localsโ remove compiler-generated local symbols. (These usually start withLor.) ๐งน--keep-section-symbolsโ when stripping a file, maybe with--strip-debugor--strip-unneeded, retain any symbols specifying section names, which would otherwise get stripped. ๐ซถ--keep-file-symbolsโ when stripping a file, maybe with--strip-debugor--strip-unneeded, retain any symbols specifying source file names, which would otherwise get stripped. ๐--only-keep-debugโ strip a file, emptying the contents of any sections that would not be stripped by--strip-debug, and leaving the debugging sections intact. In ELF files, this preserves all the note sections in the output as well. ๐
Note: the section headers of the stripped sections are preserved, including their sizes โ but the contents of the section are discarded. The section headers are kept so that other tools can match up the debuginfo file with the real executable, even if that executable has been relocated to a different address space. Kinda genius tbh.
The intention is that this option gets used in conjunction with --add-gnu-debuglink to create a two part executable:
- One is a stripped binary, which occupies less space in RAM and in a distribution.
- The other is 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.dbg"to create a file containing the debugging info. - Run
"strip --strip-debug foo"to create a stripped executable. - Run
"objcopy --add-gnu-debuglink=foo.dbg foo"to 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".
i.e., 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. Flexible queen โจ
Note: this switch is only intended for use on fully linked files. It does not make sense to use it on object files where the debugging information may be incomplete. Besides, the gnu_debuglink feature currently only supports the presence of one filename containing debugging information, not multiple filenames on a one-per-object-file basis. So don't try it, bestie ๐
--plugin nameโ load the plugin called name to add support for extra target types. This option is only available if the toolchain has been built with plugin support enabled. ๐ง
If --plugin is not provided, but plugin support has been enabled, then strip iterates over the files in ${libdir}/bfd-plugins in alphabetic order and the first plugin that claims the object in question is used.
Please note that this plugin search directory is not the one used byld's-pluginoption. In order to makestripuse the linker plugin it must be copied into the${libdir}/bfd-pluginsdirectory. For GCC based compilations the linker plugin is calledliblto_plugin.so.0.0.0. For Clang based compilations it is calledLLVMgold.so. The GCC plugin is always backwards compatible with earlier versions, so it is sufficient to just copy the newest one. ๐ซถ
-V,--versionโ show the version number forstrip. ๐-v,--verboseโ verbose output: list all object files modified. In the case of archives,strip -vlists all members of the archive. So chatty of it ๐@fileโ read command-line options from file. The options read are inserted in place of the original@fileoption. If file does not exist, or cannot be read, then the option will be treated literally, and not removed. ๐ญ
Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively. ๐
๐ SEE ALSO ๐
the Info entries for binutils.
๐ COPYRIGHT ๐
Copyright (c) 1991-2026 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.3 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".
and that's the whole page bestie, you made it to the end ๐ this lil masterpiece is binutils-2.47, dated 2026-08-11 โ go forth and strip responsibly, mwah ๐โจ
๐ฆ where this page comes from
- arch rolling: binutils 2.47-4 ยท GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3 AND FSFAP
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms