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