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

SEE ALSO

230       the Info entries for binutils.
231
233       Copyright (c) 1991-2015 Free Software Foundation, Inc.
234
235       Permission is granted to copy, distribute and/or modify this document
236       under the terms of the GNU Free Documentation License, Version 1.3 or
237       any later version published by the Free Software Foundation; with no
238       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
239       Texts.  A copy of the license is included in the section entitled "GNU
240       Free Documentation License".
241
242
243
244binutils-2.26                     2016-01-25                          STRIP(1)
Impressum