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