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