1STRIP(1)                     GNU Development Tools                    STRIP(1)
2
3
4

NAME

6       strip - Discard symbols from object files.
7

SYNOPSIS

9       strip [-F bfdname |--target=bfdname]
10             [-I bfdname |--input-target=bfdname]
11             [-O bfdname |--output-target=bfdname]
12             [-s|--strip-all]
13             [-S|-g|-d|--strip-debug]
14             [--strip-dwo]
15             [-K symbolname |--keep-symbol=symbolname]
16             [-N symbolname |--strip-symbol=symbolname]
17             [-w|--wildcard]
18             [-x|--discard-all] [-X |--discard-locals]
19             [-R sectionname |--remove-section=sectionname]
20             [-o file] [-p|--preserve-dates]
21             [-D|--enable-deterministic-archives]
22             [-U|--disable-deterministic-archives]
23             [--keep-file-symbols]
24             [--only-keep-debug]
25             [-v |--verbose] [-V|--version]
26             [--help] [--info]
27             objfile...
28

DESCRIPTION

30       GNU strip discards all symbols from object files objfile.  The list of
31       object files may include archives.  At least one object file must be
32       given.
33
34       strip modifies the files named in its argument, rather than writing
35       modified copies under different names.
36

OPTIONS

38       -F bfdname
39       --target=bfdname
40           Treat the original objfile as a file with the object code format
41           bfdname, and rewrite it in the same format.
42
43       --help
44           Show a summary of the options to strip and exit.
45
46       --info
47           Display a list showing all architectures and object formats
48           available.
49
50       -I bfdname
51       --input-target=bfdname
52           Treat the original objfile as a file with the object code format
53           bfdname.
54
55       -O bfdname
56       --output-target=bfdname
57           Replace objfile with a file in the output format bfdname.
58
59       -R sectionname
60       --remove-section=sectionname
61           Remove any section named sectionname from the output file.  This
62           option may be given more than once.  Note that using this option
63           inappropriately may make the output file unusable.  The wildcard
64           character * may be given at the end of sectionname.  If so, then
65           any section starting with sectionname will be removed.
66
67       -s
68       --strip-all
69           Remove all symbols.
70
71       -g
72       -S
73       -d
74       --strip-debug
75           Remove debugging symbols only.
76
77       --strip-dwo
78           Remove the contents of all DWARF .dwo sections, leaving the
79           remaining debugging sections and all symbols intact.  See the
80           description of this option in the objcopy section for more
81           information.
82
83       --strip-unneeded
84           Remove all symbols that are not needed for relocation processing.
85
86       -K symbolname
87       --keep-symbol=symbolname
88           When stripping symbols, keep symbol symbolname even if it would
89           normally be stripped.  This option may be given more than once.
90
91       -N symbolname
92       --strip-symbol=symbolname
93           Remove symbol symbolname from the source file. This option may be
94           given more than once, and may be combined with strip options other
95           than -K.
96
97       -o file
98           Put the stripped output in file, rather than replacing the existing
99           file.  When this argument is used, only one objfile argument may be
100           specified.
101
102       -p
103       --preserve-dates
104           Preserve the access and modification dates of the file.
105
106       -D
107       --enable-deterministic-archives
108           Operate in deterministic mode.  When copying archive members and
109           writing the archive index, use zero for UIDs, GIDs, timestamps, and
110           use consistent file modes for all files.
111
112           If binutils was configured with --enable-deterministic-archives,
113           then this mode is on by default.  It can be disabled with the -U
114           option, below.
115
116       -U
117       --disable-deterministic-archives
118           Do not operate in deterministic mode.  This is the inverse of the
119           -D option, above: when copying archive members and writing the
120           archive index, use their actual UID, GID, timestamp, and file mode
121           values.
122
123           This is the default unless binutils was configured with
124           --enable-deterministic-archives.
125
126       -w
127       --wildcard
128           Permit regular expressions in symbolnames used in other command
129           line options.  The question mark (?), asterisk (*), backslash (\)
130           and square brackets ([]) operators can be used anywhere in the
131           symbol name.  If the first character of the symbol name is the
132           exclamation point (!) then the sense of the switch is reversed for
133           that symbol.  For example:
134
135                     -w -K !foo -K fo*
136
137           would cause strip to only keep symbols that start with the letters
138           "fo", but to discard the symbol "foo".
139
140       -x
141       --discard-all
142           Remove non-global symbols.
143
144       -X
145       --discard-locals
146           Remove compiler-generated local symbols.  (These usually start with
147           L or ..)
148
149       --keep-file-symbols
150           When stripping a file, perhaps with --strip-debug or
151           --strip-unneeded, retain any symbols specifying source file names,
152           which would otherwise get stripped.
153
154       --only-keep-debug
155           Strip a file, removing contents of any sections that would not be
156           stripped by --strip-debug and leaving the debugging sections
157           intact.  In ELF files, this preserves all note sections in the
158           output.
159
160           The intention is that this option will be used in conjunction with
161           --add-gnu-debuglink to create a two part executable.  One a
162           stripped binary which will occupy less space in RAM and in a
163           distribution and the second a debugging information file which is
164           only needed if debugging abilities are required.  The suggested
165           procedure to create these files is as follows:
166
167           1.<Link the executable as normal.  Assuming that is is called>
168               "foo" then...
169
170           1.<Run "objcopy --only-keep-debug foo foo.dbg" to>
171               create a file containing the debugging info.
172
173           1.<Run "objcopy --strip-debug foo" to create a>
174               stripped executable.
175
176           1.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
177               to add a link to the debugging info into the stripped
178               executable.
179
180           Note---the choice of ".dbg" as an extension for the debug info file
181           is arbitrary.  Also the "--only-keep-debug" step is optional.  You
182           could instead do this:
183
184           1.<Link the executable as normal.>
185           1.<Copy "foo" to "foo.full">
186           1.<Run "strip --strip-debug foo">
187           1.<Run "objcopy --add-gnu-debuglink=foo.full foo">
188
189           i.e., the file pointed to by the --add-gnu-debuglink can be the
190           full executable.  It does not have to be a file created by the
191           --only-keep-debug switch.
192
193           Note---this switch is only intended for use on fully linked files.
194           It does not make sense to use it on object files where the
195           debugging information may be incomplete.  Besides the gnu_debuglink
196           feature currently only supports the presence of one filename
197           containing debugging information, not multiple filenames on a one-
198           per-object-file basis.
199
200       -V
201       --version
202           Show the version number for strip.
203
204       -v
205       --verbose
206           Verbose output: list all object files modified.  In the case of
207           archives, strip -v lists all members of the archive.
208
209       @file
210           Read command-line options from file.  The options read are inserted
211           in place of the original @file option.  If file does not exist, or
212           cannot be read, then the option will be treated literally, and not
213           removed.
214
215           Options in file are separated by whitespace.  A whitespace
216           character may be included in an option by surrounding the entire
217           option in either single or double quotes.  Any character (including
218           a backslash) may be included by prefixing the character to be
219           included with a backslash.  The file may itself contain additional
220           @file options; any such options will be processed recursively.
221

SEE ALSO

223       the Info entries for binutils.
224
226       Copyright (c) 1991-2013 Free Software Foundation, Inc.
227
228       Permission is granted to copy, distribute and/or modify this document
229       under the terms of the GNU Free Documentation License, Version 1.3 or
230       any later version published by the Free Software Foundation; with no
231       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
232       Texts.  A copy of the license is included in the section entitled "GNU
233       Free Documentation License".
234
235
236
237binutils-2.24                     2020-01-29                          STRIP(1)
Impressum