Commit | Line | Data |
---|---|---|
765a273f | 1 | \input texinfo @c -*- Texinfo -*- |
c72af735 | 2 | @setfilename binutils.info |
9bae56c5 | 3 | @include config.texi |
c72af735 | 4 | |
9abcc3b8 RP |
5 | @ifinfo |
6 | @format | |
7 | START-INFO-DIR-ENTRY | |
20f774c1 RP |
8 | * Binutils: (binutils). The GNU binary utilities "ar", "objcopy", |
9 | "objdump", "nm", "nlmconv", "size", | |
10 | "strings", "strip", and "ranlib". | |
9abcc3b8 RP |
11 | END-INFO-DIR-ENTRY |
12 | @end format | |
13 | @end ifinfo | |
c72af735 | 14 | |
8b2c2275 | 15 | @ifinfo |
54f74247 | 16 | Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. |
8b2c2275 RP |
17 | |
18 | Permission is granted to make and distribute verbatim copies of | |
19 | this manual provided the copyright notice and this permission notice | |
20 | are preserved on all copies. | |
21 | ||
22 | @ignore | |
23 | Permission is granted to process this file through TeX and print the | |
24 | results, provided the printed document carries a copying permission | |
25 | notice identical to this one except for the removal of this paragraph | |
26 | (this paragraph not being relevant to the printed manual). | |
27 | ||
28 | @end ignore | |
29 | ||
30 | Permission is granted to copy and distribute modified versions of this | |
31 | manual under the conditions for verbatim copying, provided also that | |
32 | the entire resulting derived work is distributed under the terms of a | |
33 | permission notice identical to this one. | |
34 | ||
35 | Permission is granted to copy and distribute translations of this manual | |
36 | into another language, under the above conditions for modified versions. | |
37 | @end ifinfo | |
38 | ||
c72af735 RP |
39 | @synindex ky cp |
40 | @c | |
df14d957 | 41 | @c This file documents the GNU binary utilities "ar", "ld", "objcopy", |
ba7c8e29 | 42 | @c "objdump", "nm", "size", "strings", "strip", and "ranlib". |
c72af735 | 43 | @c |
54f74247 | 44 | @c Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. |
c72af735 RP |
45 | @c |
46 | @c This text may be freely distributed under the terms of the GNU | |
47 | @c General Public License. | |
48 | @c | |
27e94bd5 | 49 | |
c72af735 | 50 | @setchapternewpage odd |
b94ff924 | 51 | @settitle @sc{gnu} Binary Utilities |
4928b97b RP |
52 | @titlepage |
53 | @finalout | |
b94ff924 | 54 | @title The @sc{gnu} Binary Utilities |
9bae56c5 | 55 | @subtitle Version @value{VERSION} |
c72af735 | 56 | @sp 1 |
e32341a7 | 57 | @subtitle May 1993 |
c72af735 | 58 | @author Roland H. Pesch |
4961ce5b | 59 | @author Jeffrey M. Osier |
c72af735 RP |
60 | @author Cygnus Support |
61 | @page | |
62 | ||
63 | @tex | |
650a49f0 | 64 | {\parskip=0pt \hfill Cygnus Support\par \hfill |
c72af735 RP |
65 | \TeX{}info \texinfoversion\par } |
66 | @end tex | |
67 | ||
68 | @vskip 0pt plus 1filll | |
54f74247 | 69 | Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. |
c72af735 RP |
70 | |
71 | Permission is granted to make and distribute verbatim copies of | |
72 | this manual provided the copyright notice and this permission notice | |
73 | are preserved on all copies. | |
74 | ||
75 | Permission is granted to copy and distribute modified versions of this | |
76 | manual under the conditions for verbatim copying, provided also that | |
77 | the entire resulting derived work is distributed under the terms of a | |
78 | permission notice identical to this one. | |
79 | ||
80 | Permission is granted to copy and distribute translations of this manual | |
81 | into another language, under the above conditions for modified versions. | |
82 | @end titlepage | |
83 | ||
eae04238 | 84 | @node Top |
8981cac5 | 85 | @top Introduction |
c72af735 RP |
86 | |
87 | @cindex version | |
b94ff924 | 88 | This brief manual contains preliminary documentation for the @sc{gnu} binary |
9bae56c5 | 89 | utilities (collectively version @value{VERSION}): |
8b2c2275 RP |
90 | |
91 | @iftex | |
c72af735 RP |
92 | @table @code |
93 | @item ar | |
94 | Create, modify, and extract from archives | |
95 | ||
96 | @item nm | |
97 | List symbols from object files | |
98 | ||
eed5eeab DM |
99 | @item objcopy |
100 | Copy and translate object files | |
101 | ||
c72af735 RP |
102 | @item objdump |
103 | Display information from object files | |
104 | ||
105 | @item ranlib | |
106 | Generate index to archive contents | |
107 | ||
108 | @item size | |
eae04238 | 109 | List file section sizes and total size |
c72af735 | 110 | |
ba7c8e29 DM |
111 | @item strings |
112 | List printable strings from files | |
113 | ||
c72af735 RP |
114 | @item strip |
115 | Discard symbols | |
eae04238 DM |
116 | |
117 | @item c++filt | |
118 | Demangle encoded C++ symbols | |
119 | ||
fb38844d ILT |
120 | @item addr2line |
121 | Convert addresses into file names and line numbers | |
122 | ||
eae04238 DM |
123 | @item nlmconv |
124 | Convert object code into a Netware Loadable Module | |
217947b2 ILT |
125 | |
126 | @item windres | |
127 | Manipulate Windows resources | |
c72af735 | 128 | @end table |
8b2c2275 | 129 | @end iftex |
c72af735 RP |
130 | |
131 | @menu | |
8b2c2275 | 132 | * ar:: Create, modify, and extract from archives |
8b2c2275 | 133 | * nm:: List symbols from object files |
eed5eeab | 134 | * objcopy:: Copy and translate object files |
8b2c2275 RP |
135 | * objdump:: Display information from object files |
136 | * ranlib:: Generate index to archive contents | |
137 | * size:: List section sizes and total size | |
ba7c8e29 | 138 | * strings:: List printable strings from files |
8b2c2275 | 139 | * strip:: Discard symbols |
b6216af2 | 140 | * c++filt:: Filter to demangle encoded C++ symbols |
fb38844d | 141 | * addr2line:: Convert addresses to file and line |
94e9ad77 | 142 | * nlmconv:: Converts object code into an NLM |
217947b2 | 143 | * windres:: Manipulate Windows resources |
eae04238 | 144 | * Selecting The Target System:: How these utilities determine the target. |
cbcfa129 ILT |
145 | * Reporting Bugs:: Reporting Bugs |
146 | * Index:: Index | |
c72af735 RP |
147 | @end menu |
148 | ||
eae04238 | 149 | @node ar |
c72af735 RP |
150 | @chapter ar |
151 | ||
152 | @kindex ar | |
153 | @cindex archives | |
154 | @cindex collections of files | |
155 | @smallexample | |
650a49f0 | 156 | ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}] |
4d9b5d5a | 157 | ar -M [ <mri-script ] |
c72af735 RP |
158 | @end smallexample |
159 | ||
b94ff924 | 160 | The @sc{gnu} @code{ar} program creates, modifies, and extracts from |
c72af735 RP |
161 | archives. An @dfn{archive} is a single file holding a collection of |
162 | other files in a structure that makes it possible to retrieve | |
163 | the original individual files (called @dfn{members} of the archive). | |
164 | ||
165 | The original files' contents, mode (permissions), timestamp, owner, and | |
ec40bbb8 | 166 | group are preserved in the archive, and can be restored on |
c72af735 RP |
167 | extraction. |
168 | ||
169 | @cindex name length | |
b94ff924 | 170 | @sc{gnu} @code{ar} can maintain archives whose members have names of any |
c72af735 | 171 | length; however, depending on how @code{ar} is configured on your |
ec40bbb8 DM |
172 | system, a limit on member-name length may be imposed for compatibility |
173 | with archive formats maintained with other tools. If it exists, the | |
c72af735 RP |
174 | limit is often 15 characters (typical of formats related to a.out) or 16 |
175 | characters (typical of formats related to coff). | |
176 | ||
177 | @cindex libraries | |
178 | @code{ar} is considered a binary utility because archives of this sort | |
179 | are most often used as @dfn{libraries} holding commonly needed | |
180 | subroutines. | |
181 | ||
182 | @cindex symbol index | |
e31e9a8d | 183 | @code{ar} creates an index to the symbols defined in relocatable |
c72af735 RP |
184 | object modules in the archive when you specify the modifier @samp{s}. |
185 | Once created, this index is updated in the archive whenever @code{ar} | |
186 | makes a change to its contents (save for the @samp{q} update operation). | |
187 | An archive with such an index speeds up linking to the library, and | |
188 | allows routines in the library to call each other without regard to | |
189 | their placement in the archive. | |
190 | ||
918c2f61 | 191 | You may use @samp{nm -s} or @samp{nm --print-armap} to list this index |
c72af735 RP |
192 | table. If an archive lacks the table, another form of @code{ar} called |
193 | @code{ranlib} can be used to add just the table. | |
194 | ||
765a273f RP |
195 | @cindex compatibility, @code{ar} |
196 | @cindex @code{ar} compatibility | |
b94ff924 | 197 | @sc{gnu} @code{ar} is designed to be compatible with two different |
765a273f RP |
198 | facilities. You can control its activity using command-line options, |
199 | like the different varieties of @code{ar} on Unix systems; or, if you | |
200 | specify the single command-line option @samp{-M}, you can control it | |
201 | with a script supplied via standard input, like the MRI ``librarian'' | |
202 | program. | |
203 | ||
204 | @menu | |
eae04238 DM |
205 | * ar cmdline:: Controlling @code{ar} on the command line |
206 | * ar scripts:: Controlling @code{ar} with a script | |
765a273f RP |
207 | @end menu |
208 | ||
209 | @page | |
eae04238 | 210 | @node ar cmdline |
765a273f RP |
211 | @section Controlling @code{ar} on the command line |
212 | ||
213 | @smallexample | |
650a49f0 | 214 | ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}] |
765a273f RP |
215 | @end smallexample |
216 | ||
217 | @cindex Unix compatibility, @code{ar} | |
218 | When you use @code{ar} in the Unix style, @code{ar} insists on at least two | |
219 | arguments to execute: one keyletter specifying the @emph{operation} | |
220 | (optionally accompanied by other keyletters specifying | |
221 | @emph{modifiers}), and the archive name to act on. | |
c72af735 | 222 | |
650a49f0 | 223 | Most operations can also accept further @var{member} arguments, |
c72af735 RP |
224 | specifying particular files to operate on. |
225 | ||
b94ff924 | 226 | @sc{gnu} @code{ar} allows you to mix the operation code @var{p} and modifier |
c72af735 RP |
227 | flags @var{mod} in any order, within the first command-line argument. |
228 | ||
229 | If you wish, you may begin the first command-line argument with a | |
230 | dash. | |
231 | ||
232 | @cindex operations on archive | |
233 | The @var{p} keyletter specifies what operation to execute; it may be | |
234 | any of the following, but you must specify only one of them: | |
235 | ||
236 | @table @code | |
237 | @item d | |
238 | @cindex deleting from archive | |
239 | @emph{Delete} modules from the archive. Specify the names of modules to | |
650a49f0 | 240 | be deleted as @var{member}@dots{}; the archive is untouched if you |
c72af735 RP |
241 | specify no files to delete. |
242 | ||
e31e9a8d | 243 | If you specify the @samp{v} modifier, @code{ar} lists each module |
c72af735 RP |
244 | as it is deleted. |
245 | ||
246 | @item m | |
247 | @cindex moving in archive | |
248 | Use this operation to @emph{move} members in an archive. | |
249 | ||
250 | The ordering of members in an archive can make a difference in how | |
251 | programs are linked using the library, if a symbol is defined in more | |
252 | than one member. | |
253 | ||
254 | If no modifiers are used with @code{m}, any members you name in the | |
650a49f0 | 255 | @var{member} arguments are moved to the @emph{end} of the archive; |
c72af735 RP |
256 | you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a |
257 | specified place instead. | |
258 | ||
259 | @item p | |
260 | @cindex printing from archive | |
261 | @emph{Print} the specified members of the archive, to the standard | |
262 | output file. If the @samp{v} modifier is specified, show the member | |
263 | name before copying its contents to standard output. | |
264 | ||
650a49f0 | 265 | If you specify no @var{member} arguments, all the files in the archive are |
ec40bbb8 | 266 | printed. |
c72af735 RP |
267 | |
268 | @item q | |
269 | @cindex quick append to archive | |
650a49f0 | 270 | @emph{Quick append}; add the files @var{member}@dots{} to the end of |
ec40bbb8 | 271 | @var{archive}, without checking for replacement. |
c72af735 RP |
272 | |
273 | The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this | |
274 | operation; new members are always placed at the end of the archive. | |
275 | ||
276 | The modifier @samp{v} makes @code{ar} list each file as it is appended. | |
277 | ||
278 | Since the point of this operation is speed, the archive's symbol table | |
279 | index is not updated, even if it already existed; you can use @samp{ar s} or | |
280 | @code{ranlib} explicitly to update the symbol table index. | |
281 | ||
282 | @item r | |
283 | @cindex replacement in archive | |
650a49f0 | 284 | Insert the files @var{member}@dots{} into @var{archive} (with |
ec40bbb8 DM |
285 | @emph{replacement}). This operation differs from @samp{q} in that any |
286 | previously existing members are deleted if their names match those being | |
287 | added. | |
c72af735 | 288 | |
650a49f0 | 289 | If one of the files named in @var{member}@dots{} does not exist, @code{ar} |
c72af735 RP |
290 | displays an error message, and leaves undisturbed any existing members |
291 | of the archive matching that name. | |
292 | ||
293 | By default, new members are added at the end of the file; but you may | |
294 | use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request | |
295 | placement relative to some existing member. | |
296 | ||
297 | The modifier @samp{v} used with this operation elicits a line of | |
298 | output for each file inserted, along with one of the letters @samp{a} or | |
299 | @samp{r} to indicate whether the file was appended (no old member | |
300 | deleted) or replaced. | |
301 | ||
302 | @item t | |
303 | @cindex contents of archive | |
304 | Display a @emph{table} listing the contents of @var{archive}, or those | |
650a49f0 | 305 | of the files listed in @var{member}@dots{} that are present in the |
c72af735 RP |
306 | archive. Normally only the member name is shown; if you also want to |
307 | see the modes (permissions), timestamp, owner, group, and size, you can | |
308 | request that by also specifying the @samp{v} modifier. | |
309 | ||
650a49f0 | 310 | If you do not specify a @var{member}, all files in the archive |
c72af735 RP |
311 | are listed. |
312 | ||
313 | @cindex repeated names in archive | |
314 | @cindex name duplication in archive | |
315 | If there is more than one file with the same name (say, @samp{fie}) in | |
e31e9a8d | 316 | an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the |
c72af735 RP |
317 | first instance; to see them all, you must ask for a complete |
318 | listing---in our example, @samp{ar t b.a}. | |
319 | @c WRS only; per Gumby, this is implementation-dependent, and in a more | |
320 | @c recent case in fact works the other way. | |
321 | ||
322 | @item x | |
323 | @cindex extract from archive | |
650a49f0 | 324 | @emph{Extract} members (named @var{member}) from the archive. You can |
c72af735 RP |
325 | use the @samp{v} modifier with this operation, to request that |
326 | @code{ar} list each name as it extracts it. | |
327 | ||
650a49f0 | 328 | If you do not specify a @var{member}, all files in the archive |
c72af735 RP |
329 | are extracted. |
330 | ||
331 | @end table | |
332 | ||
333 | A number of modifiers (@var{mod}) may immediately follow the @var{p} | |
334 | keyletter, to specify variations on an operation's behavior: | |
335 | ||
336 | @table @code | |
337 | @item a | |
338 | @cindex relative placement in archive | |
339 | Add new files @emph{after} an existing member of the | |
ec40bbb8 | 340 | archive. If you use the modifier @samp{a}, the name of an existing archive |
650a49f0 | 341 | member must be present as the @var{relpos} argument, before the |
c72af735 RP |
342 | @var{archive} specification. |
343 | ||
344 | @item b | |
345 | Add new files @emph{before} an existing member of the | |
ec40bbb8 | 346 | archive. If you use the modifier @samp{b}, the name of an existing archive |
650a49f0 | 347 | member must be present as the @var{relpos} argument, before the |
c72af735 RP |
348 | @var{archive} specification. (same as @samp{i}). |
349 | ||
350 | @item c | |
351 | @cindex creating archives | |
352 | @emph{Create} the archive. The specified @var{archive} is always | |
650a49f0 | 353 | created if it did not exist, when you request an update. But a warning is |
c72af735 RP |
354 | issued unless you specify in advance that you expect to create it, by |
355 | using this modifier. | |
356 | ||
52af6a44 | 357 | @item f |
b94ff924 | 358 | Truncate names in the archive. @sc{gnu} @code{ar} will normally permit file |
52af6a44 ILT |
359 | names of any length. This will cause it to create archives which are |
360 | not compatible with the native @code{ar} program on some systems. If | |
361 | this is a concern, the @samp{f} modifier may be used to truncate file | |
362 | names when putting them in the archive. | |
363 | ||
c72af735 RP |
364 | @item i |
365 | Insert new files @emph{before} an existing member of the | |
ec40bbb8 | 366 | archive. If you use the modifier @samp{i}, the name of an existing archive |
650a49f0 | 367 | member must be present as the @var{relpos} argument, before the |
c72af735 RP |
368 | @var{archive} specification. (same as @samp{b}). |
369 | ||
370 | @item l | |
371 | This modifier is accepted but not used. | |
372 | @c whaffor ar l modifier??? presumably compat; with | |
b94ff924 | 373 | @c what???---doc@@cygnus.com, 25jan91 |
c72af735 RP |
374 | |
375 | @item o | |
376 | @cindex dates in archive | |
377 | Preserve the @emph{original} dates of members when extracting them. If | |
378 | you do not specify this modifier, files extracted from the archive | |
e31e9a8d | 379 | are stamped with the time of extraction. |
c72af735 RP |
380 | |
381 | @item s | |
382 | @cindex writing archive index | |
383 | Write an object-file index into the archive, or update an existing one, | |
384 | even if no other change is made to the archive. You may use this modifier | |
385 | flag either with any operation, or alone. Running @samp{ar s} on an | |
386 | archive is equivalent to running @samp{ranlib} on it. | |
387 | ||
388 | @item u | |
389 | @cindex updating an archive | |
b703c078 | 390 | Normally, @samp{ar r}@dots{} inserts all files |
c72af735 RP |
391 | listed into the archive. If you would like to insert @emph{only} those |
392 | of the files you list that are newer than existing members of the same | |
393 | names, use this modifier. The @samp{u} modifier is allowed only for the | |
394 | operation @samp{r} (replace). In particular, the combination @samp{qu} is | |
395 | not allowed, since checking the timestamps would lose any speed | |
396 | advantage from the operation @samp{q}. | |
397 | ||
398 | @item v | |
399 | This modifier requests the @emph{verbose} version of an operation. Many | |
400 | operations display additional information, such as filenames processed, | |
401 | when the modifier @samp{v} is appended. | |
4d9b5d5a DM |
402 | |
403 | @item V | |
404 | This modifier shows the version number of @code{ar}. | |
765a273f RP |
405 | @end table |
406 | ||
eae04238 | 407 | @node ar scripts |
765a273f RP |
408 | @section Controlling @code{ar} with a script |
409 | ||
410 | @smallexample | |
411 | ar -M [ <@var{script} ] | |
412 | @end smallexample | |
413 | ||
414 | @cindex MRI compatibility, @code{ar} | |
415 | @cindex scripts, @code{ar} | |
416 | If you use the single command-line option @samp{-M} with @code{ar}, you | |
417 | can control its operation with a rudimentary command language. This | |
e31e9a8d | 418 | form of @code{ar} operates interactively if standard input is coming |
765a273f RP |
419 | directly from a terminal. During interactive use, @code{ar} prompts for |
420 | input (the prompt is @samp{AR >}), and continues executing even after | |
421 | errors. If you redirect standard input to a script file, no prompts are | |
e31e9a8d | 422 | issued, and @code{ar} abandons execution (with a nonzero exit code) |
765a273f RP |
423 | on any error. |
424 | ||
425 | The @code{ar} command language is @emph{not} designed to be equivalent | |
426 | to the command-line options; in fact, it provides somewhat less control | |
427 | over archives. The only purpose of the command language is to ease the | |
b94ff924 | 428 | transition to @sc{gnu} @code{ar} for developers who already have scripts |
765a273f RP |
429 | written for the MRI ``librarian'' program. |
430 | ||
431 | The syntax for the @code{ar} command language is straightforward: | |
432 | @itemize @bullet | |
433 | @item | |
434 | commands are recognized in upper or lower case; for example, @code{LIST} | |
435 | is the same as @code{list}. In the following descriptions, commands are | |
436 | shown in upper case for clarity. | |
437 | ||
438 | @item | |
439 | a single command may appear on each line; it is the first word on the | |
440 | line. | |
441 | ||
442 | @item | |
443 | empty lines are allowed, and have no effect. | |
444 | ||
445 | @item | |
446 | comments are allowed; text after either of the characters @samp{*} | |
447 | or @samp{;} is ignored. | |
448 | ||
449 | @item | |
450 | Whenever you use a list of names as part of the argument to an @code{ar} | |
451 | command, you can separate the individual names with either commas or | |
452 | blanks. Commas are shown in the explanations below, for clarity. | |
453 | ||
454 | @item | |
455 | @samp{+} is used as a line continuation character; if @samp{+} appears | |
456 | at the end of a line, the text on the following line is considered part | |
457 | of the current command. | |
458 | @end itemize | |
459 | ||
460 | Here are the commands you can use in @code{ar} scripts, or when using | |
461 | @code{ar} interactively. Three of them have special significance: | |
462 | ||
463 | @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is | |
464 | a temporary file required for most of the other commands. | |
465 | ||
466 | @code{SAVE} commits the changes so far specified by the script. Prior | |
467 | to @code{SAVE}, commands affect only the temporary copy of the current | |
468 | archive. | |
469 | ||
470 | @table @code | |
471 | @item ADDLIB @var{archive} | |
472 | @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module}) | |
473 | Add all the contents of @var{archive} (or, if specified, each named | |
474 | @var{module} from @var{archive}) to the current archive. | |
475 | ||
476 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
477 | ||
650a49f0 | 478 | @item ADDMOD @var{member}, @var{member}, @dots{} @var{member} |
765a273f RP |
479 | @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}" |
480 | @c else like "ar q..." | |
650a49f0 | 481 | Add each named @var{member} as a module in the current archive. |
765a273f RP |
482 | |
483 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
484 | ||
485 | @item CLEAR | |
486 | Discard the contents of the current archive, cancelling the effect of | |
487 | any operations since the last @code{SAVE}. May be executed (with no | |
488 | effect) even if no current archive is specified. | |
489 | ||
490 | @item CREATE @var{archive} | |
491 | Creates an archive, and makes it the current archive (required for many | |
492 | other commands). The new archive is created with a temporary name; it | |
493 | is not actually saved as @var{archive} until you use @code{SAVE}. | |
494 | You can overwrite existing archives; similarly, the contents of any | |
495 | existing file named @var{archive} will not be destroyed until @code{SAVE}. | |
496 | ||
497 | @item DELETE @var{module}, @var{module}, @dots{} @var{module} | |
498 | Delete each listed @var{module} from the current archive; equivalent to | |
499 | @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}. | |
500 | ||
501 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
502 | ||
503 | @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) | |
504 | @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile} | |
505 | List each named @var{module} present in @var{archive}. The separate | |
506 | command @code{VERBOSE} specifies the form of the output: when verbose | |
507 | output is off, output is like that of @samp{ar -t @var{archive} | |
b703c078 DM |
508 | @var{module}@dots{}}. When verbose output is on, the listing is like |
509 | @samp{ar -tv @var{archive} @var{module}@dots{}}. | |
765a273f RP |
510 | |
511 | Output normally goes to the standard output stream; however, if you | |
512 | specify @var{outputfile} as a final argument, @code{ar} directs the | |
513 | output to that file. | |
514 | ||
515 | @item END | |
516 | Exit from @code{ar}, with a @code{0} exit code to indicate successful | |
517 | completion. This command does not save the output file; if you have | |
518 | changed the current archive since the last @code{SAVE} command, those | |
519 | changes are lost. | |
520 | ||
521 | @item EXTRACT @var{module}, @var{module}, @dots{} @var{module} | |
522 | Extract each named @var{module} from the current archive, writing them | |
523 | into the current directory as separate files. Equivalent to @samp{ar -x | |
b703c078 | 524 | @var{archive} @var{module}@dots{}}. |
765a273f RP |
525 | |
526 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
527 | ||
528 | @ignore | |
529 | @c FIXME Tokens but no commands??? | |
530 | @item FULLDIR | |
531 | ||
532 | @item HELP | |
533 | @end ignore | |
534 | ||
535 | @item LIST | |
536 | Display full contents of the current archive, in ``verbose'' style | |
537 | regardless of the state of @code{VERBOSE}. The effect is like @samp{ar | |
b94ff924 | 538 | tv @var{archive}}). (This single command is a @sc{gnu} @code{ld} |
765a273f RP |
539 | enhancement, rather than present for MRI compatibility.) |
540 | ||
541 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
542 | ||
543 | @item OPEN @var{archive} | |
544 | Opens an existing archive for use as the current archive (required for | |
545 | many other commands). Any changes as the result of subsequent commands | |
546 | will not actually affect @var{archive} until you next use @code{SAVE}. | |
547 | ||
548 | @item REPLACE @var{module}, @var{module}, @dots{} @var{module} | |
549 | In the current archive, replace each existing @var{module} (named in | |
550 | the @code{REPLACE} arguments) from files in the current working directory. | |
551 | To execute this command without errors, both the file, and the module in | |
552 | the current archive, must exist. | |
553 | ||
554 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
555 | ||
556 | @item VERBOSE | |
557 | Toggle an internal flag governing the output from @code{DIRECTORY}. | |
558 | When the flag is on, @code{DIRECTORY} output matches output from | |
b703c078 | 559 | @samp{ar -tv }@dots{}. |
765a273f RP |
560 | |
561 | @item SAVE | |
562 | Commit your changes to the current archive, and actually save it as a | |
563 | file with the name specified in the last @code{CREATE} or @code{OPEN} | |
564 | command. | |
565 | ||
566 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
c72af735 RP |
567 | |
568 | @end table | |
569 | ||
8b2c2275 RP |
570 | @iftex |
571 | @node ld | |
c72af735 RP |
572 | @chapter ld |
573 | @cindex linker | |
574 | @kindex ld | |
b94ff924 VM |
575 | The @sc{gnu} linker @code{ld} is now described in a separate manual. |
576 | @xref{Top,, Overview,, Using LD: the @sc{gnu} linker}. | |
8b2c2275 | 577 | @end iftex |
c72af735 | 578 | |
eae04238 | 579 | @node nm |
c72af735 RP |
580 | @chapter nm |
581 | @cindex symbols | |
582 | @kindex nm | |
583 | ||
584 | @smallexample | |
d6a4c375 | 585 | nm [ -a | --debug-syms ] [ -g | --extern-only ] |
de3b08ac | 586 | [ -B ] [ -C | --demangle ] [ -D | --dynamic ] |
1896790e | 587 | [ -s | --print-armap ] [ -A | -o | --print-file-name ] |
6cfbdb50 | 588 | [ -n | -v | --numeric-sort ] [ -p | --no-sort ] |
1896790e | 589 | [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ] |
6cfbdb50 DM |
590 | [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ] |
591 | [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ] | |
77dd4469 | 592 | [ --defined-only ] [-l | --line-numbers ] |
9eb39bca | 593 | [ --no-demangle ] [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ] |
c72af735 RP |
594 | @end smallexample |
595 | ||
b94ff924 | 596 | @sc{gnu} @code{nm} lists the symbols from object files @var{objfile}@dots{}. |
6cfbdb50 DM |
597 | If no object files are listed as arguments, @code{nm} assumes |
598 | @file{a.out}. | |
599 | ||
600 | For each symbol, @code{nm} shows: | |
601 | ||
602 | @itemize @bullet | |
603 | @item | |
604 | The symbol value, in the radix selected by options (see below), or | |
605 | hexadecimal by default. | |
606 | ||
607 | @item | |
608 | The symbol type. At least the following types are used; others are, as | |
609 | well, depending on the object file format. If lowercase, the symbol is | |
610 | local; if uppercase, the symbol is global (external). | |
611 | ||
612 | @c Some more detail on exactly what these symbol types are used for | |
613 | @c would be nice. | |
614 | @table @code | |
615 | @item A | |
85d4b870 ILT |
616 | The symbol's value is absolute, and will not be changed by further |
617 | linking. | |
6cfbdb50 DM |
618 | |
619 | @item B | |
85d4b870 | 620 | The symbol is in the uninitialized data section (known as BSS). |
6cfbdb50 DM |
621 | |
622 | @item C | |
85d4b870 ILT |
623 | The symbol is common. Common symbols are uninitialized data. When |
624 | linking, multiple common symbols may appear with the same name. If the | |
625 | symbol is defined anywhere, the common symbols are treated as undefined | |
626 | references. For more details on common symbols, see the discussion of | |
627 | --warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}. | |
6cfbdb50 DM |
628 | |
629 | @item D | |
85d4b870 ILT |
630 | The symbol is in the initialized data section. |
631 | ||
632 | @item G | |
392e2505 | 633 | The symbol is in an initialized data section for small objects. Some |
85d4b870 ILT |
634 | object file formats permit more efficient access to small data objects, |
635 | such as a global int variable as opposed to a large global array. | |
6cfbdb50 DM |
636 | |
637 | @item I | |
85d4b870 ILT |
638 | The symbol is an indirect reference to another symbol. This is a GNU |
639 | extension to the a.out object file format which is rarely used. | |
640 | ||
641 | @item N | |
642 | The symbol is a debugging symbol. | |
643 | ||
644 | @item R | |
645 | The symbol is in a read only data section. | |
646 | ||
647 | @item S | |
392e2505 | 648 | The symbol is in an uninitialized data section for small objects. |
6cfbdb50 DM |
649 | |
650 | @item T | |
85d4b870 | 651 | The symbol is in the text (code) section. |
6cfbdb50 DM |
652 | |
653 | @item U | |
85d4b870 ILT |
654 | The symbol is undefined. |
655 | ||
656 | @item W | |
657 | The symbol is weak. When a weak defined symbol is linked with a normal | |
658 | defined symbol, the normal defined symbol is used with no error. When a | |
659 | weak undefined symbol is linked and the symbol is not defined, the value | |
660 | of the weak symbol becomes zero with no error. | |
661 | ||
662 | @item - | |
663 | The symbol is a stabs symbol in an a.out object file. In this case, the | |
664 | next values printed are the stabs other field, the stabs desc field, and | |
665 | the stab type. Stabs symbols are used to hold debugging information; | |
666 | for more information, see @ref{Top,Stabs,Stabs Overview,stabs.info, The | |
667 | ``stabs'' debug format}. | |
668 | ||
669 | @item ? | |
670 | The symbol type is unknown, or object file format specific. | |
6cfbdb50 DM |
671 | @end table |
672 | ||
673 | @item | |
674 | The symbol name. | |
675 | @end itemize | |
c72af735 RP |
676 | |
677 | The long and short forms of options, shown here as alternatives, are | |
678 | equivalent. | |
679 | ||
680 | @table @code | |
6cfbdb50 DM |
681 | @item -A |
682 | @itemx -o | |
683 | @itemx --print-file-name | |
684 | @cindex input file name | |
685 | @cindex file name | |
686 | @cindex source file name | |
687 | Precede each symbol by the name of the input file (or archive element) | |
688 | in which it was found, rather than identifying the input file once only, | |
689 | before all of its symbols. | |
c72af735 RP |
690 | |
691 | @item -a | |
918c2f61 | 692 | @itemx --debug-syms |
c72af735 | 693 | @cindex debugging symbols |
6cfbdb50 DM |
694 | Display all symbols, even debugger-only symbols; normally these are not |
695 | listed. | |
696 | ||
68dd5295 DM |
697 | @item -B |
698 | @cindex @code{nm} format | |
699 | @cindex @code{nm} compatibility | |
d6a4c375 DM |
700 | The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}). |
701 | ||
702 | @item -C | |
703 | @itemx --demangle | |
9793039f | 704 | @cindex demangling in nm |
d6a4c375 DM |
705 | Decode (@dfn{demangle}) low-level symbol names into user-level names. |
706 | Besides removing any initial underscore prepended by the system, this | |
707 | makes C++ function names readable. @xref{c++filt}, for more information | |
708 | on demangling. | |
68dd5295 | 709 | |
9eb39bca ILT |
710 | @item --no-demangle |
711 | Do not demangle low-level symbol names. This is the default. | |
712 | ||
de3b08ac ILT |
713 | @item -D |
714 | @itemx --dynamic | |
715 | @cindex dynamic symbols | |
716 | Display the dynamic symbols rather than the normal symbols. This is | |
717 | only meaningful for dynamic objects, such as certain types of shared | |
718 | libraries. | |
719 | ||
6cfbdb50 DM |
720 | @item -f @var{format} |
721 | @itemx --format=@var{format} | |
68dd5295 DM |
722 | @cindex @code{nm} format |
723 | @cindex @code{nm} compatibility | |
6cfbdb50 DM |
724 | Use the output format @var{format}, which can be @code{bsd}, |
725 | @code{sysv}, or @code{posix}. The default is @code{bsd}. | |
b26ac613 | 726 | Only the first character of @var{format} is significant; it can be |
6cfbdb50 | 727 | either upper or lower case. |
c72af735 RP |
728 | |
729 | @item -g | |
918c2f61 | 730 | @itemx --extern-only |
c72af735 RP |
731 | @cindex external symbols |
732 | Display only external symbols. | |
733 | ||
77dd4469 ILT |
734 | @item -l |
735 | @itemx --line-numbers | |
736 | @cindex symbol line numbers | |
737 | For each symbol, use debugging information to try to find a filename and | |
738 | line number. For a defined symbol, look for the line number of the | |
739 | address of the symbol. For an undefined symbol, look for the line | |
740 | number of a relocation entry which refers to the symbol. If line number | |
741 | information can be found, print it after the other symbol information. | |
742 | ||
b26ac613 DM |
743 | @item -n |
744 | @itemx -v | |
745 | @itemx --numeric-sort | |
746 | Sort symbols numerically by their addresses, rather than alphabetically | |
747 | by their names. | |
748 | ||
c72af735 | 749 | @item -p |
918c2f61 | 750 | @itemx --no-sort |
c72af735 | 751 | @cindex sorting symbols |
650a49f0 | 752 | Do not bother to sort the symbols in any order; print them in the order |
6cfbdb50 DM |
753 | encountered. |
754 | ||
755 | @item -P | |
756 | @itemx --portability | |
757 | Use the POSIX.2 standard output format instead of the default format. | |
758 | Equivalent to @samp{-f posix}. | |
c72af735 | 759 | |
c72af735 | 760 | @item -s |
918c2f61 | 761 | @itemx --print-armap |
c72af735 RP |
762 | @cindex symbol index, listing |
763 | When listing symbols from archive members, include the index: a mapping | |
ec40bbb8 DM |
764 | (stored in the archive by @code{ar} or @code{ranlib}) of which modules |
765 | contain definitions for which names. | |
c72af735 | 766 | |
c72af735 | 767 | @item -r |
918c2f61 | 768 | @itemx --reverse-sort |
ec40bbb8 | 769 | Reverse the order of the sort (whether numeric or alphabetic); let the |
c72af735 RP |
770 | last come first. |
771 | ||
1896790e ILT |
772 | @item --size-sort |
773 | Sort symbols by size. The size is computed as the difference between | |
774 | the value of the symbol and the value of the symbol with the next higher | |
775 | value. The size of the symbol is printed, rather than the value. | |
776 | ||
6cfbdb50 DM |
777 | @item -t @var{radix} |
778 | @itemx --radix=@var{radix} | |
779 | Use @var{radix} as the radix for printing the symbol values. It must be | |
780 | @samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal. | |
781 | ||
ec40bbb8 | 782 | @item --target=@var{bfdname} |
c72af735 RP |
783 | @cindex object code format |
784 | Specify an object code format other than your system's default format. | |
eae04238 | 785 | @xref{Target Selection}, for more information. |
c72af735 RP |
786 | |
787 | @item -u | |
918c2f61 | 788 | @itemx --undefined-only |
c72af735 RP |
789 | @cindex external symbols |
790 | @cindex undefined symbols | |
791 | Display only undefined symbols (those external to each object file). | |
792 | ||
dcd6706b JL |
793 | @item --defined-only |
794 | @cindex external symbols | |
795 | @cindex undefined symbols | |
796 | Display only defined symbols for each object file. | |
797 | ||
6cfbdb50 DM |
798 | @item -V |
799 | @itemx --version | |
b26ac613 DM |
800 | Show the version number of @code{nm} and exit. |
801 | ||
802 | @item --help | |
803 | Show a summary of the options to @code{nm} and exit. | |
c72af735 RP |
804 | @end table |
805 | ||
eae04238 | 806 | @node objcopy |
eed5eeab DM |
807 | @chapter objcopy |
808 | ||
809 | @smallexample | |
eae04238 DM |
810 | objcopy [ -F @var{bfdname} | --target=@var{bfdname} ] |
811 | [ -I @var{bfdname} | --input-target=@var{bfdname} ] | |
812 | [ -O @var{bfdname} | --output-target=@var{bfdname} ] | |
eed5eeab | 813 | [ -S | --strip-all ] [ -g | --strip-debug ] |
dff604a7 | 814 | [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] |
29c0d15c | 815 | [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] |
eed5eeab | 816 | [ -x | --discard-all ] [ -X | --discard-locals ] |
f7b839f7 DM |
817 | [ -b @var{byte} | --byte=@var{byte} ] |
818 | [ -i @var{interleave} | --interleave=@var{interleave} ] | |
0aca460e | 819 | [ -R @var{sectionname} | --remove-section=@var{sectionname} ] |
2483354d | 820 | [ -p | --preserve-dates ] [ --debugging ] |
33e0a06d ILT |
821 | [ --gap-fill=@var{val} ] [ --pad-to=@var{address} ] |
822 | [ --set-start=@var{val} ] [ --adjust-start=@var{incr} ] | |
823 | [ --adjust-vma=@var{incr} ] | |
6c7ed084 ILT |
824 | [ --adjust-section-vma=@var{section}@{=,+,-@}@var{val} ] |
825 | [ --adjust-warnings ] [ --no-adjust-warnings ] | |
5ab41086 | 826 | [ --set-section-flags=@var{section}=@var{flags} ] |
d0130cc8 | 827 | [ --add-section=@var{sectionname}=@var{filename} ] |
decf2865 | 828 | [ --change-leading-char ] [ --remove-leading-char ] |
9a442fe8 | 829 | [ --weaken ] |
f7b839f7 | 830 | [ -v | --verbose ] [ -V | --version ] [ --help ] |
eed5eeab DM |
831 | @var{infile} [@var{outfile}] |
832 | @end smallexample | |
833 | ||
8981cac5 JO |
834 | The @sc{gnu} @code{objcopy} utility copies the contents of an object |
835 | file to another. @code{objcopy} uses the @sc{gnu} @sc{bfd} Library to | |
836 | read and write the object files. It can write the destination object | |
837 | file in a format different from that of the source object file. The | |
838 | exact behavior of @code{objcopy} is controlled by command-line options. | |
eed5eeab DM |
839 | |
840 | @code{objcopy} creates temporary files to do its translations and | |
8981cac5 JO |
841 | deletes them afterward. @code{objcopy} uses @sc{bfd} to do all its |
842 | translation work; it has access to all the formats described in @sc{bfd} | |
843 | and thus is able to recognize most formats without being told | |
844 | explicitly. @xref{BFD,,BFD,ld.info,Using LD}. | |
eed5eeab | 845 | |
67f67ed9 ILT |
846 | @code{objcopy} can be used to generate S-records by using an output |
847 | target of @samp{srec} (e.g., use @samp{-O srec}). | |
848 | ||
849 | @code{objcopy} can be used to generate a raw binary file by using an | |
850 | output target of @samp{binary} (e.g., use @samp{-O binary}). When | |
851 | @code{objcopy} generates a raw binary file, it will essentially produce | |
852 | a memory dump of the contents of the input object file. All symbols and | |
a6afc090 | 853 | relocation information will be discarded. The memory dump will start at |
11de29d0 | 854 | the load address of the lowest section copied into the output file. |
67f67ed9 ILT |
855 | |
856 | When generating an S-record or a raw binary file, it may be helpful to | |
857 | use @samp{-S} to remove sections containing debugging information. In | |
858 | some cases @samp{-R} will be useful to remove sections which contain | |
859 | information which is not needed by the binary file. | |
860 | ||
eed5eeab DM |
861 | @table @code |
862 | @item @var{infile} | |
863 | @itemx @var{outfile} | |
8981cac5 | 864 | The source and output files, respectively. |
eed5eeab DM |
865 | If you do not specify @var{outfile}, @code{objcopy} creates a |
866 | temporary file and destructively renames the result with | |
8981cac5 | 867 | the name of @var{infile}. |
eed5eeab | 868 | |
eae04238 DM |
869 | @item -I @var{bfdname} |
870 | @itemx --input-target=@var{bfdname} | |
871 | Consider the source file's object format to be @var{bfdname}, rather than | |
872 | attempting to deduce it. @xref{Target Selection}, for more information. | |
eed5eeab | 873 | |
eae04238 DM |
874 | @item -O @var{bfdname} |
875 | @itemx --output-target=@var{bfdname} | |
876 | Write the output file using the object format @var{bfdname}. | |
877 | @xref{Target Selection}, for more information. | |
eed5eeab | 878 | |
eae04238 DM |
879 | @item -F @var{bfdname} |
880 | @itemx --target=@var{bfdname} | |
881 | Use @var{bfdname} as the object format for both the input and the output | |
882 | file; i.e., simply transfer data from source to destination with no | |
883 | translation. @xref{Target Selection}, for more information. | |
eed5eeab | 884 | |
0aca460e ILT |
885 | @item -R @var{sectionname} |
886 | @itemx --remove-section=@var{sectionname} | |
887 | Remove any section named @var{sectionname} from the output file. This | |
888 | option may be given more than once. Note that using this option | |
889 | inappropriately may make the output file unusable. | |
890 | ||
eed5eeab DM |
891 | @item -S |
892 | @itemx --strip-all | |
893 | Do not copy relocation and symbol information from the source file. | |
894 | ||
895 | @item -g | |
896 | @itemx --strip-debug | |
897 | Do not copy debugging symbols from the source file. | |
898 | ||
9135e5f8 ILT |
899 | @item --strip-unneeded |
900 | Strip all symbols that are not needed for relocation processing. | |
901 | ||
dff604a7 ILT |
902 | @item -K @var{symbolname} |
903 | @itemx --keep-symbol=@var{symbolname} | |
904 | Copy only symbol @var{symbolname} from the source file. This option may | |
905 | be given more than once. | |
906 | ||
29c0d15c ILT |
907 | @item -N @var{symbolname} |
908 | @itemx --strip-symbol=@var{symbolname} | |
dff604a7 ILT |
909 | Do not copy symbol @var{symbolname} from the source file. This option |
910 | may be given more than once, and may be combined with strip options | |
911 | other than @code{-K}. | |
29c0d15c | 912 | |
eed5eeab DM |
913 | @item -x |
914 | @itemx --discard-all | |
915 | Do not copy non-global symbols from the source file. | |
916 | @c FIXME any reason to prefer "non-global" to "local" here? | |
917 | ||
918 | @item -X | |
919 | @itemx --discard-locals | |
920 | Do not copy compiler-generated local symbols. | |
921 | (These usually start with @samp{L} or @samp{.}.) | |
922 | ||
db2e6adb DM |
923 | @item -b @var{byte} |
924 | @itemx --byte=@var{byte} | |
925 | Keep only every @var{byte}th byte of the input file (header data is not | |
f7b839f7 DM |
926 | affected). @var{byte} can be in the range from 0 to @var{interleave}-1, |
927 | where @var{interleave} is given by the @samp{-i} or @samp{--interleave} | |
928 | option, or the default of 4. This option is useful for creating files | |
8981cac5 | 929 | to program @sc{rom}. It is typically used with an @code{srec} output |
f7b839f7 DM |
930 | target. |
931 | ||
932 | @item -i @var{interleave} | |
933 | @itemx --interleave=@var{interleave} | |
8981cac5 JO |
934 | Only copy one out of every @var{interleave} bytes. Select which byte to |
935 | copy with the @var{-b} or @samp{--byte} option. The default is 4. | |
936 | @code{objcopy} ignores this option if you do not specify either @samp{-b} or | |
937 | @samp{--byte}. | |
db2e6adb | 938 | |
2483354d ILT |
939 | @item -p |
940 | @itemx --preserve-dates | |
941 | Set the access and modification dates of the output file to be the same | |
942 | as those of the input file. | |
943 | ||
f5818d79 ILT |
944 | @item --debugging |
945 | Convert debugging information, if possible. This is not the default | |
946 | because only certain debugging formats are supported, and the | |
947 | conversion process can be time consuming. | |
948 | ||
596d99ba ILT |
949 | @item --gap-fill @var{val} |
950 | Fill gaps between sections with @var{val}. This is done by increasing | |
951 | the size of the section with the lower address, and filling in the extra | |
952 | space created with @var{val}. | |
953 | ||
33e0a06d ILT |
954 | @item --pad-to @var{address} |
955 | Pad the output file up to the virtual address @var{address}. This is | |
956 | done by increasing the size of the last section. The extra space is | |
957 | filled in with the value specified by @samp{--gap-fill} (default zero). | |
958 | ||
6c7ed084 ILT |
959 | @item --set-start @var{val} |
960 | Set the address of the new file to @var{val}. Not all object file | |
a6afc090 | 961 | formats support setting the start address. |
6c7ed084 ILT |
962 | |
963 | @item --adjust-start @var{incr} | |
964 | Adjust the start address by adding @var{incr}. Not all object file | |
965 | formats support setting the start address. | |
966 | ||
967 | @item --adjust-vma @var{incr} | |
968 | Adjust the address of all sections, as well as the start address, by | |
969 | adding @var{incr}. Some object file formats do not permit section | |
970 | addresses to be changed arbitrarily. Note that this does not relocate | |
971 | the sections; if the program expects sections to be loaded at a certain | |
972 | address, and this option is used to change the sections such that they | |
973 | are loaded at a different address, the program may fail. | |
974 | ||
975 | @item --adjust-section-vma @var{section}@{=,+,-@}@var{val} | |
976 | Set or adjust the address of the named @var{section}. If @samp{=} is | |
977 | used, the section address is set to @var{val}. Otherwise, @var{val} is | |
978 | added to or subtracted from the section address. See the comments under | |
979 | @samp{--adjust-vma}, above. If @var{section} does not exist in the | |
980 | input file, a warning will be issued, unless @samp{--no-adjust-warnings} | |
981 | is used. | |
982 | ||
983 | @item --adjust-warnings | |
984 | If @samp{--adjust-section-vma} is used, and the named section does not | |
985 | exist, issue a warning. This is the default. | |
986 | ||
987 | @item --no-adjust-warnings | |
988 | Do not issue a warning if @samp{--adjust-section-vma} is used, even if | |
989 | the named section does not exist. | |
990 | ||
5ab41086 ILT |
991 | @item --set-section-flags @var{section}=@var{flags} |
992 | Set the flags for the named section. The @var{flags} argument is a | |
993 | comma separated string of flag names. The recognized names are | |
994 | @samp{alloc}, @samp{load}, @samp{readonly}, @samp{code}, @samp{data}, | |
995 | and @samp{rom}. Not all flags are meaningful for all object file | |
996 | formats. | |
997 | ||
d0130cc8 ILT |
998 | @item --add-section @var{sectionname}=@var{filename} |
999 | Add a new section named @var{sectionname} while copying the file. The | |
1000 | contents of the new section are taken from the file @var{filename}. The | |
1001 | size of the section will be the size of the file. This option only | |
1002 | works on file formats which can support sections with arbitrary names. | |
1003 | ||
decf2865 ILT |
1004 | @item --change-leading-char |
1005 | Some object file formats use special characters at the start of | |
1006 | symbols. The most common such character is underscore, which compilers | |
1007 | often add before every symbol. This option tells @code{objcopy} to | |
1008 | change the leading character of every symbol when it converts between | |
1009 | object file formats. If the object file formats use the same leading | |
1010 | character, this option has no effect. Otherwise, it will add a | |
1011 | character, or remove a character, or change a character, as | |
1012 | appropriate. | |
1013 | ||
5da470b2 ILT |
1014 | @item --remove-leading-char |
1015 | If the first character of a global symbol is a special symbol leading | |
1016 | character used by the object file format, remove the character. The | |
1017 | most common symbol leading character is underscore. This option will | |
1018 | remove a leading underscore from all global symbols. This can be useful | |
1019 | if you want to link together objects of different file formats with | |
decf2865 ILT |
1020 | different conventions for symbol names. This is different from |
1021 | @code{--change-leading-char} because it always changes the symbol name | |
1022 | when appropriate, regardless of the object file format of the output | |
1023 | file. | |
5da470b2 | 1024 | |
9a442fe8 ILT |
1025 | @item --weaken |
1026 | Change all global symbols in the file to be weak. This can be useful | |
1027 | when building an object which will be linked against other objects using | |
1028 | the @code{-R} option to the linker. This option is only effective when | |
1029 | using an object file format which supports weak symbols. | |
1030 | ||
eed5eeab DM |
1031 | @item -V |
1032 | @itemx --version | |
1033 | Show the version number of @code{objcopy}. | |
1034 | ||
1035 | @item -v | |
1036 | @itemx --verbose | |
1037 | Verbose output: list all object files modified. In the case of | |
1038 | archives, @samp{objcopy -V} lists all members of the archive. | |
1039 | ||
1040 | @item --help | |
1041 | Show a summary of the options to @code{objcopy}. | |
1042 | @end table | |
1043 | ||
eae04238 | 1044 | @node objdump |
c72af735 RP |
1045 | @chapter objdump |
1046 | ||
1047 | @cindex object file information | |
1048 | @kindex objdump | |
1049 | ||
1050 | @smallexample | |
10f2a7f6 | 1051 | objdump [ -a | --archive-headers ] |
e1c14599 | 1052 | [ -b @var{bfdname} | --target=@var{bfdname} ] [ --debugging ] |
9793039f ILT |
1053 | [ -C | --demangle ] [ -d | --disassemble ] |
1054 | [ -D | --disassemble-all ] [ --disassemble-zeroes ] | |
67c8c901 | 1055 | [ -EB | -EL | --endian=@{big | little @} ] |
d5464baa | 1056 | [ -f | --file-headers ] |
eae04238 | 1057 | [ -h | --section-headers | --headers ] [ -i | --info ] |
10f2a7f6 | 1058 | [ -j @var{section} | --section=@var{section} ] |
a8e27cc6 | 1059 | [ -l | --line-numbers ] [ -S | --source ] |
7e5e9619 JO |
1060 | [ -m @var{machine} | --architecture=@var{machine} ] |
1061 | [ -r | --reloc ] [ -R | --dynamic-reloc ] | |
1062 | [ -s | --full-contents ] [ --stabs ] | |
de3b08ac | 1063 | [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ] |
aa21a2a9 | 1064 | [ -w | --wide ] [ --start-address=@var{address} ] |
4cb99ff2 | 1065 | [ --stop-address=@var{address} ] |
5c59269f | 1066 | [ --prefix-addresses] [ --[no-]show-raw-insn ] |
ab3a59cf | 1067 | [ --adjust-vma=@var{offset} ] |
458bbd1f | 1068 | [ --version ] [ --help ] |
aa21a2a9 | 1069 | @var{objfile}@dots{} |
c72af735 RP |
1070 | @end smallexample |
1071 | ||
1072 | @code{objdump} displays information about one or more object files. | |
1073 | The options control what particular information to display. This | |
1074 | information is mostly useful to programmers who are working on the | |
1075 | compilation tools, as opposed to programmers who just want their | |
1076 | program to compile and work. | |
1077 | ||
b26ac613 DM |
1078 | @var{objfile}@dots{} are the object files to be examined. When you |
1079 | specify archives, @code{objdump} shows information on each of the member | |
1080 | object files. | |
1081 | ||
c72af735 | 1082 | The long and short forms of options, shown here as alternatives, are |
ed78872a | 1083 | equivalent. At least one option besides @samp{-l} must be given. |
c72af735 RP |
1084 | |
1085 | @table @code | |
c72af735 | 1086 | @item -a |
eae04238 | 1087 | @itemx --archive-header |
c72af735 | 1088 | @cindex archive headers |
ec40bbb8 | 1089 | If any of the @var{objfile} files are archives, display the archive |
c72af735 RP |
1090 | header information (in a format similar to @samp{ls -l}). Besides the |
1091 | information you could list with @samp{ar tv}, @samp{objdump -a} shows | |
1092 | the object file format of each archive member. | |
1093 | ||
ab3a59cf ILT |
1094 | @item --adjust-vma=@var{offset} |
1095 | @cindex section addresses in objdump | |
1096 | @cindex VMA in objdump | |
1097 | When dumping information, first add @var{offset} to all the section | |
1098 | addresses. This is useful if the section addresses do not correspond to | |
1099 | the symbol table, which can happen when putting sections at particular | |
1100 | addresses when using a format which can not represent section addresses, | |
1101 | such as a.out. | |
1102 | ||
c72af735 | 1103 | @item -b @var{bfdname} |
eae04238 | 1104 | @itemx --target=@var{bfdname} |
c72af735 | 1105 | @cindex object code format |
ec40bbb8 DM |
1106 | Specify that the object-code format for the object files is |
1107 | @var{bfdname}. This option may not be necessary; @var{objdump} can | |
1108 | automatically recognize many formats. | |
1109 | ||
1110 | For example, | |
c72af735 RP |
1111 | @example |
1112 | objdump -b oasys -m vax -h fu.o | |
1113 | @end example | |
1114 | @noindent | |
ec40bbb8 DM |
1115 | displays summary information from the section headers (@samp{-h}) of |
1116 | @file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object | |
c72af735 RP |
1117 | file in the format produced by Oasys compilers. You can list the |
1118 | formats available with the @samp{-i} option. | |
eae04238 | 1119 | @xref{Target Selection}, for more information. |
c72af735 | 1120 | |
9793039f ILT |
1121 | @item -C |
1122 | @itemx --demangle | |
1123 | @cindex demangling in objdump | |
1124 | Decode (@dfn{demangle}) low-level symbol names into user-level names. | |
1125 | Besides removing any initial underscore prepended by the system, this | |
1126 | makes C++ function names readable. @xref{c++filt}, for more information | |
1127 | on demangling. | |
1128 | ||
e1c14599 ILT |
1129 | @item --debugging |
1130 | Display debugging information. This attempts to parse debugging | |
1131 | information stored in the file and print it out using a C like syntax. | |
1132 | Only certain types of debugging information have been implemented. | |
1133 | ||
c72af735 | 1134 | @item -d |
eae04238 | 1135 | @itemx --disassemble |
c72af735 RP |
1136 | @cindex disassembling object code |
1137 | @cindex machine instructions | |
d5464baa ILT |
1138 | Display the assembler mnemonics for the machine instructions from |
1139 | @var{objfile}. This option only disassembles those sections which are | |
1140 | expected to contain instructions. | |
1141 | ||
1142 | @item -D | |
1143 | @itemx --disassemble-all | |
1144 | Like @samp{-d}, but disassemble the contents of all sections, not just | |
1145 | those expected to contain instructions. | |
c72af735 | 1146 | |
51b8c416 ILT |
1147 | @item --prefix-addresses |
1148 | When disassembling, print the complete address on each line. This is | |
1149 | the older disassembly format. | |
1150 | ||
1151 | @item --disassemble-zeroes | |
1152 | Normally the disassembly output will skip blocks of zeroes. This | |
1153 | option directs the disassembler to disassemble those blocks, just like | |
1154 | any other data. | |
1155 | ||
67c8c901 ILT |
1156 | @item -EB |
1157 | @itemx -EL | |
1158 | @itemx --endian=@{big|little@} | |
1159 | @cindex endianness | |
1160 | @cindex disassembly endianness | |
1161 | Specify the endianness of the object files. This only affects | |
1162 | disassembly. This can be useful when disassembling a file format which | |
1163 | does not describe endianness information, such as S-records. | |
1164 | ||
c72af735 | 1165 | @item -f |
eae04238 | 1166 | @itemx --file-header |
c72af735 | 1167 | @cindex object file header |
eae04238 | 1168 | Display summary information from the overall header of |
ec40bbb8 | 1169 | each of the @var{objfile} files. |
c72af735 RP |
1170 | |
1171 | @item -h | |
eae04238 | 1172 | @itemx --section-header |
c5f0c938 | 1173 | @itemx --header |
c72af735 | 1174 | @cindex section headers |
eae04238 | 1175 | Display summary information from the section headers of the |
c72af735 RP |
1176 | object file. |
1177 | ||
db2e6adb DM |
1178 | File segments may be relocated to nonstandard addresses, for example by |
1179 | using the @samp{-Ttext}, @samp{-Tdata}, or @samp{-Tbss} options to | |
1180 | @code{ld}. However, some object file formats, such as a.out, do not | |
1181 | store the starting address of the file segments. In those situations, | |
1182 | although @code{ld} relocates the sections correctly, using @samp{objdump | |
1183 | -h} to list the file section headers cannot show the correct addresses. | |
1184 | Instead, it shows the usual addresses, which are implicit for the | |
1185 | target. | |
1186 | ||
b26ac613 DM |
1187 | @item --help |
1188 | Print a summary of the options to @code{objdump} and exit. | |
1189 | ||
c72af735 | 1190 | @item -i |
eae04238 | 1191 | @itemx --info |
c72af735 RP |
1192 | @cindex architectures available |
1193 | @cindex object formats available | |
1194 | Display a list showing all architectures and object formats available | |
ec40bbb8 | 1195 | for specification with @samp{-b} or @samp{-m}. |
c72af735 | 1196 | |
c72af735 | 1197 | @item -j @var{name} |
eae04238 | 1198 | @itemx --section=@var{name} |
c72af735 | 1199 | @cindex section information |
ec40bbb8 | 1200 | Display information only for section @var{name}. |
c72af735 | 1201 | |
c72af735 | 1202 | @item -l |
eae04238 | 1203 | @itemx --line-numbers |
c72af735 | 1204 | @cindex source filenames for object files |
11548211 ILT |
1205 | Label the display (using debugging information) with the filename and |
1206 | source line numbers corresponding to the object code or relocs shown. | |
1207 | Only useful with @samp{-d}, @samp{-D}, or @samp{-r}. | |
c72af735 | 1208 | |
c72af735 | 1209 | @item -m @var{machine} |
eae04238 | 1210 | @itemx --architecture=@var{machine} |
c72af735 | 1211 | @cindex architecture |
67c8c901 ILT |
1212 | @cindex disassembly architecture |
1213 | Specify the architecture to use when disassembling object files. This | |
1214 | can be useful when disasembling object files which do not describe | |
1215 | architecture information, such as S-records. You can list the available | |
1216 | architectures with the @samp{-i} option. | |
c72af735 RP |
1217 | |
1218 | @item -r | |
c5f0c938 | 1219 | @itemx --reloc |
c72af735 | 1220 | @cindex relocation entries, in object file |
d5464baa ILT |
1221 | Print the relocation entries of the file. If used with @samp{-d} or |
1222 | @samp{-D}, the relocations are printed interspersed with the | |
1223 | disassembly. | |
c72af735 | 1224 | |
de3b08ac ILT |
1225 | @item -R |
1226 | @itemx --dynamic-reloc | |
1227 | @cindex dynamic relocation entries, in object file | |
1228 | Print the dynamic relocation entries of the file. This is only | |
1229 | meaningful for dynamic objects, such as certain types of shared | |
1230 | libraries. | |
1231 | ||
c72af735 | 1232 | @item -s |
eae04238 | 1233 | @itemx --full-contents |
c72af735 RP |
1234 | @cindex sections, full contents |
1235 | @cindex object file sections | |
1236 | Display the full contents of any sections requested. | |
1237 | ||
a8e27cc6 ILT |
1238 | @item -S |
1239 | @itemx --source | |
1240 | @cindex source disassembly | |
1241 | @cindex disassembly, with source | |
1242 | Display source code intermixed with disassembly, if possible. Implies | |
1243 | @samp{-d}. | |
1244 | ||
458bbd1f DE |
1245 | @item --show-raw-insn |
1246 | When disassembling instructions, print the instruction in hex as well as | |
4cb99ff2 ILT |
1247 | in symbolic form. This is the default except when |
1248 | @code{--prefix-addresses} is used. | |
458bbd1f | 1249 | |
5c59269f ILT |
1250 | @item --no-show-raw-insn |
1251 | When disassembling instructions, do not print the instruction bytes. | |
1252 | This is the default when @code{--prefix-addresses} is used. | |
1253 | ||
c5f0c938 JG |
1254 | @item --stabs |
1255 | @cindex stab | |
1256 | @cindex .stab | |
1257 | @cindex debug symbols | |
1258 | @cindex ELF object file format | |
c3c93fda JG |
1259 | Display the full contents of any sections requested. Display the |
1260 | contents of the .stab and .stab.index and .stab.excl sections from an | |
1261 | ELF file. This is only useful on systems (such as Solaris 2.0) in which | |
1262 | @code{.stab} debugging symbol-table entries are carried in an ELF | |
1263 | section. In most other file formats, debugging symbol-table entries are | |
c5f0c938 | 1264 | interleaved with linkage symbols, and are visible in the @samp{--syms} |
85d4b870 ILT |
1265 | output. For more information on stabs symbols, see @ref{Top,Stabs,Stabs |
1266 | Overview,stabs.info, The ``stabs'' debug format}. | |
c5f0c938 | 1267 | |
aa21a2a9 ILT |
1268 | @item --start-address=@var{address} |
1269 | @cindex start-address | |
1270 | Start displaying data at the specified address. This affects the output | |
1271 | of the @code{-d}, @code{-r} and @code{-s} options. | |
1272 | ||
1273 | @item --stop-address=@var{address} | |
1274 | @cindex stop-address | |
1275 | Stop displaying data at the specified address. This affects the output | |
1276 | of the @code{-d}, @code{-r} and @code{-s} options. | |
1277 | ||
c72af735 | 1278 | @item -t |
c5f0c938 | 1279 | @itemx --syms |
c72af735 | 1280 | @cindex symbol table entries, printing |
eae04238 | 1281 | Print the symbol table entries of the file. |
c72af735 RP |
1282 | This is similar to the information provided by the @samp{nm} program. |
1283 | ||
de3b08ac ILT |
1284 | @item -T |
1285 | @itemx --dynamic-syms | |
1286 | @cindex dynamic symbol table entries, printing | |
1287 | Print the dynamic symbol table entries of the file. This is only | |
1288 | meaningful for dynamic objects, such as certain types of shared | |
1289 | libraries. This is similar to the information provided by the @samp{nm} | |
1290 | program when given the @samp{-D} (@samp{--dynamic}) option. | |
1291 | ||
b26ac613 DM |
1292 | @item --version |
1293 | Print the version number of @code{objdump} and exit. | |
1294 | ||
c72af735 | 1295 | @item -x |
eae04238 | 1296 | @itemx --all-header |
c72af735 RP |
1297 | @cindex all header information, object file |
1298 | @cindex header information, all | |
1299 | Display all available header information, including the symbol table and | |
1300 | relocation entries. Using @samp{-x} is equivalent to specifying all of | |
1301 | @samp{-a -f -h -r -t}. | |
4b6d0f78 MM |
1302 | |
1303 | @item -w | |
1304 | @item --wide | |
1305 | @cindex wide output, printing | |
1306 | Format some lines for output devices that have more than 80 columns. | |
c72af735 RP |
1307 | @end table |
1308 | ||
eae04238 | 1309 | @node ranlib |
c72af735 RP |
1310 | @chapter ranlib |
1311 | ||
1312 | @kindex ranlib | |
1313 | @cindex archive contents | |
1314 | @cindex symbol index | |
1315 | ||
1316 | @smallexample | |
4d9b5d5a | 1317 | ranlib [-vV] @var{archive} |
c72af735 RP |
1318 | @end smallexample |
1319 | ||
ec40bbb8 | 1320 | @code{ranlib} generates an index to the contents of an archive and |
c72af735 RP |
1321 | stores it in the archive. The index lists each symbol defined by a |
1322 | member of an archive that is a relocatable object file. | |
1323 | ||
918c2f61 | 1324 | You may use @samp{nm -s} or @samp{nm --print-armap} to list this index. |
c72af735 | 1325 | |
ec40bbb8 | 1326 | An archive with such an index speeds up linking to the library and |
c72af735 RP |
1327 | allows routines in the library to call each other without regard to |
1328 | their placement in the archive. | |
1329 | ||
b94ff924 | 1330 | The @sc{gnu} @code{ranlib} program is another form of @sc{gnu} @code{ar}; running |
c72af735 RP |
1331 | @code{ranlib} is completely equivalent to executing @samp{ar -s}. |
1332 | @xref{ar}. | |
1333 | ||
4d9b5d5a DM |
1334 | @table @code |
1335 | @item -v | |
1336 | @itemx -V | |
1337 | Show the version number of @code{ranlib}. | |
c3f471a4 | 1338 | @end table |
4d9b5d5a | 1339 | |
eae04238 | 1340 | @node size |
c72af735 RP |
1341 | @chapter size |
1342 | ||
1343 | @kindex size | |
1344 | @cindex section sizes | |
1345 | ||
1346 | @smallexample | |
4d9b5d5a DM |
1347 | size [ -A | -B | --format=@var{compatibility} ] |
1348 | [ --help ] [ -d | -o | -x | --radix=@var{number} ] | |
1349 | [ --target=@var{bfdname} ] [ -V | --version ] | |
f2843a17 | 1350 | [ @var{objfile}@dots{} ] |
c72af735 RP |
1351 | @end smallexample |
1352 | ||
b94ff924 | 1353 | The @sc{gnu} @code{size} utility lists the section sizes---and the total |
ec40bbb8 DM |
1354 | size---for each of the object or archive files @var{objfile} in its |
1355 | argument list. By default, one line of output is generated for each | |
1356 | object file or each module in an archive. | |
c72af735 | 1357 | |
b26ac613 | 1358 | @var{objfile}@dots{} are the object files to be examined. |
f2843a17 | 1359 | If none are specified, the file @code{a.out} will be used. |
b26ac613 | 1360 | |
c72af735 | 1361 | The command line options have the following meanings: |
c72af735 | 1362 | |
b26ac613 | 1363 | @table @code |
c72af735 RP |
1364 | @item -A |
1365 | @itemx -B | |
ec40bbb8 | 1366 | @itemx --format=@var{compatibility} |
68dd5295 | 1367 | @cindex @code{size} display format |
b94ff924 | 1368 | Using one of these options, you can choose whether the output from @sc{gnu} |
c72af735 | 1369 | @code{size} resembles output from System V @code{size} (using @samp{-A}, |
ec40bbb8 DM |
1370 | or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or |
1371 | @samp{--format=berkeley}). The default is the one-line format similar to | |
c72af735 | 1372 | Berkeley's. |
918c2f61 PB |
1373 | @c Bonus for doc-source readers: you can also say --format=strange (or |
1374 | @c anything else that starts with 's') for sysv, and --format=boring (or | |
c72af735 RP |
1375 | @c anything else that starts with 'b') for Berkeley. |
1376 | ||
1377 | Here is an example of the Berkeley (default) format of output from | |
1378 | @code{size}: | |
1379 | @smallexample | |
eae04238 | 1380 | size --format=Berkeley ranlib size |
c72af735 RP |
1381 | text data bss dec hex filename |
1382 | 294880 81920 11592 388392 5ed28 ranlib | |
1383 | 294880 81920 11888 388688 5ee50 size | |
1384 | @end smallexample | |
1385 | ||
1386 | @noindent | |
1387 | This is the same data, but displayed closer to System V conventions: | |
1388 | ||
1389 | @smallexample | |
eae04238 | 1390 | size --format=SysV ranlib size |
c72af735 RP |
1391 | ranlib : |
1392 | section size addr | |
1393 | .text 294880 8192 | |
1394 | .data 81920 303104 | |
1395 | .bss 11592 385024 | |
1396 | Total 388392 | |
1397 | ||
1398 | ||
1399 | size : | |
1400 | section size addr | |
1401 | .text 294880 8192 | |
1402 | .data 81920 303104 | |
1403 | .bss 11888 385024 | |
1404 | Total 388688 | |
1405 | @end smallexample | |
1406 | ||
918c2f61 | 1407 | @item --help |
c72af735 RP |
1408 | Show a summary of acceptable arguments and options. |
1409 | ||
1410 | @item -d | |
1411 | @itemx -o | |
1412 | @itemx -x | |
ec40bbb8 | 1413 | @itemx --radix=@var{number} |
68dd5295 | 1414 | @cindex @code{size} number format |
c72af735 RP |
1415 | @cindex radix for section sizes |
1416 | Using one of these options, you can control whether the size of each | |
ec40bbb8 DM |
1417 | section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal |
1418 | (@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or | |
1419 | @samp{--radix=16}). In @samp{--radix=@var{number}}, only the three | |
c72af735 RP |
1420 | values (8, 10, 16) are supported. The total size is always given in two |
1421 | radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or | |
1422 | octal and hexadecimal if you're using @samp{-o}. | |
1423 | ||
ec40bbb8 | 1424 | @item --target=@var{bfdname} |
c72af735 | 1425 | @cindex object code format |
ec40bbb8 DM |
1426 | Specify that the object-code format for @var{objfile} is |
1427 | @var{bfdname}. This option may not be necessary; @code{size} can | |
eae04238 DM |
1428 | automatically recognize many formats. |
1429 | @xref{Target Selection}, for more information. | |
c72af735 RP |
1430 | |
1431 | @item -V | |
918c2f61 | 1432 | @itemx --version |
4d9b5d5a | 1433 | Display the version number of @code{size}. |
c72af735 RP |
1434 | @end table |
1435 | ||
eae04238 | 1436 | @node strings |
ba7c8e29 DM |
1437 | @chapter strings |
1438 | @kindex strings | |
1439 | @cindex listings strings | |
1440 | @cindex printing strings | |
1441 | @cindex strings, printing | |
1442 | ||
1443 | @smallexample | |
b26ac613 | 1444 | strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-] |
650a49f0 | 1445 | [--all] [--print-file-name] [--bytes=@var{min-len}] |
eae04238 DM |
1446 | [--radix=@var{radix}] [--target=@var{bfdname}] |
1447 | [--help] [--version] @var{file}@dots{} | |
ba7c8e29 DM |
1448 | @end smallexample |
1449 | ||
b94ff924 | 1450 | For each @var{file} given, @sc{gnu} @code{strings} prints the printable |
ba7c8e29 | 1451 | character sequences that are at least 4 characters long (or the number |
67ace729 | 1452 | given with the options below) and are followed by an unprintable |
ba7c8e29 | 1453 | character. By default, it only prints the strings from the initialized |
5f057047 ILT |
1454 | and loaded sections of object files; for other types of files, it prints |
1455 | the strings from the whole file. | |
ba7c8e29 DM |
1456 | |
1457 | @code{strings} is mainly useful for determining the contents of non-text | |
1458 | files. | |
1459 | ||
1460 | @table @code | |
1461 | @item -a | |
1462 | @itemx --all | |
1463 | @itemx - | |
5f057047 ILT |
1464 | Do not scan only the initialized and loaded sections of object files; |
1465 | scan the whole files. | |
ba7c8e29 DM |
1466 | |
1467 | @item -f | |
1468 | @itemx --print-file-name | |
1469 | Print the name of the file before each string. | |
1470 | ||
b26ac613 | 1471 | @item --help |
ba7c8e29 DM |
1472 | Print a summary of the program usage on the standard output and exit. |
1473 | ||
ba7c8e29 | 1474 | @itemx -@var{min-len} |
b26ac613 | 1475 | @item -n @var{min-len} |
ba7c8e29 DM |
1476 | @itemx --bytes=@var{min-len} |
1477 | Print sequences of characters that are at least @var{min-len} characters | |
1478 | long, instead of the default 4. | |
1479 | ||
1480 | @item -o | |
b26ac613 DM |
1481 | Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o} |
1482 | act like @samp{-t d} instead. Since we can not be compatible with both | |
1483 | ways, we simply chose one. | |
ba7c8e29 DM |
1484 | |
1485 | @item -t @var{radix} | |
1486 | @itemx --radix=@var{radix} | |
1487 | Print the offset within the file before each string. The single | |
1488 | character argument specifies the radix of the offset---@samp{o} for | |
1489 | octal, @samp{x} for hexadecimal, or @samp{d} for decimal. | |
1490 | ||
eae04238 DM |
1491 | @item --target=@var{bfdname} |
1492 | @cindex object code format | |
1493 | Specify an object code format other than your system's default format. | |
1494 | @xref{Target Selection}, for more information. | |
1495 | ||
ba7c8e29 DM |
1496 | @item -v |
1497 | @itemx --version | |
1498 | Print the program version number on the standard output and exit. | |
1499 | @end table | |
1500 | ||
eae04238 | 1501 | @node strip |
c72af735 RP |
1502 | @chapter strip |
1503 | ||
1504 | @kindex strip | |
1505 | @cindex removing symbols | |
1506 | @cindex discarding symbols | |
1815e42c | 1507 | @cindex symbols, discarding |
c72af735 RP |
1508 | |
1509 | @smallexample | |
eae04238 DM |
1510 | strip [ -F @var{bfdname} | --target=@var{bfdname} | --target=@var{bfdname} ] |
1511 | [ -I @var{bfdname} | --input-target=@var{bfdname} ] | |
1512 | [ -O @var{bfdname} | --output-target=@var{bfdname} ] | |
b703c078 | 1513 | [ -s | --strip-all ] [ -S | -g | --strip-debug ] |
dff604a7 | 1514 | [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] |
29c0d15c | 1515 | [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] |
b703c078 | 1516 | [ -x | --discard-all ] [ -X | --discard-locals ] |
0aca460e | 1517 | [ -R @var{sectionname} | --remove-section=@var{sectionname} ] |
2483354d | 1518 | [ -o @var{file} ] [ -p | --preserve-dates ] |
b26ac613 | 1519 | [ -v | --verbose ] [ -V | --version ] [ --help ] |
b703c078 | 1520 | @var{objfile}@dots{} |
c72af735 RP |
1521 | @end smallexample |
1522 | ||
b94ff924 | 1523 | @sc{gnu} @code{strip} discards all symbols from object files |
ec40bbb8 | 1524 | @var{objfile}. The list of object files may include archives. |
b26ac613 | 1525 | At least one object file must be given. |
c72af735 | 1526 | |
ec40bbb8 | 1527 | @code{strip} modifies the files named in its argument, |
c72af735 | 1528 | rather than writing modified copies under different names. |
c72af735 | 1529 | |
c72af735 | 1530 | @table @code |
eae04238 DM |
1531 | @item -F @var{bfdname} |
1532 | @itemx --target=@var{bfdname} | |
b26ac613 | 1533 | Treat the original @var{objfile} as a file with the object |
eae04238 DM |
1534 | code format @var{bfdname}, and rewrite it in the same format. |
1535 | @xref{Target Selection}, for more information. | |
b26ac613 DM |
1536 | |
1537 | @item --help | |
1538 | Show a summary of the options to @code{strip} and exit. | |
1539 | ||
eae04238 DM |
1540 | @item -I @var{bfdname} |
1541 | @itemx --input-target=@var{bfdname} | |
ec40bbb8 | 1542 | Treat the original @var{objfile} as a file with the object |
eae04238 DM |
1543 | code format @var{bfdname}. |
1544 | @xref{Target Selection}, for more information. | |
918c2f61 | 1545 | |
eae04238 DM |
1546 | @item -O @var{bfdname} |
1547 | @itemx --output-target=@var{bfdname} | |
1548 | Replace @var{objfile} with a file in the output format @var{bfdname}. | |
1549 | @xref{Target Selection}, for more information. | |
918c2f61 | 1550 | |
0aca460e ILT |
1551 | @item -R @var{sectionname} |
1552 | @itemx --remove-section=@var{sectionname} | |
1553 | Remove any section named @var{sectionname} from the output file. This | |
1554 | option may be given more than once. Note that using this option | |
1555 | inappropriately may make the output file unusable. | |
1556 | ||
b703c078 DM |
1557 | @item -s |
1558 | @itemx --strip-all | |
1559 | Remove all symbols. | |
1560 | ||
918c2f61 PB |
1561 | @item -g |
1562 | @itemx -S | |
1563 | @itemx --strip-debug | |
1564 | Remove debugging symbols only. | |
1565 | ||
9135e5f8 ILT |
1566 | @item --strip-unneeded |
1567 | Remove all symbols that are not needed for relocation processing. | |
1568 | ||
dff604a7 ILT |
1569 | @item -K @var{symbolname} |
1570 | @itemx --keep-symbol=@var{symbolname} | |
1571 | Keep only symbol @var{symbolname} from the source file. This option may | |
1572 | be given more than once. | |
1573 | ||
29c0d15c ILT |
1574 | @item -N @var{symbolname} |
1575 | @itemx --strip-symbol=@var{symbolname} | |
dff604a7 ILT |
1576 | Remove symbol @var{symbolname} from the source file. This option may be |
1577 | given more than once, and may be combined with strip options other than | |
1578 | @code{-K}. | |
29c0d15c | 1579 | |
16c3e32a ILT |
1580 | @item -o @var{file} |
1581 | Put the stripped output in @var{file}, rather than replacing the | |
1582 | existing file. When this argument is used, only one @var{objfile} | |
1583 | argument may be specified. | |
1584 | ||
2483354d ILT |
1585 | @item -p |
1586 | @itemx --preserve-dates | |
1587 | Preserve the access and modification dates of the file. | |
1588 | ||
918c2f61 PB |
1589 | @item -x |
1590 | @itemx --discard-all | |
1591 | Remove non-global symbols. | |
1592 | ||
1593 | @item -X | |
1594 | @itemx --discard-locals | |
1595 | Remove compiler-generated local symbols. | |
ec40bbb8 | 1596 | (These usually start with @samp{L} or @samp{.}.) |
918c2f61 PB |
1597 | |
1598 | @item -V | |
1599 | @itemx --version | |
ec40bbb8 | 1600 | Show the version number for @code{strip}. |
918c2f61 | 1601 | |
1815e42c | 1602 | @item -v |
918c2f61 PB |
1603 | @itemx --verbose |
1604 | Verbose output: list all object files modified. In the case of | |
1269d441 | 1605 | archives, @samp{strip -v} lists all members of the archive. |
c72af735 RP |
1606 | @end table |
1607 | ||
eae04238 | 1608 | @node c++filt |
b6216af2 PB |
1609 | @chapter c++filt |
1610 | ||
1611 | @kindex c++filt | |
1612 | @cindex demangling C++ symbols | |
1613 | ||
b26ac613 DM |
1614 | @smallexample |
1615 | c++filt [ -_ | --strip-underscores ] | |
6f88f031 | 1616 | [ -n | --no-strip-underscores ] |
b26ac613 | 1617 | [ -s @var{format} | --format=@var{format} ] |
d6a4c375 | 1618 | [ --help ] [ --version ] [ @var{symbol}@dots{} ] |
b26ac613 DM |
1619 | @end smallexample |
1620 | ||
6c69b6bd JO |
1621 | The C++ language provides function overloading, which means that you can |
1622 | write many functions with the same name (providing each takes parameters | |
1623 | of different types). All C++ function names are encoded into a | |
b26ac613 | 1624 | low-level assembly label (this process is known as |
6c69b6bd JO |
1625 | @dfn{mangling}). The @code{c++filt} program does the inverse mapping: it |
1626 | decodes (@dfn{demangles}) low-level names into user-level names so that | |
1627 | the linker can keep these overloaded functions from clashing. | |
1628 | ||
1629 | Every alphanumeric word (consisting of letters, digits, underscores, | |
1630 | dollars, or periods) seen in the input is a potential label. If the | |
1631 | label decodes into a C++ name, the C++ name replaces the low-level | |
1632 | name in the output. | |
b6216af2 | 1633 | |
d6a4c375 | 1634 | You can use @code{c++filt} to decipher individual symbols: |
6c69b6bd JO |
1635 | |
1636 | @example | |
1637 | c++filt @var{symbol} | |
1638 | @end example | |
1639 | ||
d6a4c375 DM |
1640 | If no @var{symbol} arguments are given, @code{c++filt} reads symbol |
1641 | names from the standard input and writes the demangled names to the | |
1642 | standard output. All results are printed on the standard output. | |
b6216af2 | 1643 | |
b26ac613 DM |
1644 | @table @code |
1645 | @item -_ | |
94e9ad77 | 1646 | @itemx --strip-underscores |
b26ac613 DM |
1647 | On some systems, both the C and C++ compilers put an underscore in front |
1648 | of every name. For example, the C name @code{foo} gets the low-level | |
6f88f031 ILT |
1649 | name @code{_foo}. This option removes the initial underscore. Whether |
1650 | @code{c++filt} removes the underscore by default is target dependent. | |
1651 | ||
1652 | @item -n | |
1653 | @itemx --no-strip-underscores | |
1654 | Do not remove the initial underscore. | |
b26ac613 DM |
1655 | |
1656 | @item -s @var{format} | |
1657 | @itemx --format=@var{format} | |
b94ff924 | 1658 | @sc{gnu} @code{nm} can decode three different methods of mangling, used by |
b26ac613 DM |
1659 | different C++ compilers. The argument to this option selects which |
1660 | method it uses: | |
1661 | ||
1662 | @table @code | |
1663 | @item gnu | |
b94ff924 | 1664 | the one used by the @sc{gnu} compiler (the default method) |
b26ac613 DM |
1665 | @item lucid |
1666 | the one used by the Lucid compiler | |
1667 | @item arm | |
1668 | the one specified by the C++ Annotated Reference Manual | |
1669 | @end table | |
1670 | ||
1671 | @item --help | |
1672 | Print a summary of the options to @code{c++filt} and exit. | |
1673 | ||
1674 | @item --version | |
1675 | Print the version number of @code{c++filt} and exit. | |
1676 | @end table | |
b6216af2 | 1677 | |
5eac46ae JO |
1678 | @quotation |
1679 | @emph{Warning:} @code{c++filt} is a new utility, and the details of its | |
1680 | user interface are subject to change in future releases. In particular, | |
1681 | a command-line option may be required in the the future to decode a name | |
1682 | passed as an argument on the command line; in other words, | |
1683 | ||
1684 | @example | |
b26ac613 | 1685 | c++filt @var{symbol} |
5eac46ae JO |
1686 | @end example |
1687 | ||
1688 | @noindent | |
1689 | may in a future release become | |
1690 | ||
1691 | @example | |
b26ac613 | 1692 | c++filt @var{option} @var{symbol} |
5eac46ae JO |
1693 | @end example |
1694 | @end quotation | |
1695 | ||
fb38844d ILT |
1696 | @node addr2line |
1697 | @chapter addr2line | |
1698 | ||
1699 | @kindex addr2line | |
1700 | @cindex address to file name and line number | |
1701 | ||
1702 | @smallexample | |
1703 | addr2line [ -b @var{bfdname} | --target=@var{bfdname} ] | |
1704 | [ -C | --demangle ] | |
1705 | [ -e @var{filename} | --exe=@var{filename} ] | |
1706 | [ -f | --functions ] [ -s | --basename ] | |
1707 | [ -H | --help ] [ -V | --version ] | |
1708 | [ addr addr ... ] | |
1709 | @end smallexample | |
1710 | ||
1711 | @code{addr2line} translates program addresses into file names and line | |
1712 | numbers. Given an address and an executable, it uses the debugging | |
1713 | information in the executable to figure out which file name and line | |
1714 | number are associated with a given address. | |
1715 | ||
1716 | The executable to use is specified with the @code{-e} option. The | |
1717 | default is @file{a.out}. | |
1718 | ||
1719 | @code{addr2line} has two modes of operation. | |
1720 | ||
1721 | In the first, hexadecimal addresses are specified on the command line, | |
1722 | and @code{addr2line} displays the file name and line number for each | |
1723 | address. | |
1724 | ||
1725 | In the second, @code{addr2line} reads hexadecimal addresses from | |
1726 | standard input, and prints the file name and line number for each | |
1727 | address on standard output. In this mode, @code{addr2line} may be used | |
1728 | in a pipe to convert dynamically chosen addresses. | |
1729 | ||
1730 | The format of the output is @samp{FILENAME:LINENO}. The file name and | |
1731 | line number for each address is printed on a separate line. If the | |
1732 | @code{-f} option is used, then each @samp{FILENAME:LINENO} line is | |
1733 | preceded by a @samp{FUNCTIONNAME} line which is the name of the function | |
1734 | containing the address. | |
1735 | ||
1736 | If the file name or function name can not be determined, | |
1737 | @code{addr2line} will print two question marks in their place. If the | |
1738 | line number can not be determined, @code{addr2line} will print 0. | |
1739 | ||
1740 | The long and short forms of options, shown here as alternatives, are | |
1741 | equivalent. | |
1742 | ||
1743 | @table @code | |
1744 | @item -b @var{bfdname} | |
1745 | @itemx --target=@var{bfdname} | |
1746 | @cindex object code format | |
1747 | Specify that the object-code format for the object files is | |
1748 | @var{bfdname}. | |
1749 | ||
1750 | @item -C | |
1751 | @itemx --demangle | |
1752 | @cindex demangling in objdump | |
1753 | Decode (@dfn{demangle}) low-level symbol names into user-level names. | |
1754 | Besides removing any initial underscore prepended by the system, this | |
1755 | makes C++ function names readable. @xref{c++filt}, for more information | |
1756 | on demangling. | |
1757 | ||
1758 | @item -e @var{filename} | |
1759 | @itemx --exe=@var{filename} | |
1760 | Specify the name of the executable for which addresses should be | |
1761 | translated. The default file is @file{a.out}. | |
1762 | ||
1763 | @item -f | |
1764 | @itemx --functions | |
1765 | Display function names as well as file and line number information. | |
1766 | ||
1767 | @item -s | |
1768 | @itemx --basenames | |
1769 | Display only the base of each file name. | |
1770 | @end table | |
1771 | ||
eae04238 | 1772 | @node nlmconv |
94e9ad77 JO |
1773 | @chapter nlmconv |
1774 | ||
1775 | @code{nlmconv} converts a relocatable object file into a NetWare | |
8981cac5 JO |
1776 | Loadable Module. |
1777 | ||
1778 | @ignore | |
1779 | @code{nlmconv} currently works with @samp{i386} object | |
4961ce5b JO |
1780 | files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC} |
1781 | object files in @sc{elf}, or @code{a.out} format@footnote{ | |
1782 | @code{nlmconv} should work with any @samp{i386} or @sc{sparc} object | |
1783 | format in the Binary File Descriptor library. It has only been tested | |
1784 | with the above formats.}. | |
8981cac5 | 1785 | @end ignore |
4961ce5b JO |
1786 | |
1787 | @quotation | |
1788 | @emph{Warning:} @code{nlmconv} is not always built as part of the binary | |
1789 | utilities, since it is only useful for NLM targets. | |
1790 | @end quotation | |
94e9ad77 JO |
1791 | |
1792 | @smallexample | |
eae04238 DM |
1793 | nlmconv [ -I @var{bfdname} | --input-target=@var{bfdname} ] |
1794 | [ -O @var{bfdname} | --output-target=@var{bfdname} ] | |
94e9ad77 | 1795 | [ -T @var{headerfile} | --header-file=@var{headerfile} ] |
20465f8b | 1796 | [ -d | --debug] [ -l @var{linker} | --linker=@var{linker} ] |
94e9ad77 JO |
1797 | [ -h | --help ] [ -V | --version ] |
1798 | @var{infile} @var{outfile} | |
1799 | @end smallexample | |
1800 | ||
1801 | @code{nlmconv} converts the relocatable @samp{i386} object file | |
1802 | @var{infile} into the NetWare Loadable Module @var{outfile}, optionally | |
1803 | reading @var{headerfile} for NLM header information. For instructions | |
5b0ba16d JO |
1804 | on writing the NLM command file language used in header files, see the |
1805 | @samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM | |
1806 | Development and Tools Overview}, which is part of the NLM Software | |
1807 | Developer's Kit (``NLM SDK''), available from Novell, Inc. | |
1808 | @code{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read | |
eae04238 | 1809 | @var{infile}; see @ref{BFD,,BFD,ld.info,Using LD}, for |
5b0ba16d | 1810 | more information. |
94e9ad77 | 1811 | |
20465f8b JO |
1812 | @code{nlmconv} can perform a link step. In other words, you can list |
1813 | more than one object file for input if you list them in the definitions | |
1814 | file (rather than simply specifying one input file on the command line). | |
1815 | In this case, @code{nlmconv} calls the linker for you. | |
1816 | ||
94e9ad77 | 1817 | @table @code |
eae04238 DM |
1818 | @item -I @var{bfdname} |
1819 | @itemx --input-target=@var{bfdname} | |
94e9ad77 | 1820 | Object format of the input file. @code{nlmconv} can usually determine |
eae04238 DM |
1821 | the format of a given file (so no default is necessary). |
1822 | @xref{Target Selection}, for more information. | |
94e9ad77 | 1823 | |
eae04238 DM |
1824 | @item -O @var{bfdname} |
1825 | @itemx --output-target=@var{bfdname} | |
94e9ad77 JO |
1826 | Object format of the output file. @code{nlmconv} infers the output |
1827 | format based on the input format, e.g. for a @samp{i386} input file the | |
eae04238 DM |
1828 | output format is @samp{nlm32-i386}. |
1829 | @xref{Target Selection}, for more information. | |
94e9ad77 JO |
1830 | |
1831 | @item -T @var{headerfile} | |
1832 | @itemx --header-file=@var{headerfile} | |
1833 | Reads @var{headerfile} for NLM header information. For instructions on | |
5b0ba16d JO |
1834 | writing the NLM command file language used in header files, see@ see the |
1835 | @samp{linkers} section, of the @cite{NLM Development and Tools | |
1836 | Overview}, which is part of the NLM Software Developer's Kit, available | |
1837 | from Novell, Inc. | |
94e9ad77 | 1838 | |
20465f8b JO |
1839 | @item -d |
1840 | @itemx --debug | |
1841 | Displays (on standard error) the linker command line used by @code{nlmconv}. | |
1842 | ||
1843 | @item -l @var{linker} | |
1844 | @itemx --linker=@var{linker} | |
1845 | Use @var{linker} for any linking. @var{linker} can be an abosolute or a | |
1846 | relative pathname. | |
1847 | ||
94e9ad77 JO |
1848 | @item -h |
1849 | @itemx --help | |
1850 | Prints a usage summary. | |
1851 | ||
1852 | @item -V | |
1853 | @itemx --version | |
1854 | Prints the version number for @code{nlmconv}. | |
1855 | @end table | |
1856 | ||
217947b2 ILT |
1857 | @node windres |
1858 | @chapter windres | |
1859 | ||
1860 | @code{windres} may be used to manipulate Windows resources. | |
1861 | ||
1862 | @quotation | |
1863 | @emph{Warning:} @code{windres} is not always built as part of the binary | |
1864 | utilities, since it is only useful for Windows targets. | |
1865 | @end quotation | |
1866 | ||
1867 | @smallexample | |
1868 | windres [options] [input-file] [output-file] | |
1869 | @end smallexample | |
1870 | ||
1871 | @code{windres} reads resources from an input file and copies them into | |
1872 | an output file. Either file may be in one of three formats: | |
1873 | ||
1874 | @table @code | |
1875 | @item rc | |
1876 | A text format read by the Resource Compiler. | |
1877 | ||
1878 | @item res | |
1879 | A binary format generated by the Resource Compiler. | |
1880 | ||
1881 | @item coff | |
1882 | A COFF object or executable. | |
1883 | @end table | |
1884 | ||
1885 | The exact description of these different formats is available in | |
1886 | documentation from Microsoft. | |
1887 | ||
1888 | When @code{windres} converts from the @code{rc} format to the @code{res} | |
1889 | format, it is acting like the Windows Resource Compiler. When | |
1890 | @code{windres} converts from the @code{res} format to the @code{coff} | |
1891 | format, it is acting like the Windows @code{CVTRES} program. | |
1892 | ||
1893 | When @code{windres} generates an @code{rc} file, the output is similar | |
1894 | but not identical to the format expected for the input. When an input | |
1895 | @code{rc} file refers to an external filename, an output @code{rc} file | |
1896 | will instead include the file contents. | |
1897 | ||
1898 | If the input or output format is not specified, @code{windres} will | |
1899 | guess based on the file name, or, for the input file, the file contents. | |
1900 | A file with an extension of @file{.rc} will be treated as an @code{rc} | |
1901 | file, a file with an extension of @file{.res} will be treated as a | |
1902 | @code{res} file, and a file with an extension of @file{.o} or | |
1903 | @file{.exe} will be treated as a @code{coff} file. | |
1904 | ||
1905 | If no output file is specified, @code{windres} will print the resources | |
1906 | in @code{rc} format to standard output. | |
1907 | ||
1908 | The normal use is for you to write an @code{rc} file, use @code{windres} | |
1909 | to convert it to a COFF object file, and then link the COFF file into | |
1910 | your application. This will make the resources described in the | |
1911 | @code{rc} file available to Windows. | |
1912 | ||
1913 | @table @code | |
1914 | @item -i @var{filename} | |
1915 | @itemx --input @var{filename} | |
1916 | The name of the input file. If this option is not used, then | |
1917 | @code{windres} will use the first non-option argument as the input file | |
1918 | name. If there are no non-option arguments, then @code{windres} will | |
1919 | read from standard input. @code{windres} can not read a COFF file from | |
1920 | standard input. | |
1921 | ||
1922 | @item -o @var{filename} | |
1923 | @itemx --output @var{filename} | |
1924 | The name of the output file. If this option is not used, then | |
1925 | @code{windres} will use the first non-option argument, after any used | |
1926 | for the input file name, as the output file name. If there is no | |
1927 | non-option argument, then @code{windres} will write to standard output. | |
1928 | @code{windres} can not write a COFF file to standard output. | |
1929 | ||
1930 | @item -I @var{format} | |
1931 | @itemx --input-format @var{format} | |
1932 | The input format to read. @var{format} may be @samp{res}, @samp{rc}, or | |
1933 | @samp{coff}. If no input format is specified, @code{windres} will | |
1934 | guess, as described above. | |
1935 | ||
1936 | @item -O @var{format} | |
1937 | @itemx --output-format @var{format} | |
1938 | The output format to generate. @var{format} may be @samp{res}, | |
1939 | @samp{rc}, or @samp{coff}. If no output format is specified, | |
1940 | @code{windres} will guess, as described above. | |
1941 | ||
1942 | @item -F @var{target} | |
1943 | @itemx --target @var{target} | |
1944 | Specify the BFD format to use for a COFF file as input or output. This | |
1945 | is a BFD target name; you can use the @code{--help} option to see a list | |
1946 | of supported targets. Normally @code{windres} will use the default | |
1947 | format, which is the first one listed by the @code{--help} option. | |
1948 | @ref{Target Selection}. | |
1949 | ||
1950 | @item --preprocessor @var{program} | |
1951 | When @code{windres} reads an @code{rc} file, it runs it through the C | |
1952 | preprocessor first. This option may be used to specify the preprocessor | |
1953 | to use, including any leading arguments. The default preprocessor | |
1954 | argument is @code{gcc -E -xc-header -DRC_INVOKED}. | |
1955 | ||
1956 | @item --include-dir @var{directory} | |
1957 | Specify an include directory to use when reading an @code{rc} file. | |
1958 | @code{windres} will pass this to the preprocessor as an @code{-I} | |
1959 | option. @code{windres} will also search this directory when looking for | |
1960 | files named in the @code{rc} file. | |
1961 | ||
1962 | @item --define @var{sym[=val]} | |
1963 | Specify a @code{-D} option to pass to the preprocessor when reading an | |
1964 | @code{rc} file. | |
1965 | ||
1966 | @item --language @var{val} | |
1967 | Specify the default language to use when reading an @code{rc} file. | |
1968 | @var{val} should be a hexadecimal language code. The low eight bits are | |
1969 | the language, and the high eight bits are the sublanguage. | |
1970 | ||
1971 | @item --help | |
1972 | Prints a usage summary. | |
1973 | ||
1974 | @item --version | |
1975 | Prints the version number for @code{windres}. | |
1976 | ||
1977 | @item --yydebug | |
1978 | If @code{windres} is compiled with @code{YYDEBUG} defined as @code{1}, | |
1979 | this will turn on parser debugging. | |
1980 | @end table | |
1981 | ||
eae04238 DM |
1982 | @node Selecting The Target System |
1983 | @chapter Selecting the target system | |
1984 | ||
8981cac5 JO |
1985 | You can specify three aspects of the target system to the @sc{gnu} |
1986 | binary file utilities, each in several ways: | |
eae04238 DM |
1987 | |
1988 | @itemize @bullet | |
1989 | @item | |
8981cac5 | 1990 | the target |
eae04238 DM |
1991 | |
1992 | @item | |
8981cac5 | 1993 | the architecture |
eae04238 DM |
1994 | |
1995 | @item | |
8981cac5 | 1996 | the linker emulation (which applies to the linker only) |
eae04238 DM |
1997 | @end itemize |
1998 | ||
1999 | In the following summaries, the lists of ways to specify values are in | |
8981cac5 JO |
2000 | order of decreasing precedence. The ways listed first override those |
2001 | listed later. | |
eae04238 | 2002 | |
8981cac5 JO |
2003 | The commands to list valid values only list the values for which the |
2004 | programs you are running were configured. If they were configured with | |
8490169d | 2005 | @samp{--enable-targets=all}, the commands list most of the available |
eae04238 | 2006 | values, but a few are left out; not all targets can be configured in at |
8981cac5 JO |
2007 | once because some of them can only be configured @dfn{native} (on hosts |
2008 | with the same type as the target system). | |
eae04238 DM |
2009 | |
2010 | @menu | |
2011 | * Target Selection:: | |
2012 | * Architecture Selection:: | |
2013 | * Linker Emulation Selection:: | |
2014 | @end menu | |
2015 | ||
2016 | @node Target Selection | |
8981cac5 | 2017 | @section Target Selection |
eae04238 DM |
2018 | |
2019 | A @dfn{target} is an object file format. A given target may be | |
2020 | supported for multiple architectures (@pxref{Architecture Selection}). | |
8981cac5 JO |
2021 | A target selection may also have variations for different operating |
2022 | systems or architectures. | |
eae04238 | 2023 | |
8981cac5 JO |
2024 | The command to list valid target values is @samp{objdump -i} |
2025 | (the first column of output contains the relevant information). | |
eae04238 | 2026 | |
10f2a7f6 JO |
2027 | Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips}, |
2028 | @samp{a.out-sunos-big}. | |
eae04238 | 2029 | |
55311d1c ILT |
2030 | You can also specify a target using a configuration triplet. This is |
2031 | the same sort of name that is passed to configure to specify a target. | |
2032 | When you use a configuration triplet as an argument, it must be fully | |
2033 | canonicalized. You can see the canonical version of a triplet by | |
2034 | running the shell script @file{config.sub} which is included with the | |
2035 | sources. | |
2036 | ||
2037 | Some sample configuration triplets are: @samp{m68k-hp-bsd}, | |
2038 | @samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}. | |
2039 | ||
8981cac5 | 2040 | @subheading @code{objdump} Target |
eae04238 DM |
2041 | |
2042 | Ways to specify: | |
2043 | ||
2044 | @enumerate | |
2045 | @item | |
8981cac5 | 2046 | command line option: @samp{-b} or @samp{--target} |
eae04238 DM |
2047 | |
2048 | @item | |
2049 | environment variable @code{GNUTARGET} | |
2050 | ||
2051 | @item | |
2052 | deduced from the input file | |
2053 | @end enumerate | |
2054 | ||
8981cac5 | 2055 | @subheading @code{objcopy} and @code{strip} Input Target |
eae04238 DM |
2056 | |
2057 | Ways to specify: | |
2058 | ||
2059 | @enumerate | |
2060 | @item | |
8981cac5 | 2061 | command line options: @samp{-I} or @samp{--input-target}, or @samp{-F} or @samp{--target} |
eae04238 DM |
2062 | |
2063 | @item | |
2064 | environment variable @code{GNUTARGET} | |
2065 | ||
2066 | @item | |
2067 | deduced from the input file | |
2068 | @end enumerate | |
2069 | ||
8981cac5 | 2070 | @subheading @code{objcopy} and @code{strip} Output Target |
eae04238 DM |
2071 | |
2072 | Ways to specify: | |
2073 | ||
2074 | @enumerate | |
2075 | @item | |
8981cac5 | 2076 | command line options: @samp{-O} or @samp{--output-target}, or @samp{-F} or @samp{--target} |
eae04238 DM |
2077 | |
2078 | @item | |
8981cac5 | 2079 | the input target (see ``@code{objcopy} and @code{strip} Input Target'' above) |
eae04238 DM |
2080 | |
2081 | @item | |
2082 | environment variable @code{GNUTARGET} | |
2083 | ||
2084 | @item | |
2085 | deduced from the input file | |
2086 | @end enumerate | |
2087 | ||
8981cac5 | 2088 | @subheading @code{nm}, @code{size}, and @code{strings} Target |
eae04238 DM |
2089 | |
2090 | Ways to specify: | |
2091 | ||
2092 | @enumerate | |
2093 | @item | |
8981cac5 | 2094 | command line option: @samp{--target} |
eae04238 DM |
2095 | |
2096 | @item | |
2097 | environment variable @code{GNUTARGET} | |
2098 | ||
2099 | @item | |
2100 | deduced from the input file | |
2101 | @end enumerate | |
2102 | ||
8981cac5 | 2103 | @subheading Linker Input Target |
eae04238 DM |
2104 | |
2105 | Ways to specify: | |
2106 | ||
2107 | @enumerate | |
2108 | @item | |
8981cac5 | 2109 | command line option: @samp{-b} or @samp{--format} |
eae04238 DM |
2110 | (@pxref{Options,,Options,ld.info,Using LD}) |
2111 | ||
2112 | @item | |
2113 | script command @code{TARGET} | |
2114 | (@pxref{Option Commands,,Option Commands,ld.info,Using LD}) | |
2115 | ||
2116 | @item | |
2117 | environment variable @code{GNUTARGET} | |
2118 | (@pxref{Environment,,Environment,ld.info,Using LD}) | |
2119 | ||
2120 | @item | |
2121 | the default target of the selected linker emulation | |
2122 | (@pxref{Linker Emulation Selection}) | |
2123 | @end enumerate | |
2124 | ||
8981cac5 | 2125 | @subheading Linker Output Target |
eae04238 DM |
2126 | |
2127 | Ways to specify: | |
2128 | ||
2129 | @enumerate | |
2130 | @item | |
8981cac5 | 2131 | command line option: @samp{-oformat} |
eae04238 DM |
2132 | (@pxref{Options,,Options,ld.info,Using LD}) |
2133 | ||
2134 | @item | |
2135 | script command @code{OUTPUT_FORMAT} | |
2136 | (@pxref{Option Commands,,Option Commands,ld.info,Using LD}) | |
2137 | ||
2138 | @item | |
8981cac5 | 2139 | the linker input target (see ``Linker Input Target'' above) |
eae04238 DM |
2140 | @end enumerate |
2141 | ||
2142 | @node Architecture Selection | |
2143 | @section Architecture selection | |
2144 | ||
8981cac5 JO |
2145 | An @dfn{architecture} is a type of @sc{cpu} on which an object file is |
2146 | to run. Its name may contain a colon, separating the name of the | |
2147 | processor family from the name of the particular @sc{cpu}. | |
eae04238 | 2148 | |
8981cac5 JO |
2149 | The command to list valid architecture values is @samp{objdump -i} (the |
2150 | second column contains the relevant information). | |
eae04238 DM |
2151 | |
2152 | Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}. | |
2153 | ||
8981cac5 | 2154 | @subheading @code{objdump} Architecture |
eae04238 DM |
2155 | |
2156 | Ways to specify: | |
2157 | ||
2158 | @enumerate | |
2159 | @item | |
8981cac5 | 2160 | command line option: @samp{-m} or @samp{--architecture} |
eae04238 DM |
2161 | |
2162 | @item | |
2163 | deduced from the input file | |
2164 | @end enumerate | |
2165 | ||
8981cac5 | 2166 | @subheading @code{objcopy}, @code{nm}, @code{size}, @code{strings} Architecture |
eae04238 DM |
2167 | |
2168 | Ways to specify: | |
2169 | ||
2170 | @enumerate | |
2171 | @item | |
2172 | deduced from the input file | |
2173 | @end enumerate | |
2174 | ||
8981cac5 | 2175 | @subheading Linker Input Architecture |
eae04238 DM |
2176 | |
2177 | Ways to specify: | |
2178 | ||
2179 | @enumerate | |
2180 | @item | |
2181 | deduced from the input file | |
2182 | @end enumerate | |
2183 | ||
8981cac5 | 2184 | @subheading Linker Output Architecture |
eae04238 DM |
2185 | |
2186 | Ways to specify: | |
2187 | ||
2188 | @enumerate | |
2189 | @item | |
2190 | script command @code{OUTPUT_ARCH} | |
2191 | (@pxref{Option Commands,,Option Commands,ld.info,Using LD}) | |
2192 | ||
2193 | @item | |
2194 | the default architecture from the linker output target | |
8981cac5 | 2195 | (@pxref{Target Selection}) |
eae04238 DM |
2196 | @end enumerate |
2197 | ||
2198 | @node Linker Emulation Selection | |
2199 | @section Linker emulation selection | |
2200 | ||
2201 | A linker @dfn{emulation} is a ``personality'' of the linker, which gives | |
2202 | the linker default values for the other aspects of the target system. | |
2203 | In particular, it consists of | |
2204 | ||
2205 | @itemize @bullet | |
2206 | @item | |
8981cac5 | 2207 | the linker script |
eae04238 DM |
2208 | |
2209 | @item | |
8981cac5 | 2210 | the target |
eae04238 DM |
2211 | |
2212 | @item | |
2213 | several ``hook'' functions that are run at certain stages of the linking | |
8981cac5 | 2214 | process to do special things that some targets require |
eae04238 DM |
2215 | @end itemize |
2216 | ||
8981cac5 | 2217 | The command to list valid linker emulation values is @samp{ld -V}. |
eae04238 DM |
2218 | |
2219 | Sample values: @samp{hp300bsd}, @samp{mipslit}, @samp{sun4}. | |
2220 | ||
2221 | Ways to specify: | |
2222 | ||
2223 | @enumerate | |
2224 | @item | |
8981cac5 | 2225 | command line option: @samp{-m} |
eae04238 DM |
2226 | (@pxref{Options,,Options,ld.info,Using LD}) |
2227 | ||
2228 | @item | |
2229 | environment variable @code{LDEMULATION} | |
2230 | ||
2231 | @item | |
2232 | compiled-in @code{DEFAULT_EMULATION} from @file{Makefile}, | |
2233 | which comes from @code{EMUL} in @file{config/@var{target}.mt} | |
2234 | @end enumerate | |
2235 | ||
cbcfa129 ILT |
2236 | @node Reporting Bugs |
2237 | @chapter Reporting Bugs | |
2238 | @cindex bugs | |
2239 | @cindex reporting bugs | |
2240 | ||
2241 | Your bug reports play an essential role in making the binary utilities | |
2242 | reliable. | |
2243 | ||
2244 | Reporting a bug may help you by bringing a solution to your problem, or | |
2245 | it may not. But in any case the principal function of a bug report is | |
2246 | to help the entire community by making the next version of the binary | |
2247 | utilities work better. Bug reports are your contribution to their | |
2248 | maintenance. | |
2249 | ||
2250 | In order for a bug report to serve its purpose, you must include the | |
2251 | information that enables us to fix the bug. | |
2252 | ||
2253 | @menu | |
2254 | * Bug Criteria:: Have you found a bug? | |
2255 | * Bug Reporting:: How to report bugs | |
2256 | @end menu | |
2257 | ||
2258 | @node Bug Criteria | |
2259 | @section Have you found a bug? | |
2260 | @cindex bug criteria | |
2261 | ||
2262 | If you are not sure whether you have found a bug, here are some guidelines: | |
2263 | ||
2264 | @itemize @bullet | |
2265 | @cindex fatal signal | |
2266 | @cindex crash | |
2267 | @item | |
2268 | If a binary utility gets a fatal signal, for any input whatever, that is | |
2269 | a bug. Reliable utilities never crash. | |
2270 | ||
2271 | @cindex error on valid input | |
2272 | @item | |
2273 | If a binary utility produces an error message for valid input, that is a | |
2274 | bug. | |
2275 | ||
2276 | @item | |
2277 | If you are an experienced user of binary utilities, your suggestions for | |
2278 | improvement are welcome in any case. | |
2279 | @end itemize | |
2280 | ||
2281 | @node Bug Reporting | |
2282 | @section How to report bugs | |
2283 | @cindex bug reports | |
2284 | @cindex bugs, reporting | |
2285 | ||
2286 | A number of companies and individuals offer support for @sc{gnu} | |
2287 | products. If you obtained the binary utilities from a support | |
2288 | organization, we recommend you contact that organization first. | |
2289 | ||
2290 | You can find contact information for many support companies and | |
2291 | individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs | |
2292 | distribution. | |
2293 | ||
2294 | In any event, we also recommend that you send bug reports for the binary | |
2295 | utilities to @samp{bug-gnu-utils@@prep.ai.mit.edu}. | |
2296 | ||
2297 | The fundamental principle of reporting bugs usefully is this: | |
2298 | @strong{report all the facts}. If you are not sure whether to state a | |
2299 | fact or leave it out, state it! | |
2300 | ||
2301 | Often people omit facts because they think they know what causes the | |
2302 | problem and assume that some details do not matter. Thus, you might | |
2303 | assume that the name of a file you use in an example does not matter. | |
2304 | Well, probably it does not, but one cannot be sure. Perhaps the bug is | |
2305 | a stray memory reference which happens to fetch from the location where | |
2306 | that pathname is stored in memory; perhaps, if the pathname were | |
2307 | different, the contents of that location would fool the utility into | |
2308 | doing the right thing despite the bug. Play it safe and give a | |
2309 | specific, complete example. That is the easiest thing for you to do, | |
2310 | and the most helpful. | |
2311 | ||
2312 | Keep in mind that the purpose of a bug report is to enable us to fix the bug if | |
2313 | it is new to us. Therefore, always write your bug reports on the assumption | |
2314 | that the bug has not been reported previously. | |
2315 | ||
2316 | Sometimes people give a few sketchy facts and ask, ``Does this ring a | |
2317 | bell?'' Those bug reports are useless, and we urge everyone to | |
2318 | @emph{refuse to respond to them} except to chide the sender to report | |
2319 | bugs properly. | |
2320 | ||
2321 | To enable us to fix the bug, you should include all these things: | |
2322 | ||
2323 | @itemize @bullet | |
2324 | @item | |
2325 | The version of the utility. Each utility announces it if you start it | |
2326 | with the @samp{--version} argument. | |
2327 | ||
2328 | Without this, we will not know whether there is any point in looking for | |
2329 | the bug in the current version of the binary utilities. | |
2330 | ||
2331 | @item | |
2332 | Any patches you may have applied to the source, including any patches | |
2333 | made to the @code{BFD} library. | |
2334 | ||
2335 | @item | |
2336 | The type of machine you are using, and the operating system name and | |
2337 | version number. | |
2338 | ||
2339 | @item | |
2340 | What compiler (and its version) was used to compile the utilities---e.g. | |
2341 | ``@code{gcc-2.7}''. | |
2342 | ||
2343 | @item | |
2344 | The command arguments you gave the utility to observe the bug. To | |
2345 | guarantee you will not omit something important, list them all. A copy | |
2346 | of the Makefile (or the output from make) is sufficient. | |
2347 | ||
2348 | If we were to try to guess the arguments, we would probably guess wrong | |
2349 | and then we might not encounter the bug. | |
2350 | ||
2351 | @item | |
2352 | A complete input file, or set of input files, that will reproduce the | |
2353 | bug. If the utility is reading an object file or files, then it is | |
2354 | generally most helpful to send the actual object files, uuencoded if | |
2355 | necessary to get them through the mail system. Making them available | |
2356 | for anonymous FTP is not as good, but may be the only reasonable choice | |
2357 | for large object files. | |
2358 | ||
2359 | If the source files were produced exclusively using @sc{gnu} programs | |
2360 | (e.g., @code{gcc}, @code{gas}, and/or the @sc{gnu} @code{ld}), then it | |
2361 | may be OK to send the source files rather than the object files. In | |
2362 | this case, be sure to say exactly what version of @code{gcc}, or | |
2363 | whatever, was used to produce the object files. Also say how | |
2364 | @code{gcc}, or whatever, was configured. | |
2365 | ||
2366 | @item | |
2367 | A description of what behavior you observe that you believe is | |
2368 | incorrect. For example, ``It gets a fatal signal.'' | |
2369 | ||
2370 | Of course, if the bug is that the utility gets a fatal signal, then we | |
2371 | will certainly notice it. But if the bug is incorrect output, we might | |
2372 | not notice unless it is glaringly wrong. You might as well not give us | |
2373 | a chance to make a mistake. | |
2374 | ||
2375 | Even if the problem you experience is a fatal signal, you should still | |
2376 | say so explicitly. Suppose something strange is going on, such as, your | |
2377 | copy of the utility is out of synch, or you have encountered a bug in | |
2378 | the C library on your system. (This has happened!) Your copy might | |
2379 | crash and ours would not. If you told us to expect a crash, then when | |
2380 | ours fails to crash, we would know that the bug was not happening for | |
2381 | us. If you had not told us to expect a crash, then we would not be able | |
2382 | to draw any conclusion from our observations. | |
2383 | ||
2384 | @item | |
2385 | If you wish to suggest changes to the source, send us context diffs, as | |
2386 | generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p} | |
2387 | option. Always send diffs from the old file to the new file. If you | |
2388 | even discuss something in the @code{ld} source, refer to it by context, | |
2389 | not by line number. | |
2390 | ||
2391 | The line numbers in our development sources will not match those in your | |
2392 | sources. Your line numbers would convey no useful information to us. | |
2393 | @end itemize | |
2394 | ||
2395 | Here are some things that are not necessary: | |
2396 | ||
2397 | @itemize @bullet | |
2398 | @item | |
2399 | A description of the envelope of the bug. | |
2400 | ||
2401 | Often people who encounter a bug spend a lot of time investigating | |
2402 | which changes to the input file will make the bug go away and which | |
2403 | changes will not affect it. | |
2404 | ||
2405 | This is often time consuming and not very useful, because the way we | |
2406 | will find the bug is by running a single example under the debugger | |
2407 | with breakpoints, not by pure deduction from a series of examples. | |
2408 | We recommend that you save your time for something else. | |
2409 | ||
2410 | Of course, if you can find a simpler example to report @emph{instead} | |
2411 | of the original one, that is a convenience for us. Errors in the | |
2412 | output will be easier to spot, running under the debugger will take | |
2413 | less time, and so on. | |
2414 | ||
2415 | However, simplification is not vital; if you do not want to do this, | |
2416 | report the bug anyway and send us the entire test case you used. | |
2417 | ||
2418 | @item | |
2419 | A patch for the bug. | |
2420 | ||
2421 | A patch for the bug does help us if it is a good one. But do not omit | |
2422 | the necessary information, such as the test case, on the assumption that | |
2423 | a patch is all we need. We might see problems with your patch and decide | |
2424 | to fix the problem another way, or we might not understand it at all. | |
2425 | ||
2426 | Sometimes with programs as complicated as the binary utilities it is | |
2427 | very hard to construct an example that will make the program follow a | |
2428 | certain path through the code. If you do not send us the example, we | |
2429 | will not be able to construct one, so we will not be able to verify that | |
2430 | the bug is fixed. | |
2431 | ||
2432 | And if we cannot understand what bug you are trying to fix, or why your | |
2433 | patch should be an improvement, we will not install it. A test case will | |
2434 | help us to understand. | |
2435 | ||
2436 | @item | |
2437 | A guess about what the bug is or what it depends on. | |
2438 | ||
2439 | Such guesses are usually wrong. Even we cannot guess right about such | |
2440 | things without first using the debugger to find the facts. | |
2441 | @end itemize | |
2442 | ||
eae04238 | 2443 | @node Index |
c72af735 RP |
2444 | @unnumbered Index |
2445 | ||
2446 | @printindex cp | |
2447 | ||
2448 | @contents | |
2449 | @bye |