1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
4 .\" ========================================================================
5 .de Sh \" Subsection heading
13 .de Sp \" Vertical space (when we can't use .PP)
17 .de Vb \" Begin verbatim text
22 .de Ve \" End verbatim text
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<>.
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
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
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.
57 . tm Index:\\$1\t\\n%\t"\\$2"
63 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
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
78 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 . \" simple accents for nroff and troff
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'
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 \
128 .\" ========================================================================
130 .IX Title "OBJCOPY 1"
131 .TH OBJCOPY 1 "2008-09-10" "binutils-2.18.90" "GNU Development Tools"
133 objcopy \- copy and translate object files
135 .IX Header "SYNOPSIS"
136 objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR]
137 [\fB\-I\fR \fIbfdname\fR|\fB\-\-input\-target=\fR\fIbfdname\fR]
138 [\fB\-O\fR \fIbfdname\fR|\fB\-\-output\-target=\fR\fIbfdname\fR]
139 [\fB\-B\fR \fIbfdarch\fR|\fB\-\-binary\-architecture=\fR\fIbfdarch\fR]
140 [\fB\-S\fR|\fB\-\-strip\-all\fR]
141 [\fB\-g\fR|\fB\-\-strip\-debug\fR]
142 [\fB\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
143 [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-symbol=\fR\fIsymbolname\fR]
144 [\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR]
145 [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR]
146 [\fB\-\-localize\-hidden\fR]
147 [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR]
148 [\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR]
149 [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
150 [\fB\-w\fR|\fB\-\-wildcard\fR]
151 [\fB\-x\fR|\fB\-\-discard\-all\fR]
152 [\fB\-X\fR|\fB\-\-discard\-locals\fR]
153 [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
154 [\fB\-i\fR \fIinterleave\fR|\fB\-\-interleave=\fR\fIinterleave\fR]
155 [\fB\-j\fR \fIsectionname\fR|\fB\-\-only\-section=\fR\fIsectionname\fR]
156 [\fB\-R\fR \fIsectionname\fR|\fB\-\-remove\-section=\fR\fIsectionname\fR]
157 [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
158 [\fB\-\-debugging\fR]
159 [\fB\-\-gap\-fill=\fR\fIval\fR]
160 [\fB\-\-pad\-to=\fR\fIaddress\fR]
161 [\fB\-\-set\-start=\fR\fIval\fR]
162 [\fB\-\-adjust\-start=\fR\fIincr\fR]
163 [\fB\-\-change\-addresses=\fR\fIincr\fR]
164 [\fB\-\-change\-section\-address\fR \fIsection\fR{=,+,\-}\fIval\fR]
165 [\fB\-\-change\-section\-lma\fR \fIsection\fR{=,+,\-}\fIval\fR]
166 [\fB\-\-change\-section\-vma\fR \fIsection\fR{=,+,\-}\fIval\fR]
167 [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
168 [\fB\-\-set\-section\-flags\fR \fIsection\fR=\fIflags\fR]
169 [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
170 [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
171 [\fB\-\-change\-leading\-char\fR] [\fB\-\-remove\-leading\-char\fR]
172 [\fB\-\-reverse\-bytes=\fR\fInum\fR]
173 [\fB\-\-srec\-len=\fR\fIival\fR] [\fB\-\-srec\-forceS3\fR]
174 [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR]
175 [\fB\-\-redefine\-syms=\fR\fIfilename\fR]
177 [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
178 [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
179 [\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR]
180 [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
181 [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
182 [\fB\-\-globalize\-symbols=\fR\fIfilename\fR]
183 [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
184 [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
185 [\fB\-\-prefix\-symbols=\fR\fIstring\fR]
186 [\fB\-\-prefix\-sections=\fR\fIstring\fR]
187 [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR]
188 [\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR]
189 [\fB\-\-keep\-file\-symbols\fR]
190 [\fB\-\-only\-keep\-debug\fR]
191 [\fB\-\-extract\-symbol\fR]
192 [\fB\-\-writable\-text\fR]
193 [\fB\-\-readonly\-text\fR]
196 [\fB\-v\fR|\fB\-\-verbose\fR]
197 [\fB\-V\fR|\fB\-\-version\fR]
198 [\fB\-\-help\fR] [\fB\-\-info\fR]
199 \fIinfile\fR [\fIoutfile\fR]
201 .IX Header "DESCRIPTION"
202 The \s-1GNU\s0 \fBobjcopy\fR utility copies the contents of an object
203 file to another. \fBobjcopy\fR uses the \s-1GNU\s0 \s-1BFD\s0 Library to
204 read and write the object files. It can write the destination object
205 file in a format different from that of the source object file. The
206 exact behavior of \fBobjcopy\fR is controlled by command-line options.
207 Note that \fBobjcopy\fR should be able to copy a fully linked file
208 between any two formats. However, copying a relocatable object file
209 between any two formats may not work as expected.
211 \&\fBobjcopy\fR creates temporary files to do its translations and
212 deletes them afterward. \fBobjcopy\fR uses \s-1BFD\s0 to do all its
213 translation work; it has access to all the formats described in \s-1BFD\s0
214 and thus is able to recognize most formats without being told
217 \&\fBobjcopy\fR can be used to generate S\-records by using an output
218 target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
220 \&\fBobjcopy\fR can be used to generate a raw binary file by using an
221 output target of \fBbinary\fR (e.g., use \fB\-O binary\fR). When
222 \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
223 a memory dump of the contents of the input object file. All symbols and
224 relocation information will be discarded. The memory dump will start at
225 the load address of the lowest section copied into the output file.
227 When generating an S\-record or a raw binary file, it may be helpful to
228 use \fB\-S\fR to remove sections containing debugging information. In
229 some cases \fB\-R\fR will be useful to remove sections which contain
230 information that is not needed by the binary file.
232 Note\-\-\-\fBobjcopy\fR is not able to change the endianness of its input
233 files. If the input format has an endianness (some formats do not),
234 \&\fBobjcopy\fR can only copy the inputs into file formats that have the
235 same endianness or which have no endianness (e.g., \fBsrec\fR).
236 (However, see the \fB\-\-reverse\-bytes\fR option.)
242 .IP "\fIoutfile\fR" 4
245 The input and output files, respectively.
246 If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
247 temporary file and destructively renames the result with
248 the name of \fIinfile\fR.
249 .IP "\fB\-I\fR \fIbfdname\fR" 4
250 .IX Item "-I bfdname"
252 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
253 .IX Item "--input-target=bfdname"
255 Consider the source file's object format to be \fIbfdname\fR, rather than
256 attempting to deduce it.
257 .IP "\fB\-O\fR \fIbfdname\fR" 4
258 .IX Item "-O bfdname"
260 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
261 .IX Item "--output-target=bfdname"
263 Write the output file using the object format \fIbfdname\fR.
264 .IP "\fB\-F\fR \fIbfdname\fR" 4
265 .IX Item "-F bfdname"
267 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
268 .IX Item "--target=bfdname"
270 Use \fIbfdname\fR as the object format for both the input and the output
271 file; i.e., simply transfer data from source to destination with no
273 .IP "\fB\-B\fR \fIbfdarch\fR" 4
274 .IX Item "-B bfdarch"
276 .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
277 .IX Item "--binary-architecture=bfdarch"
279 Useful when transforming a raw binary input file into an object file.
280 In this case the output architecture can be set to \fIbfdarch\fR. This
281 option will be ignored if the input file has a known \fIbfdarch\fR. You
282 can access this binary data inside a program by referencing the special
283 symbols that are created by the conversion process. These symbols are
284 called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
285 _binary_\fIobjfile\fR_size. e.g. you can transform a picture file into
286 an object file and then access it in your code using these symbols.
287 .IP "\fB\-j\fR \fIsectionname\fR" 4
288 .IX Item "-j sectionname"
290 .IP "\fB\-\-only\-section=\fR\fIsectionname\fR" 4
291 .IX Item "--only-section=sectionname"
293 Copy only the named section from the input file to the output file.
294 This option may be given more than once. Note that using this option
295 inappropriately may make the output file unusable.
296 .IP "\fB\-R\fR \fIsectionname\fR" 4
297 .IX Item "-R sectionname"
299 .IP "\fB\-\-remove\-section=\fR\fIsectionname\fR" 4
300 .IX Item "--remove-section=sectionname"
302 Remove any section named \fIsectionname\fR from the output file. This
303 option may be given more than once. Note that using this option
304 inappropriately may make the output file unusable.
308 .IP "\fB\-\-strip\-all\fR" 4
309 .IX Item "--strip-all"
311 Do not copy relocation and symbol information from the source file.
315 .IP "\fB\-\-strip\-debug\fR" 4
316 .IX Item "--strip-debug"
318 Do not copy debugging symbols or sections from the source file.
319 .IP "\fB\-\-strip\-unneeded\fR" 4
320 .IX Item "--strip-unneeded"
321 Strip all symbols that are not needed for relocation processing.
322 .IP "\fB\-K\fR \fIsymbolname\fR" 4
323 .IX Item "-K symbolname"
325 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
326 .IX Item "--keep-symbol=symbolname"
328 When stripping symbols, keep symbol \fIsymbolname\fR even if it would
329 normally be stripped. This option may be given more than once.
330 .IP "\fB\-N\fR \fIsymbolname\fR" 4
331 .IX Item "-N symbolname"
333 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
334 .IX Item "--strip-symbol=symbolname"
336 Do not copy symbol \fIsymbolname\fR from the source file. This option
337 may be given more than once.
338 .IP "\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR" 4
339 .IX Item "--strip-unneeded-symbol=symbolname"
340 Do not copy symbol \fIsymbolname\fR from the source file unless it is needed
341 by a relocation. This option may be given more than once.
342 .IP "\fB\-G\fR \fIsymbolname\fR" 4
343 .IX Item "-G symbolname"
345 .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
346 .IX Item "--keep-global-symbol=symbolname"
348 Keep only symbol \fIsymbolname\fR global. Make all other symbols local
349 to the file, so that they are not visible externally. This option may
350 be given more than once.
351 .IP "\fB\-\-localize\-hidden\fR" 4
352 .IX Item "--localize-hidden"
353 In an \s-1ELF\s0 object, mark all symbols that have hidden or internal visibility
354 as local. This option applies on top of symbol-specific localization options
356 .IP "\fB\-L\fR \fIsymbolname\fR" 4
357 .IX Item "-L symbolname"
359 .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
360 .IX Item "--localize-symbol=symbolname"
362 Make symbol \fIsymbolname\fR local to the file, so that it is not
363 visible externally. This option may be given more than once.
364 .IP "\fB\-W\fR \fIsymbolname\fR" 4
365 .IX Item "-W symbolname"
367 .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
368 .IX Item "--weaken-symbol=symbolname"
370 Make symbol \fIsymbolname\fR weak. This option may be given more than once.
371 .IP "\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR" 4
372 .IX Item "--globalize-symbol=symbolname"
373 Give symbol \fIsymbolname\fR global scoping so that it is visible
374 outside of the file in which it is defined. This option may be given
379 .IP "\fB\-\-wildcard\fR" 4
380 .IX Item "--wildcard"
382 Permit regular expressions in \fIsymbolname\fRs used in other command
383 line options. The question mark (?), asterisk (*), backslash (\e) and
384 square brackets ([]) operators can be used anywhere in the symbol
385 name. If the first character of the symbol name is the exclamation
386 point (!) then the sense of the switch is reversed for that symbol.
393 would cause objcopy to weaken all symbols that start with \*(L"fo\*(R"
394 except for the symbol \*(L"foo\*(R".
398 .IP "\fB\-\-discard\-all\fR" 4
399 .IX Item "--discard-all"
401 Do not copy non-global symbols from the source file.
405 .IP "\fB\-\-discard\-locals\fR" 4
406 .IX Item "--discard-locals"
408 Do not copy compiler-generated local symbols.
409 (These usually start with \fBL\fR or \fB.\fR.)
410 .IP "\fB\-b\fR \fIbyte\fR" 4
413 .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
414 .IX Item "--byte=byte"
416 Keep only every \fIbyte\fRth byte of the input file (header data is not
417 affected). \fIbyte\fR can be in the range from 0 to \fIinterleave\fR\-1,
418 where \fIinterleave\fR is given by the \fB\-i\fR or \fB\-\-interleave\fR
419 option, or the default of 4. This option is useful for creating files
420 to program \s-1ROM\s0. It is typically used with an \f(CW\*(C`srec\*(C'\fR output
422 .IP "\fB\-i\fR \fIinterleave\fR" 4
423 .IX Item "-i interleave"
425 .IP "\fB\-\-interleave=\fR\fIinterleave\fR" 4
426 .IX Item "--interleave=interleave"
428 Only copy one out of every \fIinterleave\fR bytes. Select which byte to
429 copy with the \fB\-b\fR or \fB\-\-byte\fR option. The default is 4.
430 \&\fBobjcopy\fR ignores this option if you do not specify either \fB\-b\fR or
435 .IP "\fB\-\-preserve\-dates\fR" 4
436 .IX Item "--preserve-dates"
438 Set the access and modification dates of the output file to be the same
439 as those of the input file.
440 .IP "\fB\-\-debugging\fR" 4
441 .IX Item "--debugging"
442 Convert debugging information, if possible. This is not the default
443 because only certain debugging formats are supported, and the
444 conversion process can be time consuming.
445 .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
446 .IX Item "--gap-fill val"
447 Fill gaps between sections with \fIval\fR. This operation applies to
448 the \fIload address\fR (\s-1LMA\s0) of the sections. It is done by increasing
449 the size of the section with the lower address, and filling in the extra
450 space created with \fIval\fR.
451 .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
452 .IX Item "--pad-to address"
453 Pad the output file up to the load address \fIaddress\fR. This is
454 done by increasing the size of the last section. The extra space is
455 filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
456 .IP "\fB\-\-set\-start\fR \fIval\fR" 4
457 .IX Item "--set-start val"
458 Set the start address of the new file to \fIval\fR. Not all object file
459 formats support setting the start address.
460 .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
461 .IX Item "--change-start incr"
463 .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
464 .IX Item "--adjust-start incr"
466 Change the start address by adding \fIincr\fR. Not all object file
467 formats support setting the start address.
468 .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
469 .IX Item "--change-addresses incr"
471 .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
472 .IX Item "--adjust-vma incr"
474 Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
475 address, by adding \fIincr\fR. Some object file formats do not permit
476 section addresses to be changed arbitrarily. Note that this does not
477 relocate the sections; if the program expects sections to be loaded at a
478 certain address, and this option is used to change the sections such
479 that they are loaded at a different address, the program may fail.
480 .IP "\fB\-\-change\-section\-address\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
481 .IX Item "--change-section-address section{=,+,-}val"
483 .IP "\fB\-\-adjust\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
484 .IX Item "--adjust-section-vma section{=,+,-}val"
486 Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of the named
487 \&\fIsection\fR. If \fB=\fR is used, the section address is set to
488 \&\fIval\fR. Otherwise, \fIval\fR is added to or subtracted from the
489 section address. See the comments under \fB\-\-change\-addresses\fR,
490 above. If \fIsection\fR does not exist in the input file, a warning will
491 be issued, unless \fB\-\-no\-change\-warnings\fR is used.
492 .IP "\fB\-\-change\-section\-lma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
493 .IX Item "--change-section-lma section{=,+,-}val"
494 Set or change the \s-1LMA\s0 address of the named \fIsection\fR. The \s-1LMA\s0
495 address is the address where the section will be loaded into memory at
496 program load time. Normally this is the same as the \s-1VMA\s0 address, which
497 is the address of the section at program run time, but on some systems,
498 especially those where a program is held in \s-1ROM\s0, the two can be
499 different. If \fB=\fR is used, the section address is set to
500 \&\fIval\fR. Otherwise, \fIval\fR is added to or subtracted from the
501 section address. See the comments under \fB\-\-change\-addresses\fR,
502 above. If \fIsection\fR does not exist in the input file, a warning
503 will be issued, unless \fB\-\-no\-change\-warnings\fR is used.
504 .IP "\fB\-\-change\-section\-vma\fR \fIsection\fR\fB{=,+,\-}\fR\fIval\fR" 4
505 .IX Item "--change-section-vma section{=,+,-}val"
506 Set or change the \s-1VMA\s0 address of the named \fIsection\fR. The \s-1VMA\s0
507 address is the address where the section will be located once the
508 program has started executing. Normally this is the same as the \s-1LMA\s0
509 address, which is the address where the section will be loaded into
510 memory, but on some systems, especially those where a program is held in
511 \&\s-1ROM\s0, the two can be different. If \fB=\fR is used, the section address
512 is set to \fIval\fR. Otherwise, \fIval\fR is added to or subtracted
513 from the section address. See the comments under
514 \&\fB\-\-change\-addresses\fR, above. If \fIsection\fR does not exist in
515 the input file, a warning will be issued, unless
516 \&\fB\-\-no\-change\-warnings\fR is used.
517 .IP "\fB\-\-change\-warnings\fR" 4
518 .IX Item "--change-warnings"
520 .IP "\fB\-\-adjust\-warnings\fR" 4
521 .IX Item "--adjust-warnings"
523 If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
524 \&\fB\-\-change\-section\-vma\fR is used, and the named section does not
525 exist, issue a warning. This is the default.
526 .IP "\fB\-\-no\-change\-warnings\fR" 4
527 .IX Item "--no-change-warnings"
529 .IP "\fB\-\-no\-adjust\-warnings\fR" 4
530 .IX Item "--no-adjust-warnings"
532 Do not issue a warning if \fB\-\-change\-section\-address\fR or
533 \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
534 if the named section does not exist.
535 .IP "\fB\-\-set\-section\-flags\fR \fIsection\fR\fB=\fR\fIflags\fR" 4
536 .IX Item "--set-section-flags section=flags"
537 Set the flags for the named section. The \fIflags\fR argument is a
538 comma separated string of flag names. The recognized names are
539 \&\fBalloc\fR, \fBcontents\fR, \fBload\fR, \fBnoload\fR,
540 \&\fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR, \fBshare\fR, and
541 \&\fBdebug\fR. You can set the \fBcontents\fR flag for a section which
542 does not have contents, but it is not meaningful to clear the
543 \&\fBcontents\fR flag of a section which does have contents\*(--just remove
544 the section instead. Not all flags are meaningful for all object file
546 .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
547 .IX Item "--add-section sectionname=filename"
548 Add a new section named \fIsectionname\fR while copying the file. The
549 contents of the new section are taken from the file \fIfilename\fR. The
550 size of the section will be the size of the file. This option only
551 works on file formats which can support sections with arbitrary names.
552 .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
553 .IX Item "--rename-section oldname=newname[,flags]"
554 Rename a section from \fIoldname\fR to \fInewname\fR, optionally
555 changing the section's flags to \fIflags\fR in the process. This has
556 the advantage over usng a linker script to perform the rename in that
557 the output stays as an object file and does not become a linked
560 This option is particularly helpful when the input format is binary,
561 since this will always create a section called .data. If for example,
562 you wanted instead to create a section called .rodata containing binary
563 data you could use the following command line to achieve it:
566 \& objcopy -I binary -O <output_format> -B <architecture> \e
567 \& --rename-section .data=.rodata,alloc,load,readonly,data,contents \e
568 \& <input_binary_file> <output_object_file>
570 .IP "\fB\-\-change\-leading\-char\fR" 4
571 .IX Item "--change-leading-char"
572 Some object file formats use special characters at the start of
573 symbols. The most common such character is underscore, which compilers
574 often add before every symbol. This option tells \fBobjcopy\fR to
575 change the leading character of every symbol when it converts between
576 object file formats. If the object file formats use the same leading
577 character, this option has no effect. Otherwise, it will add a
578 character, or remove a character, or change a character, as
580 .IP "\fB\-\-remove\-leading\-char\fR" 4
581 .IX Item "--remove-leading-char"
582 If the first character of a global symbol is a special symbol leading
583 character used by the object file format, remove the character. The
584 most common symbol leading character is underscore. This option will
585 remove a leading underscore from all global symbols. This can be useful
586 if you want to link together objects of different file formats with
587 different conventions for symbol names. This is different from
588 \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
589 when appropriate, regardless of the object file format of the output
591 .IP "\fB\-\-reverse\-bytes=\fR\fInum\fR" 4
592 .IX Item "--reverse-bytes=num"
593 Reverse the bytes in a section with output contents. A section length must
594 be evenly divisible by the value given in order for the swap to be able to
595 take place. Reversing takes place before the interleaving is performed.
597 This option is used typically in generating \s-1ROM\s0 images for problematic
598 target systems. For example, on some target boards, the 32\-bit words
599 fetched from 8\-bit ROMs are re-assembled in little-endian byte order
600 regardless of the \s-1CPU\s0 byte order. Depending on the programming model, the
601 endianness of the \s-1ROM\s0 may need to be modified.
603 Consider a simple file with a section containing the following eight
604 bytes: \f(CW12345678\fR.
606 Using \fB\-\-reverse\-bytes=2\fR for the above example, the bytes in the
607 output file would be ordered \f(CW21436587\fR.
609 Using \fB\-\-reverse\-bytes=4\fR for the above example, the bytes in the
610 output file would be ordered \f(CW43218765\fR.
612 By using \fB\-\-reverse\-bytes=2\fR for the above example, followed by
613 \&\fB\-\-reverse\-bytes=4\fR on the output file, the bytes in the second
614 output file would be ordered \f(CW34127856\fR.
615 .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
616 .IX Item "--srec-len=ival"
617 Meaningful only for srec output. Set the maximum length of the Srecords
618 being produced to \fIival\fR. This length covers both address, data and
620 .IP "\fB\-\-srec\-forceS3\fR" 4
621 .IX Item "--srec-forceS3"
622 Meaningful only for srec output. Avoid generation of S1/S2 records,
623 creating S3\-only record format.
624 .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
625 .IX Item "--redefine-sym old=new"
626 Change the name of a symbol \fIold\fR, to \fInew\fR. This can be useful
627 when one is trying link two things together for which you have no
628 source, and there are name collisions.
629 .IP "\fB\-\-redefine\-syms=\fR\fIfilename\fR" 4
630 .IX Item "--redefine-syms=filename"
631 Apply \fB\-\-redefine\-sym\fR to each symbol pair "\fIold\fR \fInew\fR"
632 listed in the file \fIfilename\fR. \fIfilename\fR is simply a flat file,
633 with one symbol pair per line. Line comments may be introduced by the hash
634 character. This option may be given more than once.
635 .IP "\fB\-\-weaken\fR" 4
637 Change all global symbols in the file to be weak. This can be useful
638 when building an object which will be linked against other objects using
639 the \fB\-R\fR option to the linker. This option is only effective when
640 using an object file format which supports weak symbols.
641 .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
642 .IX Item "--keep-symbols=filename"
643 Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
644 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
645 name per line. Line comments may be introduced by the hash character.
646 This option may be given more than once.
647 .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
648 .IX Item "--strip-symbols=filename"
649 Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
650 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
651 name per line. Line comments may be introduced by the hash character.
652 This option may be given more than once.
653 .IP "\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR" 4
654 .IX Item "--strip-unneeded-symbols=filename"
655 Apply \fB\-\-strip\-unneeded\-symbol\fR option to each symbol listed in
656 the file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one
657 symbol name per line. Line comments may be introduced by the hash
658 character. This option may be given more than once.
659 .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
660 .IX Item "--keep-global-symbols=filename"
661 Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
662 file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one
663 symbol name per line. Line comments may be introduced by the hash
664 character. This option may be given more than once.
665 .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
666 .IX Item "--localize-symbols=filename"
667 Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
668 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
669 name per line. Line comments may be introduced by the hash character.
670 This option may be given more than once.
671 .IP "\fB\-\-globalize\-symbols=\fR\fIfilename\fR" 4
672 .IX Item "--globalize-symbols=filename"
673 Apply \fB\-\-globalize\-symbol\fR option to each symbol listed in the file
674 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
675 name per line. Line comments may be introduced by the hash character.
676 This option may be given more than once.
677 .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
678 .IX Item "--weaken-symbols=filename"
679 Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
680 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
681 name per line. Line comments may be introduced by the hash character.
682 This option may be given more than once.
683 .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
684 .IX Item "--alt-machine-code=index"
685 If the output architecture has alternate machine codes, use the
686 \&\fIindex\fRth code instead of the default one. This is useful in case
687 a machine is assigned an official code and the tool-chain adopts the
688 new code, but other applications still depend on the original code
689 being used. For \s-1ELF\s0 based architectures if the \fIindex\fR
690 alternative does not exist then the value is treated as an absolute
691 number to be stored in the e_machine field of the \s-1ELF\s0 header.
692 .IP "\fB\-\-writable\-text\fR" 4
693 .IX Item "--writable-text"
694 Mark the output text as writable. This option isn't meaningful for all
696 .IP "\fB\-\-readonly\-text\fR" 4
697 .IX Item "--readonly-text"
698 Make the output text write protected. This option isn't meaningful for all
700 .IP "\fB\-\-pure\fR" 4
702 Mark the output file as demand paged. This option isn't meaningful for all
704 .IP "\fB\-\-impure\fR" 4
706 Mark the output file as impure. This option isn't meaningful for all
708 .IP "\fB\-\-prefix\-symbols=\fR\fIstring\fR" 4
709 .IX Item "--prefix-symbols=string"
710 Prefix all symbols in the output file with \fIstring\fR.
711 .IP "\fB\-\-prefix\-sections=\fR\fIstring\fR" 4
712 .IX Item "--prefix-sections=string"
713 Prefix all section names in the output file with \fIstring\fR.
714 .IP "\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR" 4
715 .IX Item "--prefix-alloc-sections=string"
716 Prefix all the names of all allocated sections in the output file with
718 .IP "\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR" 4
719 .IX Item "--add-gnu-debuglink=path-to-file"
720 Creates a .gnu_debuglink section which contains a reference to \fIpath-to-file\fR
721 and adds it to the output file.
722 .IP "\fB\-\-keep\-file\-symbols\fR" 4
723 .IX Item "--keep-file-symbols"
724 When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
725 \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names,
726 which would otherwise get stripped.
727 .IP "\fB\-\-only\-keep\-debug\fR" 4
728 .IX Item "--only-keep-debug"
729 Strip a file, removing contents of any sections that would not be
730 stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections
731 intact. In \s-1ELF\s0 files, this preserves all note sections in the output.
733 The intention is that this option will be used in conjunction with
734 \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable. One a
735 stripped binary which will occupy less space in \s-1RAM\s0 and in a
736 distribution and the second a debugging information file which is only
737 needed if debugging abilities are required. The suggested procedure
738 to create these files is as follows:
740 .IP "1.<Link the executable as normal. Assuming that is is called>" 4
741 .IX Item "1.<Link the executable as normal. Assuming that is is called>"
742 \&\f(CW\*(C`foo\*(C'\fR then...
743 .ie n .IP "1.<Run ""objcopy \-\-only\-keep\-debug foo foo.dbg"" to>" 4
744 .el .IP "1.<Run \f(CWobjcopy \-\-only\-keep\-debug foo foo.dbg\fR to>" 4
745 .IX Item "1.<Run objcopy --only-keep-debug foo foo.dbg to>"
746 create a file containing the debugging info.
747 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"" to create a>" 4
748 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR to create a>" 4
749 .IX Item "1.<Run objcopy --strip-debug foo to create a>"
751 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.dbg foo"">" 4
752 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.dbg foo\fR>" 4
753 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.dbg foo>"
754 to add a link to the debugging info into the stripped executable.
758 Note\-\-\-the choice of \f(CW\*(C`.dbg\*(C'\fR as an extension for the debug info
759 file is arbitrary. Also the \f(CW\*(C`\-\-only\-keep\-debug\*(C'\fR step is
760 optional. You could instead do this:
761 .IP "1.<Link the executable as normal.>" 4
762 .IX Item "1.<Link the executable as normal.>"
764 .ie n .IP "1.<Copy ""foo""\fR to \f(CW""foo.full"">" 4
765 .el .IP "1.<Copy \f(CWfoo\fR to \f(CWfoo.full\fR>" 4
766 .IX Item "1.<Copy foo to foo.full>"
767 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"">" 4
768 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR>" 4
769 .IX Item "1.<Run objcopy --strip-debug foo>"
770 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.full foo"">" 4
771 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.full foo\fR>" 4
772 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.full foo>"
777 i.e., the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the
778 full executable. It does not have to be a file created by the
779 \&\fB\-\-only\-keep\-debug\fR switch.
781 Note\-\-\-this switch is only intended for use on fully linked files. It
782 does not make sense to use it on object files where the debugging
783 information may be incomplete. Besides the gnu_debuglink feature
784 currently only supports the presence of one filename containing
785 debugging information, not multiple filenames on a one-per-object-file
788 .IP "\fB\-\-extract\-symbol\fR" 4
789 .IX Item "--extract-symbol"
790 Keep the file's section flags and symbols but remove all section data.
791 Specifically, the option:
793 .IP "*<removes the contents of all sections;>" 4
794 .IX Item "*<removes the contents of all sections;>"
796 .IP "*<sets the size of every section to zero; and>" 4
797 .IX Item "*<sets the size of every section to zero; and>"
798 .IP "*<sets the file's start address to zero.>" 4
799 .IX Item "*<sets the file's start address to zero.>"
804 This option is used to build a \fI.sym\fR file for a VxWorks kernel.
805 It can also be a useful way of reducing the size of a \fB\-\-just\-symbols\fR
811 .IP "\fB\-\-version\fR" 4
814 Show the version number of \fBobjcopy\fR.
818 .IP "\fB\-\-verbose\fR" 4
821 Verbose output: list all object files modified. In the case of
822 archives, \fBobjcopy \-V\fR lists all members of the archive.
823 .IP "\fB\-\-help\fR" 4
825 Show a summary of the options to \fBobjcopy\fR.
826 .IP "\fB\-\-info\fR" 4
828 Display a list showing all architectures and object formats available.
829 .IP "\fB@\fR\fIfile\fR" 4
831 Read command-line options from \fIfile\fR. The options read are
832 inserted in place of the original @\fIfile\fR option. If \fIfile\fR
833 does not exist, or cannot be read, then the option will be treated
834 literally, and not removed.
836 Options in \fIfile\fR are separated by whitespace. A whitespace
837 character may be included in an option by surrounding the entire
838 option in either single or double quotes. Any character (including a
839 backslash) may be included by prefixing the character to be included
840 with a backslash. The \fIfile\fR may itself contain additional
841 @\fIfile\fR options; any such options will be processed recursively.
843 .IX Header "SEE ALSO"
844 \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
846 .IX Header "COPYRIGHT"
847 Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
848 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
850 Permission is granted to copy, distribute and/or modify this document
851 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.2
852 or any later version published by the Free Software Foundation;
853 with no Invariant Sections, with no Front-Cover Texts, and with no
854 Back-Cover Texts. A copy of the license is included in the
855 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".