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