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