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