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             [-M|--merge-notes][--no-merge-notes]
17             [-N symbolname |--strip-symbol=symbolname]
18             [-w|--wildcard]
19             [-x|--discard-all] [-X |--discard-locals]
20             [-R sectionname |--remove-section=sectionname]
21             [--remove-relocations=sectionpattern]
22             [-o file] [-p|--preserve-dates]
23             [-D|--enable-deterministic-archives]
24             [-U|--disable-deterministic-archives]
25             [--keep-file-symbols]
26             [--only-keep-debug]
27             [-v |--verbose] [-V|--version]
28             [--help] [--info]
29             objfile...
30

DESCRIPTION

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

OPTIONS

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

SEE ALSO

273       the Info entries for binutils.
274
276       Copyright (c) 1991-2018 Free Software Foundation, Inc.
277
278       Permission is granted to copy, distribute and/or modify this document
279       under the terms of the GNU Free Documentation License, Version 1.3 or
280       any later version published by the Free Software Foundation; with no
281       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
282       Texts.  A copy of the license is included in the section entitled "GNU
283       Free Documentation License".
284
285
286
287binutils-2.30.90                  2018-07-09                          STRIP(1)
Impressum