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