]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - binutils/objcopy.1
* objcopy.c (gap_fill): Explicitly initialize, for clarity.
[thirdparty/binutils-gdb.git] / binutils / objcopy.1
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
11 objcopy \- copy and translate object files
12
13 .SH SYNOPSIS
14 .hy 0
15 .na
16 .TP
17 .B objcopy
18 .RB "[\|" \-F\ \fIbfdname\fB\ |\ \-\-target=\fIbfdname\fR "\|]"
19 .RB "[\|" \-I\ \fIbfdname\fB\ |\ \-\-input\-target=\fIbfdname\fR "\|]"
20 .RB "[\|" \-O\ \fIbfdname\fB\ |\ \-\-output\-target=\fIbfdname\fR "\|]"
21 .RB "[\|" \-R\ \fIsectionname\fB\ |\ \-\-remove\-section=\fIsectionname\fR "\|]"
22 .RB "[\|" \-S\ |\ \-\-strip\-all\fR "\|]"
23 .RB "[\|" \-g\ |\ \-\-strip\-debug\fR "\|]"
24 .RB "[\|" \-x\ |\ \-\-discard\-all\fR "\|]"
25 .RB "[\|" \-X\ |\ \-\-discard\-locals\fR "\|]"
26 .RB "[\|" \-b\ \fIbyte\fR\ |\ \fB\-\-byte=\fIbyte\fR "\|]"
27 .RB "[\|" \-i\ \fIinterleave\fR\ |\ \fB\-\-interleave=\fIinterleave\fR "\|]"
28 .RB "[\|" \-\-gap\-fill=\fIval\fR "\|]"
29 .RB "[\|" \-\-pad\-to=\fIaddress\fR "\|]"
30 .RB "[\|" \-\-set\-start=\fIval\fR "\|]"
31 .RB "[\|" \-\-adjust\-start=\fIincr\fR "\|]"
32 .RB "[\|" \-\-adjust\-vma=\fIincr\fR "\|]"
33 .RB "[\|" \-\-adjust\-section\-vma=\fIsection{=,+,-}val\fR "\|]"
34 .RB "[\|" \-\-adjust\-warnings\fR "\|]"
35 .RB "[\|" \-\-no\-adjust\-warnings\fR "\|]"
36 .RB "[\|" \-v\ |\ \-\-verbose\fR "\|]"
37 .RB "[\|" \-V\ |\ \-\-version\fR "\|]"
38 .RB "[\|" \-\-help\fR "\|]"
39 .B infile
40 .RB "[\|" outfile\fR "\|]"
41 .SH DESCRIPTION
42 The GNU
43 .B objcopy
44 utility copies the contents of an object file to another.
45 .B objcopy
46 uses the GNU BFD Library to read and write the object files. It can
47 write the destination object file in a format different from that of
48 the source object file. The exact behavior of
49 .B objcopy
50 is controlled by command-line options.
51 .PP
52 .B objcopy
53 creates temporary files to do its translations and deletes them
54 afterward.
55 .B objcopy
56 uses BFD to do all its translation work; it knows about all the
57 formats BFD knows about, and thus is able to recognize most formats
58 without being told explicitly.
59 .PP
60 .B objcopy
61 can be used to generate S-records by using an output target of
62 .B srec
63 (e.g., use
64 .B -O srec).
65 .PP
66 .B objcopy
67 can be used to generate a raw binary file by using an output target of
68 .B binary
69 (e.g., use
70 .B -O binary).
71 When
72 .B objcopy
73 generates a raw binary file, it will essentially produce a memory dump
74 of the contents of the input object file. All symbols and relocation
75 information will be discarded. The memory dump will start at the
76 virtual address of the lowest section copied into the output file.
77 .PP
78 When generating an S-record or a raw binary file, it may be helpful to
79 use
80 .B -S
81 to remove sections containing debugging information. In some cases
82 .B -R
83 will be useful to remove sections which contain information which is
84 not needed by the binary file.
85 .PP
86 .I infile
87 and
88 .I outfile
89 are the source and output files respectively. If you do not specify
90 .IR outfile ,
91 .B objcopy
92 creates a temporary file and destructively renames the result with the
93 name of the input file.
94
95 .SH OPTIONS
96 .TP
97 .B \-I \fIbfdname\fR, \fB\-\-input\-target=\fIbfdname
98 Consider the source file's object format to be
99 .IR bfdname ,
100 rather than attempting to deduce it.
101 .TP
102 .B \-O \fIbfdname\fR, \fB\-\-output\-target=\fIbfdname
103 Write the output file using the object format
104 .IR bfdname .
105 .TP
106 .B \-F \fIbfdname\fR, \fB\-\-target=\fIbfdname
107 Use
108 .I bfdname
109 as the object format for both the input and the output file; i.e.
110 simply transfer data from source to destination with no translation.
111 .TP
112 .B \-R \fIsectionname\fR, \fB\-\-remove-section=\fIsectionname
113 Remove the named section from the file. This option may be given more
114 than once. Note that using this option inappropriately may make the
115 output file unusable.
116 .TP
117 .B \-S\fR, \fB\-\-strip\-all
118 Do not copy relocation and symbol information from the source file.
119 .TP
120 .B \-g\fR, \fB\-\-strip\-debug
121 Do not copy debugging symbols from the source file.
122 .TP
123 .B \-x\fR, \fB \-\-discard\-all
124 Do not copy non-global symbols from the source file.
125 .TP
126 .B \-X\fR, \fB\-\-discard\-locals
127 Do not copy compiler-generated local symbols. (These usually start
128 with "L" or ".").
129 .TP
130 .B \-b \fIbyte\fR, \fB\-\-byte=\fIbyte
131 Keep only every \fIbyte\fPth byte of the input file (header data is
132 not affected). \fIbyte\fP can be in the range from 0 to the
133 interleave-1. This option is useful for creating files to program
134 ROMs. It is typically used with an srec output target.
135 .TP
136 .B \-i \fIinterleave\fR, \fB\-\-interleave=\fIinterleave
137 Only copy one out of every \fIinterleave\fP bytes. Which one to copy is
138 selected by the \fB\-b\fP or \fB\-\-byte\fP option. The default is 4.
139 The interleave is ignored if neither \fB\-b\fP nor \fB\-\-byte\fP is given.
140 .TP
141 .B \-\-gap\-fill=\fIval
142 Fill gaps between sections with \fIval\fP. This is done by increasing
143 the size of the section with the lower address, and filling in the extra
144 space created with \fIval\fP.
145 .TP
146 .B \-\-pad\-to=\fIaddress
147 Pad the output file up to the virtual address \fIaddress\fP. This is
148 done by increasing the size of the last section. The extra space is
149 filled in with the value specified by \fB\-\-gap\-fill\fP (default
150 zero).
151 .TP
152 .B \fB\-\-set\-start=\fIval
153 Set the start address of the new file to \fIval\fP. Not all object
154 file formats support setting the start address.
155 .TP
156 .B \fB\-\-adjust\-start=\fIincr
157 Adjust the start address by adding \fIincr\fP. Not all object file
158 formats support setting the start address.
159 .TP
160 .B \fB\-\-adjust\-vma=\fIincr
161 Adjust the address of all sections, as well as the start address, by
162 adding \fIincr\fP. Some object file formats do not permit section
163 addresses to be changed arbitrarily. Note that this does not relocate
164 the sections; if the program expects sections to be loaded at a
165 certain address, and this option is used to change the sections such
166 that they are loaded at a different address, the program may fail.
167 .TP
168 .B \fB\-\-adjust\-section\-vma=\fIsection{=,+,-}val
169 Set or adjust the address of the named \fIsection\fP. If \fI=\fP is
170 used, the section address is set to \fIval\fP. Otherwise, \fIval\fP
171 is added to or subtracted from the section address. See the comments
172 under \fB\-\-adjust\-vma\fP, above. If \fIsection\fP does not exist
173 in the input file, a warning will be issued, unless
174 \fB\-\-no\-adjust\-warnings\fP is used.
175 .TP
176 .B \fB\-\-adjust\-warnings
177 If \fB\-\-adjust\-section\-vma\fP is used, and the named section does
178 not exist, issue a warning. This is the default.
179 .TP
180 .B \fB\-\-no\-adjust\-warnings
181 Do not issue a warning if \fB\-\-adjust\-section\-vma\fP is used, even
182 if the named section does not exist.
183 .TP
184 .B \-v\fR, \fB\-\-verbose
185 Verbose output: list all object files modified. In the case of
186 archives, "\fBobjcopy \-V\fR" lists all members of the archive.
187 .TP
188 .B \-V\fR, \fB\-\-version
189 Show the version number of
190 .B objcopy
191 and exit.
192 .TP
193 .B \-\-help
194 Show a summary of the options to
195 .B objcopy
196 and exit.
197 .SH "SEE ALSO"
198 .RB "`\|" binutils "\|'"
199 entry in
200 .B
201 info\c
202 \&;
203 .I
204 The GNU Binary Utilities\c
205 \&, Roland H. Pesch (June 1993).
206
207 .SH COPYING
208 Copyright (c) 1993,1994 Free Software Foundation, Inc.
209 .PP
210 Permission is granted to make and distribute verbatim copies of
211 this manual provided the copyright notice and this permission notice
212 are preserved on all copies.
213 .PP
214 Permission is granted to copy and distribute modified versions of this
215 manual under the conditions for verbatim copying, provided that the
216 entire resulting derived work is distributed under the terms of a
217 permission notice identical to this one.
218 .PP
219 Permission is granted to copy and distribute translations of this
220 manual into another language, under the above conditions for modified
221 versions, except that this permission notice may be included in
222 translations approved by the Free Software Foundation instead of in
223 the original English.