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