Merge from vendor branch OPENSSH:
[dragonfly.git] / contrib / binutils-2.14 / binutils / doc / objcopy.1
1 .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
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.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
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 "2003-04-27" "binutils-2.13.90" "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] [\fB\-g\fR|\fB\-\-strip\-debug\fR]
141         [\fB\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
142         [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-symbol=\fR\fIsymbolname\fR]
143         [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR]
144         [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR]
145         [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
146         [\fB\-x\fR|\fB\-\-discard\-all\fR] [\fB\-X\fR|\fB\-\-discard\-locals\fR]
147         [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
148         [\fB\-i\fR \fIinterleave\fR|\fB\-\-interleave=\fR\fIinterleave\fR]
149         [\fB\-j\fR \fIsectionname\fR|\fB\-\-only\-section=\fR\fIsectionname\fR]
150         [\fB\-R\fR \fIsectionname\fR|\fB\-\-remove\-section=\fR\fIsectionname\fR]
151         [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
152         [\fB\-\-debugging\fR]
153         [\fB\-\-gap\-fill=\fR\fIval\fR] [\fB\-\-pad\-to=\fR\fIaddress\fR]
154         [\fB\-\-set\-start=\fR\fIval\fR] [\fB\-\-adjust\-start=\fR\fIincr\fR]
155         [\fB\-\-change\-addresses=\fR\fIincr\fR]
156         [\fB\-\-change\-section\-address\fR \fIsection\fR{=,+,\-}\fIval\fR]
157         [\fB\-\-change\-section\-lma\fR \fIsection\fR{=,+,\-}\fIval\fR]
158         [\fB\-\-change\-section\-vma\fR \fIsection\fR{=,+,\-}\fIval\fR]
159         [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
160         [\fB\-\-set\-section\-flags\fR \fIsection\fR=\fIflags\fR]
161         [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
162         [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
163         [\fB\-\-change\-leading\-char\fR ] [\fB\-\-remove\-leading\-char\fR]
164         [\fB\-\-srec\-len=\fR\fIival\fR ] [\fB\-\-srec\-forceS3\fR]
165         [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR ]
166         [\fB\-\-weaken\fR]
167         [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
168         [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
169         [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
170         [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
171         [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
172         [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
173         [\fB\-\-prefix\-symbols=\fR\fIstring\fR]
174         [\fB\-\-prefix\-sections=\fR\fIstring\fR]
175         [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR]
176         [\fB\-v\fR|\fB\-\-verbose\fR]
177         [\fB\-V\fR|\fB\-\-version\fR]  
178         [\fB\-\-help\fR] [\fB\-\-info\fR]
179         \fIinfile\fR [\fIoutfile\fR]
180 .SH "DESCRIPTION"
181 .IX Header "DESCRIPTION"
182 The \s-1GNU\s0 \fBobjcopy\fR utility copies the contents of an object
183 file to another.  \fBobjcopy\fR uses the \s-1GNU\s0 \s-1BFD\s0 Library to
184 read and write the object files.  It can write the destination object
185 file in a format different from that of the source object file.  The
186 exact behavior of \fBobjcopy\fR is controlled by command-line options.
187 Note that \fBobjcopy\fR should be able to copy a fully linked file
188 between any two formats. However, copying a relocatable object file
189 between any two formats may not work as expected.
190 .PP
191 \&\fBobjcopy\fR creates temporary files to do its translations and
192 deletes them afterward.  \fBobjcopy\fR uses \s-1BFD\s0 to do all its
193 translation work; it has access to all the formats described in \s-1BFD\s0
194 and thus is able to recognize most formats without being told
195 explicitly.  
196 .PP
197 \&\fBobjcopy\fR can be used to generate S\-records by using an output
198 target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
199 .PP
200 \&\fBobjcopy\fR can be used to generate a raw binary file by using an
201 output target of \fBbinary\fR (e.g., use \fB\-O binary\fR).  When
202 \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
203 a memory dump of the contents of the input object file.  All symbols and
204 relocation information will be discarded.  The memory dump will start at
205 the load address of the lowest section copied into the output file.
206 .PP
207 When generating an S\-record or a raw binary file, it may be helpful to
208 use \fB\-S\fR to remove sections containing debugging information.  In
209 some cases \fB\-R\fR will be useful to remove sections which contain
210 information that is not needed by the binary file.
211 .PP
212 Note\-\-\-\fBobjcopy\fR is not able to change the endianness of its input
213 files.  If the input format has an endianness (some formats do not),
214 \&\fBobjcopy\fR can only copy the inputs into file formats that have the
215 same endianness or which have no endianness (e.g., \fBsrec\fR).
216 .SH "OPTIONS"
217 .IX Header "OPTIONS"
218 .IP "\fIinfile\fR" 4
219 .IX Item "infile"
220 .PD 0
221 .IP "\fIoutfile\fR" 4
222 .IX Item "outfile"
223 .PD
224 The input and output files, respectively.
225 If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
226 temporary file and destructively renames the result with
227 the name of \fIinfile\fR.
228 .IP "\fB\-I\fR \fIbfdname\fR" 4
229 .IX Item "-I bfdname"
230 .PD 0
231 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
232 .IX Item "--input-target=bfdname"
233 .PD
234 Consider the source file's object format to be \fIbfdname\fR, rather than
235 attempting to deduce it.  
236 .IP "\fB\-O\fR \fIbfdname\fR" 4
237 .IX Item "-O bfdname"
238 .PD 0
239 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
240 .IX Item "--output-target=bfdname"
241 .PD
242 Write the output file using the object format \fIbfdname\fR.
243 .IP "\fB\-F\fR \fIbfdname\fR" 4
244 .IX Item "-F bfdname"
245 .PD 0
246 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
247 .IX Item "--target=bfdname"
248 .PD
249 Use \fIbfdname\fR as the object format for both the input and the output
250 file; i.e., simply transfer data from source to destination with no
251 translation.  
252 .IP "\fB\-B\fR \fIbfdarch\fR" 4
253 .IX Item "-B bfdarch"
254 .PD 0
255 .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
256 .IX Item "--binary-architecture=bfdarch"
257 .PD
258 Useful when transforming a raw binary input file into an object file.
259 In this case the output architecture can be set to \fIbfdarch\fR. This
260 option will be ignored if the input file has a known \fIbfdarch\fR. You
261 can access this binary data inside a program by referencing the special
262 symbols that are created by the conversion process.  These symbols are
263 called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
264 _binary_\fIobjfile\fR_size.  e.g. you can transform a picture file into
265 an object file and then access it in your code using these symbols. 
266 .IP "\fB\-j\fR \fIsectionname\fR" 4
267 .IX Item "-j sectionname"
268 .PD 0
269 .IP "\fB\-\-only\-section=\fR\fIsectionname\fR" 4
270 .IX Item "--only-section=sectionname"
271 .PD
272 Copy only the named section from the input file to the output file.
273 This option may be given more than once.  Note that using this option
274 inappropriately may make the output file unusable.
275 .IP "\fB\-R\fR \fIsectionname\fR" 4
276 .IX Item "-R sectionname"
277 .PD 0
278 .IP "\fB\-\-remove\-section=\fR\fIsectionname\fR" 4
279 .IX Item "--remove-section=sectionname"
280 .PD
281 Remove any section named \fIsectionname\fR from the output file.  This
282 option may be given more than once.  Note that using this option
283 inappropriately may make the output file unusable.
284 .IP "\fB\-S\fR" 4
285 .IX Item "-S"
286 .PD 0
287 .IP "\fB\-\-strip\-all\fR" 4
288 .IX Item "--strip-all"
289 .PD
290 Do not copy relocation and symbol information from the source file.
291 .IP "\fB\-g\fR" 4
292 .IX Item "-g"
293 .PD 0
294 .IP "\fB\-\-strip\-debug\fR" 4
295 .IX Item "--strip-debug"
296 .PD
297 Do not copy debugging symbols from the source file.
298 .IP "\fB\-\-strip\-unneeded\fR" 4
299 .IX Item "--strip-unneeded"
300 Strip all symbols that are not needed for relocation processing.
301 .IP "\fB\-K\fR \fIsymbolname\fR" 4
302 .IX Item "-K symbolname"
303 .PD 0
304 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
305 .IX Item "--keep-symbol=symbolname"
306 .PD
307 Copy only symbol \fIsymbolname\fR from the source file.  This option may
308 be given more than once.
309 .IP "\fB\-N\fR \fIsymbolname\fR" 4
310 .IX Item "-N symbolname"
311 .PD 0
312 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
313 .IX Item "--strip-symbol=symbolname"
314 .PD
315 Do not copy symbol \fIsymbolname\fR from the source file.  This option
316 may be given more than once.
317 .IP "\fB\-G\fR \fIsymbolname\fR" 4
318 .IX Item "-G symbolname"
319 .PD 0
320 .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
321 .IX Item "--keep-global-symbol=symbolname"
322 .PD
323 Keep only symbol \fIsymbolname\fR global.  Make all other symbols local
324 to the file, so that they are not visible externally.  This option may
325 be given more than once.
326 .IP "\fB\-L\fR \fIsymbolname\fR" 4
327 .IX Item "-L symbolname"
328 .PD 0
329 .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
330 .IX Item "--localize-symbol=symbolname"
331 .PD
332 Make symbol \fIsymbolname\fR local to the file, so that it is not
333 visible externally.  This option may be given more than once.
334 .IP "\fB\-W\fR \fIsymbolname\fR" 4
335 .IX Item "-W symbolname"
336 .PD 0
337 .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
338 .IX Item "--weaken-symbol=symbolname"
339 .PD
340 Make symbol \fIsymbolname\fR weak. This option may be given more than once.
341 .IP "\fB\-x\fR" 4
342 .IX Item "-x"
343 .PD 0
344 .IP "\fB\-\-discard\-all\fR" 4
345 .IX Item "--discard-all"
346 .PD
347 Do not copy non-global symbols from the source file.
348 .IP "\fB\-X\fR" 4
349 .IX Item "-X"
350 .PD 0
351 .IP "\fB\-\-discard\-locals\fR" 4
352 .IX Item "--discard-locals"
353 .PD
354 Do not copy compiler-generated local symbols.
355 (These usually start with \fBL\fR or \fB.\fR.)
356 .IP "\fB\-b\fR \fIbyte\fR" 4
357 .IX Item "-b byte"
358 .PD 0
359 .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
360 .IX Item "--byte=byte"
361 .PD
362 Keep only every \fIbyte\fRth byte of the input file (header data is not
363 affected).  \fIbyte\fR can be in the range from 0 to \fIinterleave\fR\-1,
364 where \fIinterleave\fR is given by the \fB\-i\fR or \fB\-\-interleave\fR
365 option, or the default of 4.  This option is useful for creating files
366 to program \s-1ROM\s0.  It is typically used with an \f(CW\*(C`srec\*(C'\fR output
367 target.
368 .IP "\fB\-i\fR \fIinterleave\fR" 4
369 .IX Item "-i interleave"
370 .PD 0
371 .IP "\fB\-\-interleave=\fR\fIinterleave\fR" 4
372 .IX Item "--interleave=interleave"
373 .PD
374 Only copy one out of every \fIinterleave\fR bytes.  Select which byte to
375 copy with the \fB\-b\fR or \fB\-\-byte\fR option.  The default is 4.
376 \&\fBobjcopy\fR ignores this option if you do not specify either \fB\-b\fR or
377 \&\fB\-\-byte\fR.
378 .IP "\fB\-p\fR" 4
379 .IX Item "-p"
380 .PD 0
381 .IP "\fB\-\-preserve\-dates\fR" 4
382 .IX Item "--preserve-dates"
383 .PD
384 Set the access and modification dates of the output file to be the same
385 as those of the input file.
386 .IP "\fB\-\-debugging\fR" 4
387 .IX Item "--debugging"
388 Convert debugging information, if possible.  This is not the default
389 because only certain debugging formats are supported, and the
390 conversion process can be time consuming.
391 .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
392 .IX Item "--gap-fill val"
393 Fill gaps between sections with \fIval\fR.  This operation applies to
394 the \fIload address\fR (\s-1LMA\s0) of the sections.  It is done by increasing
395 the size of the section with the lower address, and filling in the extra
396 space created with \fIval\fR.
397 .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
398 .IX Item "--pad-to address"
399 Pad the output file up to the load address \fIaddress\fR.  This is
400 done by increasing the size of the last section.  The extra space is
401 filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
402 .IP "\fB\-\-set\-start\fR \fIval\fR" 4
403 .IX Item "--set-start val"
404 Set the start address of the new file to \fIval\fR.  Not all object file
405 formats support setting the start address.
406 .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
407 .IX Item "--change-start incr"
408 .PD 0
409 .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
410 .IX Item "--adjust-start incr"
411 .PD
412 Change the start address by adding \fIincr\fR.  Not all object file
413 formats support setting the start address.
414 .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
415 .IX Item "--change-addresses incr"
416 .PD 0
417 .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
418 .IX Item "--adjust-vma incr"
419 .PD
420 Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
421 address, by adding \fIincr\fR.  Some object file formats do not permit
422 section addresses to be changed arbitrarily.  Note that this does not
423 relocate the sections; if the program expects sections to be loaded at a
424 certain address, and this option is used to change the sections such
425 that they are loaded at a different address, the program may fail. 
426 .IP "\fB\-\-change\-section\-address\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
427 .IX Item "--change-section-address section{=,+,-}val"
428 .PD 0
429 .IP "\fB\-\-adjust\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
430 .IX Item "--adjust-section-vma section{=,+,-}val"
431 .PD
432 Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of the named
433 \&\fIsection\fR.  If \fB=\fR is used, the section address is set to
434 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
435 section address.  See the comments under \fB\-\-change\-addresses\fR,
436 above. If \fIsection\fR does not exist in the input file, a warning will
437 be issued, unless \fB\-\-no\-change\-warnings\fR is used.
438 .IP "\fB\-\-change\-section\-lma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
439 .IX Item "--change-section-lma section{=,+,-}val"
440 Set or change the \s-1LMA\s0 address of the named \fIsection\fR.  The \s-1LMA\s0
441 address is the address where the section will be loaded into memory at
442 program load time.  Normally this is the same as the \s-1VMA\s0 address, which
443 is the address of the section at program run time, but on some systems,
444 especially those where a program is held in \s-1ROM\s0, the two can be
445 different.  If \fB=\fR is used, the section address is set to
446 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
447 section address.  See the comments under \fB\-\-change\-addresses\fR,
448 above.  If \fIsection\fR does not exist in the input file, a warning
449 will be issued, unless \fB\-\-no\-change\-warnings\fR is used.  
450 .IP "\fB\-\-change\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
451 .IX Item "--change-section-vma section{=,+,-}val"
452 Set or change the \s-1VMA\s0 address of the named \fIsection\fR.  The \s-1VMA\s0
453 address is the address where the section will be located once the
454 program has started executing.  Normally this is the same as the \s-1LMA\s0
455 address, which is the address where the section will be loaded into
456 memory, but on some systems, especially those where a program is held in
457 \&\s-1ROM\s0, the two can be different.  If \fB=\fR is used, the section address
458 is set to \fIval\fR.  Otherwise, \fIval\fR is added to or subtracted
459 from the section address.  See the comments under
460 \&\fB\-\-change\-addresses\fR, above.  If \fIsection\fR does not exist in
461 the input file, a warning will be issued, unless
462 \&\fB\-\-no\-change\-warnings\fR is used.   
463 .IP "\fB\-\-change\-warnings\fR" 4
464 .IX Item "--change-warnings"
465 .PD 0
466 .IP "\fB\-\-adjust\-warnings\fR" 4
467 .IX Item "--adjust-warnings"
468 .PD
469 If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
470 \&\fB\-\-change\-section\-vma\fR is used, and the named section does not
471 exist, issue a warning.  This is the default. 
472 .IP "\fB\-\-no\-change\-warnings\fR" 4
473 .IX Item "--no-change-warnings"
474 .PD 0
475 .IP "\fB\-\-no\-adjust\-warnings\fR" 4
476 .IX Item "--no-adjust-warnings"
477 .PD
478 Do not issue a warning if \fB\-\-change\-section\-address\fR or
479 \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
480 if the named section does not exist. 
481 .IP "\fB\-\-set\-section\-flags\fR \fIsection\fR\fB=\fR\fIflags\fR" 4
482 .IX Item "--set-section-flags section=flags"
483 Set the flags for the named section.  The \fIflags\fR argument is a
484 comma separated string of flag names.  The recognized names are
485 \&\fBalloc\fR, \fBcontents\fR, \fBload\fR, \fBnoload\fR,
486 \&\fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR, \fBshare\fR, and
487 \&\fBdebug\fR.  You can set the \fBcontents\fR flag for a section which
488 does not have contents, but it is not meaningful to clear the
489 \&\fBcontents\fR flag of a section which does have contents\*(--just remove
490 the section instead.  Not all flags are meaningful for all object file
491 formats.
492 .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
493 .IX Item "--add-section sectionname=filename"
494 Add a new section named \fIsectionname\fR while copying the file.  The
495 contents of the new section are taken from the file \fIfilename\fR.  The
496 size of the section will be the size of the file.  This option only
497 works on file formats which can support sections with arbitrary names.
498 .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
499 .IX Item "--rename-section oldname=newname[,flags]"
500 Rename a section from \fIoldname\fR to \fInewname\fR, optionally
501 changing the section's flags to \fIflags\fR in the process.  This has
502 the advantage over usng a linker script to perform the rename in that
503 the output stays as an object file and does not become a linked
504 executable.
505 .Sp
506 This option is particularly helpful when the input format is binary,
507 since this will always create a section called .data.  If for example,
508 you wanted instead to create a section called .rodata containing binary
509 data you could use the following command line to achieve it:
510 .Sp
511 .Vb 3
512 \&          objcopy -I binary -O <output_format> -B <architecture> \e
513 \&           --rename-section .data=.rodata,alloc,load,readonly,data,contents \e
514 \&           <input_binary_file> <output_object_file>
515 .Ve
516 .IP "\fB\-\-change\-leading\-char\fR" 4
517 .IX Item "--change-leading-char"
518 Some object file formats use special characters at the start of
519 symbols.  The most common such character is underscore, which compilers
520 often add before every symbol.  This option tells \fBobjcopy\fR to
521 change the leading character of every symbol when it converts between
522 object file formats.  If the object file formats use the same leading
523 character, this option has no effect.  Otherwise, it will add a
524 character, or remove a character, or change a character, as
525 appropriate.
526 .IP "\fB\-\-remove\-leading\-char\fR" 4
527 .IX Item "--remove-leading-char"
528 If the first character of a global symbol is a special symbol leading
529 character used by the object file format, remove the character.  The
530 most common symbol leading character is underscore.  This option will
531 remove a leading underscore from all global symbols.  This can be useful
532 if you want to link together objects of different file formats with
533 different conventions for symbol names.  This is different from
534 \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
535 when appropriate, regardless of the object file format of the output
536 file.
537 .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
538 .IX Item "--srec-len=ival"
539 Meaningful only for srec output.  Set the maximum length of the Srecords
540 being produced to \fIival\fR.  This length covers both address, data and
541 crc fields.
542 .IP "\fB\-\-srec\-forceS3\fR" 4
543 .IX Item "--srec-forceS3"
544 Meaningful only for srec output.  Avoid generation of S1/S2 records, 
545 creating S3\-only record format.
546 .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
547 .IX Item "--redefine-sym old=new"
548 Change the name of a symbol \fIold\fR, to \fInew\fR.  This can be useful
549 when one is trying link two things together for which you have no
550 source, and there are name collisions.
551 .IP "\fB\-\-weaken\fR" 4
552 .IX Item "--weaken"
553 Change all global symbols in the file to be weak.  This can be useful
554 when building an object which will be linked against other objects using
555 the \fB\-R\fR option to the linker.  This option is only effective when
556 using an object file format which supports weak symbols.
557 .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
558 .IX Item "--keep-symbols=filename"
559 Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
560 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
561 name per line.  Line comments may be introduced by the hash character.
562 This option may be given more than once.
563 .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
564 .IX Item "--strip-symbols=filename"
565 Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
566 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
567 name per line.  Line comments may be introduced by the hash character.
568 This option may be given more than once.
569 .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
570 .IX Item "--keep-global-symbols=filename"
571 Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
572 file \fIfilename\fR.  \fIfilename\fR is simply a flat file, with one
573 symbol name per line.  Line comments may be introduced by the hash
574 character.  This option may be given more than once.
575 .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
576 .IX Item "--localize-symbols=filename"
577 Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
578 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
579 name per line.  Line comments may be introduced by the hash character.
580 This option may be given more than once.
581 .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
582 .IX Item "--weaken-symbols=filename"
583 Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
584 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
585 name per line.  Line comments may be introduced by the hash character.
586 This option may be given more than once.
587 .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
588 .IX Item "--alt-machine-code=index"
589 If the output architecture has alternate machine codes, use the
590 \&\fIindex\fRth code instead of the default one.  This is useful in case
591 a machine is assigned an official code and the tool-chain adopts the 
592 new code, but other applications still depend on the original code
593 being used.
594 .IP "\fB\-\-prefix\-symbols=\fR\fIstring\fR" 4
595 .IX Item "--prefix-symbols=string"
596 Prefix all symbols in the output file with \fIstring\fR.
597 .IP "\fB\-\-prefix\-sections=\fR\fIstring\fR" 4
598 .IX Item "--prefix-sections=string"
599 Prefix all section names in the output file with \fIstring\fR.
600 .IP "\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR" 4
601 .IX Item "--prefix-alloc-sections=string"
602 Prefix all the names of all allocated sections in the output file with
603 \&\fIstring\fR.
604 .IP "\fB\-V\fR" 4
605 .IX Item "-V"
606 .PD 0
607 .IP "\fB\-\-version\fR" 4
608 .IX Item "--version"
609 .PD
610 Show the version number of \fBobjcopy\fR.
611 .IP "\fB\-v\fR" 4
612 .IX Item "-v"
613 .PD 0
614 .IP "\fB\-\-verbose\fR" 4
615 .IX Item "--verbose"
616 .PD
617 Verbose output: list all object files modified.  In the case of
618 archives, \fBobjcopy \-V\fR lists all members of the archive.
619 .IP "\fB\-\-help\fR" 4
620 .IX Item "--help"
621 Show a summary of the options to \fBobjcopy\fR.
622 .IP "\fB\-\-info\fR" 4
623 .IX Item "--info"
624 Display a list showing all architectures and object formats available.
625 .SH "SEE ALSO"
626 .IX Header "SEE ALSO"
627 \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
628 .SH "COPYRIGHT"
629 .IX Header "COPYRIGHT"
630 Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
631 2001, 2002, 2003 Free Software Foundation, Inc.
632 .PP
633 Permission is granted to copy, distribute and/or modify this document
634 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
635 or any later version published by the Free Software Foundation;
636 with no Invariant Sections, with no Front-Cover Texts, and with no
637 Back-Cover Texts.  A copy of the license is included in the
638 section entitled ``\s-1GNU\s0 Free Documentation License''.