Merge from vendor branch FILE:
[dragonfly.git] / contrib / binutils-2.17 / binutils / doc / objcopy.1
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
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 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .\"
67 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
68 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
69 .    \" fudge factors for nroff and troff
70 .if n \{\
71 .    ds #H 0
72 .    ds #V .8m
73 .    ds #F .3m
74 .    ds #[ \f1
75 .    ds #] \fP
76 .\}
77 .if t \{\
78 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
79 .    ds #V .6m
80 .    ds #F 0
81 .    ds #[ \&
82 .    ds #] \&
83 .\}
84 .    \" simple accents for nroff and troff
85 .if n \{\
86 .    ds ' \&
87 .    ds ` \&
88 .    ds ^ \&
89 .    ds , \&
90 .    ds ~ ~
91 .    ds /
92 .\}
93 .if t \{\
94 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
95 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
96 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
97 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
98 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
99 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
100 .\}
101 .    \" troff and (daisy-wheel) nroff accents
102 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
103 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
104 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
105 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
106 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
107 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
108 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
109 .ds ae a\h'-(\w'a'u*4/10)'e
110 .ds Ae A\h'-(\w'A'u*4/10)'E
111 .    \" corrections for vroff
112 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
113 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
114 .    \" for low resolution devices (crt and lpr)
115 .if \n(.H>23 .if \n(.V>19 \
116 \{\
117 .    ds : e
118 .    ds 8 ss
119 .    ds o a
120 .    ds d- d\h'-1'\(ga
121 .    ds D- D\h'-1'\(hy
122 .    ds th \o'bp'
123 .    ds Th \o'LP'
124 .    ds ae ae
125 .    ds Ae AE
126 .\}
127 .rm #[ #] #H #V #F C
128 .\" ========================================================================
129 .\"
130 .IX Title "OBJCOPY 1"
131 .TH OBJCOPY 1 "2006-06-23" "binutils-2.17" "GNU Development Tools"
132 .SH "NAME"
133 objcopy \- copy and translate object files
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 objcopy [\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\-B\fR \fIbfdarch\fR|\fB\-\-binary\-architecture=\fR\fIbfdarch\fR]
140         [\fB\-S\fR|\fB\-\-strip\-all\fR]
141         [\fB\-g\fR|\fB\-\-strip\-debug\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\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR]
145         [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR]
146         [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR]
147         [\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR]
148         [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
149         [\fB\-w\fR|\fB\-\-wildcard\fR]
150         [\fB\-x\fR|\fB\-\-discard\-all\fR]
151         [\fB\-X\fR|\fB\-\-discard\-locals\fR]
152         [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
153         [\fB\-i\fR \fIinterleave\fR|\fB\-\-interleave=\fR\fIinterleave\fR]
154         [\fB\-j\fR \fIsectionname\fR|\fB\-\-only\-section=\fR\fIsectionname\fR]
155         [\fB\-R\fR \fIsectionname\fR|\fB\-\-remove\-section=\fR\fIsectionname\fR]
156         [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
157         [\fB\-\-debugging\fR]
158         [\fB\-\-gap\-fill=\fR\fIval\fR]
159         [\fB\-\-pad\-to=\fR\fIaddress\fR]
160         [\fB\-\-set\-start=\fR\fIval\fR]
161         [\fB\-\-adjust\-start=\fR\fIincr\fR]
162         [\fB\-\-change\-addresses=\fR\fIincr\fR]
163         [\fB\-\-change\-section\-address\fR \fIsection\fR{=,+,\-}\fIval\fR]
164         [\fB\-\-change\-section\-lma\fR \fIsection\fR{=,+,\-}\fIval\fR]
165         [\fB\-\-change\-section\-vma\fR \fIsection\fR{=,+,\-}\fIval\fR]
166         [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
167         [\fB\-\-set\-section\-flags\fR \fIsection\fR=\fIflags\fR]
168         [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
169         [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
170         [\fB\-\-change\-leading\-char\fR] [\fB\-\-remove\-leading\-char\fR]
171         [\fB\-\-srec\-len=\fR\fIival\fR] [\fB\-\-srec\-forceS3\fR]
172         [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR]
173         [\fB\-\-redefine\-syms=\fR\fIfilename\fR]
174         [\fB\-\-weaken\fR]
175         [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
176         [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
177         [\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR]
178         [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
179         [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
180         [\fB\-\-globalize\-symbols=\fR\fIfilename\fR]
181         [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
182         [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
183         [\fB\-\-prefix\-symbols=\fR\fIstring\fR]
184         [\fB\-\-prefix\-sections=\fR\fIstring\fR]
185         [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR]
186         [\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR]
187         [\fB\-\-keep\-file\-symbols\fR]
188         [\fB\-\-only\-keep\-debug\fR]
189         [\fB\-\-writable\-text\fR]
190         [\fB\-\-readonly\-text\fR]
191         [\fB\-\-pure\fR]
192         [\fB\-\-impure\fR]
193         [\fB\-v\fR|\fB\-\-verbose\fR]
194         [\fB\-V\fR|\fB\-\-version\fR]  
195         [\fB\-\-help\fR] [\fB\-\-info\fR]
196         \fIinfile\fR [\fIoutfile\fR]
197 .SH "DESCRIPTION"
198 .IX Header "DESCRIPTION"
199 The \s-1GNU\s0 \fBobjcopy\fR utility copies the contents of an object
200 file to another.  \fBobjcopy\fR uses the \s-1GNU\s0 \s-1BFD\s0 Library to
201 read and write the object files.  It can write the destination object
202 file in a format different from that of the source object file.  The
203 exact behavior of \fBobjcopy\fR is controlled by command-line options.
204 Note that \fBobjcopy\fR should be able to copy a fully linked file
205 between any two formats. However, copying a relocatable object file
206 between any two formats may not work as expected.
207 .PP
208 \&\fBobjcopy\fR creates temporary files to do its translations and
209 deletes them afterward.  \fBobjcopy\fR uses \s-1BFD\s0 to do all its
210 translation work; it has access to all the formats described in \s-1BFD\s0
211 and thus is able to recognize most formats without being told
212 explicitly.  
213 .PP
214 \&\fBobjcopy\fR can be used to generate S\-records by using an output
215 target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
216 .PP
217 \&\fBobjcopy\fR can be used to generate a raw binary file by using an
218 output target of \fBbinary\fR (e.g., use \fB\-O binary\fR).  When
219 \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
220 a memory dump of the contents of the input object file.  All symbols and
221 relocation information will be discarded.  The memory dump will start at
222 the load address of the lowest section copied into the output file.
223 .PP
224 When generating an S\-record or a raw binary file, it may be helpful to
225 use \fB\-S\fR to remove sections containing debugging information.  In
226 some cases \fB\-R\fR will be useful to remove sections which contain
227 information that is not needed by the binary file.
228 .PP
229 Note\-\-\-\fBobjcopy\fR is not able to change the endianness of its input
230 files.  If the input format has an endianness (some formats do not),
231 \&\fBobjcopy\fR can only copy the inputs into file formats that have the
232 same endianness or which have no endianness (e.g., \fBsrec\fR).
233 .SH "OPTIONS"
234 .IX Header "OPTIONS"
235 .IP "\fIinfile\fR" 4
236 .IX Item "infile"
237 .PD 0
238 .IP "\fIoutfile\fR" 4
239 .IX Item "outfile"
240 .PD
241 The input and output files, respectively.
242 If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
243 temporary file and destructively renames the result with
244 the name of \fIinfile\fR.
245 .IP "\fB\-I\fR \fIbfdname\fR" 4
246 .IX Item "-I bfdname"
247 .PD 0
248 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
249 .IX Item "--input-target=bfdname"
250 .PD
251 Consider the source file's object format to be \fIbfdname\fR, rather than
252 attempting to deduce it.  
253 .IP "\fB\-O\fR \fIbfdname\fR" 4
254 .IX Item "-O bfdname"
255 .PD 0
256 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
257 .IX Item "--output-target=bfdname"
258 .PD
259 Write the output file using the object format \fIbfdname\fR.
260 .IP "\fB\-F\fR \fIbfdname\fR" 4
261 .IX Item "-F bfdname"
262 .PD 0
263 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
264 .IX Item "--target=bfdname"
265 .PD
266 Use \fIbfdname\fR as the object format for both the input and the output
267 file; i.e., simply transfer data from source to destination with no
268 translation.  
269 .IP "\fB\-B\fR \fIbfdarch\fR" 4
270 .IX Item "-B bfdarch"
271 .PD 0
272 .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
273 .IX Item "--binary-architecture=bfdarch"
274 .PD
275 Useful when transforming a raw binary input file into an object file.
276 In this case the output architecture can be set to \fIbfdarch\fR. This
277 option will be ignored if the input file has a known \fIbfdarch\fR. You
278 can access this binary data inside a program by referencing the special
279 symbols that are created by the conversion process.  These symbols are
280 called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
281 _binary_\fIobjfile\fR_size.  e.g. you can transform a picture file into
282 an object file and then access it in your code using these symbols. 
283 .IP "\fB\-j\fR \fIsectionname\fR" 4
284 .IX Item "-j sectionname"
285 .PD 0
286 .IP "\fB\-\-only\-section=\fR\fIsectionname\fR" 4
287 .IX Item "--only-section=sectionname"
288 .PD
289 Copy only the named section from the input file to the output file.
290 This option may be given more than once.  Note that using this option
291 inappropriately may make the output file unusable.
292 .IP "\fB\-R\fR \fIsectionname\fR" 4
293 .IX Item "-R sectionname"
294 .PD 0
295 .IP "\fB\-\-remove\-section=\fR\fIsectionname\fR" 4
296 .IX Item "--remove-section=sectionname"
297 .PD
298 Remove any section named \fIsectionname\fR from the output file.  This
299 option may be given more than once.  Note that using this option
300 inappropriately may make the output file unusable.
301 .IP "\fB\-S\fR" 4
302 .IX Item "-S"
303 .PD 0
304 .IP "\fB\-\-strip\-all\fR" 4
305 .IX Item "--strip-all"
306 .PD
307 Do not copy relocation and symbol information from the source file.
308 .IP "\fB\-g\fR" 4
309 .IX Item "-g"
310 .PD 0
311 .IP "\fB\-\-strip\-debug\fR" 4
312 .IX Item "--strip-debug"
313 .PD
314 Do not copy debugging symbols or sections from the source file.
315 .IP "\fB\-\-strip\-unneeded\fR" 4
316 .IX Item "--strip-unneeded"
317 Strip all symbols that are not needed for relocation processing.
318 .IP "\fB\-K\fR \fIsymbolname\fR" 4
319 .IX Item "-K symbolname"
320 .PD 0
321 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
322 .IX Item "--keep-symbol=symbolname"
323 .PD
324 When stripping symbols, keep symbol \fIsymbolname\fR even if it would
325 normally be stripped.  This option may be given more than once.
326 .IP "\fB\-N\fR \fIsymbolname\fR" 4
327 .IX Item "-N symbolname"
328 .PD 0
329 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
330 .IX Item "--strip-symbol=symbolname"
331 .PD
332 Do not copy symbol \fIsymbolname\fR from the source file.  This option
333 may be given more than once.
334 .IP "\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR" 4
335 .IX Item "--strip-unneeded-symbol=symbolname"
336 Do not copy symbol \fIsymbolname\fR from the source file unless it is needed
337 by a relocation.  This option may be given more than once.
338 .IP "\fB\-G\fR \fIsymbolname\fR" 4
339 .IX Item "-G symbolname"
340 .PD 0
341 .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
342 .IX Item "--keep-global-symbol=symbolname"
343 .PD
344 Keep only symbol \fIsymbolname\fR global.  Make all other symbols local
345 to the file, so that they are not visible externally.  This option may
346 be given more than once.
347 .IP "\fB\-L\fR \fIsymbolname\fR" 4
348 .IX Item "-L symbolname"
349 .PD 0
350 .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
351 .IX Item "--localize-symbol=symbolname"
352 .PD
353 Make symbol \fIsymbolname\fR local to the file, so that it is not
354 visible externally.  This option may be given more than once.
355 .IP "\fB\-W\fR \fIsymbolname\fR" 4
356 .IX Item "-W symbolname"
357 .PD 0
358 .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
359 .IX Item "--weaken-symbol=symbolname"
360 .PD
361 Make symbol \fIsymbolname\fR weak. This option may be given more than once.
362 .IP "\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR" 4
363 .IX Item "--globalize-symbol=symbolname"
364 Give symbol \fIsymbolname\fR global scoping so that it is visible
365 outside of the file in which it is defined.  This option may be given
366 more than once.
367 .IP "\fB\-w\fR" 4
368 .IX Item "-w"
369 .PD 0
370 .IP "\fB\-\-wildcard\fR" 4
371 .IX Item "--wildcard"
372 .PD
373 Permit regular expressions in \fIsymbolname\fRs used in other command
374 line options.  The question mark (?), asterisk (*), backslash (\e) and
375 square brackets ([]) operators can be used anywhere in the symbol
376 name.  If the first character of the symbol name is the exclamation
377 point (!) then the sense of the switch is reversed for that symbol.
378 For example:
379 .Sp
380 .Vb 1
381 \&          \-w \-W !foo \-W fo*
382 .Ve
383 .Sp
384 would cause objcopy to weaken all symbols that start with \*(L"fo\*(R"
385 except for the symbol \*(L"foo\*(R".
386 .IP "\fB\-x\fR" 4
387 .IX Item "-x"
388 .PD 0
389 .IP "\fB\-\-discard\-all\fR" 4
390 .IX Item "--discard-all"
391 .PD
392 Do not copy non-global symbols from the source file.
393 .IP "\fB\-X\fR" 4
394 .IX Item "-X"
395 .PD 0
396 .IP "\fB\-\-discard\-locals\fR" 4
397 .IX Item "--discard-locals"
398 .PD
399 Do not copy compiler-generated local symbols.
400 (These usually start with \fBL\fR or \fB.\fR.)
401 .IP "\fB\-b\fR \fIbyte\fR" 4
402 .IX Item "-b byte"
403 .PD 0
404 .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
405 .IX Item "--byte=byte"
406 .PD
407 Keep only every \fIbyte\fRth byte of the input file (header data is not
408 affected).  \fIbyte\fR can be in the range from 0 to \fIinterleave\fR\-1,
409 where \fIinterleave\fR is given by the \fB\-i\fR or \fB\-\-interleave\fR
410 option, or the default of 4.  This option is useful for creating files
411 to program \s-1ROM\s0.  It is typically used with an \f(CW\*(C`srec\*(C'\fR output
412 target.
413 .IP "\fB\-i\fR \fIinterleave\fR" 4
414 .IX Item "-i interleave"
415 .PD 0
416 .IP "\fB\-\-interleave=\fR\fIinterleave\fR" 4
417 .IX Item "--interleave=interleave"
418 .PD
419 Only copy one out of every \fIinterleave\fR bytes.  Select which byte to
420 copy with the \fB\-b\fR or \fB\-\-byte\fR option.  The default is 4.
421 \&\fBobjcopy\fR ignores this option if you do not specify either \fB\-b\fR or
422 \&\fB\-\-byte\fR.
423 .IP "\fB\-p\fR" 4
424 .IX Item "-p"
425 .PD 0
426 .IP "\fB\-\-preserve\-dates\fR" 4
427 .IX Item "--preserve-dates"
428 .PD
429 Set the access and modification dates of the output file to be the same
430 as those of the input file.
431 .IP "\fB\-\-debugging\fR" 4
432 .IX Item "--debugging"
433 Convert debugging information, if possible.  This is not the default
434 because only certain debugging formats are supported, and the
435 conversion process can be time consuming.
436 .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
437 .IX Item "--gap-fill val"
438 Fill gaps between sections with \fIval\fR.  This operation applies to
439 the \fIload address\fR (\s-1LMA\s0) of the sections.  It is done by increasing
440 the size of the section with the lower address, and filling in the extra
441 space created with \fIval\fR.
442 .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
443 .IX Item "--pad-to address"
444 Pad the output file up to the load address \fIaddress\fR.  This is
445 done by increasing the size of the last section.  The extra space is
446 filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
447 .IP "\fB\-\-set\-start\fR \fIval\fR" 4
448 .IX Item "--set-start val"
449 Set the start address of the new file to \fIval\fR.  Not all object file
450 formats support setting the start address.
451 .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
452 .IX Item "--change-start incr"
453 .PD 0
454 .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
455 .IX Item "--adjust-start incr"
456 .PD
457 Change the start address by adding \fIincr\fR.  Not all object file
458 formats support setting the start address.
459 .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
460 .IX Item "--change-addresses incr"
461 .PD 0
462 .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
463 .IX Item "--adjust-vma incr"
464 .PD
465 Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
466 address, by adding \fIincr\fR.  Some object file formats do not permit
467 section addresses to be changed arbitrarily.  Note that this does not
468 relocate the sections; if the program expects sections to be loaded at a
469 certain address, and this option is used to change the sections such
470 that they are loaded at a different address, the program may fail. 
471 .IP "\fB\-\-change\-section\-address\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
472 .IX Item "--change-section-address section{=,+,-}val"
473 .PD 0
474 .IP "\fB\-\-adjust\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
475 .IX Item "--adjust-section-vma section{=,+,-}val"
476 .PD
477 Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of the named
478 \&\fIsection\fR.  If \fB=\fR is used, the section address is set to
479 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
480 section address.  See the comments under \fB\-\-change\-addresses\fR,
481 above. If \fIsection\fR does not exist in the input file, a warning will
482 be issued, unless \fB\-\-no\-change\-warnings\fR is used.
483 .IP "\fB\-\-change\-section\-lma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
484 .IX Item "--change-section-lma section{=,+,-}val"
485 Set or change the \s-1LMA\s0 address of the named \fIsection\fR.  The \s-1LMA\s0
486 address is the address where the section will be loaded into memory at
487 program load time.  Normally this is the same as the \s-1VMA\s0 address, which
488 is the address of the section at program run time, but on some systems,
489 especially those where a program is held in \s-1ROM\s0, the two can be
490 different.  If \fB=\fR is used, the section address is set to
491 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
492 section address.  See the comments under \fB\-\-change\-addresses\fR,
493 above.  If \fIsection\fR does not exist in the input file, a warning
494 will be issued, unless \fB\-\-no\-change\-warnings\fR is used.  
495 .IP "\fB\-\-change\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
496 .IX Item "--change-section-vma section{=,+,-}val"
497 Set or change the \s-1VMA\s0 address of the named \fIsection\fR.  The \s-1VMA\s0
498 address is the address where the section will be located once the
499 program has started executing.  Normally this is the same as the \s-1LMA\s0
500 address, which is the address where the section will be loaded into
501 memory, but on some systems, especially those where a program is held in
502 \&\s-1ROM\s0, the two can be different.  If \fB=\fR is used, the section address
503 is set to \fIval\fR.  Otherwise, \fIval\fR is added to or subtracted
504 from the section address.  See the comments under
505 \&\fB\-\-change\-addresses\fR, above.  If \fIsection\fR does not exist in
506 the input file, a warning will be issued, unless
507 \&\fB\-\-no\-change\-warnings\fR is used.   
508 .IP "\fB\-\-change\-warnings\fR" 4
509 .IX Item "--change-warnings"
510 .PD 0
511 .IP "\fB\-\-adjust\-warnings\fR" 4
512 .IX Item "--adjust-warnings"
513 .PD
514 If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
515 \&\fB\-\-change\-section\-vma\fR is used, and the named section does not
516 exist, issue a warning.  This is the default. 
517 .IP "\fB\-\-no\-change\-warnings\fR" 4
518 .IX Item "--no-change-warnings"
519 .PD 0
520 .IP "\fB\-\-no\-adjust\-warnings\fR" 4
521 .IX Item "--no-adjust-warnings"
522 .PD
523 Do not issue a warning if \fB\-\-change\-section\-address\fR or
524 \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
525 if the named section does not exist. 
526 .IP "\fB\-\-set\-section\-flags\fR \fIsection\fR\fB=\fR\fIflags\fR" 4
527 .IX Item "--set-section-flags section=flags"
528 Set the flags for the named section.  The \fIflags\fR argument is a
529 comma separated string of flag names.  The recognized names are
530 \&\fBalloc\fR, \fBcontents\fR, \fBload\fR, \fBnoload\fR,
531 \&\fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR, \fBshare\fR, and
532 \&\fBdebug\fR.  You can set the \fBcontents\fR flag for a section which
533 does not have contents, but it is not meaningful to clear the
534 \&\fBcontents\fR flag of a section which does have contents\*(--just remove
535 the section instead.  Not all flags are meaningful for all object file
536 formats.
537 .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
538 .IX Item "--add-section sectionname=filename"
539 Add a new section named \fIsectionname\fR while copying the file.  The
540 contents of the new section are taken from the file \fIfilename\fR.  The
541 size of the section will be the size of the file.  This option only
542 works on file formats which can support sections with arbitrary names.
543 .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
544 .IX Item "--rename-section oldname=newname[,flags]"
545 Rename a section from \fIoldname\fR to \fInewname\fR, optionally
546 changing the section's flags to \fIflags\fR in the process.  This has
547 the advantage over usng a linker script to perform the rename in that
548 the output stays as an object file and does not become a linked
549 executable.
550 .Sp
551 This option is particularly helpful when the input format is binary,
552 since this will always create a section called .data.  If for example,
553 you wanted instead to create a section called .rodata containing binary
554 data you could use the following command line to achieve it:
555 .Sp
556 .Vb 3
557 \&          objcopy \-I binary \-O <output_format> \-B <architecture> \e
558 \&           \-\-rename\-section .data=.rodata,alloc,load,readonly,data,contents \e
559 \&           <input_binary_file> <output_object_file>
560 .Ve
561 .IP "\fB\-\-change\-leading\-char\fR" 4
562 .IX Item "--change-leading-char"
563 Some object file formats use special characters at the start of
564 symbols.  The most common such character is underscore, which compilers
565 often add before every symbol.  This option tells \fBobjcopy\fR to
566 change the leading character of every symbol when it converts between
567 object file formats.  If the object file formats use the same leading
568 character, this option has no effect.  Otherwise, it will add a
569 character, or remove a character, or change a character, as
570 appropriate.
571 .IP "\fB\-\-remove\-leading\-char\fR" 4
572 .IX Item "--remove-leading-char"
573 If the first character of a global symbol is a special symbol leading
574 character used by the object file format, remove the character.  The
575 most common symbol leading character is underscore.  This option will
576 remove a leading underscore from all global symbols.  This can be useful
577 if you want to link together objects of different file formats with
578 different conventions for symbol names.  This is different from
579 \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
580 when appropriate, regardless of the object file format of the output
581 file.
582 .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
583 .IX Item "--srec-len=ival"
584 Meaningful only for srec output.  Set the maximum length of the Srecords
585 being produced to \fIival\fR.  This length covers both address, data and
586 crc fields.
587 .IP "\fB\-\-srec\-forceS3\fR" 4
588 .IX Item "--srec-forceS3"
589 Meaningful only for srec output.  Avoid generation of S1/S2 records, 
590 creating S3\-only record format.
591 .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
592 .IX Item "--redefine-sym old=new"
593 Change the name of a symbol \fIold\fR, to \fInew\fR.  This can be useful
594 when one is trying link two things together for which you have no
595 source, and there are name collisions.
596 .IP "\fB\-\-redefine\-syms=\fR\fIfilename\fR" 4
597 .IX Item "--redefine-syms=filename"
598 Apply \fB\-\-redefine\-sym\fR to each symbol pair "\fIold\fR \fInew\fR"
599 listed in the file \fIfilename\fR.  \fIfilename\fR is simply a flat file,
600 with one symbol pair per line.  Line comments may be introduced by the hash
601 character.  This option may be given more than once.
602 .IP "\fB\-\-weaken\fR" 4
603 .IX Item "--weaken"
604 Change all global symbols in the file to be weak.  This can be useful
605 when building an object which will be linked against other objects using
606 the \fB\-R\fR option to the linker.  This option is only effective when
607 using an object file format which supports weak symbols.
608 .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
609 .IX Item "--keep-symbols=filename"
610 Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
611 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
612 name per line.  Line comments may be introduced by the hash character.
613 This option may be given more than once.
614 .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
615 .IX Item "--strip-symbols=filename"
616 Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
617 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
618 name per line.  Line comments may be introduced by the hash character.
619 This option may be given more than once.
620 .IP "\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR" 4
621 .IX Item "--strip-unneeded-symbols=filename"
622 Apply \fB\-\-strip\-unneeded\-symbol\fR option to each symbol listed in
623 the file \fIfilename\fR.  \fIfilename\fR is simply a flat file, with one
624 symbol name per line.  Line comments may be introduced by the hash
625 character.  This option may be given more than once.
626 .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
627 .IX Item "--keep-global-symbols=filename"
628 Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
629 file \fIfilename\fR.  \fIfilename\fR is simply a flat file, with one
630 symbol name per line.  Line comments may be introduced by the hash
631 character.  This option may be given more than once.
632 .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
633 .IX Item "--localize-symbols=filename"
634 Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
635 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
636 name per line.  Line comments may be introduced by the hash character.
637 This option may be given more than once.
638 .IP "\fB\-\-globalize\-symbols=\fR\fIfilename\fR" 4
639 .IX Item "--globalize-symbols=filename"
640 Apply \fB\-\-globalize\-symbol\fR option to each symbol listed in the file
641 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
642 name per line.  Line comments may be introduced by the hash character.
643 This option may be given more than once.
644 .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
645 .IX Item "--weaken-symbols=filename"
646 Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
647 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
648 name per line.  Line comments may be introduced by the hash character.
649 This option may be given more than once.
650 .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
651 .IX Item "--alt-machine-code=index"
652 If the output architecture has alternate machine codes, use the
653 \&\fIindex\fRth code instead of the default one.  This is useful in case
654 a machine is assigned an official code and the tool-chain adopts the 
655 new code, but other applications still depend on the original code
656 being used.  For \s-1ELF\s0 based architectures if the \fIindex\fR
657 alternative does not exist then the value is treated as an absolute
658 number to be stored in the e_machine field of the \s-1ELF\s0 header.
659 .IP "\fB\-\-writable\-text\fR" 4
660 .IX Item "--writable-text"
661 Mark the output text as writable.  This option isn't meaningful for all
662 object file formats.
663 .IP "\fB\-\-readonly\-text\fR" 4
664 .IX Item "--readonly-text"
665 Make the output text write protected.  This option isn't meaningful for all
666 object file formats.
667 .IP "\fB\-\-pure\fR" 4
668 .IX Item "--pure"
669 Mark the output file as demand paged.  This option isn't meaningful for all
670 object file formats.
671 .IP "\fB\-\-impure\fR" 4
672 .IX Item "--impure"
673 Mark the output file as impure.  This option isn't meaningful for all
674 object file formats.
675 .IP "\fB\-\-prefix\-symbols=\fR\fIstring\fR" 4
676 .IX Item "--prefix-symbols=string"
677 Prefix all symbols in the output file with \fIstring\fR.
678 .IP "\fB\-\-prefix\-sections=\fR\fIstring\fR" 4
679 .IX Item "--prefix-sections=string"
680 Prefix all section names in the output file with \fIstring\fR.
681 .IP "\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR" 4
682 .IX Item "--prefix-alloc-sections=string"
683 Prefix all the names of all allocated sections in the output file with
684 \&\fIstring\fR.
685 .IP "\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR" 4
686 .IX Item "--add-gnu-debuglink=path-to-file"
687 Creates a .gnu_debuglink section which contains a reference to \fIpath-to-file\fR
688 and adds it to the output file.
689 .IP "\fB\-\-keep\-file\-symbols\fR" 4
690 .IX Item "--keep-file-symbols"
691 When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
692 \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names,
693 which would otherwise get stripped.
694 .IP "\fB\-\-only\-keep\-debug\fR" 4
695 .IX Item "--only-keep-debug"
696 Strip a file, removing contents of any sections that would not be
697 stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections
698 intact.
699 .Sp
700 The intention is that this option will be used in conjunction with
701 \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable.  One a
702 stripped binary which will occupy less space in \s-1RAM\s0 and in a
703 distribution and the second a debugging information file which is only
704 needed if debugging abilities are required.  The suggested procedure
705 to create these files is as follows:
706 .RS 4
707 .IP "1.<Link the executable as normal.  Assuming that is is called>" 4
708 .IX Item "1.<Link the executable as normal.  Assuming that is is called>"
709 \&\f(CW\*(C`foo\*(C'\fR then...
710 .ie n .IP "1.<Run ""objcopy \-\-only\-keep\-debug foo foo.dbg"" to>" 4
711 .el .IP "1.<Run \f(CWobjcopy \-\-only\-keep\-debug foo foo.dbg\fR to>" 4
712 .IX Item "1.<Run objcopy --only-keep-debug foo foo.dbg to>"
713 create a file containing the debugging info.
714 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"" to create a>" 4
715 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR to create a>" 4
716 .IX Item "1.<Run objcopy --strip-debug foo to create a>"
717 stripped executable.
718 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.dbg foo"">" 4
719 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.dbg foo\fR>" 4
720 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.dbg foo>"
721 to add a link to the debugging info into the stripped executable.
722 .RE
723 .RS 4
724 .Sp
725 Note \- the choice of \f(CW\*(C`.dbg\*(C'\fR as an extension for the debug info
726 file is arbitrary.  Also the \f(CW\*(C`\-\-only\-keep\-debug\*(C'\fR step is
727 optional.  You could instead do this:
728 .IP "1.<Link the executable as normal.>" 4
729 .IX Item "1.<Link the executable as normal.>"
730 .PD 0
731 .ie n .IP "1.<Copy ""foo""\fR to  \f(CW""foo.full"">" 4
732 .el .IP "1.<Copy \f(CWfoo\fR to  \f(CWfoo.full\fR>" 4
733 .IX Item "1.<Copy foo to  foo.full>"
734 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"">" 4
735 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR>" 4
736 .IX Item "1.<Run objcopy --strip-debug foo>"
737 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.full foo"">" 4
738 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.full foo\fR>" 4
739 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.full foo>"
740 .RE
741 .RS 4
742 .PD
743 .Sp
744 i.e. the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the
745 full executable.  It does not have to be a file created by the
746 \&\fB\-\-only\-keep\-debug\fR switch.
747 .RE
748 .IP "\fB\-V\fR" 4
749 .IX Item "-V"
750 .PD 0
751 .IP "\fB\-\-version\fR" 4
752 .IX Item "--version"
753 .PD
754 Show the version number of \fBobjcopy\fR.
755 .IP "\fB\-v\fR" 4
756 .IX Item "-v"
757 .PD 0
758 .IP "\fB\-\-verbose\fR" 4
759 .IX Item "--verbose"
760 .PD
761 Verbose output: list all object files modified.  In the case of
762 archives, \fBobjcopy \-V\fR lists all members of the archive.
763 .IP "\fB\-\-help\fR" 4
764 .IX Item "--help"
765 Show a summary of the options to \fBobjcopy\fR.
766 .IP "\fB\-\-info\fR" 4
767 .IX Item "--info"
768 Display a list showing all architectures and object formats available.
769 .IP "\fB@\fR\fIfile\fR" 4
770 .IX Item "@file"
771 Read command-line options from \fIfile\fR.  The options read are
772 inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
773 does not exist, or cannot be read, then the option will be treated
774 literally, and not removed.  
775 .Sp
776 Options in \fIfile\fR are separated by whitespace.  A whitespace
777 character may be included in an option by surrounding the entire
778 option in either single or double quotes.  Any character (including a
779 backslash) may be included by prefixing the character to be included
780 with a backslash.  The \fIfile\fR may itself contain additional
781 @\fIfile\fR options; any such options will be processed recursively.
782 .SH "SEE ALSO"
783 .IX Header "SEE ALSO"
784 \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
785 .SH "COPYRIGHT"
786 .IX Header "COPYRIGHT"
787 Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
788 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
789 .PP
790 Permission is granted to copy, distribute and/or modify this document
791 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
792 or any later version published by the Free Software Foundation;
793 with no Invariant Sections, with no Front-Cover Texts, and with no
794 Back-Cover Texts.  A copy of the license is included in the
795 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".