Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / binutils / binutils / doc / objcopy.1
1 .\" Automatically generated by Pod::Man v1.3, 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
25 .fi
26 ..
27 .\" Set up some character translations and predefined strings.  \*(-- will
28 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
29 .\" double quote, and \*(R" will give a right double quote.  | will give a
30 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
31 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
32 .\" expand to `' in nroff, nothing in troff, for use with C<>.
33 .tr \(*W-|\(bv\*(Tr
34 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
35 .ie n \{\
36 .    ds -- \(*W-
37 .    ds PI pi
38 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
39 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
40 .    ds L" ""
41 .    ds R" ""
42 .    ds C` ""
43 .    ds C' ""
44 'br\}
45 .el\{\
46 .    ds -- \|\(em\|
47 .    ds PI \(*p
48 .    ds L" ``
49 .    ds R" ''
50 'br\}
51 .\"
52 .\" If the F register is turned on, we'll generate index entries on stderr for
53 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
54 .\" entries marked with X<> in POD.  Of course, you'll have to process the
55 .\" output yourself in some meaningful fashion.
56 .if \nF \{\
57 .    de IX
58 .    tm Index:\\$1\t\\n%\t"\\$2"
59 ..
60 .    nr % 0
61 .    rr F
62 .\}
63 .\"
64 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
65 .\" way too many mistakes in technical documents.
66 .hy 0
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "OBJCOPY 1"
132 .TH OBJCOPY 1 "2002-05-14" "binutils-2.12.1" "GNU Development Tools"
133 .UC
134 .SH "NAME"
135 objcopy \- copy and translate object files
136 .SH "SYNOPSIS"
137 .IX Header "SYNOPSIS"
138 objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR]
139         [\fB\-I\fR \fIbfdname\fR|\fB\-\-input\-target=\fR\fIbfdname\fR]
140         [\fB\-O\fR \fIbfdname\fR|\fB\-\-output\-target=\fR\fIbfdname\fR]
141         [\fB\-B\fR \fIbfdarch\fR|\fB\-\-binary\-architecture=\fR\fIbfdarch\fR]
142         [\fB\-S\fR|\fB\-\-strip\-all\fR] [\fB\-g\fR|\fB\-\-strip\-debug\fR]
143         [\fB\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
144         [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-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\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
148         [\fB\-x\fR|\fB\-\-discard\-all\fR] [\fB\-X\fR|\fB\-\-discard\-locals\fR]
149         [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
150         [\fB\-i\fR \fIinterleave\fR|\fB\-\-interleave=\fR\fIinterleave\fR]
151         [\fB\-j\fR \fIsectionname\fR|\fB\-\-only\-section=\fR\fIsectionname\fR]
152         [\fB\-R\fR \fIsectionname\fR|\fB\-\-remove\-section=\fR\fIsectionname\fR]
153         [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
154         [\fB\-\-debugging\fR]
155         [\fB\-\-gap\-fill=\fR\fIval\fR] [\fB\-\-pad\-to=\fR\fIaddress\fR]
156         [\fB\-\-set\-start=\fR\fIval\fR] [\fB\-\-adjust\-start=\fR\fIincr\fR]
157         [\fB\-\-change\-addresses=\fR\fIincr\fR]
158         [\fB\-\-change\-section\-address\fR \fIsection\fR{=,+,\-}\fIval\fR]
159         [\fB\-\-change\-section\-lma\fR \fIsection\fR{=,+,\-}\fIval\fR]
160         [\fB\-\-change\-section\-vma\fR \fIsection\fR{=,+,\-}\fIval\fR]
161         [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
162         [\fB\-\-set\-section\-flags\fR \fIsection\fR=\fIflags\fR]
163         [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
164         [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
165         [\fB\-\-change\-leading\-char\fR ] [\fB\-\-remove\-leading\-char\fR]
166         [\fB\-\-srec\-len=\fR\fIival\fR ] [\fB\-\-srec\-forceS3\fR]
167         [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR ]
168         [\fB\-\-weaken\fR]
169         [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
170         [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
171         [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
172         [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
173         [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
174         [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
175         [\fB\-v\fR|\fB\-\-verbose\fR]
176         [\fB\-V\fR|\fB\-\-version\fR]  
177         [\fB\-\-help\fR]
178         \fIinfile\fR [\fIoutfile\fR]
179 .SH "DESCRIPTION"
180 .IX Header "DESCRIPTION"
181 The \s-1GNU\s0 \fBobjcopy\fR utility copies the contents of an object
182 file to another.  \fBobjcopy\fR uses the \s-1GNU\s0 \s-1BFD\s0 Library to
183 read and write the object files.  It can write the destination object
184 file in a format different from that of the source object file.  The
185 exact behavior of \fBobjcopy\fR is controlled by command-line options.
186 Note that \fBobjcopy\fR should be able to copy a fully linked file
187 between any two formats. However, copying a relocatable object file
188 between any two formats may not work as expected.
189 .PP
190 \&\fBobjcopy\fR creates temporary files to do its translations and
191 deletes them afterward.  \fBobjcopy\fR uses \s-1BFD\s0 to do all its
192 translation work; it has access to all the formats described in \s-1BFD\s0
193 and thus is able to recognize most formats without being told
194 explicitly.  
195 .PP
196 \&\fBobjcopy\fR can be used to generate S\-records by using an output
197 target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
198 .PP
199 \&\fBobjcopy\fR can be used to generate a raw binary file by using an
200 output target of \fBbinary\fR (e.g., use \fB\-O binary\fR).  When
201 \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
202 a memory dump of the contents of the input object file.  All symbols and
203 relocation information will be discarded.  The memory dump will start at
204 the load address of the lowest section copied into the output file.
205 .PP
206 When generating an S\-record or a raw binary file, it may be helpful to
207 use \fB\-S\fR to remove sections containing debugging information.  In
208 some cases \fB\-R\fR will be useful to remove sections which contain
209 information that is not needed by the binary file.
210 .PP
211 Note \- \fBobjcopy\fR is not able to change the endianness of its input
212 files.  If the input format has an endianness, (some formats do not),
213 \&\fBobjcopy\fR can only copy the inputs into file formats that have the
214 same endianness or which have no endianness (eg \fBsrec\fR).
215 .SH "OPTIONS"
216 .IX Header "OPTIONS"
217 .IP "\fIinfile\fR" 4
218 .IX Item "infile"
219 .PD 0
220 .IP "\fIoutfile\fR" 4
221 .IX Item "outfile"
222 .PD
223 The input and output files, respectively.
224 If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
225 temporary file and destructively renames the result with
226 the name of \fIinfile\fR.
227 .IP "\fB\-I\fR \fIbfdname\fR" 4
228 .IX Item "-I bfdname"
229 .PD 0
230 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
231 .IX Item "--input-target=bfdname"
232 .PD
233 Consider the source file's object format to be \fIbfdname\fR, rather than
234 attempting to deduce it.  
235 .IP "\fB\-O\fR \fIbfdname\fR" 4
236 .IX Item "-O bfdname"
237 .PD 0
238 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
239 .IX Item "--output-target=bfdname"
240 .PD
241 Write the output file using the object format \fIbfdname\fR.
242 .IP "\fB\-F\fR \fIbfdname\fR" 4
243 .IX Item "-F bfdname"
244 .PD 0
245 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
246 .IX Item "--target=bfdname"
247 .PD
248 Use \fIbfdname\fR as the object format for both the input and the output
249 file; i.e., simply transfer data from source to destination with no
250 translation.  
251 .IP "\fB\-B\fR \fIbfdarch\fR" 4
252 .IX Item "-B bfdarch"
253 .PD 0
254 .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
255 .IX Item "--binary-architecture=bfdarch"
256 .PD
257 Useful when transforming a raw binary input file into an object file.
258 In this case the output architecture can be set to \fIbfdarch\fR. This
259 option will be ignored if the input file has a known \fIbfdarch\fR. You
260 can access this binary data inside a program by referencing the special
261 symbols that are created by the conversion process.  These symbols are
262 called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
263 _binary_\fIobjfile\fR_size.  e.g. you can transform a picture file into
264 an object file and then access it in your code using these symbols. 
265 .IP "\fB\-j\fR \fIsectionname\fR" 4
266 .IX Item "-j sectionname"
267 .PD 0
268 .IP "\fB\-\-only\-section=\fR\fIsectionname\fR" 4
269 .IX Item "--only-section=sectionname"
270 .PD
271 Copy only the named section from the input file to the output file.
272 This option may be given more than once.  Note that using this option
273 inappropriately may make the output file unusable.
274 .IP "\fB\-R\fR \fIsectionname\fR" 4
275 .IX Item "-R sectionname"
276 .PD 0
277 .IP "\fB\-\-remove\-section=\fR\fIsectionname\fR" 4
278 .IX Item "--remove-section=sectionname"
279 .PD
280 Remove any section named \fIsectionname\fR from the output file.  This
281 option may be given more than once.  Note that using this option
282 inappropriately may make the output file unusable.
283 .IP "\fB\-S\fR" 4
284 .IX Item "-S"
285 .PD 0
286 .IP "\fB\-\-strip\-all\fR" 4
287 .IX Item "--strip-all"
288 .PD
289 Do not copy relocation and symbol information from the source file.
290 .IP "\fB\-g\fR" 4
291 .IX Item "-g"
292 .PD 0
293 .IP "\fB\-\-strip\-debug\fR" 4
294 .IX Item "--strip-debug"
295 .PD
296 Do not copy debugging symbols from the source file.
297 .IP "\fB\-\-strip\-unneeded\fR" 4
298 .IX Item "--strip-unneeded"
299 Strip all symbols that are not needed for relocation processing.
300 .IP "\fB\-K\fR \fIsymbolname\fR" 4
301 .IX Item "-K symbolname"
302 .PD 0
303 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
304 .IX Item "--keep-symbol=symbolname"
305 .PD
306 Copy only symbol \fIsymbolname\fR from the source file.  This option may
307 be given more than once.
308 .IP "\fB\-N\fR \fIsymbolname\fR" 4
309 .IX Item "-N symbolname"
310 .PD 0
311 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
312 .IX Item "--strip-symbol=symbolname"
313 .PD
314 Do not copy symbol \fIsymbolname\fR from the source file.  This option
315 may be given more than once.
316 .IP "\fB\-G\fR \fIsymbolname\fR" 4
317 .IX Item "-G symbolname"
318 .PD 0
319 .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
320 .IX Item "--keep-global-symbol=symbolname"
321 .PD
322 Keep only symbol \fIsymbolname\fR global.  Make all other symbols local
323 to the file, so that they are not visible externally.  This option may
324 be given more than once.
325 .IP "\fB\-L\fR \fIsymbolname\fR" 4
326 .IX Item "-L symbolname"
327 .PD 0
328 .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
329 .IX Item "--localize-symbol=symbolname"
330 .PD
331 Make symbol \fIsymbolname\fR local to the file, so that it is not
332 visible externally.  This option may be given more than once.
333 .IP "\fB\-W\fR \fIsymbolname\fR" 4
334 .IX Item "-W symbolname"
335 .PD 0
336 .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
337 .IX Item "--weaken-symbol=symbolname"
338 .PD
339 Make symbol \fIsymbolname\fR weak. This option may be given more than once.
340 .IP "\fB\-x\fR" 4
341 .IX Item "-x"
342 .PD 0
343 .IP "\fB\-\-discard\-all\fR" 4
344 .IX Item "--discard-all"
345 .PD
346 Do not copy non-global symbols from the source file.
347 .IP "\fB\-X\fR" 4
348 .IX Item "-X"
349 .PD 0
350 .IP "\fB\-\-discard\-locals\fR" 4
351 .IX Item "--discard-locals"
352 .PD
353 Do not copy compiler-generated local symbols.
354 (These usually start with \fBL\fR or \fB.\fR.)
355 .IP "\fB\-b\fR \fIbyte\fR" 4
356 .IX Item "-b byte"
357 .PD 0
358 .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
359 .IX Item "--byte=byte"
360 .PD
361 Keep only every \fIbyte\fRth byte of the input file (header data is not
362 affected).  \fIbyte\fR can be in the range from 0 to \fIinterleave\fR\-1,
363 where \fIinterleave\fR is given by the \fB\-i\fR or \fB\-\-interleave\fR
364 option, or the default of 4.  This option is useful for creating files
365 to program \s-1ROM\s0.  It is typically used with an \f(CW\*(C`srec\*(C'\fR output
366 target.
367 .IP "\fB\-i\fR \fIinterleave\fR" 4
368 .IX Item "-i interleave"
369 .PD 0
370 .IP "\fB\-\-interleave=\fR\fIinterleave\fR" 4
371 .IX Item "--interleave=interleave"
372 .PD
373 Only copy one out of every \fIinterleave\fR bytes.  Select which byte to
374 copy with the \fB\-b\fR or \fB\-\-byte\fR option.  The default is 4.
375 \&\fBobjcopy\fR ignores this option if you do not specify either \fB\-b\fR or
376 \&\fB\-\-byte\fR.
377 .IP "\fB\-p\fR" 4
378 .IX Item "-p"
379 .PD 0
380 .IP "\fB\-\-preserve\-dates\fR" 4
381 .IX Item "--preserve-dates"
382 .PD
383 Set the access and modification dates of the output file to be the same
384 as those of the input file.
385 .IP "\fB\-\-debugging\fR" 4
386 .IX Item "--debugging"
387 Convert debugging information, if possible.  This is not the default
388 because only certain debugging formats are supported, and the
389 conversion process can be time consuming.
390 .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
391 .IX Item "--gap-fill val"
392 Fill gaps between sections with \fIval\fR.  This operation applies to
393 the \fIload address\fR (\s-1LMA\s0) of the sections.  It is done by increasing
394 the size of the section with the lower address, and filling in the extra
395 space created with \fIval\fR.
396 .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
397 .IX Item "--pad-to address"
398 Pad the output file up to the load address \fIaddress\fR.  This is
399 done by increasing the size of the last section.  The extra space is
400 filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
401 .IP "\fB\-\-set\-start\fR \fIval\fR" 4
402 .IX Item "--set-start val"
403 Set the start address of the new file to \fIval\fR.  Not all object file
404 formats support setting the start address.
405 .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
406 .IX Item "--change-start incr"
407 .PD 0
408 .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
409 .IX Item "--adjust-start incr"
410 .PD
411 Change the start address by adding \fIincr\fR.  Not all object file
412 formats support setting the start address.
413 .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
414 .IX Item "--change-addresses incr"
415 .PD 0
416 .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
417 .IX Item "--adjust-vma incr"
418 .PD
419 Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
420 address, by adding \fIincr\fR.  Some object file formats do not permit
421 section addresses to be changed arbitrarily.  Note that this does not
422 relocate the sections; if the program expects sections to be loaded at a
423 certain address, and this option is used to change the sections such
424 that they are loaded at a different address, the program may fail. 
425 .IP "\fB\-\-change\-section\-address\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
426 .IX Item "--change-section-address section{=,+,-}val"
427 .PD 0
428 .IP "\fB\-\-adjust\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
429 .IX Item "--adjust-section-vma section{=,+,-}val"
430 .PD
431 Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of the named
432 \&\fIsection\fR.  If \fB=\fR is used, the section address is set to
433 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
434 section address.  See the comments under \fB\-\-change\-addresses\fR,
435 above. If \fIsection\fR does not exist in the input file, a warning will
436 be issued, unless \fB\-\-no\-change\-warnings\fR is used.
437 .IP "\fB\-\-change\-section\-lma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
438 .IX Item "--change-section-lma section{=,+,-}val"
439 Set or change the \s-1LMA\s0 address of the named \fIsection\fR.  The \s-1LMA\s0
440 address is the address where the section will be loaded into memory at
441 program load time.  Normally this is the same as the \s-1VMA\s0 address, which
442 is the address of the section at program run time, but on some systems,
443 especially those where a program is held in \s-1ROM\s0, the two can be
444 different.  If \fB=\fR is used, the section address is set to
445 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
446 section address.  See the comments under \fB\-\-change\-addresses\fR,
447 above.  If \fIsection\fR does not exist in the input file, a warning
448 will be issued, unless \fB\-\-no\-change\-warnings\fR is used.  
449 .IP "\fB\-\-change\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
450 .IX Item "--change-section-vma section{=,+,-}val"
451 Set or change the \s-1VMA\s0 address of the named \fIsection\fR.  The \s-1VMA\s0
452 address is the address where the section will be located once the
453 program has started executing.  Normally this is the same as the \s-1LMA\s0
454 address, which is the address where the section will be loaded into
455 memory, but on some systems, especially those where a program is held in
456 \&\s-1ROM\s0, the two can be different.  If \fB=\fR is used, the section address
457 is set to \fIval\fR.  Otherwise, \fIval\fR is added to or subtracted
458 from the section address.  See the comments under
459 \&\fB\-\-change\-addresses\fR, above.  If \fIsection\fR does not exist in
460 the input file, a warning will be issued, unless
461 \&\fB\-\-no\-change\-warnings\fR is used.   
462 .IP "\fB\-\-change\-warnings\fR" 4
463 .IX Item "--change-warnings"
464 .PD 0
465 .IP "\fB\-\-adjust\-warnings\fR" 4
466 .IX Item "--adjust-warnings"
467 .PD
468 If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
469 \&\fB\-\-change\-section\-vma\fR is used, and the named section does not
470 exist, issue a warning.  This is the default. 
471 .IP "\fB\-\-no\-change\-warnings\fR" 4
472 .IX Item "--no-change-warnings"
473 .PD 0
474 .IP "\fB\-\-no\-adjust\-warnings\fR" 4
475 .IX Item "--no-adjust-warnings"
476 .PD
477 Do not issue a warning if \fB\-\-change\-section\-address\fR or
478 \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
479 if the named section does not exist. 
480 .IP "\fB\-\-set\-section\-flags\fR \fIsection\fR\fB=\fR\fIflags\fR" 4
481 .IX Item "--set-section-flags section=flags"
482 Set the flags for the named section.  The \fIflags\fR argument is a
483 comma separated string of flag names.  The recognized names are
484 \&\fBalloc\fR, \fBcontents\fR, \fBload\fR, \fBnoload\fR,
485 \&\fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR, \fBshare\fR, and
486 \&\fBdebug\fR.  You can set the \fBcontents\fR flag for a section which
487 does not have contents, but it is not meaningful to clear the
488 \&\fBcontents\fR flag of a section which does have contents\*(--just remove
489 the section instead.  Not all flags are meaningful for all object file
490 formats.
491 .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
492 .IX Item "--add-section sectionname=filename"
493 Add a new section named \fIsectionname\fR while copying the file.  The
494 contents of the new section are taken from the file \fIfilename\fR.  The
495 size of the section will be the size of the file.  This option only
496 works on file formats which can support sections with arbitrary names.
497 .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
498 .IX Item "--rename-section oldname=newname[,flags]"
499 Rename a section from \fIoldname\fR to \fInewname\fR, optionally
500 changing the section's flags to \fIflags\fR in the process.  This has
501 the advantage over usng a linker script to perform the rename in that
502 the output stays as an object file and does not become a linked
503 executable.
504 .Sp
505 This option is particularly helpful when the input format is binary,
506 since this will always create a section called .data.  If for example,
507 you wanted instead to create a section called .rodata containing binary
508 data you could use the following command line to achieve it:
509 .Sp
510 .Vb 3
511 \&          objcopy -I binary -O <output_format> -B <architecture> \e
512 \&           --rename-section .data=.rodata,alloc,load,readonly,data,contents \e
513 \&           <input_binary_file> <output_object_file>
514 .Ve
515 .IP "\fB\-\-change\-leading\-char\fR" 4
516 .IX Item "--change-leading-char"
517 Some object file formats use special characters at the start of
518 symbols.  The most common such character is underscore, which compilers
519 often add before every symbol.  This option tells \fBobjcopy\fR to
520 change the leading character of every symbol when it converts between
521 object file formats.  If the object file formats use the same leading
522 character, this option has no effect.  Otherwise, it will add a
523 character, or remove a character, or change a character, as
524 appropriate.
525 .IP "\fB\-\-remove\-leading\-char\fR" 4
526 .IX Item "--remove-leading-char"
527 If the first character of a global symbol is a special symbol leading
528 character used by the object file format, remove the character.  The
529 most common symbol leading character is underscore.  This option will
530 remove a leading underscore from all global symbols.  This can be useful
531 if you want to link together objects of different file formats with
532 different conventions for symbol names.  This is different from
533 \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
534 when appropriate, regardless of the object file format of the output
535 file.
536 .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
537 .IX Item "--srec-len=ival"
538 Meaningful only for srec output.  Set the maximum length of the Srecords
539 being produced to \fIival\fR.  This length covers both address, data and
540 crc fields.
541 .IP "\fB\-\-srec\-forceS3\fR" 4
542 .IX Item "--srec-forceS3"
543 Meaningful only for srec output.  Avoid generation of S1/S2 records, 
544 creating S3\-only record format.
545 .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
546 .IX Item "--redefine-sym old=new"
547 Change the name of a symbol \fIold\fR, to \fInew\fR.  This can be useful
548 when one is trying link two things together for which you have no
549 source, and there are name collisions.
550 .IP "\fB\-\-weaken\fR" 4
551 .IX Item "--weaken"
552 Change all global symbols in the file to be weak.  This can be useful
553 when building an object which will be linked against other objects using
554 the \fB\-R\fR option to the linker.  This option is only effective when
555 using an object file format which supports weak symbols.
556 .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
557 .IX Item "--keep-symbols=filename"
558 Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
559 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
560 name per line.  Line comments may be introduced by the hash character.
561 This option may be given more than once.
562 .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
563 .IX Item "--strip-symbols=filename"
564 Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
565 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
566 name per line.  Line comments may be introduced by the hash character.
567 This option may be given more than once.
568 .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
569 .IX Item "--keep-global-symbols=filename"
570 Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
571 file \fIfilename\fR.  \fIfilename\fR is simply a flat file, with one
572 symbol name per line.  Line comments may be introduced by the hash
573 character.  This option may be given more than once.
574 .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
575 .IX Item "--localize-symbols=filename"
576 Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
577 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
578 name per line.  Line comments may be introduced by the hash character.
579 This option may be given more than once.
580 .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
581 .IX Item "--weaken-symbols=filename"
582 Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
583 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
584 name per line.  Line comments may be introduced by the hash character.
585 This option may be given more than once.
586 .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
587 .IX Item "--alt-machine-code=index"
588 If the output architecture has alternate machine codes, use the
589 \&\fIindex\fRth code instead of the default one.  This is useful in case
590 a machine is assigned an official code and the tool-chain adopts the 
591 new code, but other applications still depend on the original code
592 being used.
593 .IP "\fB\-V\fR" 4
594 .IX Item "-V"
595 .PD 0
596 .IP "\fB\-\-version\fR" 4
597 .IX Item "--version"
598 .PD
599 Show the version number of \fBobjcopy\fR.
600 .IP "\fB\-v\fR" 4
601 .IX Item "-v"
602 .PD 0
603 .IP "\fB\-\-verbose\fR" 4
604 .IX Item "--verbose"
605 .PD
606 Verbose output: list all object files modified.  In the case of
607 archives, \fBobjcopy \-V\fR lists all members of the archive.
608 .IP "\fB\-\-help\fR" 4
609 .IX Item "--help"
610 Show a summary of the options to \fBobjcopy\fR.
611 .SH "SEE ALSO"
612 .IX Header "SEE ALSO"
613 \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
614 .SH "COPYRIGHT"
615 .IX Header "COPYRIGHT"
616 Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 Free Software Foundation, Inc.
617 .PP
618 Permission is granted to copy, distribute and/or modify this document
619 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
620 or any later version published by the Free Software Foundation;
621 with no Invariant Sections, with no Front-Cover Texts, and with no
622 Back-Cover Texts.  A copy of the license is included in the
623 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".