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