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