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