Merge branch 'vendor/GREP'
[dragonfly.git] / contrib / binutils-2.24 / binutils / doc / strip.1
1 .\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "STRIP 1"
127 .TH STRIP 1 "2013-11-18" "binutils-2.23.91" "GNU Development Tools"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 strip \- Discard symbols from object files.
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 strip [\fB\-F\fR \fIbfdname\fR |\fB\-\-target=\fR\fIbfdname\fR]
137       [\fB\-I\fR \fIbfdname\fR |\fB\-\-input\-target=\fR\fIbfdname\fR]
138       [\fB\-O\fR \fIbfdname\fR |\fB\-\-output\-target=\fR\fIbfdname\fR]
139       [\fB\-s\fR|\fB\-\-strip\-all\fR]
140       [\fB\-S\fR|\fB\-g\fR|\fB\-d\fR|\fB\-\-strip\-debug\fR]
141       [\fB\-\-strip\-dwo\fR]
142       [\fB\-K\fR \fIsymbolname\fR |\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
143       [\fB\-N\fR \fIsymbolname\fR |\fB\-\-strip\-symbol=\fR\fIsymbolname\fR]
144       [\fB\-w\fR|\fB\-\-wildcard\fR]
145       [\fB\-x\fR|\fB\-\-discard\-all\fR] [\fB\-X\fR |\fB\-\-discard\-locals\fR]
146       [\fB\-R\fR \fIsectionname\fR |\fB\-\-remove\-section=\fR\fIsectionname\fR]
147       [\fB\-o\fR \fIfile\fR] [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
148       [\fB\-D\fR|\fB\-\-enable\-deterministic\-archives\fR]
149       [\fB\-U\fR|\fB\-\-disable\-deterministic\-archives\fR]
150       [\fB\-\-keep\-file\-symbols\fR]
151       [\fB\-\-only\-keep\-debug\fR]
152       [\fB\-v\fR |\fB\-\-verbose\fR] [\fB\-V\fR|\fB\-\-version\fR]
153       [\fB\-\-help\fR] [\fB\-\-info\fR]
154       \fIobjfile\fR...
155 .SH "DESCRIPTION"
156 .IX Header "DESCRIPTION"
157 \&\s-1GNU\s0 \fBstrip\fR discards all symbols from object files
158 \&\fIobjfile\fR.  The list of object files may include archives.
159 At least one object file must be given.
160 .PP
161 \&\fBstrip\fR modifies the files named in its argument,
162 rather than writing modified copies under different names.
163 .SH "OPTIONS"
164 .IX Header "OPTIONS"
165 .IP "\fB\-F\fR \fIbfdname\fR" 4
166 .IX Item "-F bfdname"
167 .PD 0
168 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
169 .IX Item "--target=bfdname"
170 .PD
171 Treat the original \fIobjfile\fR as a file with the object
172 code format \fIbfdname\fR, and rewrite it in the same format.
173 .IP "\fB\-\-help\fR" 4
174 .IX Item "--help"
175 Show a summary of the options to \fBstrip\fR and exit.
176 .IP "\fB\-\-info\fR" 4
177 .IX Item "--info"
178 Display a list showing all architectures and object formats available.
179 .IP "\fB\-I\fR \fIbfdname\fR" 4
180 .IX Item "-I bfdname"
181 .PD 0
182 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
183 .IX Item "--input-target=bfdname"
184 .PD
185 Treat the original \fIobjfile\fR as a file with the object
186 code format \fIbfdname\fR.
187 .IP "\fB\-O\fR \fIbfdname\fR" 4
188 .IX Item "-O bfdname"
189 .PD 0
190 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
191 .IX Item "--output-target=bfdname"
192 .PD
193 Replace \fIobjfile\fR with a file in the output format \fIbfdname\fR.
194 .IP "\fB\-R\fR \fIsectionname\fR" 4
195 .IX Item "-R sectionname"
196 .PD 0
197 .IP "\fB\-\-remove\-section=\fR\fIsectionname\fR" 4
198 .IX Item "--remove-section=sectionname"
199 .PD
200 Remove any section named \fIsectionname\fR from the output file.  This
201 option may be given more than once.  Note that using this option
202 inappropriately may make the output file unusable.  The wildcard
203 character \fB*\fR may be given at the end of \fIsectionname\fR.  If
204 so, then any section starting with \fIsectionname\fR will be removed.
205 .IP "\fB\-s\fR" 4
206 .IX Item "-s"
207 .PD 0
208 .IP "\fB\-\-strip\-all\fR" 4
209 .IX Item "--strip-all"
210 .PD
211 Remove all symbols.
212 .IP "\fB\-g\fR" 4
213 .IX Item "-g"
214 .PD 0
215 .IP "\fB\-S\fR" 4
216 .IX Item "-S"
217 .IP "\fB\-d\fR" 4
218 .IX Item "-d"
219 .IP "\fB\-\-strip\-debug\fR" 4
220 .IX Item "--strip-debug"
221 .PD
222 Remove debugging symbols only.
223 .IP "\fB\-\-strip\-dwo\fR" 4
224 .IX Item "--strip-dwo"
225 Remove the contents of all \s-1DWARF\s0 .dwo sections, leaving the
226 remaining debugging sections and all symbols intact.
227 See the description of this option in the \fBobjcopy\fR section
228 for more information.
229 .IP "\fB\-\-strip\-unneeded\fR" 4
230 .IX Item "--strip-unneeded"
231 Remove all symbols that are not needed for relocation processing.
232 .IP "\fB\-K\fR \fIsymbolname\fR" 4
233 .IX Item "-K symbolname"
234 .PD 0
235 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
236 .IX Item "--keep-symbol=symbolname"
237 .PD
238 When stripping symbols, keep symbol \fIsymbolname\fR even if it would
239 normally be stripped.  This option may be given more than once.
240 .IP "\fB\-N\fR \fIsymbolname\fR" 4
241 .IX Item "-N symbolname"
242 .PD 0
243 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
244 .IX Item "--strip-symbol=symbolname"
245 .PD
246 Remove symbol \fIsymbolname\fR from the source file. This option may be
247 given more than once, and may be combined with strip options other than
248 \&\fB\-K\fR.
249 .IP "\fB\-o\fR \fIfile\fR" 4
250 .IX Item "-o file"
251 Put the stripped output in \fIfile\fR, rather than replacing the
252 existing file.  When this argument is used, only one \fIobjfile\fR
253 argument may be specified.
254 .IP "\fB\-p\fR" 4
255 .IX Item "-p"
256 .PD 0
257 .IP "\fB\-\-preserve\-dates\fR" 4
258 .IX Item "--preserve-dates"
259 .PD
260 Preserve the access and modification dates of the file.
261 .IP "\fB\-D\fR" 4
262 .IX Item "-D"
263 .PD 0
264 .IP "\fB\-\-enable\-deterministic\-archives\fR" 4
265 .IX Item "--enable-deterministic-archives"
266 .PD
267 Operate in \fIdeterministic\fR mode.  When copying archive members
268 and writing the archive index, use zero for UIDs, GIDs, timestamps,
269 and use consistent file modes for all files.
270 .Sp
271 If \fIbinutils\fR was configured with
272 \&\fB\-\-enable\-deterministic\-archives\fR, then this mode is on by default.
273 It can be disabled with the \fB\-U\fR option, below.
274 .IP "\fB\-U\fR" 4
275 .IX Item "-U"
276 .PD 0
277 .IP "\fB\-\-disable\-deterministic\-archives\fR" 4
278 .IX Item "--disable-deterministic-archives"
279 .PD
280 Do \fInot\fR operate in \fIdeterministic\fR mode.  This is the
281 inverse of the \fB\-D\fR option, above: when copying archive members
282 and writing the archive index, use their actual \s-1UID\s0, \s-1GID\s0, timestamp,
283 and file mode values.
284 .Sp
285 This is the default unless \fIbinutils\fR was configured with
286 \&\fB\-\-enable\-deterministic\-archives\fR.
287 .IP "\fB\-w\fR" 4
288 .IX Item "-w"
289 .PD 0
290 .IP "\fB\-\-wildcard\fR" 4
291 .IX Item "--wildcard"
292 .PD
293 Permit regular expressions in \fIsymbolname\fRs used in other command
294 line options.  The question mark (?), asterisk (*), backslash (\e) and
295 square brackets ([]) operators can be used anywhere in the symbol
296 name.  If the first character of the symbol name is the exclamation
297 point (!) then the sense of the switch is reversed for that symbol.
298 For example:
299 .Sp
300 .Vb 1
301 \&          \-w \-K !foo \-K fo*
302 .Ve
303 .Sp
304 would cause strip to only keep symbols that start with the letters
305 \&\*(L"fo\*(R", but to discard the symbol \*(L"foo\*(R".
306 .IP "\fB\-x\fR" 4
307 .IX Item "-x"
308 .PD 0
309 .IP "\fB\-\-discard\-all\fR" 4
310 .IX Item "--discard-all"
311 .PD
312 Remove non-global symbols.
313 .IP "\fB\-X\fR" 4
314 .IX Item "-X"
315 .PD 0
316 .IP "\fB\-\-discard\-locals\fR" 4
317 .IX Item "--discard-locals"
318 .PD
319 Remove compiler-generated local symbols.
320 (These usually start with \fBL\fR or \fB.\fR.)
321 .IP "\fB\-\-keep\-file\-symbols\fR" 4
322 .IX Item "--keep-file-symbols"
323 When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
324 \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names,
325 which would otherwise get stripped.
326 .IP "\fB\-\-only\-keep\-debug\fR" 4
327 .IX Item "--only-keep-debug"
328 Strip a file, removing contents of any sections that would not be
329 stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections
330 intact.  In \s-1ELF\s0 files, this preserves all note sections in the output.
331 .Sp
332 The intention is that this option will be used in conjunction with
333 \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable.  One a
334 stripped binary which will occupy less space in \s-1RAM\s0 and in a
335 distribution and the second a debugging information file which is only
336 needed if debugging abilities are required.  The suggested procedure
337 to create these files is as follows:
338 .RS 4
339 .IP "1.<Link the executable as normal.  Assuming that is is called>" 4
340 .IX Item "1.<Link the executable as normal.  Assuming that is is called>"
341 \&\f(CW\*(C`foo\*(C'\fR then...
342 .ie n .IP "1.<Run ""objcopy \-\-only\-keep\-debug foo foo.dbg"" to>" 4
343 .el .IP "1.<Run \f(CWobjcopy \-\-only\-keep\-debug foo foo.dbg\fR to>" 4
344 .IX Item "1.<Run objcopy --only-keep-debug foo foo.dbg to>"
345 create a file containing the debugging info.
346 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"" to create a>" 4
347 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR to create a>" 4
348 .IX Item "1.<Run objcopy --strip-debug foo to create a>"
349 stripped executable.
350 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.dbg foo"">" 4
351 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.dbg foo\fR>" 4
352 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.dbg foo>"
353 to add a link to the debugging info into the stripped executable.
354 .RE
355 .RS 4
356 .Sp
357 Note\-\-\-the choice of \f(CW\*(C`.dbg\*(C'\fR as an extension for the debug info
358 file is arbitrary.  Also the \f(CW\*(C`\-\-only\-keep\-debug\*(C'\fR step is
359 optional.  You could instead do this:
360 .IP "1.<Link the executable as normal.>" 4
361 .IX Item "1.<Link the executable as normal.>"
362 .PD 0
363 .ie n .IP "1.<Copy ""foo"" to ""foo.full"">" 4
364 .el .IP "1.<Copy \f(CWfoo\fR to \f(CWfoo.full\fR>" 4
365 .IX Item "1.<Copy foo to foo.full>"
366 .ie n .IP "1.<Run ""strip \-\-strip\-debug foo"">" 4
367 .el .IP "1.<Run \f(CWstrip \-\-strip\-debug foo\fR>" 4
368 .IX Item "1.<Run strip --strip-debug foo>"
369 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.full foo"">" 4
370 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.full foo\fR>" 4
371 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.full foo>"
372 .RE
373 .RS 4
374 .PD
375 .Sp
376 i.e., the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the
377 full executable.  It does not have to be a file created by the
378 \&\fB\-\-only\-keep\-debug\fR switch.
379 .Sp
380 Note\-\-\-this switch is only intended for use on fully linked files.  It
381 does not make sense to use it on object files where the debugging
382 information may be incomplete.  Besides the gnu_debuglink feature
383 currently only supports the presence of one filename containing
384 debugging information, not multiple filenames on a one-per-object-file
385 basis.
386 .RE
387 .IP "\fB\-V\fR" 4
388 .IX Item "-V"
389 .PD 0
390 .IP "\fB\-\-version\fR" 4
391 .IX Item "--version"
392 .PD
393 Show the version number for \fBstrip\fR.
394 .IP "\fB\-v\fR" 4
395 .IX Item "-v"
396 .PD 0
397 .IP "\fB\-\-verbose\fR" 4
398 .IX Item "--verbose"
399 .PD
400 Verbose output: list all object files modified.  In the case of
401 archives, \fBstrip \-v\fR lists all members of the archive.
402 .IP "\fB@\fR\fIfile\fR" 4
403 .IX Item "@file"
404 Read command-line options from \fIfile\fR.  The options read are
405 inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
406 does not exist, or cannot be read, then the option will be treated
407 literally, and not removed.
408 .Sp
409 Options in \fIfile\fR are separated by whitespace.  A whitespace
410 character may be included in an option by surrounding the entire
411 option in either single or double quotes.  Any character (including a
412 backslash) may be included by prefixing the character to be included
413 with a backslash.  The \fIfile\fR may itself contain additional
414 @\fIfile\fR options; any such options will be processed recursively.
415 .SH "SEE ALSO"
416 .IX Header "SEE ALSO"
417 the Info entries for \fIbinutils\fR.
418 .SH "COPYRIGHT"
419 .IX Header "COPYRIGHT"
420 Copyright (c) 1991\-2013 Free Software Foundation, Inc.
421 .PP
422 Permission is granted to copy, distribute and/or modify this document
423 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
424 or any later version published by the Free Software Foundation;
425 with no Invariant Sections, with no Front-Cover Texts, and with no
426 Back-Cover Texts.  A copy of the license is included in the
427 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".