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