]> Git Repo - binutils.git/blame_incremental - binutils/objcopy.1
* Makefile.in (VERSION): Set to cygnus-2.7.1.
[binutils.git] / binutils / objcopy.1
... / ...
CommitLineData
1.\" Copyright (c) 1991 Free Software Foundation
2.\" See section COPYING for conditions for redistribution
3.TH objcopy 1 "October 1994" "cygnus support" "GNU Development Tools"
4.de BP
5.sp
6.ti \-.2i
7\(**
8..
9
10.SH NAME
11objcopy \- copy and translate object files
12
13.SH SYNOPSIS
14.hy 0
15.na
16.TP
17.B objcopy
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 "\|]"
24.RB "[\|" \-\-strip\-unneeded\fR "\|]"
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 "\|]"
29.RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]"
30.RB "[\|" \-i\ \fIinterleave\fR\ |\ \fB\-\-interleave=\fIinterleave\fR "\|]"
31.RB "[\|" \-\-debugging "\|]"
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 "\|]"
40.RB "[\|" \-\-set\-section\-flags=\fIsection=flags\fR "\|]"
41.RB "[\|" \-\-add\-section=\fIsectionname=filename\fR "\|]"
42.RB "[\|" \-\-remove\-leading\-char\fR "\|]"
43.RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
44.RB "[\|" \-V\ |\ \-\-version\fR "\|]"
45.RB "[\|" \-\-help\fR "\|]"
46.B infile
47.RB "[\|" outfile\fR "\|]"
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.
58.PP
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.
66.PP
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
82information will be discarded. The memory dump will start at the
83virtual address of the lowest section copied into the output file.
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
93.I infile
94and
95.I outfile
96are the source and output files respectively. If you do not specify
97.IR outfile ,
98.B objcopy
99creates a temporary file and destructively renames the result with the
100name of the input file.
101
102.SH OPTIONS
103.TP
104.B \-I \fIbfdname\fR, \fB\-\-input\-target=\fIbfdname
105Consider the source file's object format to be
106.IR bfdname ,
107rather than attempting to deduce it.
108.TP
109.B \-O \fIbfdname\fR, \fB\-\-output\-target=\fIbfdname
110Write the output file using the object format
111.IR bfdname .
112.TP
113.B \-F \fIbfdname\fR, \fB\-\-target=\fIbfdname
114Use
115.I bfdname
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
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
124.B \-S\fR, \fB\-\-strip\-all
125Do not copy relocation and symbol information from the source file.
126.TP
127.B \-g\fR, \fB\-\-strip\-debug
128Do not copy debugging symbols from the source file.
129.TP
130.B \-\-strip\-unneeded
131Strip all symbols that are not needed for relocation processing.
132.TP
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
137.B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname
138Do not copy symbol \fIsymbolname\fP from the source file. This option
139may be given more than once, and may be combined with strip options
140other than \fB\-K\fR.
141.TP
142.B \-x\fR, \fB \-\-discard\-all
143Do not copy non-global symbols from the source file.
144.TP
145.B \-X\fR, \fB\-\-discard\-locals
146Do not copy compiler-generated local symbols. (These usually start
147with "L" or ".").
148.TP
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
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
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
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
176.B \fB\-\-set\-start=\fIval
177Set the start address of the new file to \fIval\fP. Not all object
178file formats support setting the start address.
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
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
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
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
230.B \-v\fR, \fB\-\-verbose
231Verbose output: list all object files modified. In the case of
232archives, "\fBobjcopy \-V\fR" lists all members of the archive.
233.TP
234.B \-V\fR, \fB\-\-version
235Show the version number of
236.B objcopy
237and exit.
238.TP
239.B \-\-help
240Show a summary of the options to
241.B objcopy
242and exit.
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
254Copyright (c) 1993, 94, 95, 1996 Free Software Foundation, Inc.
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.023057 seconds and 4 git commands to generate.