* values.c (unpack_double): Make it compile with MSVC++ 2.x.
[deliverable/binutils-gdb.git] / binutils / objcopy.1
CommitLineData
08ad9921
JO
1.\" Copyright (c) 1991 Free Software Foundation
2.\" See section COPYING for conditions for redistribution
6c7ed084 3.TH objcopy 1 "October 1994" "cygnus support" "GNU Development Tools"
08ad9921
JO
4.de BP
5.sp
6.ti \-.2i
7\(**
8..
9
10.SH NAME
f7b839f7 11objcopy \- copy and translate object files
08ad9921
JO
12
13.SH SYNOPSIS
14.hy 0
15.na
b26ac613 16.TP
08ad9921 17.B objcopy
dff604a7
ILT
18.RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fR "\|]"
19.RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fR "\|]"
20.RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fR "\|]"
21.RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fR "\|]"
22.RB "[\|" \-S\fR\ |\ \fB\-\-strip\-all\fR "\|]"
23.RB "[\|" \-g\fR\ |\ \fB\-\-strip\-debug\fR "\|]"
9135e5f8 24.RB "[\|" \-\-strip\-unneeded\fR "\|]"
dff604a7
ILT
25.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]"
26.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]"
27.RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all\fR "\|]"
28.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals\fR "\|]"
33e0a06d
ILT
29.RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]"
30.RB "[\|" \-i\ \fIinterleave\fR\ |\ \fB\-\-interleave=\fIinterleave\fR "\|]"
f5818d79 31.RB "[\|" \-\-debugging "\|]"
33e0a06d
ILT
32.RB "[\|" \-\-gap\-fill=\fIval\fR "\|]"
33.RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]"
34.RB "[\|" \-\-set\-start=\fIval\fR "\|]"
35.RB "[\|" \-\-adjust\-start=\fIincr\fR "\|]"
36.RB "[\|" \-\-adjust\-vma=\fIincr\fR "\|]"
37.RB "[\|" \-\-adjust\-section\-vma=\fIsection{=,+,-}val\fR "\|]"
38.RB "[\|" \-\-adjust\-warnings\fR "\|]"
39.RB "[\|" \-\-no\-adjust\-warnings\fR "\|]"
5ab41086 40.RB "[\|" \-\-set\-section\-flags=\fIsection=flags\fR "\|]"
d0130cc8 41.RB "[\|" \-\-add\-section=\fIsectionname=filename\fR "\|]"
decf2865 42.RB "[\|" \-\-change\-leading\-char\fR "\|]"
5da470b2 43.RB "[\|" \-\-remove\-leading\-char\fR "\|]"
3883531f
JO
44.RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
45.RB "[\|" \-V\ |\ \-\-version\fR "\|]"
46.RB "[\|" \-\-help\fR "\|]"
b26ac613 47.B infile
3883531f 48.RB "[\|" outfile\fR "\|]"
08ad9921
JO
49.SH DESCRIPTION
50The GNU
51.B objcopy
52utility copies the contents of an object file to another.
53.B objcopy
54uses the GNU BFD Library to read and write the object files. It can
55write the destination object file in a format different from that of
56the source object file. The exact behavior of
57.B objcopy
58is controlled by command-line options.
b26ac613 59.PP
08ad9921
JO
60.B objcopy
61creates temporary files to do its translations and deletes them
62afterward.
63.B objcopy
64uses BFD to do all its translation work; it knows about all the
65formats BFD knows about, and thus is able to recognize most formats
66without being told explicitly.
b26ac613 67.PP
67f67ed9
ILT
68.B objcopy
69can be used to generate S-records by using an output target of
70.B srec
71(e.g., use
72.B -O srec).
73.PP
74.B objcopy
75can be used to generate a raw binary file by using an output target of
76.B binary
77(e.g., use
78.B -O binary).
79When
80.B objcopy
81generates a raw binary file, it will essentially produce a memory dump
82of the contents of the input object file. All symbols and relocation
a6afc090
ILT
83information will be discarded. The memory dump will start at the
84virtual address of the lowest section copied into the output file.
67f67ed9
ILT
85.PP
86When generating an S-record or a raw binary file, it may be helpful to
87use
88.B -S
89to remove sections containing debugging information. In some cases
90.B -R
91will be useful to remove sections which contain information which is
92not needed by the binary file.
93.PP
b26ac613
DM
94.I infile
95and
96.I outfile
97are the source and output files respectively. If you do not specify
08ad9921
JO
98.IR outfile ,
99.B objcopy
100creates a temporary file and destructively renames the result with the
101name of the input file.
b26ac613
DM
102
103.SH OPTIONS
08ad9921 104.TP
eae04238 105.B \-I \fIbfdname\fR, \fB\-\-input\-target=\fIbfdname
08ad9921 106Consider the source file's object format to be
eae04238 107.IR bfdname ,
08ad9921
JO
108rather than attempting to deduce it.
109.TP
eae04238 110.B \-O \fIbfdname\fR, \fB\-\-output\-target=\fIbfdname
08ad9921 111Write the output file using the object format
eae04238 112.IR bfdname .
08ad9921 113.TP
eae04238 114.B \-F \fIbfdname\fR, \fB\-\-target=\fIbfdname
08ad9921 115Use
eae04238 116.I bfdname
08ad9921
JO
117as the object format for both the input and the output file; i.e.
118simply transfer data from source to destination with no translation.
119.TP
0aca460e
ILT
120.B \-R \fIsectionname\fR, \fB\-\-remove-section=\fIsectionname
121Remove the named section from the file. This option may be given more
122than once. Note that using this option inappropriately may make the
123output file unusable.
124.TP
3883531f 125.B \-S\fR, \fB\-\-strip\-all
08ad9921
JO
126Do not copy relocation and symbol information from the source file.
127.TP
3883531f 128.B \-g\fR, \fB\-\-strip\-debug
08ad9921
JO
129Do not copy debugging symbols from the source file.
130.TP
9135e5f8
ILT
131.B \-\-strip\-unneeded
132Strip all symbols that are not needed for relocation processing.
133.TP
dff604a7
ILT
134.B \-K \fIsymbolname\fR, \fB\-\-keep\-symbol=\fIsymbolname
135Copy only symbol \fIsymbolname\fP from the source file. This option
136may be given more than once.
137.TP
29c0d15c
ILT
138.B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname
139Do not copy symbol \fIsymbolname\fP from the source file. This option
dff604a7
ILT
140may be given more than once, and may be combined with strip options
141other than \fB\-K\fR.
29c0d15c 142.TP
3883531f 143.B \-x\fR, \fB \-\-discard\-all
08ad9921
JO
144Do not copy non-global symbols from the source file.
145.TP
3883531f 146.B \-X\fR, \fB\-\-discard\-locals
08ad9921
JO
147Do not copy compiler-generated local symbols. (These usually start
148with "L" or ".").
149.TP
f7b839f7
DM
150.B \-b \fIbyte\fR, \fB\-\-byte=\fIbyte
151Keep only every \fIbyte\fPth byte of the input file (header data is
152not affected). \fIbyte\fP can be in the range from 0 to the
153interleave-1. This option is useful for creating files to program
154ROMs. It is typically used with an srec output target.
155.TP
156.B \-i \fIinterleave\fR, \fB\-\-interleave=\fIinterleave
157Only copy one out of every \fIinterleave\fP bytes. Which one to copy is
158selected by the \fB\-b\fP or \fB\-\-byte\fP option. The default is 4.
159The interleave is ignored if neither \fB\-b\fP nor \fB\-\-byte\fP is given.
160.TP
f5818d79
ILT
161.B \-\-debugging
162Convert debugging information, if possible. This is not the default
163because only certain debugging formats are supported, and the
164conversion process can be time consuming.
165.TP
596d99ba
ILT
166.B \-\-gap\-fill=\fIval
167Fill gaps between sections with \fIval\fP. This is done by increasing
168the size of the section with the lower address, and filling in the extra
169space created with \fIval\fP.
170.TP
33e0a06d
ILT
171.B \-\-pad\-to=\fIaddress
172Pad the output file up to the virtual address \fIaddress\fP. This is
173done by increasing the size of the last section. The extra space is
174filled in with the value specified by \fB\-\-gap\-fill\fP (default
175zero).
176.TP
6c7ed084
ILT
177.B \fB\-\-set\-start=\fIval
178Set the start address of the new file to \fIval\fP. Not all object
a6afc090 179file formats support setting the start address.
6c7ed084
ILT
180.TP
181.B \fB\-\-adjust\-start=\fIincr
182Adjust the start address by adding \fIincr\fP. Not all object file
183formats support setting the start address.
184.TP
185.B \fB\-\-adjust\-vma=\fIincr
186Adjust the address of all sections, as well as the start address, by
187adding \fIincr\fP. Some object file formats do not permit section
188addresses to be changed arbitrarily. Note that this does not relocate
189the sections; if the program expects sections to be loaded at a
190certain address, and this option is used to change the sections such
191that they are loaded at a different address, the program may fail.
192.TP
193.B \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val
194Set or adjust the address of the named \fIsection\fP. If \fI=\fP is
195used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
196is added to or subtracted from the section address. See the comments
197under \fB\-\-adjust\-vma\fP, above. If \fIsection\fP does not exist
198in the input file, a warning will be issued, unless
199\fB\-\-no\-adjust\-warnings\fP is used.
200.TP
201.B \fB\-\-adjust\-warnings
202If \fB\-\-adjust\-section\-vma\fP is used, and the named section does
203not exist, issue a warning. This is the default.
204.TP
205.B \fB\-\-no\-adjust\-warnings
206Do not issue a warning if \fB\-\-adjust\-section\-vma\fP is used, even
207if the named section does not exist.
208.TP
5ab41086
ILT
209.B \fB\-\-set\-section\-flags=\fIsection=flags
210Set the flags for the named section. The \fIflags\fP argument is a
211comma separated string of flag names. The recognized names are
212\fIalloc\fP, \fIload\fP, \fIreadonly\fP, \fIcode\fP, \fIdata\fP, and
213\fIrom\fP. Not all flags are meaningful for all object file
214formats.
215.TP
d0130cc8
ILT
216.B \fB\-\-add\-section=\fIsectionname=filename
217Add a new section named \fIsectionname\fR while copying the file. The
218contents of the new section are taken from the file \fIfilename\fR.
219The size of the section will be the size of the file. This option
220only works on file formats which can support sections with arbitrary
221names.
222.TP
decf2865
ILT
223.B \-\-change\-leading\-char
224Some object file formats use special characters at the start of
225symbols. The most common such character is underscore, which compilers
226often add before every symbol. This option tells
227.B objcopy
228to change the leading character of every symbol when it converts
229between object file formats. If the object file formats use the same
230leading character, this option has no effect. Otherwise, it will add
231a character, or remove a character, or change a character, as
232appropriate.
233.TP
5da470b2
ILT
234.B \-\-remove\-leading\-char
235If the first character of a global symbol is a special symbol leading
236character used by the object file format, remove the character. The
237most common symbol leading character is underscore. This option will
decf2865
ILT
238remove a leading underscore from all global symbols. This can be
239useful if you want to link together objects of different file formats
240with different conventions for symbol names. This is different from
241@code{--change-leading-char} because it always changes the symbol name
242when appropriate, regardless of the object file format of the output
5da470b2 243.TP
3883531f 244.B \-v\fR, \fB\-\-verbose
08ad9921 245Verbose output: list all object files modified. In the case of
b26ac613
DM
246archives, "\fBobjcopy \-V\fR" lists all members of the archive.
247.TP
3883531f 248.B \-V\fR, \fB\-\-version
08ad9921 249Show the version number of
b26ac613
DM
250.B objcopy
251and exit.
252.TP
253.B \-\-help
254Show a summary of the options to
255.B objcopy
256and exit.
08ad9921
JO
257.SH "SEE ALSO"
258.RB "`\|" binutils "\|'"
259entry in
260.B
261info\c
262\&;
263.I
264The GNU Binary Utilities\c
265\&, Roland H. Pesch (June 1993).
266
267.SH COPYING
f5818d79 268Copyright (c) 1993, 94, 95, 1996 Free Software Foundation, Inc.
08ad9921
JO
269.PP
270Permission is granted to make and distribute verbatim copies of
271this manual provided the copyright notice and this permission notice
272are preserved on all copies.
273.PP
274Permission is granted to copy and distribute modified versions of this
275manual under the conditions for verbatim copying, provided that the
276entire resulting derived work is distributed under the terms of a
277permission notice identical to this one.
278.PP
279Permission is granted to copy and distribute translations of this
280manual into another language, under the above conditions for modified
281versions, except that this permission notice may be included in
282translations approved by the Free Software Foundation instead of in
283the original English.
This page took 0.128954 seconds and 4 git commands to generate.