* Makefile.in (ALL_MACHINES): Add tekhex.o.
[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
eae04238
DM
18.RB "[\|" \-F\ \fIbfdname\fB\ |\ \-\-target=\fIbfdname\fR "\|]"
19.RB "[\|" \-I\ \fIbfdname\fB\ |\ \-\-input\-target=\fIbfdname\fR "\|]"
20.RB "[\|" \-O\ \fIbfdname\fB\ |\ \-\-output\-target=\fIbfdname\fR "\|]"
0aca460e 21.RB "[\|" \-R\ \fIsectionname\fB\ |\ \-\-remove\-section=\fIsectionname\fR "\|]"
3883531f
JO
22.RB "[\|" \-S\ |\ \-\-strip\-all\fR "\|]"
23.RB "[\|" \-g\ |\ \-\-strip\-debug\fR "\|]"
24.RB "[\|" \-x\ |\ \-\-discard\-all\fR "\|]"
25.RB "[\|" \-X\ |\ \-\-discard\-locals\fR "\|]"
6c7ed084
ILT
26.RB "[\|" \-b\ \fIbyte\fP |\ \-\-byte=\fIbyte\fP "\|]"
27.RB "[\|" \-i\ \fIinterleave\fP |\ \-\-interleave=\fIinterleave\fP "\|]"
596d99ba 28.RB "[\|" \-\-gap\-fill=\fIval\fP "\|]"
6c7ed084
ILT
29.RB "[\|" \-\-set\-start=\fIval\fP "\|]"
30.RB "[\|" \-\-adjust\-start=\fIincr\fP "\|]"
31.RB "[\|" \-\-adjust\-vma=\fIincr\fP "\|]"
32.RB "[\|" \-\-adjust\-section\-vma=\fIsection{=,+,-}val\fP "\|]"
33.RB "[\|" \-\-adjust\-warnings "\|]"
34.RB "[\|" \-\-no\-adjust\-warnings "\|]"
3883531f
JO
35.RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
36.RB "[\|" \-V\ |\ \-\-version\fR "\|]"
37.RB "[\|" \-\-help\fR "\|]"
b26ac613 38.B infile
3883531f 39.RB "[\|" outfile\fR "\|]"
08ad9921
JO
40.SH DESCRIPTION
41The GNU
42.B objcopy
43utility copies the contents of an object file to another.
44.B objcopy
45uses the GNU BFD Library to read and write the object files. It can
46write the destination object file in a format different from that of
47the source object file. The exact behavior of
48.B objcopy
49is controlled by command-line options.
b26ac613 50.PP
08ad9921
JO
51.B objcopy
52creates temporary files to do its translations and deletes them
53afterward.
54.B objcopy
55uses BFD to do all its translation work; it knows about all the
56formats BFD knows about, and thus is able to recognize most formats
57without being told explicitly.
b26ac613 58.PP
67f67ed9
ILT
59.B objcopy
60can be used to generate S-records by using an output target of
61.B srec
62(e.g., use
63.B -O srec).
64.PP
65.B objcopy
66can be used to generate a raw binary file by using an output target of
67.B binary
68(e.g., use
69.B -O binary).
70When
71.B objcopy
72generates a raw binary file, it will essentially produce a memory dump
73of the contents of the input object file. All symbols and relocation
a6afc090
ILT
74information will be discarded. The memory dump will start at the
75virtual address of the lowest section copied into the output file.
67f67ed9
ILT
76.PP
77When generating an S-record or a raw binary file, it may be helpful to
78use
79.B -S
80to remove sections containing debugging information. In some cases
81.B -R
82will be useful to remove sections which contain information which is
83not needed by the binary file.
84.PP
b26ac613
DM
85.I infile
86and
87.I outfile
88are the source and output files respectively. If you do not specify
08ad9921
JO
89.IR outfile ,
90.B objcopy
91creates a temporary file and destructively renames the result with the
92name of the input file.
b26ac613
DM
93
94.SH OPTIONS
08ad9921 95.TP
eae04238 96.B \-I \fIbfdname\fR, \fB\-\-input\-target=\fIbfdname
08ad9921 97Consider the source file's object format to be
eae04238 98.IR bfdname ,
08ad9921
JO
99rather than attempting to deduce it.
100.TP
eae04238 101.B \-O \fIbfdname\fR, \fB\-\-output\-target=\fIbfdname
08ad9921 102Write the output file using the object format
eae04238 103.IR bfdname .
08ad9921 104.TP
eae04238 105.B \-F \fIbfdname\fR, \fB\-\-target=\fIbfdname
08ad9921 106Use
eae04238 107.I bfdname
08ad9921
JO
108as the object format for both the input and the output file; i.e.
109simply transfer data from source to destination with no translation.
110.TP
0aca460e
ILT
111.B \-R \fIsectionname\fR, \fB\-\-remove-section=\fIsectionname
112Remove the named section from the file. This option may be given more
113than once. Note that using this option inappropriately may make the
114output file unusable.
115.TP
3883531f 116.B \-S\fR, \fB\-\-strip\-all
08ad9921
JO
117Do not copy relocation and symbol information from the source file.
118.TP
3883531f 119.B \-g\fR, \fB\-\-strip\-debug
08ad9921
JO
120Do not copy debugging symbols from the source file.
121.TP
3883531f 122.B \-x\fR, \fB \-\-discard\-all
08ad9921
JO
123Do not copy non-global symbols from the source file.
124.TP
3883531f 125.B \-X\fR, \fB\-\-discard\-locals
08ad9921
JO
126Do not copy compiler-generated local symbols. (These usually start
127with "L" or ".").
128.TP
f7b839f7
DM
129.B \-b \fIbyte\fR, \fB\-\-byte=\fIbyte
130Keep only every \fIbyte\fPth byte of the input file (header data is
131not affected). \fIbyte\fP can be in the range from 0 to the
132interleave-1. This option is useful for creating files to program
133ROMs. It is typically used with an srec output target.
134.TP
135.B \-i \fIinterleave\fR, \fB\-\-interleave=\fIinterleave
136Only copy one out of every \fIinterleave\fP bytes. Which one to copy is
137selected by the \fB\-b\fP or \fB\-\-byte\fP option. The default is 4.
138The interleave is ignored if neither \fB\-b\fP nor \fB\-\-byte\fP is given.
139.TP
596d99ba
ILT
140.B \-\-gap\-fill=\fIval
141Fill gaps between sections with \fIval\fP. This is done by increasing
142the size of the section with the lower address, and filling in the extra
143space created with \fIval\fP.
144.TP
6c7ed084
ILT
145.B \fB\-\-set\-start=\fIval
146Set the start address of the new file to \fIval\fP. Not all object
a6afc090 147file formats support setting the start address.
6c7ed084
ILT
148.TP
149.B \fB\-\-adjust\-start=\fIincr
150Adjust the start address by adding \fIincr\fP. Not all object file
151formats support setting the start address.
152.TP
153.B \fB\-\-adjust\-vma=\fIincr
154Adjust the address of all sections, as well as the start address, by
155adding \fIincr\fP. Some object file formats do not permit section
156addresses to be changed arbitrarily. Note that this does not relocate
157the sections; if the program expects sections to be loaded at a
158certain address, and this option is used to change the sections such
159that they are loaded at a different address, the program may fail.
160.TP
161.B \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val
162Set or adjust the address of the named \fIsection\fP. If \fI=\fP is
163used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
164is added to or subtracted from the section address. See the comments
165under \fB\-\-adjust\-vma\fP, above. If \fIsection\fP does not exist
166in the input file, a warning will be issued, unless
167\fB\-\-no\-adjust\-warnings\fP is used.
168.TP
169.B \fB\-\-adjust\-warnings
170If \fB\-\-adjust\-section\-vma\fP is used, and the named section does
171not exist, issue a warning. This is the default.
172.TP
173.B \fB\-\-no\-adjust\-warnings
174Do not issue a warning if \fB\-\-adjust\-section\-vma\fP is used, even
175if the named section does not exist.
176.TP
3883531f 177.B \-v\fR, \fB\-\-verbose
08ad9921 178Verbose output: list all object files modified. In the case of
b26ac613
DM
179archives, "\fBobjcopy \-V\fR" lists all members of the archive.
180.TP
3883531f 181.B \-V\fR, \fB\-\-version
08ad9921 182Show the version number of
b26ac613
DM
183.B objcopy
184and exit.
185.TP
186.B \-\-help
187Show a summary of the options to
188.B objcopy
189and exit.
08ad9921
JO
190.SH "SEE ALSO"
191.RB "`\|" binutils "\|'"
192entry in
193.B
194info\c
195\&;
196.I
197The GNU Binary Utilities\c
198\&, Roland H. Pesch (June 1993).
199
200.SH COPYING
6c7ed084 201Copyright (c) 1993,1994 Free Software Foundation, Inc.
08ad9921
JO
202.PP
203Permission is granted to make and distribute verbatim copies of
204this manual provided the copyright notice and this permission notice
205are preserved on all copies.
206.PP
207Permission is granted to copy and distribute modified versions of this
208manual under the conditions for verbatim copying, provided that the
209entire resulting derived work is distributed under the terms of a
210permission notice identical to this one.
211.PP
212Permission is granted to copy and distribute translations of this
213manual into another language, under the above conditions for modified
214versions, except that this permission notice may be included in
215translations approved by the Free Software Foundation instead of in
216the original English.
This page took 0.081183 seconds and 4 git commands to generate.