binutils: strip
1
1 8 strip
1 *******
1
1 strip [-F BFDNAME |--target=BFDNAME]
1 [-I BFDNAME |--input-target=BFDNAME]
1 [-O BFDNAME |--output-target=BFDNAME]
1 [-s|--strip-all]
1 [-S|-g|-d|--strip-debug]
1 [--strip-dwo]
1 [-K SYMBOLNAME|--keep-symbol=SYMBOLNAME]
1 [-M|--merge-notes][--no-merge-notes]
1 [-N SYMBOLNAME |--strip-symbol=SYMBOLNAME]
1 [-w|--wildcard]
1 [-x|--discard-all] [-X |--discard-locals]
1 [-R SECTIONNAME |--remove-section=SECTIONNAME]
1 [--remove-relocations=SECTIONPATTERN]
1 [-o FILE] [-p|--preserve-dates]
1 [-D|--enable-deterministic-archives]
1 [-U|--disable-deterministic-archives]
1 [--keep-file-symbols]
1 [--only-keep-debug]
1 [-v |--verbose] [-V|--version]
1 [--help] [--info]
1 OBJFILE...
1
1 GNU 'strip' discards all symbols from object files OBJFILE. The list
1 of object files may include archives. At least one object file must be
1 given.
1
1 'strip' modifies the files named in its argument, rather than writing
1 modified copies under different names.
1
1 '-F BFDNAME'
1 '--target=BFDNAME'
1 Treat the original OBJFILE as a file with the object code format
11 BFDNAME, and rewrite it in the same format. ⇒Target
Selection, for more information.
1
1 '--help'
1 Show a summary of the options to 'strip' and exit.
1
1 '--info'
1 Display a list showing all architectures and object formats
1 available.
1
1 '-I BFDNAME'
1 '--input-target=BFDNAME'
1 Treat the original OBJFILE as a file with the object code format
1 BFDNAME. ⇒Target Selection, for more information.
1
1 '-O BFDNAME'
1 '--output-target=BFDNAME'
11 Replace OBJFILE with a file in the output format BFDNAME. ⇒
Target Selection, for more information.
1
1 '-R SECTIONNAME'
1 '--remove-section=SECTIONNAME'
1 Remove any section named SECTIONNAME from the output file, in
1 addition to whatever sections would otherwise be removed. This
1 option may be given more than once. Note that using this option
1 inappropriately may make the output file unusable. The wildcard
1 character '*' may be given at the end of SECTIONNAME. If so, then
1 any section starting with SECTIONNAME will be removed.
1
1 If the first character of SECTIONPATTERN is the exclamation point
1 (!) then matching sections will not be removed even if an earlier
1 use of '--remove-section' on the same command line would otherwise
1 remove it. For example:
1
1 --remove-section=.text.* --remove-section=!.text.foo
1
1 will remove all sections matching the pattern '.text.*', but will
1 not remove the section '.text.foo'.
1
1 '--remove-relocations=SECTIONPATTERN'
1 Remove relocations from the output file for any section matching
1 SECTIONPATTERN. This option may be given more than once. Note
1 that using this option inappropriately may make the output file
1 unusable. Wildcard characters are accepted in SECTIONPATTERN. For
1 example:
1
1 --remove-relocations=.text.*
1
1 will remove the relocations for all sections matching the patter
1 '.text.*'.
1
1 If the first character of SECTIONPATTERN is the exclamation point
1 (!) then matching sections will not have their relocation removed
1 even if an earlier use of '--remove-relocations' on the same
1 command line would otherwise cause the relocations to be removed.
1 For example:
1
1 --remove-relocations=.text.* --remove-relocations=!.text.foo
1
1 will remove all relocations for sections matching the pattern
1 '.text.*', but will not remove relocations for the section
1 '.text.foo'.
1
1 '-s'
1 '--strip-all'
1 Remove all symbols.
1
1 '-g'
1 '-S'
1 '-d'
1 '--strip-debug'
1 Remove debugging symbols only.
1
1 '--strip-dwo'
1 Remove the contents of all DWARF .dwo sections, leaving the
1 remaining debugging sections and all symbols intact. See the
1 description of this option in the 'objcopy' section for more
1 information.
1
1 '--strip-unneeded'
1 Remove all symbols that are not needed for relocation processing.
1
1 '-K SYMBOLNAME'
1 '--keep-symbol=SYMBOLNAME'
1 When stripping symbols, keep symbol SYMBOLNAME even if it would
1 normally be stripped. This option may be given more than once.
1
1 '-M'
1 '--merge-notes'
1 '--no-merge-notes'
1 For ELF files, attempt (or do not attempt) to reduce the size of
1 any SHT_NOTE type sections by removing duplicate notes. The
1 default is to attempt this reduction.
1
1 '-N SYMBOLNAME'
1 '--strip-symbol=SYMBOLNAME'
1 Remove symbol SYMBOLNAME from the source file. This option may be
1 given more than once, and may be combined with strip options other
1 than '-K'.
1
1 '-o FILE'
1 Put the stripped output in FILE, rather than replacing the existing
1 file. When this argument is used, only one OBJFILE argument may be
1 specified.
1
1 '-p'
1 '--preserve-dates'
1 Preserve the access and modification dates of the file.
1
1 '-D'
1 '--enable-deterministic-archives'
1 Operate in _deterministic_ mode. When copying archive members and
1 writing the archive index, use zero for UIDs, GIDs, timestamps, and
1 use consistent file modes for all files.
1
1 If 'binutils' was configured with
1 '--enable-deterministic-archives', then this mode is on by default.
1 It can be disabled with the '-U' option, below.
1
1 '-U'
1 '--disable-deterministic-archives'
1 Do _not_ operate in _deterministic_ mode. This is the inverse of
1 the '-D' option, above: when copying archive members and writing
1 the archive index, use their actual UID, GID, timestamp, and file
1 mode values.
1
1 This is the default unless 'binutils' was configured with
1 '--enable-deterministic-archives'.
1
1 '-w'
1 '--wildcard'
1 Permit regular expressions in SYMBOLNAMEs used in other command
1 line options. The question mark (?), asterisk (*), backslash (\)
1 and square brackets ([]) operators can be used anywhere in the
1 symbol name. If the first character of the symbol name is the
1 exclamation point (!) then the sense of the switch is reversed for
1 that symbol. For example:
1
1 -w -K !foo -K fo*
1
1 would cause strip to only keep symbols that start with the letters
1 "fo", but to discard the symbol "foo".
1
1 '-x'
1 '--discard-all'
1 Remove non-global symbols.
1
1 '-X'
1 '--discard-locals'
1 Remove compiler-generated local symbols. (These usually start with
1 'L' or '.'.)
1
1 '--keep-file-symbols'
1 When stripping a file, perhaps with '--strip-debug' or
1 '--strip-unneeded', retain any symbols specifying source file
1 names, which would otherwise get stripped.
1
1 '--only-keep-debug'
1 Strip a file, emptying the contents of any sections that would not
1 be stripped by '--strip-debug' and leaving the debugging sections
1 intact. In ELF files, this preserves all the note sections in the
1 output as well.
1
1 Note - the section headers of the stripped sections are preserved,
1 including their sizes, but the contents of the section are
1 discarded. The section headers are preserved so that other tools
1 can match up the debuginfo file with the real executable, even if
1 that executable has been relocated to a different address space.
1
1 The intention is that this option will be used in conjunction with
1 '--add-gnu-debuglink' to create a two part executable. One a
1 stripped binary which will occupy less space in RAM and in a
1 distribution and the second a debugging information file which is
1 only needed if debugging abilities are required. The suggested
1 procedure to create these files is as follows:
1
1 1. Link the executable as normal. Assuming that is is called
1 'foo' then...
1 2. Run 'objcopy --only-keep-debug foo foo.dbg' to create a file
1 containing the debugging info.
1 3. Run 'objcopy --strip-debug foo' to create a stripped
1 executable.
1 4. Run 'objcopy --add-gnu-debuglink=foo.dbg foo' to add a link to
1 the debugging info into the stripped executable.
1
1 Note--the choice of '.dbg' as an extension for the debug info file
1 is arbitrary. Also the '--only-keep-debug' step is optional. You
1 could instead do this:
1
1 1. Link the executable as normal.
1 2. Copy 'foo' to 'foo.full'
1 3. Run 'strip --strip-debug foo'
1 4. Run 'objcopy --add-gnu-debuglink=foo.full foo'
1
1 i.e., the file pointed to by the '--add-gnu-debuglink' can be the
1 full executable. It does not have to be a file created by the
1 '--only-keep-debug' switch.
1
1 Note--this switch is only intended for use on fully linked files.
1 It does not make sense to use it on object files where the
1 debugging information may be incomplete. Besides the gnu_debuglink
1 feature currently only supports the presence of one filename
1 containing debugging information, not multiple filenames on a
1 one-per-object-file basis.
1
1 '-V'
1 '--version'
1 Show the version number for 'strip'.
1
1 '-v'
1 '--verbose'
1 Verbose output: list all object files modified. In the case of
1 archives, 'strip -v' lists all members of the archive.
1