1 .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
9 .de Vb \" Begin verbatim text
14 .de Ve \" End verbatim text
18 .\" Set up some character translations and predefined strings. \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
21 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
29 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD. Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
54 .\" Avoid warning from groff about undefined register 'F'.
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
62 . tm Index:\\$1\t\\n%\t"\\$2"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear. Run. Save yourself. No user-serviceable parts.
74 . \" fudge factors for nroff and troff
83 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 . \" simple accents for nroff and troff
99 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
106 . \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 . \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 . \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
133 .\" ========================================================================
135 .IX Title "OBJCOPY 1"
136 .TH OBJCOPY 1 "2022-02-09" "binutils-2.38" "GNU Development Tools"
137 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
142 objcopy \- copy and translate object files
144 .IX Header "SYNOPSIS"
145 objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR]
146 [\fB\-I\fR \fIbfdname\fR|\fB\-\-input\-target=\fR\fIbfdname\fR]
147 [\fB\-O\fR \fIbfdname\fR|\fB\-\-output\-target=\fR\fIbfdname\fR]
148 [\fB\-B\fR \fIbfdarch\fR|\fB\-\-binary\-architecture=\fR\fIbfdarch\fR]
149 [\fB\-S\fR|\fB\-\-strip\-all\fR]
150 [\fB\-g\fR|\fB\-\-strip\-debug\fR]
151 [\fB\-\-strip\-unneeded\fR]
152 [\fB\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
153 [\fB\-\-keep\-file\-symbols\fR]
154 [\fB\-\-keep\-section\-symbols\fR]
155 [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-symbol=\fR\fIsymbolname\fR]
156 [\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR]
157 [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR]
158 [\fB\-\-localize\-hidden\fR]
159 [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR]
160 [\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR]
161 [\fB\-\-globalize\-symbols=\fR\fIfilename\fR]
162 [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
163 [\fB\-w\fR|\fB\-\-wildcard\fR]
164 [\fB\-x\fR|\fB\-\-discard\-all\fR]
165 [\fB\-X\fR|\fB\-\-discard\-locals\fR]
166 [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
167 [\fB\-i\fR [\fIbreadth\fR]|\fB\-\-interleave\fR[=\fIbreadth\fR]]
168 [\fB\-\-interleave\-width=\fR\fIwidth\fR]
169 [\fB\-j\fR \fIsectionpattern\fR|\fB\-\-only\-section=\fR\fIsectionpattern\fR]
170 [\fB\-R\fR \fIsectionpattern\fR|\fB\-\-remove\-section=\fR\fIsectionpattern\fR]
171 [\fB\-\-keep\-section=\fR\fIsectionpattern\fR]
172 [\fB\-\-remove\-relocations=\fR\fIsectionpattern\fR]
173 [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
174 [\fB\-D\fR|\fB\-\-enable\-deterministic\-archives\fR]
175 [\fB\-U\fR|\fB\-\-disable\-deterministic\-archives\fR]
176 [\fB\-\-debugging\fR]
177 [\fB\-\-gap\-fill=\fR\fIval\fR]
178 [\fB\-\-pad\-to=\fR\fIaddress\fR]
179 [\fB\-\-set\-start=\fR\fIval\fR]
180 [\fB\-\-adjust\-start=\fR\fIincr\fR]
181 [\fB\-\-change\-addresses=\fR\fIincr\fR]
182 [\fB\-\-change\-section\-address\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
183 [\fB\-\-change\-section\-lma\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
184 [\fB\-\-change\-section\-vma\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
185 [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
186 [\fB\-\-set\-section\-flags\fR \fIsectionpattern\fR=\fIflags\fR]
187 [\fB\-\-set\-section\-alignment\fR \fIsectionpattern\fR=\fIalign\fR]
188 [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
189 [\fB\-\-dump\-section\fR \fIsectionname\fR=\fIfilename\fR]
190 [\fB\-\-update\-section\fR \fIsectionname\fR=\fIfilename\fR]
191 [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
192 [\fB\-\-long\-section\-names\fR {enable,disable,keep}]
193 [\fB\-\-change\-leading\-char\fR] [\fB\-\-remove\-leading\-char\fR]
194 [\fB\-\-reverse\-bytes=\fR\fInum\fR]
195 [\fB\-\-srec\-len=\fR\fIival\fR] [\fB\-\-srec\-forceS3\fR]
196 [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR]
197 [\fB\-\-redefine\-syms=\fR\fIfilename\fR]
199 [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
200 [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
201 [\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR]
202 [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
203 [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
204 [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
205 [\fB\-\-add\-symbol\fR \fIname\fR=[\fIsection\fR:]\fIvalue\fR[,\fIflags\fR]]
206 [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
207 [\fB\-\-prefix\-symbols=\fR\fIstring\fR]
208 [\fB\-\-prefix\-sections=\fR\fIstring\fR]
209 [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR]
210 [\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR]
211 [\fB\-\-only\-keep\-debug\fR]
212 [\fB\-\-strip\-dwo\fR]
213 [\fB\-\-extract\-dwo\fR]
214 [\fB\-\-extract\-symbol\fR]
215 [\fB\-\-writable\-text\fR]
216 [\fB\-\-readonly\-text\fR]
219 [\fB\-\-file\-alignment=\fR\fInum\fR]
220 [\fB\-\-heap=\fR\fIsize\fR]
221 [\fB\-\-image\-base=\fR\fIaddress\fR]
222 [\fB\-\-section\-alignment=\fR\fInum\fR]
223 [\fB\-\-stack=\fR\fIsize\fR]
224 [\fB\-\-subsystem=\fR\fIwhich\fR:\fImajor\fR.\fIminor\fR]
225 [\fB\-\-compress\-debug\-sections\fR]
226 [\fB\-\-decompress\-debug\-sections\fR]
227 [\fB\-\-elf\-stt\-common=\fR\fIval\fR]
228 [\fB\-\-merge\-notes\fR]
229 [\fB\-\-no\-merge\-notes\fR]
230 [\fB\-\-verilog\-data\-width=\fR\fIval\fR]
231 [\fB\-v\fR|\fB\-\-verbose\fR]
232 [\fB\-V\fR|\fB\-\-version\fR]
233 [\fB\-\-help\fR] [\fB\-\-info\fR]
234 \fIinfile\fR [\fIoutfile\fR]
236 .IX Header "DESCRIPTION"
237 The \s-1GNU\s0 \fBobjcopy\fR utility copies the contents of an object
238 file to another. \fBobjcopy\fR uses the \s-1GNU BFD\s0 Library to
239 read and write the object files. It can write the destination object
240 file in a format different from that of the source object file. The
241 exact behavior of \fBobjcopy\fR is controlled by command-line options.
242 Note that \fBobjcopy\fR should be able to copy a fully linked file
243 between any two formats. However, copying a relocatable object file
244 between any two formats may not work as expected.
246 \&\fBobjcopy\fR creates temporary files to do its translations and
247 deletes them afterward. \fBobjcopy\fR uses \s-1BFD\s0 to do all its
248 translation work; it has access to all the formats described in \s-1BFD\s0
249 and thus is able to recognize most formats without being told
252 \&\fBobjcopy\fR can be used to generate S\-records by using an output
253 target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
255 \&\fBobjcopy\fR can be used to generate a raw binary file by using an
256 output target of \fBbinary\fR (e.g., use \fB\-O binary\fR). When
257 \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
258 a memory dump of the contents of the input object file. All symbols and
259 relocation information will be discarded. The memory dump will start at
260 the load address of the lowest section copied into the output file.
262 When generating an S\-record or a raw binary file, it may be helpful to
263 use \fB\-S\fR to remove sections containing debugging information. In
264 some cases \fB\-R\fR will be useful to remove sections which contain
265 information that is not needed by the binary file.
267 Note\-\-\-\fBobjcopy\fR is not able to change the endianness of its input
268 files. If the input format has an endianness (some formats do not),
269 \&\fBobjcopy\fR can only copy the inputs into file formats that have the
270 same endianness or which have no endianness (e.g., \fBsrec\fR).
271 (However, see the \fB\-\-reverse\-bytes\fR option.)
277 .IP "\fIoutfile\fR" 4
280 The input and output files, respectively.
281 If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
282 temporary file and destructively renames the result with
283 the name of \fIinfile\fR.
284 .IP "\fB\-I\fR \fIbfdname\fR" 4
285 .IX Item "-I bfdname"
287 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
288 .IX Item "--input-target=bfdname"
290 Consider the source file's object format to be \fIbfdname\fR, rather than
291 attempting to deduce it.
292 .IP "\fB\-O\fR \fIbfdname\fR" 4
293 .IX Item "-O bfdname"
295 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
296 .IX Item "--output-target=bfdname"
298 Write the output file using the object format \fIbfdname\fR.
299 .IP "\fB\-F\fR \fIbfdname\fR" 4
300 .IX Item "-F bfdname"
302 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
303 .IX Item "--target=bfdname"
305 Use \fIbfdname\fR as the object format for both the input and the output
306 file; i.e., simply transfer data from source to destination with no
308 .IP "\fB\-B\fR \fIbfdarch\fR" 4
309 .IX Item "-B bfdarch"
311 .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
312 .IX Item "--binary-architecture=bfdarch"
314 Useful when transforming a architecture-less input file into an object file.
315 In this case the output architecture can be set to \fIbfdarch\fR. This
316 option will be ignored if the input file has a known \fIbfdarch\fR. You
317 can access this binary data inside a program by referencing the special
318 symbols that are created by the conversion process. These symbols are
319 called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
320 _binary_\fIobjfile\fR_size. e.g. you can transform a picture file into
321 an object file and then access it in your code using these symbols.
322 .IP "\fB\-j\fR \fIsectionpattern\fR" 4
323 .IX Item "-j sectionpattern"
325 .IP "\fB\-\-only\-section=\fR\fIsectionpattern\fR" 4
326 .IX Item "--only-section=sectionpattern"
328 Copy only the indicated sections from the input file to the output file.
329 This option may be given more than once. Note that using this option
330 inappropriately may make the output file unusable. Wildcard
331 characters are accepted in \fIsectionpattern\fR.
333 If the first character of \fIsectionpattern\fR is the exclamation
334 point (!) then matching sections will not be copied, even if earlier
335 use of \fB\-\-only\-section\fR on the same command line would
336 otherwise copy it. For example:
339 \& \-\-only\-section=.text.* \-\-only\-section=!.text.foo
342 will copy all sectinos matching '.text.*' but not the section
344 .IP "\fB\-R\fR \fIsectionpattern\fR" 4
345 .IX Item "-R sectionpattern"
347 .IP "\fB\-\-remove\-section=\fR\fIsectionpattern\fR" 4
348 .IX Item "--remove-section=sectionpattern"
350 Remove any section matching \fIsectionpattern\fR from the output file.
351 This option may be given more than once. Note that using this option
352 inappropriately may make the output file unusable. Wildcard
353 characters are accepted in \fIsectionpattern\fR. Using both the
354 \&\fB\-j\fR and \fB\-R\fR options together results in undefined
357 If the first character of \fIsectionpattern\fR is the exclamation
358 point (!) then matching sections will not be removed even if an
359 earlier use of \fB\-\-remove\-section\fR on the same command line
360 would otherwise remove it. For example:
363 \& \-\-remove\-section=.text.* \-\-remove\-section=!.text.foo
366 will remove all sections matching the pattern '.text.*', but will not
367 remove the section '.text.foo'.
368 .IP "\fB\-\-keep\-section=\fR\fIsectionpattern\fR" 4
369 .IX Item "--keep-section=sectionpattern"
370 When removing sections from the output file, keep sections that match
371 \&\fIsectionpattern\fR.
372 .IP "\fB\-\-remove\-relocations=\fR\fIsectionpattern\fR" 4
373 .IX Item "--remove-relocations=sectionpattern"
374 Remove non-dynamic relocations from the output file for any section
375 matching \fIsectionpattern\fR. This option may be given more than
376 once. Note that using this option inappropriately may make the output
377 file unusable, and attempting to remove a dynamic relocation section
378 such as \fB.rela.plt\fR from an executable or shared library with
379 \&\fB\-\-remove\-relocations=.plt\fR will not work. Wildcard characters
380 are accepted in \fIsectionpattern\fR.
384 \& \-\-remove\-relocations=.text.*
387 will remove the relocations for all sections matching the pattern
390 If the first character of \fIsectionpattern\fR is the exclamation
391 point (!) then matching sections will not have their relocation
392 removed even if an earlier use of \fB\-\-remove\-relocations\fR on the
393 same command line would otherwise cause the relocations to be removed.
397 \& \-\-remove\-relocations=.text.* \-\-remove\-relocations=!.text.foo
400 will remove all relocations for sections matching the pattern
401 \&'.text.*', but will not remove relocations for the section
406 .IP "\fB\-\-strip\-all\fR" 4
407 .IX Item "--strip-all"
409 Do not copy relocation and symbol information from the source file.
410 Also deletes debug sections.
414 .IP "\fB\-\-strip\-debug\fR" 4
415 .IX Item "--strip-debug"
417 Do not copy debugging symbols or sections from the source file.
418 .IP "\fB\-\-strip\-unneeded\fR" 4
419 .IX Item "--strip-unneeded"
420 Remove all symbols that are not needed for relocation processing in
421 addition to debugging symbols and sections stripped by
422 \&\fB\-\-strip\-debug\fR.
423 .IP "\fB\-K\fR \fIsymbolname\fR" 4
424 .IX Item "-K symbolname"
426 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
427 .IX Item "--keep-symbol=symbolname"
429 When stripping symbols, keep symbol \fIsymbolname\fR even if it would
430 normally be stripped. This option may be given more than once.
431 .IP "\fB\-N\fR \fIsymbolname\fR" 4
432 .IX Item "-N symbolname"
434 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
435 .IX Item "--strip-symbol=symbolname"
437 Do not copy symbol \fIsymbolname\fR from the source file. This option
438 may be given more than once.
439 .IP "\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR" 4
440 .IX Item "--strip-unneeded-symbol=symbolname"
441 Do not copy symbol \fIsymbolname\fR from the source file unless it is needed
442 by a relocation. This option may be given more than once.
443 .IP "\fB\-G\fR \fIsymbolname\fR" 4
444 .IX Item "-G symbolname"
446 .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
447 .IX Item "--keep-global-symbol=symbolname"
449 Keep only symbol \fIsymbolname\fR global. Make all other symbols local
450 to the file, so that they are not visible externally. This option may
451 be given more than once. Note: this option cannot be used in
452 conjunction with the \fB\-\-globalize\-symbol\fR or
453 \&\fB\-\-globalize\-symbols\fR options.
454 .IP "\fB\-\-localize\-hidden\fR" 4
455 .IX Item "--localize-hidden"
456 In an \s-1ELF\s0 object, mark all symbols that have hidden or internal visibility
457 as local. This option applies on top of symbol-specific localization options
459 .IP "\fB\-L\fR \fIsymbolname\fR" 4
460 .IX Item "-L symbolname"
462 .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
463 .IX Item "--localize-symbol=symbolname"
465 Convert a global or weak symbol called \fIsymbolname\fR into a local
466 symbol, so that it is not visible externally. This option may be
467 given more than once. Note \- unique symbols are not converted.
468 .IP "\fB\-W\fR \fIsymbolname\fR" 4
469 .IX Item "-W symbolname"
471 .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
472 .IX Item "--weaken-symbol=symbolname"
474 Make symbol \fIsymbolname\fR weak. This option may be given more than once.
475 .IP "\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR" 4
476 .IX Item "--globalize-symbol=symbolname"
477 Give symbol \fIsymbolname\fR global scoping so that it is visible
478 outside of the file in which it is defined. This option may be given
479 more than once. Note: this option cannot be used in conjunction with
480 the \fB\-G\fR or \fB\-\-keep\-global\-symbol\fR options.
484 .IP "\fB\-\-wildcard\fR" 4
485 .IX Item "--wildcard"
487 Permit regular expressions in \fIsymbolname\fRs used in other command
488 line options. The question mark (?), asterisk (*), backslash (\e) and
489 square brackets ([]) operators can be used anywhere in the symbol
490 name. If the first character of the symbol name is the exclamation
491 point (!) then the sense of the switch is reversed for that symbol.
495 \& \-w \-W !foo \-W fo*
498 would cause objcopy to weaken all symbols that start with \*(L"fo\*(R"
499 except for the symbol \*(L"foo\*(R".
503 .IP "\fB\-\-discard\-all\fR" 4
504 .IX Item "--discard-all"
506 Do not copy non-global symbols from the source file.
510 .IP "\fB\-\-discard\-locals\fR" 4
511 .IX Item "--discard-locals"
513 Do not copy compiler-generated local symbols.
514 (These usually start with \fBL\fR or \fB.\fR.)
515 .IP "\fB\-b\fR \fIbyte\fR" 4
518 .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
519 .IX Item "--byte=byte"
521 If interleaving has been enabled via the \fB\-\-interleave\fR option
522 then start the range of bytes to keep at the \fIbyte\fRth byte.
523 \&\fIbyte\fR can be in the range from 0 to \fIbreadth\fR\-1, where
524 \&\fIbreadth\fR is the value given by the \fB\-\-interleave\fR option.
525 .IP "\fB\-i [\fR\fIbreadth\fR\fB]\fR" 4
526 .IX Item "-i [breadth]"
528 .IP "\fB\-\-interleave[=\fR\fIbreadth\fR\fB]\fR" 4
529 .IX Item "--interleave[=breadth]"
531 Only copy a range out of every \fIbreadth\fR bytes. (Header data is
532 not affected). Select which byte in the range begins the copy with
533 the \fB\-\-byte\fR option. Select the width of the range with the
534 \&\fB\-\-interleave\-width\fR option.
536 This option is useful for creating files to program \s-1ROM.\s0 It is
537 typically used with an \f(CW\*(C`srec\*(C'\fR output target. Note that
538 \&\fBobjcopy\fR will complain if you do not specify the
539 \&\fB\-\-byte\fR option as well.
541 The default interleave breadth is 4, so with \fB\-\-byte\fR set to 0,
542 \&\fBobjcopy\fR would copy the first byte out of every four bytes
543 from the input to the output.
544 .IP "\fB\-\-interleave\-width=\fR\fIwidth\fR" 4
545 .IX Item "--interleave-width=width"
546 When used with the \fB\-\-interleave\fR option, copy \fIwidth\fR
547 bytes at a time. The start of the range of bytes to be copied is set
548 by the \fB\-\-byte\fR option, and the extent of the range is set with
549 the \fB\-\-interleave\fR option.
551 The default value for this option is 1. The value of \fIwidth\fR plus
552 the \fIbyte\fR value set by the \fB\-\-byte\fR option must not exceed
553 the interleave breadth set by the \fB\-\-interleave\fR option.
555 This option can be used to create images for two 16\-bit flashes interleaved
556 in a 32\-bit bus by passing \fB\-b 0 \-i 4 \-\-interleave\-width=2\fR
557 and \fB\-b 2 \-i 4 \-\-interleave\-width=2\fR to two \fBobjcopy\fR
558 commands. If the input was '12345678' then the outputs would be
559 \&'1256' and '3478' respectively.
563 .IP "\fB\-\-preserve\-dates\fR" 4
564 .IX Item "--preserve-dates"
566 Set the access and modification dates of the output file to be the same
567 as those of the input file.
571 .IP "\fB\-\-enable\-deterministic\-archives\fR" 4
572 .IX Item "--enable-deterministic-archives"
574 Operate in \fIdeterministic\fR mode. When copying archive members
575 and writing the archive index, use zero for UIDs, GIDs, timestamps,
576 and use consistent file modes for all files.
578 If \fIbinutils\fR was configured with
579 \&\fB\-\-enable\-deterministic\-archives\fR, then this mode is on by default.
580 It can be disabled with the \fB\-U\fR option, below.
584 .IP "\fB\-\-disable\-deterministic\-archives\fR" 4
585 .IX Item "--disable-deterministic-archives"
587 Do \fInot\fR operate in \fIdeterministic\fR mode. This is the
588 inverse of the \fB\-D\fR option, above: when copying archive members
589 and writing the archive index, use their actual \s-1UID, GID,\s0 timestamp,
590 and file mode values.
592 This is the default unless \fIbinutils\fR was configured with
593 \&\fB\-\-enable\-deterministic\-archives\fR.
594 .IP "\fB\-\-debugging\fR" 4
595 .IX Item "--debugging"
596 Convert debugging information, if possible. This is not the default
597 because only certain debugging formats are supported, and the
598 conversion process can be time consuming.
599 .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
600 .IX Item "--gap-fill val"
601 Fill gaps between sections with \fIval\fR. This operation applies to
602 the \fIload address\fR (\s-1LMA\s0) of the sections. It is done by increasing
603 the size of the section with the lower address, and filling in the extra
604 space created with \fIval\fR.
605 .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
606 .IX Item "--pad-to address"
607 Pad the output file up to the load address \fIaddress\fR. This is
608 done by increasing the size of the last section. The extra space is
609 filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
610 .IP "\fB\-\-set\-start\fR \fIval\fR" 4
611 .IX Item "--set-start val"
612 Set the start address (also known as the entry address) of the new
613 file to \fIval\fR. Not all object file formats support setting the
615 .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
616 .IX Item "--change-start incr"
618 .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
619 .IX Item "--adjust-start incr"
621 Change the start address (also known as the entry address) by adding
622 \&\fIincr\fR. Not all object file formats support setting the start
624 .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
625 .IX Item "--change-addresses incr"
627 .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
628 .IX Item "--adjust-vma incr"
630 Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
631 address, by adding \fIincr\fR. Some object file formats do not permit
632 section addresses to be changed arbitrarily. Note that this does not
633 relocate the sections; if the program expects sections to be loaded at a
634 certain address, and this option is used to change the sections such
635 that they are loaded at a different address, the program may fail.
636 .IP "\fB\-\-change\-section\-address\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
637 .IX Item "--change-section-address sectionpattern{=,+,-}val"
639 .IP "\fB\-\-adjust\-section\-vma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
640 .IX Item "--adjust-section-vma sectionpattern{=,+,-}val"
642 Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of any section
643 matching \fIsectionpattern\fR. If \fB=\fR is used, the section
644 address is set to \fIval\fR. Otherwise, \fIval\fR is added to or
645 subtracted from the section address. See the comments under
646 \&\fB\-\-change\-addresses\fR, above. If \fIsectionpattern\fR does not
647 match any sections in the input file, a warning will be issued, unless
648 \&\fB\-\-no\-change\-warnings\fR is used.
649 .IP "\fB\-\-change\-section\-lma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
650 .IX Item "--change-section-lma sectionpattern{=,+,-}val"
651 Set or change the \s-1LMA\s0 address of any sections matching
652 \&\fIsectionpattern\fR. The \s-1LMA\s0 address is the address where the
653 section will be loaded into memory at program load time. Normally
654 this is the same as the \s-1VMA\s0 address, which is the address of the
655 section at program run time, but on some systems, especially those
656 where a program is held in \s-1ROM,\s0 the two can be different. If \fB=\fR
657 is used, the section address is set to \fIval\fR. Otherwise,
658 \&\fIval\fR is added to or subtracted from the section address. See the
659 comments under \fB\-\-change\-addresses\fR, above. If
660 \&\fIsectionpattern\fR does not match any sections in the input file, a
661 warning will be issued, unless \fB\-\-no\-change\-warnings\fR is used.
662 .IP "\fB\-\-change\-section\-vma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
663 .IX Item "--change-section-vma sectionpattern{=,+,-}val"
664 Set or change the \s-1VMA\s0 address of any section matching
665 \&\fIsectionpattern\fR. The \s-1VMA\s0 address is the address where the
666 section will be located once the program has started executing.
667 Normally this is the same as the \s-1LMA\s0 address, which is the address
668 where the section will be loaded into memory, but on some systems,
669 especially those where a program is held in \s-1ROM,\s0 the two can be
670 different. If \fB=\fR is used, the section address is set to
671 \&\fIval\fR. Otherwise, \fIval\fR is added to or subtracted from the
672 section address. See the comments under \fB\-\-change\-addresses\fR,
673 above. If \fIsectionpattern\fR does not match any sections in the
674 input file, a warning will be issued, unless
675 \&\fB\-\-no\-change\-warnings\fR is used.
676 .IP "\fB\-\-change\-warnings\fR" 4
677 .IX Item "--change-warnings"
679 .IP "\fB\-\-adjust\-warnings\fR" 4
680 .IX Item "--adjust-warnings"
682 If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
683 \&\fB\-\-change\-section\-vma\fR is used, and the section pattern does not
684 match any sections, issue a warning. This is the default.
685 .IP "\fB\-\-no\-change\-warnings\fR" 4
686 .IX Item "--no-change-warnings"
688 .IP "\fB\-\-no\-adjust\-warnings\fR" 4
689 .IX Item "--no-adjust-warnings"
691 Do not issue a warning if \fB\-\-change\-section\-address\fR or
692 \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
693 if the section pattern does not match any sections.
694 .IP "\fB\-\-set\-section\-flags\fR \fIsectionpattern\fR\fB=\fR\fIflags\fR" 4
695 .IX Item "--set-section-flags sectionpattern=flags"
696 Set the flags for any sections matching \fIsectionpattern\fR. The
697 \&\fIflags\fR argument is a comma separated string of flag names. The
698 recognized names are \fBalloc\fR, \fBcontents\fR, \fBload\fR,
699 \&\fBnoload\fR, \fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR,
700 \&\fBexclude\fR, \fBshare\fR, and \fBdebug\fR. You can set the
701 \&\fBcontents\fR flag for a section which does not have contents, but it
702 is not meaningful to clear the \fBcontents\fR flag of a section which
703 does have contents\*(--just remove the section instead. Not all flags are
704 meaningful for all object file formats. In particular the
705 \&\fBshare\fR flag is only meaningful for \s-1COFF\s0 format files and not for
706 \&\s-1ELF\s0 format files.
707 .IP "\fB\-\-set\-section\-alignment\fR \fIsectionpattern\fR\fB=\fR\fIalign\fR" 4
708 .IX Item "--set-section-alignment sectionpattern=align"
709 Set the alignment for any sections matching \fIsectionpattern\fR.
710 \&\fIalign\fR specifies the alignment in bytes and must be a power of
711 two, i.e. 1, 2, 4, 8....
712 .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
713 .IX Item "--add-section sectionname=filename"
714 Add a new section named \fIsectionname\fR while copying the file. The
715 contents of the new section are taken from the file \fIfilename\fR. The
716 size of the section will be the size of the file. This option only
717 works on file formats which can support sections with arbitrary names.
718 Note \- it may be necessary to use the \fB\-\-set\-section\-flags\fR
719 option to set the attributes of the newly created section.
720 .IP "\fB\-\-dump\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
721 .IX Item "--dump-section sectionname=filename"
722 Place the contents of section named \fIsectionname\fR into the file
723 \&\fIfilename\fR, overwriting any contents that may have been there
724 previously. This option is the inverse of \fB\-\-add\-section\fR.
725 This option is similar to the \fB\-\-only\-section\fR option except
726 that it does not create a formatted file, it just dumps the contents
727 as raw binary data, without applying any relocations. The option can
728 be specified more than once.
729 .IP "\fB\-\-update\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
730 .IX Item "--update-section sectionname=filename"
731 Replace the existing contents of a section named \fIsectionname\fR
732 with the contents of file \fIfilename\fR. The size of the section
733 will be adjusted to the size of the file. The section flags for
734 \&\fIsectionname\fR will be unchanged. For \s-1ELF\s0 format files the section
735 to segment mapping will also remain unchanged, something which is not
736 possible using \fB\-\-remove\-section\fR followed by
737 \&\fB\-\-add\-section\fR. The option can be specified more than once.
739 Note \- it is possible to use \fB\-\-rename\-section\fR and
740 \&\fB\-\-update\-section\fR to both update and rename a section from one
741 command line. In this case, pass the original section name to
742 \&\fB\-\-update\-section\fR, and the original and new section names to
743 \&\fB\-\-rename\-section\fR.
744 .IP "\fB\-\-add\-symbol\fR \fIname\fR\fB=[\fR\fIsection\fR\fB:]\fR\fIvalue\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
745 .IX Item "--add-symbol name=[section:]value[,flags]"
746 Add a new symbol named \fIname\fR while copying the file. This option may be
747 specified multiple times. If the \fIsection\fR is given, the symbol will be
748 associated with and relative to that section, otherwise it will be an \s-1ABS\s0
749 symbol. Specifying an undefined section will result in a fatal error. There
750 is no check for the value, it will be taken as specified. Symbol flags can
751 be specified and not all flags will be meaningful for all object file
752 formats. By default, the symbol will be global. The special flag
753 \&'before=\fIothersym\fR' will insert the new symbol in front of the specified
754 \&\fIothersym\fR, otherwise the symbol(s) will be added at the end of the
755 symbol table in the order they appear.
756 .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
757 .IX Item "--rename-section oldname=newname[,flags]"
758 Rename a section from \fIoldname\fR to \fInewname\fR, optionally
759 changing the section's flags to \fIflags\fR in the process. This has
760 the advantage over using a linker script to perform the rename in that
761 the output stays as an object file and does not become a linked
762 executable. This option accepts the same set of flags as the
763 \&\fB\-\-sect\-section\-flags\fR option.
765 This option is particularly helpful when the input format is binary,
766 since this will always create a section called .data. If for example,
767 you wanted instead to create a section called .rodata containing binary
768 data you could use the following command line to achieve it:
771 \& objcopy \-I binary \-O <output_format> \-B <architecture> \e
772 \& \-\-rename\-section .data=.rodata,alloc,load,readonly,data,contents \e
773 \& <input_binary_file> <output_object_file>
775 .IP "\fB\-\-long\-section\-names {enable,disable,keep}\fR" 4
776 .IX Item "--long-section-names {enable,disable,keep}"
777 Controls the handling of long section names when processing \f(CW\*(C`COFF\*(C'\fR
778 and \f(CW\*(C`PE\-COFF\*(C'\fR object formats. The default behaviour, \fBkeep\fR,
779 is to preserve long section names if any are present in the input file.
780 The \fBenable\fR and \fBdisable\fR options forcibly enable or disable
781 the use of long section names in the output object; when \fBdisable\fR
782 is in effect, any long section names in the input object will be truncated.
783 The \fBenable\fR option will only emit long section names if any are
784 present in the inputs; this is mostly the same as \fBkeep\fR, but it
785 is left undefined whether the \fBenable\fR option might force the
786 creation of an empty string table in the output file.
787 .IP "\fB\-\-change\-leading\-char\fR" 4
788 .IX Item "--change-leading-char"
789 Some object file formats use special characters at the start of
790 symbols. The most common such character is underscore, which compilers
791 often add before every symbol. This option tells \fBobjcopy\fR to
792 change the leading character of every symbol when it converts between
793 object file formats. If the object file formats use the same leading
794 character, this option has no effect. Otherwise, it will add a
795 character, or remove a character, or change a character, as
797 .IP "\fB\-\-remove\-leading\-char\fR" 4
798 .IX Item "--remove-leading-char"
799 If the first character of a global symbol is a special symbol leading
800 character used by the object file format, remove the character. The
801 most common symbol leading character is underscore. This option will
802 remove a leading underscore from all global symbols. This can be useful
803 if you want to link together objects of different file formats with
804 different conventions for symbol names. This is different from
805 \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
806 when appropriate, regardless of the object file format of the output
808 .IP "\fB\-\-reverse\-bytes=\fR\fInum\fR" 4
809 .IX Item "--reverse-bytes=num"
810 Reverse the bytes in a section with output contents. A section length must
811 be evenly divisible by the value given in order for the swap to be able to
812 take place. Reversing takes place before the interleaving is performed.
814 This option is used typically in generating \s-1ROM\s0 images for problematic
815 target systems. For example, on some target boards, the 32\-bit words
816 fetched from 8\-bit ROMs are re-assembled in little-endian byte order
817 regardless of the \s-1CPU\s0 byte order. Depending on the programming model, the
818 endianness of the \s-1ROM\s0 may need to be modified.
820 Consider a simple file with a section containing the following eight
821 bytes: \f(CW12345678\fR.
823 Using \fB\-\-reverse\-bytes=2\fR for the above example, the bytes in the
824 output file would be ordered \f(CW21436587\fR.
826 Using \fB\-\-reverse\-bytes=4\fR for the above example, the bytes in the
827 output file would be ordered \f(CW43218765\fR.
829 By using \fB\-\-reverse\-bytes=2\fR for the above example, followed by
830 \&\fB\-\-reverse\-bytes=4\fR on the output file, the bytes in the second
831 output file would be ordered \f(CW34127856\fR.
832 .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
833 .IX Item "--srec-len=ival"
834 Meaningful only for srec output. Set the maximum length of the Srecords
835 being produced to \fIival\fR. This length covers both address, data and
837 .IP "\fB\-\-srec\-forceS3\fR" 4
838 .IX Item "--srec-forceS3"
839 Meaningful only for srec output. Avoid generation of S1/S2 records,
840 creating S3\-only record format.
841 .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
842 .IX Item "--redefine-sym old=new"
843 Change the name of a symbol \fIold\fR, to \fInew\fR. This can be useful
844 when one is trying link two things together for which you have no
845 source, and there are name collisions.
846 .IP "\fB\-\-redefine\-syms=\fR\fIfilename\fR" 4
847 .IX Item "--redefine-syms=filename"
848 Apply \fB\-\-redefine\-sym\fR to each symbol pair "\fIold\fR \fInew\fR"
849 listed in the file \fIfilename\fR. \fIfilename\fR is simply a flat file,
850 with one symbol pair per line. Line comments may be introduced by the hash
851 character. This option may be given more than once.
852 .IP "\fB\-\-weaken\fR" 4
854 Change all global symbols in the file to be weak. This can be useful
855 when building an object which will be linked against other objects using
856 the \fB\-R\fR option to the linker. This option is only effective when
857 using an object file format which supports weak symbols.
858 .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
859 .IX Item "--keep-symbols=filename"
860 Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
861 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
862 name per line. Line comments may be introduced by the hash character.
863 This option may be given more than once.
864 .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
865 .IX Item "--strip-symbols=filename"
866 Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
867 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
868 name per line. Line comments may be introduced by the hash character.
869 This option may be given more than once.
870 .IP "\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR" 4
871 .IX Item "--strip-unneeded-symbols=filename"
872 Apply \fB\-\-strip\-unneeded\-symbol\fR option to each symbol listed in
873 the file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one
874 symbol name per line. Line comments may be introduced by the hash
875 character. This option may be given more than once.
876 .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
877 .IX Item "--keep-global-symbols=filename"
878 Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
879 file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one
880 symbol name per line. Line comments may be introduced by the hash
881 character. This option may be given more than once.
882 .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
883 .IX Item "--localize-symbols=filename"
884 Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
885 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
886 name per line. Line comments may be introduced by the hash character.
887 This option may be given more than once.
888 .IP "\fB\-\-globalize\-symbols=\fR\fIfilename\fR" 4
889 .IX Item "--globalize-symbols=filename"
890 Apply \fB\-\-globalize\-symbol\fR option to each symbol listed in the file
891 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
892 name per line. Line comments may be introduced by the hash character.
893 This option may be given more than once. Note: this option cannot be
894 used in conjunction with the \fB\-G\fR or \fB\-\-keep\-global\-symbol\fR
896 .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
897 .IX Item "--weaken-symbols=filename"
898 Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
899 \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
900 name per line. Line comments may be introduced by the hash character.
901 This option may be given more than once.
902 .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
903 .IX Item "--alt-machine-code=index"
904 If the output architecture has alternate machine codes, use the
905 \&\fIindex\fRth code instead of the default one. This is useful in case
906 a machine is assigned an official code and the tool-chain adopts the
907 new code, but other applications still depend on the original code
908 being used. For \s-1ELF\s0 based architectures if the \fIindex\fR
909 alternative does not exist then the value is treated as an absolute
910 number to be stored in the e_machine field of the \s-1ELF\s0 header.
911 .IP "\fB\-\-writable\-text\fR" 4
912 .IX Item "--writable-text"
913 Mark the output text as writable. This option isn't meaningful for all
915 .IP "\fB\-\-readonly\-text\fR" 4
916 .IX Item "--readonly-text"
917 Make the output text write protected. This option isn't meaningful for all
919 .IP "\fB\-\-pure\fR" 4
921 Mark the output file as demand paged. This option isn't meaningful for all
923 .IP "\fB\-\-impure\fR" 4
925 Mark the output file as impure. This option isn't meaningful for all
927 .IP "\fB\-\-prefix\-symbols=\fR\fIstring\fR" 4
928 .IX Item "--prefix-symbols=string"
929 Prefix all symbols in the output file with \fIstring\fR.
930 .IP "\fB\-\-prefix\-sections=\fR\fIstring\fR" 4
931 .IX Item "--prefix-sections=string"
932 Prefix all section names in the output file with \fIstring\fR.
933 .IP "\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR" 4
934 .IX Item "--prefix-alloc-sections=string"
935 Prefix all the names of all allocated sections in the output file with
937 .IP "\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR" 4
938 .IX Item "--add-gnu-debuglink=path-to-file"
939 Creates a .gnu_debuglink section which contains a reference to
940 \&\fIpath-to-file\fR and adds it to the output file. Note: the file at
941 \&\fIpath-to-file\fR must exist. Part of the process of adding the
942 \&.gnu_debuglink section involves embedding a checksum of the contents
943 of the debug info file into the section.
945 If the debug info file is built in one location but it is going to be
946 installed at a later time into a different location then do not use
947 the path to the installed location. The \fB\-\-add\-gnu\-debuglink\fR
948 option will fail because the installed file does not exist yet.
949 Instead put the debug info file in the current directory and use the
950 \&\fB\-\-add\-gnu\-debuglink\fR option without any directory components,
954 \& objcopy \-\-add\-gnu\-debuglink=foo.debug
957 At debug time the debugger will attempt to look for the separate debug
958 info file in a set of known locations. The exact set of these
959 locations varies depending upon the distribution being used, but it
962 .ie n .IP """* The same directory as the executable.""" 4
963 .el .IP "\f(CW* The same directory as the executable.\fR" 4
964 .IX Item "* The same directory as the executable."
966 .ie n .IP """* A sub\-directory of the directory containing the executable""" 4
967 .el .IP "\f(CW* A sub\-directory of the directory containing the executable\fR" 4
968 .IX Item "* A sub-directory of the directory containing the executable"
971 .ie n .IP """* A global debug directory such as /usr/lib/debug.""" 4
972 .el .IP "\f(CW* A global debug directory such as /usr/lib/debug.\fR" 4
973 .IX Item "* A global debug directory such as /usr/lib/debug."
977 As long as the debug info file has been installed into one of these
978 locations before the debugger is run everything should work
981 .IP "\fB\-\-keep\-section\-symbils\fR" 4
982 .IX Item "--keep-section-symbils"
983 When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
984 \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying section names,
985 which would otherwise get stripped.
986 .IP "\fB\-\-keep\-file\-symbols\fR" 4
987 .IX Item "--keep-file-symbols"
988 When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
989 \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names,
990 which would otherwise get stripped.
991 .IP "\fB\-\-only\-keep\-debug\fR" 4
992 .IX Item "--only-keep-debug"
993 Strip a file, removing contents of any sections that would not be
994 stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections
995 intact. In \s-1ELF\s0 files, this preserves all note sections in the output.
997 Note \- the section headers of the stripped sections are preserved,
998 including their sizes, but the contents of the section are discarded.
999 The section headers are preserved so that other tools can match up the
1000 debuginfo file with the real executable, even if that executable has
1001 been relocated to a different address space.
1003 The intention is that this option will be used in conjunction with
1004 \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable. One a
1005 stripped binary which will occupy less space in \s-1RAM\s0 and in a
1006 distribution and the second a debugging information file which is only
1007 needed if debugging abilities are required. The suggested procedure
1008 to create these files is as follows:
1010 .IP "1.<Link the executable as normal. Assuming that it is called>" 4
1011 .IX Item "1.<Link the executable as normal. Assuming that it is called>"
1012 \&\f(CW\*(C`foo\*(C'\fR then...
1013 .ie n .IP "1.<Run ""objcopy \-\-only\-keep\-debug foo foo.dbg"" to>" 4
1014 .el .IP "1.<Run \f(CWobjcopy \-\-only\-keep\-debug foo foo.dbg\fR to>" 4
1015 .IX Item "1.<Run objcopy --only-keep-debug foo foo.dbg to>"
1016 create a file containing the debugging info.
1017 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"" to create a>" 4
1018 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR to create a>" 4
1019 .IX Item "1.<Run objcopy --strip-debug foo to create a>"
1020 stripped executable.
1021 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.dbg foo"">" 4
1022 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.dbg foo\fR>" 4
1023 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.dbg foo>"
1024 to add a link to the debugging info into the stripped executable.
1028 Note\-\-\-the choice of \f(CW\*(C`.dbg\*(C'\fR as an extension for the debug info
1029 file is arbitrary. Also the \f(CW\*(C`\-\-only\-keep\-debug\*(C'\fR step is
1030 optional. You could instead do this:
1031 .IP "1.<Link the executable as normal.>" 4
1032 .IX Item "1.<Link the executable as normal.>"
1034 .ie n .IP "1.<Copy ""foo"" to ""foo.full"">" 4
1035 .el .IP "1.<Copy \f(CWfoo\fR to \f(CWfoo.full\fR>" 4
1036 .IX Item "1.<Copy foo to foo.full>"
1037 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"">" 4
1038 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR>" 4
1039 .IX Item "1.<Run objcopy --strip-debug foo>"
1040 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.full foo"">" 4
1041 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.full foo\fR>" 4
1042 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.full foo>"
1047 i.e., the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the
1048 full executable. It does not have to be a file created by the
1049 \&\fB\-\-only\-keep\-debug\fR switch.
1051 Note\-\-\-this switch is only intended for use on fully linked files. It
1052 does not make sense to use it on object files where the debugging
1053 information may be incomplete. Besides the gnu_debuglink feature
1054 currently only supports the presence of one filename containing
1055 debugging information, not multiple filenames on a one-per-object-file
1058 .IP "\fB\-\-strip\-dwo\fR" 4
1059 .IX Item "--strip-dwo"
1060 Remove the contents of all \s-1DWARF\s0 .dwo sections, leaving the
1061 remaining debugging sections and all symbols intact.
1062 This option is intended for use by the compiler as part of
1063 the \fB\-gsplit\-dwarf\fR option, which splits debug information
1064 between the .o file and a separate .dwo file. The compiler
1065 generates all debug information in the same file, then uses
1066 the \fB\-\-extract\-dwo\fR option to copy the .dwo sections to
1067 the .dwo file, then the \fB\-\-strip\-dwo\fR option to remove
1068 those sections from the original .o file.
1069 .IP "\fB\-\-extract\-dwo\fR" 4
1070 .IX Item "--extract-dwo"
1071 Extract the contents of all \s-1DWARF\s0 .dwo sections. See the
1072 \&\fB\-\-strip\-dwo\fR option for more information.
1073 .IP "\fB\-\-file\-alignment\fR \fInum\fR" 4
1074 .IX Item "--file-alignment num"
1075 Specify the file alignment. Sections in the file will always begin at
1076 file offsets which are multiples of this number. This defaults to
1078 [This option is specific to \s-1PE\s0 targets.]
1079 .IP "\fB\-\-heap\fR \fIreserve\fR" 4
1080 .IX Item "--heap reserve"
1082 .IP "\fB\-\-heap\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
1083 .IX Item "--heap reserve,commit"
1085 Specify the number of bytes of memory to reserve (and optionally commit)
1086 to be used as heap for this program.
1087 [This option is specific to \s-1PE\s0 targets.]
1088 .IP "\fB\-\-image\-base\fR \fIvalue\fR" 4
1089 .IX Item "--image-base value"
1090 Use \fIvalue\fR as the base address of your program or dll. This is
1091 the lowest memory location that will be used when your program or dll
1092 is loaded. To reduce the need to relocate and improve performance of
1093 your dlls, each should have a unique base address and not overlap any
1094 other dlls. The default is 0x400000 for executables, and 0x10000000
1096 [This option is specific to \s-1PE\s0 targets.]
1097 .IP "\fB\-\-section\-alignment\fR \fInum\fR" 4
1098 .IX Item "--section-alignment num"
1099 Sets the section alignment field in the \s-1PE\s0 header. Sections in memory
1100 will always begin at addresses which are a multiple of this number.
1102 [This option is specific to \s-1PE\s0 targets.]
1103 .IP "\fB\-\-stack\fR \fIreserve\fR" 4
1104 .IX Item "--stack reserve"
1106 .IP "\fB\-\-stack\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
1107 .IX Item "--stack reserve,commit"
1109 Specify the number of bytes of memory to reserve (and optionally commit)
1110 to be used as stack for this program.
1111 [This option is specific to \s-1PE\s0 targets.]
1112 .IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
1113 .IX Item "--subsystem which"
1115 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR" 4
1116 .IX Item "--subsystem which:major"
1117 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR\fB.\fR\fIminor\fR" 4
1118 .IX Item "--subsystem which:major.minor"
1120 Specifies the subsystem under which your program will execute. The
1121 legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
1122 \&\f(CW\*(C`console\*(C'\fR, \f(CW\*(C`posix\*(C'\fR, \f(CW\*(C`efi\-app\*(C'\fR, \f(CW\*(C`efi\-bsd\*(C'\fR,
1123 \&\f(CW\*(C`efi\-rtd\*(C'\fR, \f(CW\*(C`sal\-rtd\*(C'\fR, and \f(CW\*(C`xbox\*(C'\fR. You may optionally set
1124 the subsystem version also. Numeric values are also accepted for
1126 [This option is specific to \s-1PE\s0 targets.]
1127 .IP "\fB\-\-extract\-symbol\fR" 4
1128 .IX Item "--extract-symbol"
1129 Keep the file's section flags and symbols but remove all section data.
1130 Specifically, the option:
1132 .IP "*<removes the contents of all sections;>" 4
1133 .IX Item "*<removes the contents of all sections;>"
1135 .IP "*<sets the size of every section to zero; and>" 4
1136 .IX Item "*<sets the size of every section to zero; and>"
1137 .IP "*<sets the file's start address to zero.>" 4
1138 .IX Item "*<sets the file's start address to zero.>"
1143 This option is used to build a \fI.sym\fR file for a VxWorks kernel.
1144 It can also be a useful way of reducing the size of a \fB\-\-just\-symbols\fR
1147 .IP "\fB\-\-compress\-debug\-sections\fR" 4
1148 .IX Item "--compress-debug-sections"
1149 Compress \s-1DWARF\s0 debug sections using zlib with \s-1SHF_COMPRESSED\s0 from the
1150 \&\s-1ELF ABI.\s0 Note \- if compression would actually make a section
1151 \&\fIlarger\fR, then it is not compressed.
1152 .IP "\fB\-\-compress\-debug\-sections=none\fR" 4
1153 .IX Item "--compress-debug-sections=none"
1155 .IP "\fB\-\-compress\-debug\-sections=zlib\fR" 4
1156 .IX Item "--compress-debug-sections=zlib"
1157 .IP "\fB\-\-compress\-debug\-sections=zlib\-gnu\fR" 4
1158 .IX Item "--compress-debug-sections=zlib-gnu"
1159 .IP "\fB\-\-compress\-debug\-sections=zlib\-gabi\fR" 4
1160 .IX Item "--compress-debug-sections=zlib-gabi"
1162 For \s-1ELF\s0 files, these options control how \s-1DWARF\s0 debug sections are
1163 compressed. \fB\-\-compress\-debug\-sections=none\fR is equivalent
1164 to \fB\-\-decompress\-debug\-sections\fR.
1165 \&\fB\-\-compress\-debug\-sections=zlib\fR and
1166 \&\fB\-\-compress\-debug\-sections=zlib\-gabi\fR are equivalent to
1167 \&\fB\-\-compress\-debug\-sections\fR.
1168 \&\fB\-\-compress\-debug\-sections=zlib\-gnu\fR compresses \s-1DWARF\s0 debug
1169 sections using zlib. The debug sections are renamed to begin with
1170 \&\fB.zdebug\fR instead of \fB.debug\fR. Note \- if compression would
1171 actually make a section \fIlarger\fR, then it is not compressed nor
1173 .IP "\fB\-\-decompress\-debug\-sections\fR" 4
1174 .IX Item "--decompress-debug-sections"
1175 Decompress \s-1DWARF\s0 debug sections using zlib. The original section
1176 names of the compressed sections are restored.
1177 .IP "\fB\-\-elf\-stt\-common=yes\fR" 4
1178 .IX Item "--elf-stt-common=yes"
1180 .IP "\fB\-\-elf\-stt\-common=no\fR" 4
1181 .IX Item "--elf-stt-common=no"
1183 For \s-1ELF\s0 files, these options control whether common symbols should be
1184 converted to the \f(CW\*(C`STT_COMMON\*(C'\fR or \f(CW\*(C`STT_OBJECT\*(C'\fR type.
1185 \&\fB\-\-elf\-stt\-common=yes\fR converts common symbol type to
1186 \&\f(CW\*(C`STT_COMMON\*(C'\fR. \fB\-\-elf\-stt\-common=no\fR converts common symbol
1187 type to \f(CW\*(C`STT_OBJECT\*(C'\fR.
1188 .IP "\fB\-\-merge\-notes\fR" 4
1189 .IX Item "--merge-notes"
1191 .IP "\fB\-\-no\-merge\-notes\fR" 4
1192 .IX Item "--no-merge-notes"
1194 For \s-1ELF\s0 files, attempt (or do not attempt) to reduce the size of any
1195 \&\s-1SHT_NOTE\s0 type sections by removing duplicate notes.
1199 .IP "\fB\-\-version\fR" 4
1200 .IX Item "--version"
1202 Show the version number of \fBobjcopy\fR.
1203 .IP "\fB\-\-verilog\-data\-width=\fR\fIbytes\fR" 4
1204 .IX Item "--verilog-data-width=bytes"
1205 For Verilog output, this options controls the number of bytes
1206 converted for each output data element. The input target controls the
1207 endianness of the conversion.
1211 .IP "\fB\-\-verbose\fR" 4
1212 .IX Item "--verbose"
1214 Verbose output: list all object files modified. In the case of
1215 archives, \fBobjcopy \-V\fR lists all members of the archive.
1216 .IP "\fB\-\-help\fR" 4
1218 Show a summary of the options to \fBobjcopy\fR.
1219 .IP "\fB\-\-info\fR" 4
1221 Display a list showing all architectures and object formats available.
1222 .IP "\fB@\fR\fIfile\fR" 4
1224 Read command-line options from \fIfile\fR. The options read are
1225 inserted in place of the original @\fIfile\fR option. If \fIfile\fR
1226 does not exist, or cannot be read, then the option will be treated
1227 literally, and not removed.
1229 Options in \fIfile\fR are separated by whitespace. A whitespace
1230 character may be included in an option by surrounding the entire
1231 option in either single or double quotes. Any character (including a
1232 backslash) may be included by prefixing the character to be included
1233 with a backslash. The \fIfile\fR may itself contain additional
1234 @\fIfile\fR options; any such options will be processed recursively.
1236 .IX Header "SEE ALSO"
1237 \&\fBld\fR\|(1), \fBobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
1239 .IX Header "COPYRIGHT"
1240 Copyright (c) 1991\-2022 Free Software Foundation, Inc.
1242 Permission is granted to copy, distribute and/or modify this document
1243 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
1244 or any later version published by the Free Software Foundation;
1245 with no Invariant Sections, with no Front-Cover Texts, and with no
1246 Back-Cover Texts. A copy of the license is included in the
1247 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".