Merge remote-tracking branch 'origin/vendor/LDNS'
[dragonfly.git] / contrib / binutils-2.27 / binutils / doc / objcopy.1
1 .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
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<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
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
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is turned on, 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.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{
60 .    if \nF \{
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
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
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
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'
105 .\}
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 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "OBJCOPY 1"
136 .TH OBJCOPY 1 "2016-08-03" "binutils-2.27" "GNU Development Tools"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 objcopy \- copy and translate object files
143 .SH "SYNOPSIS"
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\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
152         [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-symbol=\fR\fIsymbolname\fR]
153         [\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR]
154         [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR]
155         [\fB\-\-localize\-hidden\fR]
156         [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR]
157         [\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR]
158         [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
159         [\fB\-w\fR|\fB\-\-wildcard\fR]
160         [\fB\-x\fR|\fB\-\-discard\-all\fR]
161         [\fB\-X\fR|\fB\-\-discard\-locals\fR]
162         [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
163         [\fB\-i\fR [\fIbreadth\fR]|\fB\-\-interleave\fR[=\fIbreadth\fR]]
164         [\fB\-\-interleave\-width=\fR\fIwidth\fR]
165         [\fB\-j\fR \fIsectionpattern\fR|\fB\-\-only\-section=\fR\fIsectionpattern\fR]
166         [\fB\-R\fR \fIsectionpattern\fR|\fB\-\-remove\-section=\fR\fIsectionpattern\fR]
167         [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
168         [\fB\-D\fR|\fB\-\-enable\-deterministic\-archives\fR]
169         [\fB\-U\fR|\fB\-\-disable\-deterministic\-archives\fR]
170         [\fB\-\-debugging\fR]
171         [\fB\-\-gap\-fill=\fR\fIval\fR]
172         [\fB\-\-pad\-to=\fR\fIaddress\fR]
173         [\fB\-\-set\-start=\fR\fIval\fR]
174         [\fB\-\-adjust\-start=\fR\fIincr\fR]
175         [\fB\-\-change\-addresses=\fR\fIincr\fR]
176         [\fB\-\-change\-section\-address\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
177         [\fB\-\-change\-section\-lma\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
178         [\fB\-\-change\-section\-vma\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
179         [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
180         [\fB\-\-set\-section\-flags\fR \fIsectionpattern\fR=\fIflags\fR]
181         [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
182         [\fB\-\-dump\-section\fR \fIsectionname\fR=\fIfilename\fR]
183         [\fB\-\-update\-section\fR \fIsectionname\fR=\fIfilename\fR]
184         [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
185         [\fB\-\-long\-section\-names\fR {enable,disable,keep}]
186         [\fB\-\-change\-leading\-char\fR] [\fB\-\-remove\-leading\-char\fR]
187         [\fB\-\-reverse\-bytes=\fR\fInum\fR]
188         [\fB\-\-srec\-len=\fR\fIival\fR] [\fB\-\-srec\-forceS3\fR]
189         [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR]
190         [\fB\-\-redefine\-syms=\fR\fIfilename\fR]
191         [\fB\-\-weaken\fR]
192         [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
193         [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
194         [\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR]
195         [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
196         [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
197         [\fB\-\-globalize\-symbols=\fR\fIfilename\fR]
198         [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
199         [\fB\-\-add\-symbol\fR \fIname\fR=[\fIsection\fR:]\fIvalue\fR[,\fIflags\fR]
200         [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
201         [\fB\-\-prefix\-symbols=\fR\fIstring\fR]
202         [\fB\-\-prefix\-sections=\fR\fIstring\fR]
203         [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR]
204         [\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR]
205         [\fB\-\-keep\-file\-symbols\fR]
206         [\fB\-\-only\-keep\-debug\fR]
207         [\fB\-\-strip\-dwo\fR]
208         [\fB\-\-extract\-dwo\fR]
209         [\fB\-\-extract\-symbol\fR]
210         [\fB\-\-writable\-text\fR]
211         [\fB\-\-readonly\-text\fR]
212         [\fB\-\-pure\fR]
213         [\fB\-\-impure\fR]
214         [\fB\-\-file\-alignment=\fR\fInum\fR]
215         [\fB\-\-heap=\fR\fIsize\fR]
216         [\fB\-\-image\-base=\fR\fIaddress\fR]
217         [\fB\-\-section\-alignment=\fR\fInum\fR]
218         [\fB\-\-stack=\fR\fIsize\fR]
219         [\fB\-\-subsystem=\fR\fIwhich\fR:\fImajor\fR.\fIminor\fR]
220         [\fB\-\-compress\-debug\-sections\fR]
221         [\fB\-\-decompress\-debug\-sections\fR]
222         [\fB\-\-elf\-stt\-common=\fR\fIval\fR]
223         [\fB\-v\fR|\fB\-\-verbose\fR]
224         [\fB\-V\fR|\fB\-\-version\fR]
225         [\fB\-\-help\fR] [\fB\-\-info\fR]
226         \fIinfile\fR [\fIoutfile\fR]
227 .SH "DESCRIPTION"
228 .IX Header "DESCRIPTION"
229 The \s-1GNU \s0\fBobjcopy\fR utility copies the contents of an object
230 file to another.  \fBobjcopy\fR uses the \s-1GNU BFD\s0 Library to
231 read and write the object files.  It can write the destination object
232 file in a format different from that of the source object file.  The
233 exact behavior of \fBobjcopy\fR is controlled by command-line options.
234 Note that \fBobjcopy\fR should be able to copy a fully linked file
235 between any two formats. However, copying a relocatable object file
236 between any two formats may not work as expected.
237 .PP
238 \&\fBobjcopy\fR creates temporary files to do its translations and
239 deletes them afterward.  \fBobjcopy\fR uses \s-1BFD\s0 to do all its
240 translation work; it has access to all the formats described in \s-1BFD\s0
241 and thus is able to recognize most formats without being told
242 explicitly.
243 .PP
244 \&\fBobjcopy\fR can be used to generate S\-records by using an output
245 target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
246 .PP
247 \&\fBobjcopy\fR can be used to generate a raw binary file by using an
248 output target of \fBbinary\fR (e.g., use \fB\-O binary\fR).  When
249 \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
250 a memory dump of the contents of the input object file.  All symbols and
251 relocation information will be discarded.  The memory dump will start at
252 the load address of the lowest section copied into the output file.
253 .PP
254 When generating an S\-record or a raw binary file, it may be helpful to
255 use \fB\-S\fR to remove sections containing debugging information.  In
256 some cases \fB\-R\fR will be useful to remove sections which contain
257 information that is not needed by the binary file.
258 .PP
259 Note\-\-\-\fBobjcopy\fR is not able to change the endianness of its input
260 files.  If the input format has an endianness (some formats do not),
261 \&\fBobjcopy\fR can only copy the inputs into file formats that have the
262 same endianness or which have no endianness (e.g., \fBsrec\fR).
263 (However, see the \fB\-\-reverse\-bytes\fR option.)
264 .SH "OPTIONS"
265 .IX Header "OPTIONS"
266 .IP "\fIinfile\fR" 4
267 .IX Item "infile"
268 .PD 0
269 .IP "\fIoutfile\fR" 4
270 .IX Item "outfile"
271 .PD
272 The input and output files, respectively.
273 If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
274 temporary file and destructively renames the result with
275 the name of \fIinfile\fR.
276 .IP "\fB\-I\fR \fIbfdname\fR" 4
277 .IX Item "-I bfdname"
278 .PD 0
279 .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
280 .IX Item "--input-target=bfdname"
281 .PD
282 Consider the source file's object format to be \fIbfdname\fR, rather than
283 attempting to deduce it.
284 .IP "\fB\-O\fR \fIbfdname\fR" 4
285 .IX Item "-O bfdname"
286 .PD 0
287 .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
288 .IX Item "--output-target=bfdname"
289 .PD
290 Write the output file using the object format \fIbfdname\fR.
291 .IP "\fB\-F\fR \fIbfdname\fR" 4
292 .IX Item "-F bfdname"
293 .PD 0
294 .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
295 .IX Item "--target=bfdname"
296 .PD
297 Use \fIbfdname\fR as the object format for both the input and the output
298 file; i.e., simply transfer data from source to destination with no
299 translation.
300 .IP "\fB\-B\fR \fIbfdarch\fR" 4
301 .IX Item "-B bfdarch"
302 .PD 0
303 .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
304 .IX Item "--binary-architecture=bfdarch"
305 .PD
306 Useful when transforming a architecture-less input file into an object file.
307 In this case the output architecture can be set to \fIbfdarch\fR.  This
308 option will be ignored if the input file has a known \fIbfdarch\fR.  You
309 can access this binary data inside a program by referencing the special
310 symbols that are created by the conversion process.  These symbols are
311 called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
312 _binary_\fIobjfile\fR_size.  e.g. you can transform a picture file into
313 an object file and then access it in your code using these symbols.
314 .IP "\fB\-j\fR \fIsectionpattern\fR" 4
315 .IX Item "-j sectionpattern"
316 .PD 0
317 .IP "\fB\-\-only\-section=\fR\fIsectionpattern\fR" 4
318 .IX Item "--only-section=sectionpattern"
319 .PD
320 Copy only the indicated sections from the input file to the output file.
321 This option may be given more than once.  Note that using this option
322 inappropriately may make the output file unusable.  Wildcard
323 characters are accepted in \fIsectionpattern\fR.
324 .IP "\fB\-R\fR \fIsectionpattern\fR" 4
325 .IX Item "-R sectionpattern"
326 .PD 0
327 .IP "\fB\-\-remove\-section=\fR\fIsectionpattern\fR" 4
328 .IX Item "--remove-section=sectionpattern"
329 .PD
330 Remove any section matching \fIsectionpattern\fR from the output file.
331 This option may be given more than once.  Note that using this option
332 inappropriately may make the output file unusable.  Wildcard
333 characters are accepted in \fIsectionpattern\fR.  Using both the
334 \&\fB\-j\fR and \fB\-R\fR options together results in undefined
335 behaviour.
336 .IP "\fB\-S\fR" 4
337 .IX Item "-S"
338 .PD 0
339 .IP "\fB\-\-strip\-all\fR" 4
340 .IX Item "--strip-all"
341 .PD
342 Do not copy relocation and symbol information from the source file.
343 .IP "\fB\-g\fR" 4
344 .IX Item "-g"
345 .PD 0
346 .IP "\fB\-\-strip\-debug\fR" 4
347 .IX Item "--strip-debug"
348 .PD
349 Do not copy debugging symbols or sections from the source file.
350 .IP "\fB\-\-strip\-unneeded\fR" 4
351 .IX Item "--strip-unneeded"
352 Strip all symbols that are not needed for relocation processing.
353 .IP "\fB\-K\fR \fIsymbolname\fR" 4
354 .IX Item "-K symbolname"
355 .PD 0
356 .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
357 .IX Item "--keep-symbol=symbolname"
358 .PD
359 When stripping symbols, keep symbol \fIsymbolname\fR even if it would
360 normally be stripped.  This option may be given more than once.
361 .IP "\fB\-N\fR \fIsymbolname\fR" 4
362 .IX Item "-N symbolname"
363 .PD 0
364 .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
365 .IX Item "--strip-symbol=symbolname"
366 .PD
367 Do not copy symbol \fIsymbolname\fR from the source file.  This option
368 may be given more than once.
369 .IP "\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR" 4
370 .IX Item "--strip-unneeded-symbol=symbolname"
371 Do not copy symbol \fIsymbolname\fR from the source file unless it is needed
372 by a relocation.  This option may be given more than once.
373 .IP "\fB\-G\fR \fIsymbolname\fR" 4
374 .IX Item "-G symbolname"
375 .PD 0
376 .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
377 .IX Item "--keep-global-symbol=symbolname"
378 .PD
379 Keep only symbol \fIsymbolname\fR global.  Make all other symbols local
380 to the file, so that they are not visible externally.  This option may
381 be given more than once.
382 .IP "\fB\-\-localize\-hidden\fR" 4
383 .IX Item "--localize-hidden"
384 In an \s-1ELF\s0 object, mark all symbols that have hidden or internal visibility
385 as local.  This option applies on top of symbol-specific localization options
386 such as \fB\-L\fR.
387 .IP "\fB\-L\fR \fIsymbolname\fR" 4
388 .IX Item "-L symbolname"
389 .PD 0
390 .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
391 .IX Item "--localize-symbol=symbolname"
392 .PD
393 Make symbol \fIsymbolname\fR local to the file, so that it is not
394 visible externally.  This option may be given more than once.
395 .IP "\fB\-W\fR \fIsymbolname\fR" 4
396 .IX Item "-W symbolname"
397 .PD 0
398 .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
399 .IX Item "--weaken-symbol=symbolname"
400 .PD
401 Make symbol \fIsymbolname\fR weak. This option may be given more than once.
402 .IP "\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR" 4
403 .IX Item "--globalize-symbol=symbolname"
404 Give symbol \fIsymbolname\fR global scoping so that it is visible
405 outside of the file in which it is defined.  This option may be given
406 more than once.
407 .IP "\fB\-w\fR" 4
408 .IX Item "-w"
409 .PD 0
410 .IP "\fB\-\-wildcard\fR" 4
411 .IX Item "--wildcard"
412 .PD
413 Permit regular expressions in \fIsymbolname\fRs used in other command
414 line options.  The question mark (?), asterisk (*), backslash (\e) and
415 square brackets ([]) operators can be used anywhere in the symbol
416 name.  If the first character of the symbol name is the exclamation
417 point (!) then the sense of the switch is reversed for that symbol.
418 For example:
419 .Sp
420 .Vb 1
421 \&          \-w \-W !foo \-W fo*
422 .Ve
423 .Sp
424 would cause objcopy to weaken all symbols that start with \*(L"fo\*(R"
425 except for the symbol \*(L"foo\*(R".
426 .IP "\fB\-x\fR" 4
427 .IX Item "-x"
428 .PD 0
429 .IP "\fB\-\-discard\-all\fR" 4
430 .IX Item "--discard-all"
431 .PD
432 Do not copy non-global symbols from the source file.
433 .IP "\fB\-X\fR" 4
434 .IX Item "-X"
435 .PD 0
436 .IP "\fB\-\-discard\-locals\fR" 4
437 .IX Item "--discard-locals"
438 .PD
439 Do not copy compiler-generated local symbols.
440 (These usually start with \fBL\fR or \fB.\fR.)
441 .IP "\fB\-b\fR \fIbyte\fR" 4
442 .IX Item "-b byte"
443 .PD 0
444 .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
445 .IX Item "--byte=byte"
446 .PD
447 If interleaving has been enabled via the \fB\-\-interleave\fR option
448 then start the range of bytes to keep at the \fIbyte\fRth byte.
449 \&\fIbyte\fR can be in the range from 0 to \fIbreadth\fR\-1, where
450 \&\fIbreadth\fR is the value given by the \fB\-\-interleave\fR option.
451 .IP "\fB\-i [\fR\fIbreadth\fR\fB]\fR" 4
452 .IX Item "-i [breadth]"
453 .PD 0
454 .IP "\fB\-\-interleave[=\fR\fIbreadth\fR\fB]\fR" 4
455 .IX Item "--interleave[=breadth]"
456 .PD
457 Only copy a range out of every \fIbreadth\fR bytes.  (Header data is
458 not affected).  Select which byte in the range begins the copy with
459 the \fB\-\-byte\fR option.  Select the width of the range with the
460 \&\fB\-\-interleave\-width\fR option.
461 .Sp
462 This option is useful for creating files to program \s-1ROM. \s0 It is
463 typically used with an \f(CW\*(C`srec\*(C'\fR output target.  Note that
464 \&\fBobjcopy\fR will complain if you do not specify the
465 \&\fB\-\-byte\fR option as well.
466 .Sp
467 The default interleave breadth is 4, so with \fB\-\-byte\fR set to 0,
468 \&\fBobjcopy\fR would copy the first byte out of every four bytes
469 from the input to the output.
470 .IP "\fB\-\-interleave\-width=\fR\fIwidth\fR" 4
471 .IX Item "--interleave-width=width"
472 When used with the \fB\-\-interleave\fR option, copy \fIwidth\fR
473 bytes at a time.  The start of the range of bytes to be copied is set
474 by the \fB\-\-byte\fR option, and the extent of the range is set with
475 the \fB\-\-interleave\fR option.
476 .Sp
477 The default value for this option is 1.  The value of \fIwidth\fR plus
478 the \fIbyte\fR value set by the \fB\-\-byte\fR option must not exceed
479 the interleave breadth set by the \fB\-\-interleave\fR option.
480 .Sp
481 This option can be used to create images for two 16\-bit flashes interleaved
482 in a 32\-bit bus by passing \fB\-b 0 \-i 4 \-\-interleave\-width=2\fR
483 and \fB\-b 2 \-i 4 \-\-interleave\-width=2\fR to two \fBobjcopy\fR
484 commands.  If the input was '12345678' then the outputs would be
485 \&'1256' and '3478' respectively.
486 .IP "\fB\-p\fR" 4
487 .IX Item "-p"
488 .PD 0
489 .IP "\fB\-\-preserve\-dates\fR" 4
490 .IX Item "--preserve-dates"
491 .PD
492 Set the access and modification dates of the output file to be the same
493 as those of the input file.
494 .IP "\fB\-D\fR" 4
495 .IX Item "-D"
496 .PD 0
497 .IP "\fB\-\-enable\-deterministic\-archives\fR" 4
498 .IX Item "--enable-deterministic-archives"
499 .PD
500 Operate in \fIdeterministic\fR mode.  When copying archive members
501 and writing the archive index, use zero for UIDs, GIDs, timestamps,
502 and use consistent file modes for all files.
503 .Sp
504 If \fIbinutils\fR was configured with
505 \&\fB\-\-enable\-deterministic\-archives\fR, then this mode is on by default.
506 It can be disabled with the \fB\-U\fR option, below.
507 .IP "\fB\-U\fR" 4
508 .IX Item "-U"
509 .PD 0
510 .IP "\fB\-\-disable\-deterministic\-archives\fR" 4
511 .IX Item "--disable-deterministic-archives"
512 .PD
513 Do \fInot\fR operate in \fIdeterministic\fR mode.  This is the
514 inverse of the \fB\-D\fR option, above: when copying archive members
515 and writing the archive index, use their actual \s-1UID, GID,\s0 timestamp,
516 and file mode values.
517 .Sp
518 This is the default unless \fIbinutils\fR was configured with
519 \&\fB\-\-enable\-deterministic\-archives\fR.
520 .IP "\fB\-\-debugging\fR" 4
521 .IX Item "--debugging"
522 Convert debugging information, if possible.  This is not the default
523 because only certain debugging formats are supported, and the
524 conversion process can be time consuming.
525 .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
526 .IX Item "--gap-fill val"
527 Fill gaps between sections with \fIval\fR.  This operation applies to
528 the \fIload address\fR (\s-1LMA\s0) of the sections.  It is done by increasing
529 the size of the section with the lower address, and filling in the extra
530 space created with \fIval\fR.
531 .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
532 .IX Item "--pad-to address"
533 Pad the output file up to the load address \fIaddress\fR.  This is
534 done by increasing the size of the last section.  The extra space is
535 filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
536 .IP "\fB\-\-set\-start\fR \fIval\fR" 4
537 .IX Item "--set-start val"
538 Set the start address of the new file to \fIval\fR.  Not all object file
539 formats support setting the start address.
540 .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
541 .IX Item "--change-start incr"
542 .PD 0
543 .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
544 .IX Item "--adjust-start incr"
545 .PD
546 Change the start address by adding \fIincr\fR.  Not all object file
547 formats support setting the start address.
548 .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
549 .IX Item "--change-addresses incr"
550 .PD 0
551 .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
552 .IX Item "--adjust-vma incr"
553 .PD
554 Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
555 address, by adding \fIincr\fR.  Some object file formats do not permit
556 section addresses to be changed arbitrarily.  Note that this does not
557 relocate the sections; if the program expects sections to be loaded at a
558 certain address, and this option is used to change the sections such
559 that they are loaded at a different address, the program may fail.
560 .IP "\fB\-\-change\-section\-address\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
561 .IX Item "--change-section-address sectionpattern{=,+,-}val"
562 .PD 0
563 .IP "\fB\-\-adjust\-section\-vma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
564 .IX Item "--adjust-section-vma sectionpattern{=,+,-}val"
565 .PD
566 Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of any section
567 matching \fIsectionpattern\fR.  If \fB=\fR is used, the section
568 address is set to \fIval\fR.  Otherwise, \fIval\fR is added to or
569 subtracted from the section address.  See the comments under
570 \&\fB\-\-change\-addresses\fR, above. If \fIsectionpattern\fR does not
571 match any sections in the input file, a warning will be issued, unless
572 \&\fB\-\-no\-change\-warnings\fR is used.
573 .IP "\fB\-\-change\-section\-lma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
574 .IX Item "--change-section-lma sectionpattern{=,+,-}val"
575 Set or change the \s-1LMA\s0 address of any sections matching
576 \&\fIsectionpattern\fR.  The \s-1LMA\s0 address is the address where the
577 section will be loaded into memory at program load time.  Normally
578 this is the same as the \s-1VMA\s0 address, which is the address of the
579 section at program run time, but on some systems, especially those
580 where a program is held in \s-1ROM,\s0 the two can be different.  If \fB=\fR
581 is used, the section address is set to \fIval\fR.  Otherwise,
582 \&\fIval\fR is added to or subtracted from the section address.  See the
583 comments under \fB\-\-change\-addresses\fR, above.  If
584 \&\fIsectionpattern\fR does not match any sections in the input file, a
585 warning will be issued, unless \fB\-\-no\-change\-warnings\fR is used.
586 .IP "\fB\-\-change\-section\-vma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
587 .IX Item "--change-section-vma sectionpattern{=,+,-}val"
588 Set or change the \s-1VMA\s0 address of any section matching
589 \&\fIsectionpattern\fR.  The \s-1VMA\s0 address is the address where the
590 section will be located once the program has started executing.
591 Normally this is the same as the \s-1LMA\s0 address, which is the address
592 where the section will be loaded into memory, but on some systems,
593 especially those where a program is held in \s-1ROM,\s0 the two can be
594 different.  If \fB=\fR is used, the section address is set to
595 \&\fIval\fR.  Otherwise, \fIval\fR is added to or subtracted from the
596 section address.  See the comments under \fB\-\-change\-addresses\fR,
597 above.  If \fIsectionpattern\fR does not match any sections in the
598 input file, a warning will be issued, unless
599 \&\fB\-\-no\-change\-warnings\fR is used.
600 .IP "\fB\-\-change\-warnings\fR" 4
601 .IX Item "--change-warnings"
602 .PD 0
603 .IP "\fB\-\-adjust\-warnings\fR" 4
604 .IX Item "--adjust-warnings"
605 .PD
606 If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
607 \&\fB\-\-change\-section\-vma\fR is used, and the section pattern does not
608 match any sections, issue a warning.  This is the default.
609 .IP "\fB\-\-no\-change\-warnings\fR" 4
610 .IX Item "--no-change-warnings"
611 .PD 0
612 .IP "\fB\-\-no\-adjust\-warnings\fR" 4
613 .IX Item "--no-adjust-warnings"
614 .PD
615 Do not issue a warning if \fB\-\-change\-section\-address\fR or
616 \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
617 if the section pattern does not match any sections.
618 .IP "\fB\-\-set\-section\-flags\fR \fIsectionpattern\fR\fB=\fR\fIflags\fR" 4
619 .IX Item "--set-section-flags sectionpattern=flags"
620 Set the flags for any sections matching \fIsectionpattern\fR.  The
621 \&\fIflags\fR argument is a comma separated string of flag names.  The
622 recognized names are \fBalloc\fR, \fBcontents\fR, \fBload\fR,
623 \&\fBnoload\fR, \fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR,
624 \&\fBshare\fR, and \fBdebug\fR.  You can set the \fBcontents\fR flag
625 for a section which does not have contents, but it is not meaningful
626 to clear the \fBcontents\fR flag of a section which does have
627 contents\*(--just remove the section instead.  Not all flags are
628 meaningful for all object file formats.
629 .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
630 .IX Item "--add-section sectionname=filename"
631 Add a new section named \fIsectionname\fR while copying the file.  The
632 contents of the new section are taken from the file \fIfilename\fR.  The
633 size of the section will be the size of the file.  This option only
634 works on file formats which can support sections with arbitrary names.
635 Note \- it may be necessary to use the \fB\-\-set\-section\-flags\fR
636 option to set the attributes of the newly created section.
637 .IP "\fB\-\-dump\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
638 .IX Item "--dump-section sectionname=filename"
639 Place the contents of section named \fIsectionname\fR into the file
640 \&\fIfilename\fR, overwriting any contents that may have been there
641 previously.  This option is the inverse of \fB\-\-add\-section\fR.
642 This option is similar to the \fB\-\-only\-section\fR option except
643 that it does not create a formatted file, it just dumps the contents
644 as raw binary data, without applying any relocations.  The option can
645 be specified more than once.
646 .IP "\fB\-\-update\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
647 .IX Item "--update-section sectionname=filename"
648 Replace the existing contents of a section named \fIsectionname\fR
649 with the contents of file \fIfilename\fR.  The size of the section
650 will be adjusted to the size of the file.  The section flags for
651 \&\fIsectionname\fR will be unchanged.  For \s-1ELF\s0 format files the section
652 to segment mapping will also remain unchanged, something which is not
653 possible using \fB\-\-remove\-section\fR followed by
654 \&\fB\-\-add\-section\fR.  The option can be specified more than once.
655 .Sp
656 Note \- it is possible to use \fB\-\-rename\-section\fR and
657 \&\fB\-\-update\-section\fR to both update and rename a section from one
658 command line.  In this case, pass the original section name to
659 \&\fB\-\-update\-section\fR, and the original and new section names to
660 \&\fB\-\-rename\-section\fR.
661 .IP "\fB\-\-add\-symbol\fR \fIname\fR\fB=[\fR\fIsection\fR\fB:]\fR\fIvalue\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
662 .IX Item "--add-symbol name=[section:]value[,flags]"
663 Add a new symbol named \fIname\fR while copying the file.  This option may be
664 specified multiple times.  If the \fIsection\fR is given, the symbol will be
665 associated with and relative to that section, otherwise it will be an \s-1ABS\s0
666 symbol.  Specifying an undefined section will result in a fatal error.  There
667 is no check for the value, it will be taken as specified.  Symbol flags can
668 be specified and not all flags will be meaningful for all object file
669 formats.  By default, the symbol will be global.  The special flag
670 \&'before=\fIothersym\fR' will insert the new symbol in front of the specified
671 \&\fIothersym\fR, otherwise the symbol(s) will be added at the end of the
672 symbol table in the order they appear.
673 .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
674 .IX Item "--rename-section oldname=newname[,flags]"
675 Rename a section from \fIoldname\fR to \fInewname\fR, optionally
676 changing the section's flags to \fIflags\fR in the process.  This has
677 the advantage over usng a linker script to perform the rename in that
678 the output stays as an object file and does not become a linked
679 executable.
680 .Sp
681 This option is particularly helpful when the input format is binary,
682 since this will always create a section called .data.  If for example,
683 you wanted instead to create a section called .rodata containing binary
684 data you could use the following command line to achieve it:
685 .Sp
686 .Vb 3
687 \&          objcopy \-I binary \-O <output_format> \-B <architecture> \e
688 \&           \-\-rename\-section .data=.rodata,alloc,load,readonly,data,contents \e
689 \&           <input_binary_file> <output_object_file>
690 .Ve
691 .IP "\fB\-\-long\-section\-names {enable,disable,keep}\fR" 4
692 .IX Item "--long-section-names {enable,disable,keep}"
693 Controls the handling of long section names when processing \f(CW\*(C`COFF\*(C'\fR
694 and \f(CW\*(C`PE\-COFF\*(C'\fR object formats.  The default behaviour, \fBkeep\fR,
695 is to preserve long section names if any are present in the input file.
696 The \fBenable\fR and \fBdisable\fR options forcibly enable or disable
697 the use of long section names in the output object; when \fBdisable\fR
698 is in effect, any long section names in the input object will be truncated.
699 The \fBenable\fR option will only emit long section names if any are
700 present in the inputs; this is mostly the same as \fBkeep\fR, but it
701 is left undefined whether the \fBenable\fR option might force the
702 creation of an empty string table in the output file.
703 .IP "\fB\-\-change\-leading\-char\fR" 4
704 .IX Item "--change-leading-char"
705 Some object file formats use special characters at the start of
706 symbols.  The most common such character is underscore, which compilers
707 often add before every symbol.  This option tells \fBobjcopy\fR to
708 change the leading character of every symbol when it converts between
709 object file formats.  If the object file formats use the same leading
710 character, this option has no effect.  Otherwise, it will add a
711 character, or remove a character, or change a character, as
712 appropriate.
713 .IP "\fB\-\-remove\-leading\-char\fR" 4
714 .IX Item "--remove-leading-char"
715 If the first character of a global symbol is a special symbol leading
716 character used by the object file format, remove the character.  The
717 most common symbol leading character is underscore.  This option will
718 remove a leading underscore from all global symbols.  This can be useful
719 if you want to link together objects of different file formats with
720 different conventions for symbol names.  This is different from
721 \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
722 when appropriate, regardless of the object file format of the output
723 file.
724 .IP "\fB\-\-reverse\-bytes=\fR\fInum\fR" 4
725 .IX Item "--reverse-bytes=num"
726 Reverse the bytes in a section with output contents.  A section length must
727 be evenly divisible by the value given in order for the swap to be able to
728 take place. Reversing takes place before the interleaving is performed.
729 .Sp
730 This option is used typically in generating \s-1ROM\s0 images for problematic
731 target systems.  For example, on some target boards, the 32\-bit words
732 fetched from 8\-bit ROMs are re-assembled in little-endian byte order
733 regardless of the \s-1CPU\s0 byte order.  Depending on the programming model, the
734 endianness of the \s-1ROM\s0 may need to be modified.
735 .Sp
736 Consider a simple file with a section containing the following eight
737 bytes:  \f(CW12345678\fR.
738 .Sp
739 Using \fB\-\-reverse\-bytes=2\fR for the above example, the bytes in the
740 output file would be ordered \f(CW21436587\fR.
741 .Sp
742 Using \fB\-\-reverse\-bytes=4\fR for the above example, the bytes in the
743 output file would be ordered \f(CW43218765\fR.
744 .Sp
745 By using \fB\-\-reverse\-bytes=2\fR for the above example, followed by
746 \&\fB\-\-reverse\-bytes=4\fR on the output file, the bytes in the second
747 output file would be ordered \f(CW34127856\fR.
748 .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
749 .IX Item "--srec-len=ival"
750 Meaningful only for srec output.  Set the maximum length of the Srecords
751 being produced to \fIival\fR.  This length covers both address, data and
752 crc fields.
753 .IP "\fB\-\-srec\-forceS3\fR" 4
754 .IX Item "--srec-forceS3"
755 Meaningful only for srec output.  Avoid generation of S1/S2 records,
756 creating S3\-only record format.
757 .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
758 .IX Item "--redefine-sym old=new"
759 Change the name of a symbol \fIold\fR, to \fInew\fR.  This can be useful
760 when one is trying link two things together for which you have no
761 source, and there are name collisions.
762 .IP "\fB\-\-redefine\-syms=\fR\fIfilename\fR" 4
763 .IX Item "--redefine-syms=filename"
764 Apply \fB\-\-redefine\-sym\fR to each symbol pair "\fIold\fR \fInew\fR"
765 listed in the file \fIfilename\fR.  \fIfilename\fR is simply a flat file,
766 with one symbol pair per line.  Line comments may be introduced by the hash
767 character.  This option may be given more than once.
768 .IP "\fB\-\-weaken\fR" 4
769 .IX Item "--weaken"
770 Change all global symbols in the file to be weak.  This can be useful
771 when building an object which will be linked against other objects using
772 the \fB\-R\fR option to the linker.  This option is only effective when
773 using an object file format which supports weak symbols.
774 .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
775 .IX Item "--keep-symbols=filename"
776 Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
777 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
778 name per line.  Line comments may be introduced by the hash character.
779 This option may be given more than once.
780 .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
781 .IX Item "--strip-symbols=filename"
782 Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
783 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
784 name per line.  Line comments may be introduced by the hash character.
785 This option may be given more than once.
786 .IP "\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR" 4
787 .IX Item "--strip-unneeded-symbols=filename"
788 Apply \fB\-\-strip\-unneeded\-symbol\fR option to each symbol listed in
789 the file \fIfilename\fR.  \fIfilename\fR is simply a flat file, with one
790 symbol name per line.  Line comments may be introduced by the hash
791 character.  This option may be given more than once.
792 .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
793 .IX Item "--keep-global-symbols=filename"
794 Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
795 file \fIfilename\fR.  \fIfilename\fR is simply a flat file, with one
796 symbol name per line.  Line comments may be introduced by the hash
797 character.  This option may be given more than once.
798 .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
799 .IX Item "--localize-symbols=filename"
800 Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
801 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
802 name per line.  Line comments may be introduced by the hash character.
803 This option may be given more than once.
804 .IP "\fB\-\-globalize\-symbols=\fR\fIfilename\fR" 4
805 .IX Item "--globalize-symbols=filename"
806 Apply \fB\-\-globalize\-symbol\fR option to each symbol listed in the file
807 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
808 name per line.  Line comments may be introduced by the hash character.
809 This option may be given more than once.
810 .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
811 .IX Item "--weaken-symbols=filename"
812 Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
813 \&\fIfilename\fR.  \fIfilename\fR is simply a flat file, with one symbol
814 name per line.  Line comments may be introduced by the hash character.
815 This option may be given more than once.
816 .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
817 .IX Item "--alt-machine-code=index"
818 If the output architecture has alternate machine codes, use the
819 \&\fIindex\fRth code instead of the default one.  This is useful in case
820 a machine is assigned an official code and the tool-chain adopts the
821 new code, but other applications still depend on the original code
822 being used.  For \s-1ELF\s0 based architectures if the \fIindex\fR
823 alternative does not exist then the value is treated as an absolute
824 number to be stored in the e_machine field of the \s-1ELF\s0 header.
825 .IP "\fB\-\-writable\-text\fR" 4
826 .IX Item "--writable-text"
827 Mark the output text as writable.  This option isn't meaningful for all
828 object file formats.
829 .IP "\fB\-\-readonly\-text\fR" 4
830 .IX Item "--readonly-text"
831 Make the output text write protected.  This option isn't meaningful for all
832 object file formats.
833 .IP "\fB\-\-pure\fR" 4
834 .IX Item "--pure"
835 Mark the output file as demand paged.  This option isn't meaningful for all
836 object file formats.
837 .IP "\fB\-\-impure\fR" 4
838 .IX Item "--impure"
839 Mark the output file as impure.  This option isn't meaningful for all
840 object file formats.
841 .IP "\fB\-\-prefix\-symbols=\fR\fIstring\fR" 4
842 .IX Item "--prefix-symbols=string"
843 Prefix all symbols in the output file with \fIstring\fR.
844 .IP "\fB\-\-prefix\-sections=\fR\fIstring\fR" 4
845 .IX Item "--prefix-sections=string"
846 Prefix all section names in the output file with \fIstring\fR.
847 .IP "\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR" 4
848 .IX Item "--prefix-alloc-sections=string"
849 Prefix all the names of all allocated sections in the output file with
850 \&\fIstring\fR.
851 .IP "\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR" 4
852 .IX Item "--add-gnu-debuglink=path-to-file"
853 Creates a .gnu_debuglink section which contains a reference to
854 \&\fIpath-to-file\fR and adds it to the output file.  Note: the file at
855 \&\fIpath-to-file\fR must exist.  Part of the process of adding the
856 \&.gnu_debuglink section involves embedding a checksum of the contents
857 of the debug info file into the section.
858 .Sp
859 If the debug info file is built in one location but it is going to be
860 installed at a later time into a different location then do not use
861 the path to the installed location.  The \fB\-\-add\-gnu\-debuglink\fR
862 option will fail because the installed file does not exist yet.
863 Instead put the debug info file in the current directory and use the
864 \&\fB\-\-add\-gnu\-debuglink\fR option without any directory components,
865 like this:
866 .Sp
867 .Vb 1
868 \&         objcopy \-\-add\-gnu\-debuglink=foo.debug
869 .Ve
870 .Sp
871 At debug time the debugger will attempt to look for the separate debug
872 info file in a set of known locations.  The exact set of these
873 locations varies depending upon the distribution being used, but it
874 typically includes:
875 .RS 4
876 .ie n .IP """* The same directory as the executable.""" 4
877 .el .IP "\f(CW* The same directory as the executable.\fR" 4
878 .IX Item "* The same directory as the executable."
879 .PD 0
880 .ie n .IP """* A sub\-directory of the directory containing the executable""" 4
881 .el .IP "\f(CW* A sub\-directory of the directory containing the executable\fR" 4
882 .IX Item "* A sub-directory of the directory containing the executable"
883 .PD
884 called .debug
885 .ie n .IP """* A global debug directory such as /usr/lib/debug.""" 4
886 .el .IP "\f(CW* A global debug directory such as /usr/lib/debug.\fR" 4
887 .IX Item "* A global debug directory such as /usr/lib/debug."
888 .RE
889 .RS 4
890 .Sp
891 As long as the debug info file has been installed into one of these
892 locations before the debugger is run everything should work
893 correctly.
894 .RE
895 .IP "\fB\-\-keep\-file\-symbols\fR" 4
896 .IX Item "--keep-file-symbols"
897 When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
898 \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names,
899 which would otherwise get stripped.
900 .IP "\fB\-\-only\-keep\-debug\fR" 4
901 .IX Item "--only-keep-debug"
902 Strip a file, removing contents of any sections that would not be
903 stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections
904 intact.  In \s-1ELF\s0 files, this preserves all note sections in the output.
905 .Sp
906 Note \- the section headers of the stripped sections are preserved,
907 including their sizes, but the contents of the section are discarded.
908 The section headers are preserved so that other tools can match up the
909 debuginfo file with the real executable, even if that executable has
910 been relocated to a different address space.
911 .Sp
912 The intention is that this option will be used in conjunction with
913 \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable.  One a
914 stripped binary which will occupy less space in \s-1RAM\s0 and in a
915 distribution and the second a debugging information file which is only
916 needed if debugging abilities are required.  The suggested procedure
917 to create these files is as follows:
918 .RS 4
919 .IP "1.<Link the executable as normal.  Assuming that is is called>" 4
920 .IX Item "1.<Link the executable as normal. Assuming that is is called>"
921 \&\f(CW\*(C`foo\*(C'\fR then...
922 .ie n .IP "1.<Run ""objcopy \-\-only\-keep\-debug foo foo.dbg"" to>" 4
923 .el .IP "1.<Run \f(CWobjcopy \-\-only\-keep\-debug foo foo.dbg\fR to>" 4
924 .IX Item "1.<Run objcopy --only-keep-debug foo foo.dbg to>"
925 create a file containing the debugging info.
926 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"" to create a>" 4
927 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR to create a>" 4
928 .IX Item "1.<Run objcopy --strip-debug foo to create a>"
929 stripped executable.
930 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.dbg foo"">" 4
931 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.dbg foo\fR>" 4
932 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.dbg foo>"
933 to add a link to the debugging info into the stripped executable.
934 .RE
935 .RS 4
936 .Sp
937 Note\-\-\-the choice of \f(CW\*(C`.dbg\*(C'\fR as an extension for the debug info
938 file is arbitrary.  Also the \f(CW\*(C`\-\-only\-keep\-debug\*(C'\fR step is
939 optional.  You could instead do this:
940 .IP "1.<Link the executable as normal.>" 4
941 .IX Item "1.<Link the executable as normal.>"
942 .PD 0
943 .ie n .IP "1.<Copy ""foo"" to  ""foo.full"">" 4
944 .el .IP "1.<Copy \f(CWfoo\fR to  \f(CWfoo.full\fR>" 4
945 .IX Item "1.<Copy foo to foo.full>"
946 .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"">" 4
947 .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR>" 4
948 .IX Item "1.<Run objcopy --strip-debug foo>"
949 .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.full foo"">" 4
950 .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.full foo\fR>" 4
951 .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.full foo>"
952 .RE
953 .RS 4
954 .PD
955 .Sp
956 i.e., the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the
957 full executable.  It does not have to be a file created by the
958 \&\fB\-\-only\-keep\-debug\fR switch.
959 .Sp
960 Note\-\-\-this switch is only intended for use on fully linked files.  It
961 does not make sense to use it on object files where the debugging
962 information may be incomplete.  Besides the gnu_debuglink feature
963 currently only supports the presence of one filename containing
964 debugging information, not multiple filenames on a one-per-object-file
965 basis.
966 .RE
967 .IP "\fB\-\-strip\-dwo\fR" 4
968 .IX Item "--strip-dwo"
969 Remove the contents of all \s-1DWARF \s0.dwo sections, leaving the
970 remaining debugging sections and all symbols intact.
971 This option is intended for use by the compiler as part of
972 the \fB\-gsplit\-dwarf\fR option, which splits debug information
973 between the .o file and a separate .dwo file.  The compiler
974 generates all debug information in the same file, then uses
975 the \fB\-\-extract\-dwo\fR option to copy the .dwo sections to
976 the .dwo file, then the \fB\-\-strip\-dwo\fR option to remove
977 those sections from the original .o file.
978 .IP "\fB\-\-extract\-dwo\fR" 4
979 .IX Item "--extract-dwo"
980 Extract the contents of all \s-1DWARF \s0.dwo sections.  See the
981 \&\fB\-\-strip\-dwo\fR option for more information.
982 .IP "\fB\-\-file\-alignment\fR \fInum\fR" 4
983 .IX Item "--file-alignment num"
984 Specify the file alignment.  Sections in the file will always begin at
985 file offsets which are multiples of this number.  This defaults to
986 512.
987 [This option is specific to \s-1PE\s0 targets.]
988 .IP "\fB\-\-heap\fR \fIreserve\fR" 4
989 .IX Item "--heap reserve"
990 .PD 0
991 .IP "\fB\-\-heap\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
992 .IX Item "--heap reserve,commit"
993 .PD
994 Specify the number of bytes of memory to reserve (and optionally commit)
995 to be used as heap for this program.
996 [This option is specific to \s-1PE\s0 targets.]
997 .IP "\fB\-\-image\-base\fR \fIvalue\fR" 4
998 .IX Item "--image-base value"
999 Use \fIvalue\fR as the base address of your program or dll.  This is
1000 the lowest memory location that will be used when your program or dll
1001 is loaded.  To reduce the need to relocate and improve performance of
1002 your dlls, each should have a unique base address and not overlap any
1003 other dlls.  The default is 0x400000 for executables, and 0x10000000
1004 for dlls.
1005 [This option is specific to \s-1PE\s0 targets.]
1006 .IP "\fB\-\-section\-alignment\fR \fInum\fR" 4
1007 .IX Item "--section-alignment num"
1008 Sets the section alignment.  Sections in memory will always begin at
1009 addresses which are a multiple of this number.  Defaults to 0x1000.
1010 [This option is specific to \s-1PE\s0 targets.]
1011 .IP "\fB\-\-stack\fR \fIreserve\fR" 4
1012 .IX Item "--stack reserve"
1013 .PD 0
1014 .IP "\fB\-\-stack\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
1015 .IX Item "--stack reserve,commit"
1016 .PD
1017 Specify the number of bytes of memory to reserve (and optionally commit)
1018 to be used as stack for this program.
1019 [This option is specific to \s-1PE\s0 targets.]
1020 .IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
1021 .IX Item "--subsystem which"
1022 .PD 0
1023 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR" 4
1024 .IX Item "--subsystem which:major"
1025 .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR\fB.\fR\fIminor\fR" 4
1026 .IX Item "--subsystem which:major.minor"
1027 .PD
1028 Specifies the subsystem under which your program will execute.  The
1029 legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
1030 \&\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,
1031 \&\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
1032 the subsystem version also.  Numeric values are also accepted for
1033 \&\fIwhich\fR.
1034 [This option is specific to \s-1PE\s0 targets.]
1035 .IP "\fB\-\-extract\-symbol\fR" 4
1036 .IX Item "--extract-symbol"
1037 Keep the file's section flags and symbols but remove all section data.
1038 Specifically, the option:
1039 .RS 4
1040 .IP "*<removes the contents of all sections;>" 4
1041 .IX Item "*<removes the contents of all sections;>"
1042 .PD 0
1043 .IP "*<sets the size of every section to zero; and>" 4
1044 .IX Item "*<sets the size of every section to zero; and>"
1045 .IP "*<sets the file's start address to zero.>" 4
1046 .IX Item "*<sets the file's start address to zero.>"
1047 .RE
1048 .RS 4
1049 .PD
1050 .Sp
1051 This option is used to build a \fI.sym\fR file for a VxWorks kernel.
1052 It can also be a useful way of reducing the size of a \fB\-\-just\-symbols\fR
1053 linker input file.
1054 .RE
1055 .IP "\fB\-\-compress\-debug\-sections\fR" 4
1056 .IX Item "--compress-debug-sections"
1057 Compress \s-1DWARF\s0 debug sections using zlib with \s-1SHF_COMPRESSED\s0 from the
1058 \&\s-1ELF ABI. \s0 Note \- if compression would actually make a section
1059 \&\fIlarger\fR, then it is not compressed.
1060 .IP "\fB\-\-compress\-debug\-sections=none\fR" 4
1061 .IX Item "--compress-debug-sections=none"
1062 .PD 0
1063 .IP "\fB\-\-compress\-debug\-sections=zlib\fR" 4
1064 .IX Item "--compress-debug-sections=zlib"
1065 .IP "\fB\-\-compress\-debug\-sections=zlib\-gnu\fR" 4
1066 .IX Item "--compress-debug-sections=zlib-gnu"
1067 .IP "\fB\-\-compress\-debug\-sections=zlib\-gabi\fR" 4
1068 .IX Item "--compress-debug-sections=zlib-gabi"
1069 .PD
1070 For \s-1ELF\s0 files, these options control how \s-1DWARF\s0 debug sections are
1071 compressed.  \fB\-\-compress\-debug\-sections=none\fR is equivalent
1072 to \fB\-\-decompress\-debug\-sections\fR.
1073 \&\fB\-\-compress\-debug\-sections=zlib\fR and
1074 \&\fB\-\-compress\-debug\-sections=zlib\-gabi\fR are equivalent to
1075 \&\fB\-\-compress\-debug\-sections\fR.
1076 \&\fB\-\-compress\-debug\-sections=zlib\-gnu\fR compresses \s-1DWARF\s0 debug
1077 sections using zlib.  The debug sections are renamed to begin with
1078 \&\fB.zdebug\fR instead of \fB.debug\fR.  Note \- if compression would
1079 actually make a section \fIlarger\fR, then it is not compressed nor
1080 renamed.
1081 .IP "\fB\-\-decompress\-debug\-sections\fR" 4
1082 .IX Item "--decompress-debug-sections"
1083 Decompress \s-1DWARF\s0 debug sections using zlib.  The original section
1084 names of the compressed sections are restored.
1085 .IP "\fB\-\-elf\-stt\-common=yes\fR" 4
1086 .IX Item "--elf-stt-common=yes"
1087 .PD 0
1088 .IP "\fB\-\-elf\-stt\-common=no\fR" 4
1089 .IX Item "--elf-stt-common=no"
1090 .PD
1091 For \s-1ELF\s0 files, these options control whether common symbols should be
1092 converted to the \f(CW\*(C`STT_COMMON\*(C'\fR or \f(CW\*(C`STT_OBJECT\*(C'\fR type.
1093 \&\fB\-\-elf\-stt\-common=yes\fR converts common symbol type to
1094 \&\f(CW\*(C`STT_COMMON\*(C'\fR. \fB\-\-elf\-stt\-common=no\fR converts common symbol
1095 type to \f(CW\*(C`STT_OBJECT\*(C'\fR.
1096 .IP "\fB\-V\fR" 4
1097 .IX Item "-V"
1098 .PD 0
1099 .IP "\fB\-\-version\fR" 4
1100 .IX Item "--version"
1101 .PD
1102 Show the version number of \fBobjcopy\fR.
1103 .IP "\fB\-v\fR" 4
1104 .IX Item "-v"
1105 .PD 0
1106 .IP "\fB\-\-verbose\fR" 4
1107 .IX Item "--verbose"
1108 .PD
1109 Verbose output: list all object files modified.  In the case of
1110 archives, \fBobjcopy \-V\fR lists all members of the archive.
1111 .IP "\fB\-\-help\fR" 4
1112 .IX Item "--help"
1113 Show a summary of the options to \fBobjcopy\fR.
1114 .IP "\fB\-\-info\fR" 4
1115 .IX Item "--info"
1116 Display a list showing all architectures and object formats available.
1117 .IP "\fB@\fR\fIfile\fR" 4
1118 .IX Item "@file"
1119 Read command-line options from \fIfile\fR.  The options read are
1120 inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
1121 does not exist, or cannot be read, then the option will be treated
1122 literally, and not removed.
1123 .Sp
1124 Options in \fIfile\fR are separated by whitespace.  A whitespace
1125 character may be included in an option by surrounding the entire
1126 option in either single or double quotes.  Any character (including a
1127 backslash) may be included by prefixing the character to be included
1128 with a backslash.  The \fIfile\fR may itself contain additional
1129 @\fIfile\fR options; any such options will be processed recursively.
1130 .SH "SEE ALSO"
1131 .IX Header "SEE ALSO"
1132 \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
1133 .SH "COPYRIGHT"
1134 .IX Header "COPYRIGHT"
1135 Copyright (c) 1991\-2016 Free Software Foundation, Inc.
1136 .PP
1137 Permission is granted to copy, distribute and/or modify this document
1138 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
1139 or any later version published by the Free Software Foundation;
1140 with no Invariant Sections, with no Front-Cover Texts, and with no
1141 Back-Cover Texts.  A copy of the license is included in the
1142 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".