Added support for v850e and v850eq instructions.
[deliverable/binutils-gdb.git] / binutils / binutils.texi
1 \input texinfo @c -*- Texinfo -*-
2 @setfilename binutils.info
3 @include config.texi
4
5 @ifinfo
6 @format
7 START-INFO-DIR-ENTRY
8 * Binutils: (binutils). The GNU binary utilities "ar", "objcopy",
9 "objdump", "nm", "nlmconv", "size",
10 "strings", "strip", and "ranlib".
11 END-INFO-DIR-ENTRY
12 @end format
13 @end ifinfo
14
15 @ifinfo
16 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
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
39 @synindex ky cp
40 @c
41 @c This file documents the GNU binary utilities "ar", "ld", "objcopy",
42 @c "objdump", "nm", "size", "strings", "strip", and "ranlib".
43 @c
44 @c Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
45 @c
46 @c This text may be freely distributed under the terms of the GNU
47 @c General Public License.
48 @c
49
50 @setchapternewpage odd
51 @settitle @sc{gnu} Binary Utilities
52 @titlepage
53 @finalout
54 @title The @sc{gnu} Binary Utilities
55 @subtitle Version @value{VERSION}
56 @sp 1
57 @subtitle May 1993
58 @author Roland H. Pesch
59 @author Jeffrey M. Osier
60 @author Cygnus Support
61 @page
62
63 @tex
64 {\parskip=0pt \hfill Cygnus Support\par \hfill
65 \TeX{}info \texinfoversion\par }
66 @end tex
67
68 @vskip 0pt plus 1filll
69 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
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
84 @node Top
85 @top Introduction
86
87 @cindex version
88 This brief manual contains preliminary documentation for the @sc{gnu} binary
89 utilities (collectively version @value{VERSION}):
90
91 @iftex
92 @table @code
93 @item ar
94 Create, modify, and extract from archives
95
96 @item nm
97 List symbols from object files
98
99 @item objcopy
100 Copy and translate object files
101
102 @item objdump
103 Display information from object files
104
105 @item ranlib
106 Generate index to archive contents
107
108 @item size
109 List file section sizes and total size
110
111 @item strings
112 List printable strings from files
113
114 @item strip
115 Discard symbols
116
117 @item c++filt
118 Demangle encoded C++ symbols
119
120 @item addr2line
121 Convert addresses into file names and line numbers
122
123 @item nlmconv
124 Convert object code into a Netware Loadable Module
125
126 @item windres
127 Manipulate Windows resources
128 @end table
129 @end iftex
130
131 @menu
132 * ar:: Create, modify, and extract from archives
133 * nm:: List symbols from object files
134 * objcopy:: Copy and translate object files
135 * objdump:: Display information from object files
136 * ranlib:: Generate index to archive contents
137 * size:: List section sizes and total size
138 * strings:: List printable strings from files
139 * strip:: Discard symbols
140 * c++filt:: Filter to demangle encoded C++ symbols
141 * addr2line:: Convert addresses to file and line
142 * nlmconv:: Converts object code into an NLM
143 * windres:: Manipulate Windows resources
144 * Selecting The Target System:: How these utilities determine the target.
145 * Reporting Bugs:: Reporting Bugs
146 * Index:: Index
147 @end menu
148
149 @node ar
150 @chapter ar
151
152 @kindex ar
153 @cindex archives
154 @cindex collections of files
155 @smallexample
156 ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
157 ar -M [ <mri-script ]
158 @end smallexample
159
160 The @sc{gnu} @code{ar} program creates, modifies, and extracts from
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
166 group are preserved in the archive, and can be restored on
167 extraction.
168
169 @cindex name length
170 @sc{gnu} @code{ar} can maintain archives whose members have names of any
171 length; however, depending on how @code{ar} is configured on your
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
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
183 @code{ar} creates an index to the symbols defined in relocatable
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
191 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
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
195 @cindex compatibility, @code{ar}
196 @cindex @code{ar} compatibility
197 @sc{gnu} @code{ar} is designed to be compatible with two different
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
205 * ar cmdline:: Controlling @code{ar} on the command line
206 * ar scripts:: Controlling @code{ar} with a script
207 @end menu
208
209 @page
210 @node ar cmdline
211 @section Controlling @code{ar} on the command line
212
213 @smallexample
214 ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
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.
222
223 Most operations can also accept further @var{member} arguments,
224 specifying particular files to operate on.
225
226 @sc{gnu} @code{ar} allows you to mix the operation code @var{p} and modifier
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
240 be deleted as @var{member}@dots{}; the archive is untouched if you
241 specify no files to delete.
242
243 If you specify the @samp{v} modifier, @code{ar} lists each module
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
255 @var{member} arguments are moved to the @emph{end} of the archive;
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
265 If you specify no @var{member} arguments, all the files in the archive are
266 printed.
267
268 @item q
269 @cindex quick append to archive
270 @emph{Quick append}; add the files @var{member}@dots{} to the end of
271 @var{archive}, without checking for replacement.
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
284 Insert the files @var{member}@dots{} into @var{archive} (with
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.
288
289 If one of the files named in @var{member}@dots{} does not exist, @code{ar}
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
305 of the files listed in @var{member}@dots{} that are present in the
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
310 If you do not specify a @var{member}, all files in the archive
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
316 an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
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
324 @emph{Extract} members (named @var{member}) from the archive. You can
325 use the @samp{v} modifier with this operation, to request that
326 @code{ar} list each name as it extracts it.
327
328 If you do not specify a @var{member}, all files in the archive
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
340 archive. If you use the modifier @samp{a}, the name of an existing archive
341 member must be present as the @var{relpos} argument, before the
342 @var{archive} specification.
343
344 @item b
345 Add new files @emph{before} an existing member of the
346 archive. If you use the modifier @samp{b}, the name of an existing archive
347 member must be present as the @var{relpos} argument, before the
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
353 created if it did not exist, when you request an update. But a warning is
354 issued unless you specify in advance that you expect to create it, by
355 using this modifier.
356
357 @item f
358 Truncate names in the archive. @sc{gnu} @code{ar} will normally permit file
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
364 @item i
365 Insert new files @emph{before} an existing member of the
366 archive. If you use the modifier @samp{i}, the name of an existing archive
367 member must be present as the @var{relpos} argument, before the
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
373 @c what???---doc@@cygnus.com, 25jan91
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
379 are stamped with the time of extraction.
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
390 Normally, @samp{ar r}@dots{} inserts all files
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.
402
403 @item V
404 This modifier shows the version number of @code{ar}.
405 @end table
406
407 @node ar scripts
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
418 form of @code{ar} operates interactively if standard input is coming
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
422 issued, and @code{ar} abandons execution (with a nonzero exit code)
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
428 transition to @sc{gnu} @code{ar} for developers who already have scripts
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
478 @item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
479 @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
480 @c else like "ar q..."
481 Add each named @var{member} as a module in the current archive.
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}
508 @var{module}@dots{}}. When verbose output is on, the listing is like
509 @samp{ar -tv @var{archive} @var{module}@dots{}}.
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
524 @var{archive} @var{module}@dots{}}.
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
538 tv @var{archive}}). (This single command is a @sc{gnu} @code{ld}
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
559 @samp{ar -tv }@dots{}.
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}.
567
568 @end table
569
570 @iftex
571 @node ld
572 @chapter ld
573 @cindex linker
574 @kindex ld
575 The @sc{gnu} linker @code{ld} is now described in a separate manual.
576 @xref{Top,, Overview,, Using LD: the @sc{gnu} linker}.
577 @end iftex
578
579 @node nm
580 @chapter nm
581 @cindex symbols
582 @kindex nm
583
584 @smallexample
585 nm [ -a | --debug-syms ] [ -g | --extern-only ]
586 [ -B ] [ -C | --demangle ] [ -D | --dynamic ]
587 [ -s | --print-armap ] [ -A | -o | --print-file-name ]
588 [ -n | -v | --numeric-sort ] [ -p | --no-sort ]
589 [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ]
590 [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
591 [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
592 [ --defined-only ] [-l | --line-numbers ]
593 [ --no-demangle ] [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ]
594 @end smallexample
595
596 @sc{gnu} @code{nm} lists the symbols from object files @var{objfile}@dots{}.
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
616 The symbol's value is absolute, and will not be changed by further
617 linking.
618
619 @item B
620 The symbol is in the uninitialized data section (known as BSS).
621
622 @item C
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}.
628
629 @item D
630 The symbol is in the initialized data section.
631
632 @item G
633 The symbol is in an initialized data section for small objects. Some
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.
636
637 @item I
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
648 The symbol is in an uninitialized data section for small objects.
649
650 @item T
651 The symbol is in the text (code) section.
652
653 @item U
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.
671 @end table
672
673 @item
674 The symbol name.
675 @end itemize
676
677 The long and short forms of options, shown here as alternatives, are
678 equivalent.
679
680 @table @code
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.
690
691 @item -a
692 @itemx --debug-syms
693 @cindex debugging symbols
694 Display all symbols, even debugger-only symbols; normally these are not
695 listed.
696
697 @item -B
698 @cindex @code{nm} format
699 @cindex @code{nm} compatibility
700 The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}).
701
702 @item -C
703 @itemx --demangle
704 @cindex demangling in nm
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.
709
710 @item --no-demangle
711 Do not demangle low-level symbol names. This is the default.
712
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
720 @item -f @var{format}
721 @itemx --format=@var{format}
722 @cindex @code{nm} format
723 @cindex @code{nm} compatibility
724 Use the output format @var{format}, which can be @code{bsd},
725 @code{sysv}, or @code{posix}. The default is @code{bsd}.
726 Only the first character of @var{format} is significant; it can be
727 either upper or lower case.
728
729 @item -g
730 @itemx --extern-only
731 @cindex external symbols
732 Display only external symbols.
733
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
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
749 @item -p
750 @itemx --no-sort
751 @cindex sorting symbols
752 Do not bother to sort the symbols in any order; print them in the order
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}.
759
760 @item -s
761 @itemx --print-armap
762 @cindex symbol index, listing
763 When listing symbols from archive members, include the index: a mapping
764 (stored in the archive by @code{ar} or @code{ranlib}) of which modules
765 contain definitions for which names.
766
767 @item -r
768 @itemx --reverse-sort
769 Reverse the order of the sort (whether numeric or alphabetic); let the
770 last come first.
771
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
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
782 @item --target=@var{bfdname}
783 @cindex object code format
784 Specify an object code format other than your system's default format.
785 @xref{Target Selection}, for more information.
786
787 @item -u
788 @itemx --undefined-only
789 @cindex external symbols
790 @cindex undefined symbols
791 Display only undefined symbols (those external to each object file).
792
793 @item --defined-only
794 @cindex external symbols
795 @cindex undefined symbols
796 Display only defined symbols for each object file.
797
798 @item -V
799 @itemx --version
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.
804 @end table
805
806 @node objcopy
807 @chapter objcopy
808
809 @smallexample
810 objcopy [ -F @var{bfdname} | --target=@var{bfdname} ]
811 [ -I @var{bfdname} | --input-target=@var{bfdname} ]
812 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
813 [ -S | --strip-all ] [ -g | --strip-debug ]
814 [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ]
815 [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ]
816 [ -x | --discard-all ] [ -X | --discard-locals ]
817 [ -b @var{byte} | --byte=@var{byte} ]
818 [ -i @var{interleave} | --interleave=@var{interleave} ]
819 [ -R @var{sectionname} | --remove-section=@var{sectionname} ]
820 [ -p | --preserve-dates ] [ --debugging ]
821 [ --gap-fill=@var{val} ] [ --pad-to=@var{address} ]
822 [ --set-start=@var{val} ] [ --adjust-start=@var{incr} ]
823 [ --adjust-vma=@var{incr} ]
824 [ --adjust-section-vma=@var{section}@{=,+,-@}@var{val} ]
825 [ --adjust-warnings ] [ --no-adjust-warnings ]
826 [ --set-section-flags=@var{section}=@var{flags} ]
827 [ --add-section=@var{sectionname}=@var{filename} ]
828 [ --change-leading-char ] [ --remove-leading-char ]
829 [ --weaken ]
830 [ -v | --verbose ] [ -V | --version ] [ --help ]
831 @var{infile} [@var{outfile}]
832 @end smallexample
833
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.
839
840 @code{objcopy} creates temporary files to do its translations and
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}.
845
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
853 relocation information will be discarded. The memory dump will start at
854 the load address of the lowest section copied into the output file.
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
861 @table @code
862 @item @var{infile}
863 @itemx @var{outfile}
864 The source and output files, respectively.
865 If you do not specify @var{outfile}, @code{objcopy} creates a
866 temporary file and destructively renames the result with
867 the name of @var{infile}.
868
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.
873
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.
878
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.
884
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
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
899 @item --strip-unneeded
900 Strip all symbols that are not needed for relocation processing.
901
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
907 @item -N @var{symbolname}
908 @itemx --strip-symbol=@var{symbolname}
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}.
912
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
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
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
929 to program @sc{rom}. It is typically used with an @code{srec} output
930 target.
931
932 @item -i @var{interleave}
933 @itemx --interleave=@var{interleave}
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}.
938
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
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
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
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
959 @item --set-start @var{val}
960 Set the address of the new file to @var{val}. Not all object file
961 formats support setting the start address.
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
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
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
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
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
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.
1024
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
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
1044 @node objdump
1045 @chapter objdump
1046
1047 @cindex object file information
1048 @kindex objdump
1049
1050 @smallexample
1051 objdump [ -a | --archive-headers ]
1052 [ -b @var{bfdname} | --target=@var{bfdname} ] [ --debugging ]
1053 [ -C | --demangle ] [ -d | --disassemble ]
1054 [ -D | --disassemble-all ] [ --disassemble-zeroes ]
1055 [ -EB | -EL | --endian=@{big | little @} ]
1056 [ -f | --file-headers ]
1057 [ -h | --section-headers | --headers ] [ -i | --info ]
1058 [ -j @var{section} | --section=@var{section} ]
1059 [ -l | --line-numbers ] [ -S | --source ]
1060 [ -m @var{machine} | --architecture=@var{machine} ]
1061 [ -r | --reloc ] [ -R | --dynamic-reloc ]
1062 [ -s | --full-contents ] [ --stabs ]
1063 [ -t | --syms ] [ -T | --dynamic-syms ] [ -x | --all-headers ]
1064 [ -w | --wide ] [ --start-address=@var{address} ]
1065 [ --stop-address=@var{address} ]
1066 [ --prefix-addresses] [ --[no-]show-raw-insn ]
1067 [ --adjust-vma=@var{offset} ]
1068 [ --version ] [ --help ]
1069 @var{objfile}@dots{}
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
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
1082 The long and short forms of options, shown here as alternatives, are
1083 equivalent. At least one option besides @samp{-l} must be given.
1084
1085 @table @code
1086 @item -a
1087 @itemx --archive-header
1088 @cindex archive headers
1089 If any of the @var{objfile} files are archives, display the archive
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
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
1103 @item -b @var{bfdname}
1104 @itemx --target=@var{bfdname}
1105 @cindex object code format
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,
1111 @example
1112 objdump -b oasys -m vax -h fu.o
1113 @end example
1114 @noindent
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
1117 file in the format produced by Oasys compilers. You can list the
1118 formats available with the @samp{-i} option.
1119 @xref{Target Selection}, for more information.
1120
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
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
1134 @item -d
1135 @itemx --disassemble
1136 @cindex disassembling object code
1137 @cindex machine instructions
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.
1146
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
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
1165 @item -f
1166 @itemx --file-header
1167 @cindex object file header
1168 Display summary information from the overall header of
1169 each of the @var{objfile} files.
1170
1171 @item -h
1172 @itemx --section-header
1173 @itemx --header
1174 @cindex section headers
1175 Display summary information from the section headers of the
1176 object file.
1177
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
1187 @item --help
1188 Print a summary of the options to @code{objdump} and exit.
1189
1190 @item -i
1191 @itemx --info
1192 @cindex architectures available
1193 @cindex object formats available
1194 Display a list showing all architectures and object formats available
1195 for specification with @samp{-b} or @samp{-m}.
1196
1197 @item -j @var{name}
1198 @itemx --section=@var{name}
1199 @cindex section information
1200 Display information only for section @var{name}.
1201
1202 @item -l
1203 @itemx --line-numbers
1204 @cindex source filenames for object files
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}.
1208
1209 @item -m @var{machine}
1210 @itemx --architecture=@var{machine}
1211 @cindex architecture
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.
1217
1218 @item -r
1219 @itemx --reloc
1220 @cindex relocation entries, in object file
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.
1224
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
1232 @item -s
1233 @itemx --full-contents
1234 @cindex sections, full contents
1235 @cindex object file sections
1236 Display the full contents of any sections requested.
1237
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
1245 @item --show-raw-insn
1246 When disassembling instructions, print the instruction in hex as well as
1247 in symbolic form. This is the default except when
1248 @code{--prefix-addresses} is used.
1249
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
1254 @item --stabs
1255 @cindex stab
1256 @cindex .stab
1257 @cindex debug symbols
1258 @cindex ELF object file format
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
1264 interleaved with linkage symbols, and are visible in the @samp{--syms}
1265 output. For more information on stabs symbols, see @ref{Top,Stabs,Stabs
1266 Overview,stabs.info, The ``stabs'' debug format}.
1267
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
1278 @item -t
1279 @itemx --syms
1280 @cindex symbol table entries, printing
1281 Print the symbol table entries of the file.
1282 This is similar to the information provided by the @samp{nm} program.
1283
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
1292 @item --version
1293 Print the version number of @code{objdump} and exit.
1294
1295 @item -x
1296 @itemx --all-header
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}.
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.
1307 @end table
1308
1309 @node ranlib
1310 @chapter ranlib
1311
1312 @kindex ranlib
1313 @cindex archive contents
1314 @cindex symbol index
1315
1316 @smallexample
1317 ranlib [-vV] @var{archive}
1318 @end smallexample
1319
1320 @code{ranlib} generates an index to the contents of an archive and
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
1324 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
1325
1326 An archive with such an index speeds up linking to the library and
1327 allows routines in the library to call each other without regard to
1328 their placement in the archive.
1329
1330 The @sc{gnu} @code{ranlib} program is another form of @sc{gnu} @code{ar}; running
1331 @code{ranlib} is completely equivalent to executing @samp{ar -s}.
1332 @xref{ar}.
1333
1334 @table @code
1335 @item -v
1336 @itemx -V
1337 Show the version number of @code{ranlib}.
1338 @end table
1339
1340 @node size
1341 @chapter size
1342
1343 @kindex size
1344 @cindex section sizes
1345
1346 @smallexample
1347 size [ -A | -B | --format=@var{compatibility} ]
1348 [ --help ] [ -d | -o | -x | --radix=@var{number} ]
1349 [ --target=@var{bfdname} ] [ -V | --version ]
1350 @var{objfile}@dots{}
1351 @end smallexample
1352
1353 The @sc{gnu} @code{size} utility lists the section sizes---and the total
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.
1357
1358 @var{objfile}@dots{} are the object files to be examined.
1359
1360 The command line options have the following meanings:
1361
1362 @table @code
1363 @item -A
1364 @itemx -B
1365 @itemx --format=@var{compatibility}
1366 @cindex @code{size} display format
1367 Using one of these options, you can choose whether the output from @sc{gnu}
1368 @code{size} resembles output from System V @code{size} (using @samp{-A},
1369 or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or
1370 @samp{--format=berkeley}). The default is the one-line format similar to
1371 Berkeley's.
1372 @c Bonus for doc-source readers: you can also say --format=strange (or
1373 @c anything else that starts with 's') for sysv, and --format=boring (or
1374 @c anything else that starts with 'b') for Berkeley.
1375
1376 Here is an example of the Berkeley (default) format of output from
1377 @code{size}:
1378 @smallexample
1379 size --format=Berkeley ranlib size
1380 text data bss dec hex filename
1381 294880 81920 11592 388392 5ed28 ranlib
1382 294880 81920 11888 388688 5ee50 size
1383 @end smallexample
1384
1385 @noindent
1386 This is the same data, but displayed closer to System V conventions:
1387
1388 @smallexample
1389 size --format=SysV ranlib size
1390 ranlib :
1391 section size addr
1392 .text 294880 8192
1393 .data 81920 303104
1394 .bss 11592 385024
1395 Total 388392
1396
1397
1398 size :
1399 section size addr
1400 .text 294880 8192
1401 .data 81920 303104
1402 .bss 11888 385024
1403 Total 388688
1404 @end smallexample
1405
1406 @item --help
1407 Show a summary of acceptable arguments and options.
1408
1409 @item -d
1410 @itemx -o
1411 @itemx -x
1412 @itemx --radix=@var{number}
1413 @cindex @code{size} number format
1414 @cindex radix for section sizes
1415 Using one of these options, you can control whether the size of each
1416 section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal
1417 (@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or
1418 @samp{--radix=16}). In @samp{--radix=@var{number}}, only the three
1419 values (8, 10, 16) are supported. The total size is always given in two
1420 radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
1421 octal and hexadecimal if you're using @samp{-o}.
1422
1423 @item --target=@var{bfdname}
1424 @cindex object code format
1425 Specify that the object-code format for @var{objfile} is
1426 @var{bfdname}. This option may not be necessary; @code{size} can
1427 automatically recognize many formats.
1428 @xref{Target Selection}, for more information.
1429
1430 @item -V
1431 @itemx --version
1432 Display the version number of @code{size}.
1433 @end table
1434
1435 @node strings
1436 @chapter strings
1437 @kindex strings
1438 @cindex listings strings
1439 @cindex printing strings
1440 @cindex strings, printing
1441
1442 @smallexample
1443 strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-]
1444 [--all] [--print-file-name] [--bytes=@var{min-len}]
1445 [--radix=@var{radix}] [--target=@var{bfdname}]
1446 [--help] [--version] @var{file}@dots{}
1447 @end smallexample
1448
1449 For each @var{file} given, @sc{gnu} @code{strings} prints the printable
1450 character sequences that are at least 4 characters long (or the number
1451 given with the options below) and are followed by an unprintable
1452 character. By default, it only prints the strings from the initialized
1453 and loaded sections of object files; for other types of files, it prints
1454 the strings from the whole file.
1455
1456 @code{strings} is mainly useful for determining the contents of non-text
1457 files.
1458
1459 @table @code
1460 @item -a
1461 @itemx --all
1462 @itemx -
1463 Do not scan only the initialized and loaded sections of object files;
1464 scan the whole files.
1465
1466 @item -f
1467 @itemx --print-file-name
1468 Print the name of the file before each string.
1469
1470 @item --help
1471 Print a summary of the program usage on the standard output and exit.
1472
1473 @itemx -@var{min-len}
1474 @item -n @var{min-len}
1475 @itemx --bytes=@var{min-len}
1476 Print sequences of characters that are at least @var{min-len} characters
1477 long, instead of the default 4.
1478
1479 @item -o
1480 Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o}
1481 act like @samp{-t d} instead. Since we can not be compatible with both
1482 ways, we simply chose one.
1483
1484 @item -t @var{radix}
1485 @itemx --radix=@var{radix}
1486 Print the offset within the file before each string. The single
1487 character argument specifies the radix of the offset---@samp{o} for
1488 octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
1489
1490 @item --target=@var{bfdname}
1491 @cindex object code format
1492 Specify an object code format other than your system's default format.
1493 @xref{Target Selection}, for more information.
1494
1495 @item -v
1496 @itemx --version
1497 Print the program version number on the standard output and exit.
1498 @end table
1499
1500 @node strip
1501 @chapter strip
1502
1503 @kindex strip
1504 @cindex removing symbols
1505 @cindex discarding symbols
1506 @cindex symbols, discarding
1507
1508 @smallexample
1509 strip [ -F @var{bfdname} | --target=@var{bfdname} | --target=@var{bfdname} ]
1510 [ -I @var{bfdname} | --input-target=@var{bfdname} ]
1511 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
1512 [ -s | --strip-all ] [ -S | -g | --strip-debug ]
1513 [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ]
1514 [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ]
1515 [ -x | --discard-all ] [ -X | --discard-locals ]
1516 [ -R @var{sectionname} | --remove-section=@var{sectionname} ]
1517 [ -o @var{file} ] [ -p | --preserve-dates ]
1518 [ -v | --verbose ] [ -V | --version ] [ --help ]
1519 @var{objfile}@dots{}
1520 @end smallexample
1521
1522 @sc{gnu} @code{strip} discards all symbols from object files
1523 @var{objfile}. The list of object files may include archives.
1524 At least one object file must be given.
1525
1526 @code{strip} modifies the files named in its argument,
1527 rather than writing modified copies under different names.
1528
1529 @table @code
1530 @item -F @var{bfdname}
1531 @itemx --target=@var{bfdname}
1532 Treat the original @var{objfile} as a file with the object
1533 code format @var{bfdname}, and rewrite it in the same format.
1534 @xref{Target Selection}, for more information.
1535
1536 @item --help
1537 Show a summary of the options to @code{strip} and exit.
1538
1539 @item -I @var{bfdname}
1540 @itemx --input-target=@var{bfdname}
1541 Treat the original @var{objfile} as a file with the object
1542 code format @var{bfdname}.
1543 @xref{Target Selection}, for more information.
1544
1545 @item -O @var{bfdname}
1546 @itemx --output-target=@var{bfdname}
1547 Replace @var{objfile} with a file in the output format @var{bfdname}.
1548 @xref{Target Selection}, for more information.
1549
1550 @item -R @var{sectionname}
1551 @itemx --remove-section=@var{sectionname}
1552 Remove any section named @var{sectionname} from the output file. This
1553 option may be given more than once. Note that using this option
1554 inappropriately may make the output file unusable.
1555
1556 @item -s
1557 @itemx --strip-all
1558 Remove all symbols.
1559
1560 @item -g
1561 @itemx -S
1562 @itemx --strip-debug
1563 Remove debugging symbols only.
1564
1565 @item --strip-unneeded
1566 Remove all symbols that are not needed for relocation processing.
1567
1568 @item -K @var{symbolname}
1569 @itemx --keep-symbol=@var{symbolname}
1570 Keep only symbol @var{symbolname} from the source file. This option may
1571 be given more than once.
1572
1573 @item -N @var{symbolname}
1574 @itemx --strip-symbol=@var{symbolname}
1575 Remove symbol @var{symbolname} from the source file. This option may be
1576 given more than once, and may be combined with strip options other than
1577 @code{-K}.
1578
1579 @item -o @var{file}
1580 Put the stripped output in @var{file}, rather than replacing the
1581 existing file. When this argument is used, only one @var{objfile}
1582 argument may be specified.
1583
1584 @item -p
1585 @itemx --preserve-dates
1586 Preserve the access and modification dates of the file.
1587
1588 @item -x
1589 @itemx --discard-all
1590 Remove non-global symbols.
1591
1592 @item -X
1593 @itemx --discard-locals
1594 Remove compiler-generated local symbols.
1595 (These usually start with @samp{L} or @samp{.}.)
1596
1597 @item -V
1598 @itemx --version
1599 Show the version number for @code{strip}.
1600
1601 @item -v
1602 @itemx --verbose
1603 Verbose output: list all object files modified. In the case of
1604 archives, @samp{strip -v} lists all members of the archive.
1605 @end table
1606
1607 @node c++filt
1608 @chapter c++filt
1609
1610 @kindex c++filt
1611 @cindex demangling C++ symbols
1612
1613 @smallexample
1614 c++filt [ -_ | --strip-underscores ]
1615 [ -n | --no-strip-underscores ]
1616 [ -s @var{format} | --format=@var{format} ]
1617 [ --help ] [ --version ] [ @var{symbol}@dots{} ]
1618 @end smallexample
1619
1620 The C++ language provides function overloading, which means that you can
1621 write many functions with the same name (providing each takes parameters
1622 of different types). All C++ function names are encoded into a
1623 low-level assembly label (this process is known as
1624 @dfn{mangling}). The @code{c++filt} program does the inverse mapping: it
1625 decodes (@dfn{demangles}) low-level names into user-level names so that
1626 the linker can keep these overloaded functions from clashing.
1627
1628 Every alphanumeric word (consisting of letters, digits, underscores,
1629 dollars, or periods) seen in the input is a potential label. If the
1630 label decodes into a C++ name, the C++ name replaces the low-level
1631 name in the output.
1632
1633 You can use @code{c++filt} to decipher individual symbols:
1634
1635 @example
1636 c++filt @var{symbol}
1637 @end example
1638
1639 If no @var{symbol} arguments are given, @code{c++filt} reads symbol
1640 names from the standard input and writes the demangled names to the
1641 standard output. All results are printed on the standard output.
1642
1643 @table @code
1644 @item -_
1645 @itemx --strip-underscores
1646 On some systems, both the C and C++ compilers put an underscore in front
1647 of every name. For example, the C name @code{foo} gets the low-level
1648 name @code{_foo}. This option removes the initial underscore. Whether
1649 @code{c++filt} removes the underscore by default is target dependent.
1650
1651 @item -n
1652 @itemx --no-strip-underscores
1653 Do not remove the initial underscore.
1654
1655 @item -s @var{format}
1656 @itemx --format=@var{format}
1657 @sc{gnu} @code{nm} can decode three different methods of mangling, used by
1658 different C++ compilers. The argument to this option selects which
1659 method it uses:
1660
1661 @table @code
1662 @item gnu
1663 the one used by the @sc{gnu} compiler (the default method)
1664 @item lucid
1665 the one used by the Lucid compiler
1666 @item arm
1667 the one specified by the C++ Annotated Reference Manual
1668 @end table
1669
1670 @item --help
1671 Print a summary of the options to @code{c++filt} and exit.
1672
1673 @item --version
1674 Print the version number of @code{c++filt} and exit.
1675 @end table
1676
1677 @quotation
1678 @emph{Warning:} @code{c++filt} is a new utility, and the details of its
1679 user interface are subject to change in future releases. In particular,
1680 a command-line option may be required in the the future to decode a name
1681 passed as an argument on the command line; in other words,
1682
1683 @example
1684 c++filt @var{symbol}
1685 @end example
1686
1687 @noindent
1688 may in a future release become
1689
1690 @example
1691 c++filt @var{option} @var{symbol}
1692 @end example
1693 @end quotation
1694
1695 @node addr2line
1696 @chapter addr2line
1697
1698 @kindex addr2line
1699 @cindex address to file name and line number
1700
1701 @smallexample
1702 addr2line [ -b @var{bfdname} | --target=@var{bfdname} ]
1703 [ -C | --demangle ]
1704 [ -e @var{filename} | --exe=@var{filename} ]
1705 [ -f | --functions ] [ -s | --basename ]
1706 [ -H | --help ] [ -V | --version ]
1707 [ addr addr ... ]
1708 @end smallexample
1709
1710 @code{addr2line} translates program addresses into file names and line
1711 numbers. Given an address and an executable, it uses the debugging
1712 information in the executable to figure out which file name and line
1713 number are associated with a given address.
1714
1715 The executable to use is specified with the @code{-e} option. The
1716 default is @file{a.out}.
1717
1718 @code{addr2line} has two modes of operation.
1719
1720 In the first, hexadecimal addresses are specified on the command line,
1721 and @code{addr2line} displays the file name and line number for each
1722 address.
1723
1724 In the second, @code{addr2line} reads hexadecimal addresses from
1725 standard input, and prints the file name and line number for each
1726 address on standard output. In this mode, @code{addr2line} may be used
1727 in a pipe to convert dynamically chosen addresses.
1728
1729 The format of the output is @samp{FILENAME:LINENO}. The file name and
1730 line number for each address is printed on a separate line. If the
1731 @code{-f} option is used, then each @samp{FILENAME:LINENO} line is
1732 preceded by a @samp{FUNCTIONNAME} line which is the name of the function
1733 containing the address.
1734
1735 If the file name or function name can not be determined,
1736 @code{addr2line} will print two question marks in their place. If the
1737 line number can not be determined, @code{addr2line} will print 0.
1738
1739 The long and short forms of options, shown here as alternatives, are
1740 equivalent.
1741
1742 @table @code
1743 @item -b @var{bfdname}
1744 @itemx --target=@var{bfdname}
1745 @cindex object code format
1746 Specify that the object-code format for the object files is
1747 @var{bfdname}.
1748
1749 @item -C
1750 @itemx --demangle
1751 @cindex demangling in objdump
1752 Decode (@dfn{demangle}) low-level symbol names into user-level names.
1753 Besides removing any initial underscore prepended by the system, this
1754 makes C++ function names readable. @xref{c++filt}, for more information
1755 on demangling.
1756
1757 @item -e @var{filename}
1758 @itemx --exe=@var{filename}
1759 Specify the name of the executable for which addresses should be
1760 translated. The default file is @file{a.out}.
1761
1762 @item -f
1763 @itemx --functions
1764 Display function names as well as file and line number information.
1765
1766 @item -s
1767 @itemx --basenames
1768 Display only the base of each file name.
1769 @end table
1770
1771 @node nlmconv
1772 @chapter nlmconv
1773
1774 @code{nlmconv} converts a relocatable object file into a NetWare
1775 Loadable Module.
1776
1777 @ignore
1778 @code{nlmconv} currently works with @samp{i386} object
1779 files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
1780 object files in @sc{elf}, or @code{a.out} format@footnote{
1781 @code{nlmconv} should work with any @samp{i386} or @sc{sparc} object
1782 format in the Binary File Descriptor library. It has only been tested
1783 with the above formats.}.
1784 @end ignore
1785
1786 @quotation
1787 @emph{Warning:} @code{nlmconv} is not always built as part of the binary
1788 utilities, since it is only useful for NLM targets.
1789 @end quotation
1790
1791 @smallexample
1792 nlmconv [ -I @var{bfdname} | --input-target=@var{bfdname} ]
1793 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
1794 [ -T @var{headerfile} | --header-file=@var{headerfile} ]
1795 [ -d | --debug] [ -l @var{linker} | --linker=@var{linker} ]
1796 [ -h | --help ] [ -V | --version ]
1797 @var{infile} @var{outfile}
1798 @end smallexample
1799
1800 @code{nlmconv} converts the relocatable @samp{i386} object file
1801 @var{infile} into the NetWare Loadable Module @var{outfile}, optionally
1802 reading @var{headerfile} for NLM header information. For instructions
1803 on writing the NLM command file language used in header files, see the
1804 @samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
1805 Development and Tools Overview}, which is part of the NLM Software
1806 Developer's Kit (``NLM SDK''), available from Novell, Inc.
1807 @code{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
1808 @var{infile}; see @ref{BFD,,BFD,ld.info,Using LD}, for
1809 more information.
1810
1811 @code{nlmconv} can perform a link step. In other words, you can list
1812 more than one object file for input if you list them in the definitions
1813 file (rather than simply specifying one input file on the command line).
1814 In this case, @code{nlmconv} calls the linker for you.
1815
1816 @table @code
1817 @item -I @var{bfdname}
1818 @itemx --input-target=@var{bfdname}
1819 Object format of the input file. @code{nlmconv} can usually determine
1820 the format of a given file (so no default is necessary).
1821 @xref{Target Selection}, for more information.
1822
1823 @item -O @var{bfdname}
1824 @itemx --output-target=@var{bfdname}
1825 Object format of the output file. @code{nlmconv} infers the output
1826 format based on the input format, e.g. for a @samp{i386} input file the
1827 output format is @samp{nlm32-i386}.
1828 @xref{Target Selection}, for more information.
1829
1830 @item -T @var{headerfile}
1831 @itemx --header-file=@var{headerfile}
1832 Reads @var{headerfile} for NLM header information. For instructions on
1833 writing the NLM command file language used in header files, see@ see the
1834 @samp{linkers} section, of the @cite{NLM Development and Tools
1835 Overview}, which is part of the NLM Software Developer's Kit, available
1836 from Novell, Inc.
1837
1838 @item -d
1839 @itemx --debug
1840 Displays (on standard error) the linker command line used by @code{nlmconv}.
1841
1842 @item -l @var{linker}
1843 @itemx --linker=@var{linker}
1844 Use @var{linker} for any linking. @var{linker} can be an abosolute or a
1845 relative pathname.
1846
1847 @item -h
1848 @itemx --help
1849 Prints a usage summary.
1850
1851 @item -V
1852 @itemx --version
1853 Prints the version number for @code{nlmconv}.
1854 @end table
1855
1856 @node windres
1857 @chapter windres
1858
1859 @code{windres} may be used to manipulate Windows resources.
1860
1861 @quotation
1862 @emph{Warning:} @code{windres} is not always built as part of the binary
1863 utilities, since it is only useful for Windows targets.
1864 @end quotation
1865
1866 @smallexample
1867 windres [options] [input-file] [output-file]
1868 @end smallexample
1869
1870 @code{windres} reads resources from an input file and copies them into
1871 an output file. Either file may be in one of three formats:
1872
1873 @table @code
1874 @item rc
1875 A text format read by the Resource Compiler.
1876
1877 @item res
1878 A binary format generated by the Resource Compiler.
1879
1880 @item coff
1881 A COFF object or executable.
1882 @end table
1883
1884 The exact description of these different formats is available in
1885 documentation from Microsoft.
1886
1887 When @code{windres} converts from the @code{rc} format to the @code{res}
1888 format, it is acting like the Windows Resource Compiler. When
1889 @code{windres} converts from the @code{res} format to the @code{coff}
1890 format, it is acting like the Windows @code{CVTRES} program.
1891
1892 When @code{windres} generates an @code{rc} file, the output is similar
1893 but not identical to the format expected for the input. When an input
1894 @code{rc} file refers to an external filename, an output @code{rc} file
1895 will instead include the file contents.
1896
1897 If the input or output format is not specified, @code{windres} will
1898 guess based on the file name, or, for the input file, the file contents.
1899 A file with an extension of @file{.rc} will be treated as an @code{rc}
1900 file, a file with an extension of @file{.res} will be treated as a
1901 @code{res} file, and a file with an extension of @file{.o} or
1902 @file{.exe} will be treated as a @code{coff} file.
1903
1904 If no output file is specified, @code{windres} will print the resources
1905 in @code{rc} format to standard output.
1906
1907 The normal use is for you to write an @code{rc} file, use @code{windres}
1908 to convert it to a COFF object file, and then link the COFF file into
1909 your application. This will make the resources described in the
1910 @code{rc} file available to Windows.
1911
1912 @table @code
1913 @item -i @var{filename}
1914 @itemx --input @var{filename}
1915 The name of the input file. If this option is not used, then
1916 @code{windres} will use the first non-option argument as the input file
1917 name. If there are no non-option arguments, then @code{windres} will
1918 read from standard input. @code{windres} can not read a COFF file from
1919 standard input.
1920
1921 @item -o @var{filename}
1922 @itemx --output @var{filename}
1923 The name of the output file. If this option is not used, then
1924 @code{windres} will use the first non-option argument, after any used
1925 for the input file name, as the output file name. If there is no
1926 non-option argument, then @code{windres} will write to standard output.
1927 @code{windres} can not write a COFF file to standard output.
1928
1929 @item -I @var{format}
1930 @itemx --input-format @var{format}
1931 The input format to read. @var{format} may be @samp{res}, @samp{rc}, or
1932 @samp{coff}. If no input format is specified, @code{windres} will
1933 guess, as described above.
1934
1935 @item -O @var{format}
1936 @itemx --output-format @var{format}
1937 The output format to generate. @var{format} may be @samp{res},
1938 @samp{rc}, or @samp{coff}. If no output format is specified,
1939 @code{windres} will guess, as described above.
1940
1941 @item -F @var{target}
1942 @itemx --target @var{target}
1943 Specify the BFD format to use for a COFF file as input or output. This
1944 is a BFD target name; you can use the @code{--help} option to see a list
1945 of supported targets. Normally @code{windres} will use the default
1946 format, which is the first one listed by the @code{--help} option.
1947 @ref{Target Selection}.
1948
1949 @item --preprocessor @var{program}
1950 When @code{windres} reads an @code{rc} file, it runs it through the C
1951 preprocessor first. This option may be used to specify the preprocessor
1952 to use, including any leading arguments. The default preprocessor
1953 argument is @code{gcc -E -xc-header -DRC_INVOKED}.
1954
1955 @item --include-dir @var{directory}
1956 Specify an include directory to use when reading an @code{rc} file.
1957 @code{windres} will pass this to the preprocessor as an @code{-I}
1958 option. @code{windres} will also search this directory when looking for
1959 files named in the @code{rc} file.
1960
1961 @item --define @var{sym[=val]}
1962 Specify a @code{-D} option to pass to the preprocessor when reading an
1963 @code{rc} file.
1964
1965 @item --language @var{val}
1966 Specify the default language to use when reading an @code{rc} file.
1967 @var{val} should be a hexadecimal language code. The low eight bits are
1968 the language, and the high eight bits are the sublanguage.
1969
1970 @item --help
1971 Prints a usage summary.
1972
1973 @item --version
1974 Prints the version number for @code{windres}.
1975
1976 @item --yydebug
1977 If @code{windres} is compiled with @code{YYDEBUG} defined as @code{1},
1978 this will turn on parser debugging.
1979 @end table
1980
1981 @node Selecting The Target System
1982 @chapter Selecting the target system
1983
1984 You can specify three aspects of the target system to the @sc{gnu}
1985 binary file utilities, each in several ways:
1986
1987 @itemize @bullet
1988 @item
1989 the target
1990
1991 @item
1992 the architecture
1993
1994 @item
1995 the linker emulation (which applies to the linker only)
1996 @end itemize
1997
1998 In the following summaries, the lists of ways to specify values are in
1999 order of decreasing precedence. The ways listed first override those
2000 listed later.
2001
2002 The commands to list valid values only list the values for which the
2003 programs you are running were configured. If they were configured with
2004 @samp{--enable-targets=all}, the commands list most of the available
2005 values, but a few are left out; not all targets can be configured in at
2006 once because some of them can only be configured @dfn{native} (on hosts
2007 with the same type as the target system).
2008
2009 @menu
2010 * Target Selection::
2011 * Architecture Selection::
2012 * Linker Emulation Selection::
2013 @end menu
2014
2015 @node Target Selection
2016 @section Target Selection
2017
2018 A @dfn{target} is an object file format. A given target may be
2019 supported for multiple architectures (@pxref{Architecture Selection}).
2020 A target selection may also have variations for different operating
2021 systems or architectures.
2022
2023 The command to list valid target values is @samp{objdump -i}
2024 (the first column of output contains the relevant information).
2025
2026 Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
2027 @samp{a.out-sunos-big}.
2028
2029 You can also specify a target using a configuration triplet. This is
2030 the same sort of name that is passed to configure to specify a target.
2031 When you use a configuration triplet as an argument, it must be fully
2032 canonicalized. You can see the canonical version of a triplet by
2033 running the shell script @file{config.sub} which is included with the
2034 sources.
2035
2036 Some sample configuration triplets are: @samp{m68k-hp-bsd},
2037 @samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}.
2038
2039 @subheading @code{objdump} Target
2040
2041 Ways to specify:
2042
2043 @enumerate
2044 @item
2045 command line option: @samp{-b} or @samp{--target}
2046
2047 @item
2048 environment variable @code{GNUTARGET}
2049
2050 @item
2051 deduced from the input file
2052 @end enumerate
2053
2054 @subheading @code{objcopy} and @code{strip} Input Target
2055
2056 Ways to specify:
2057
2058 @enumerate
2059 @item
2060 command line options: @samp{-I} or @samp{--input-target}, or @samp{-F} or @samp{--target}
2061
2062 @item
2063 environment variable @code{GNUTARGET}
2064
2065 @item
2066 deduced from the input file
2067 @end enumerate
2068
2069 @subheading @code{objcopy} and @code{strip} Output Target
2070
2071 Ways to specify:
2072
2073 @enumerate
2074 @item
2075 command line options: @samp{-O} or @samp{--output-target}, or @samp{-F} or @samp{--target}
2076
2077 @item
2078 the input target (see ``@code{objcopy} and @code{strip} Input Target'' above)
2079
2080 @item
2081 environment variable @code{GNUTARGET}
2082
2083 @item
2084 deduced from the input file
2085 @end enumerate
2086
2087 @subheading @code{nm}, @code{size}, and @code{strings} Target
2088
2089 Ways to specify:
2090
2091 @enumerate
2092 @item
2093 command line option: @samp{--target}
2094
2095 @item
2096 environment variable @code{GNUTARGET}
2097
2098 @item
2099 deduced from the input file
2100 @end enumerate
2101
2102 @subheading Linker Input Target
2103
2104 Ways to specify:
2105
2106 @enumerate
2107 @item
2108 command line option: @samp{-b} or @samp{--format}
2109 (@pxref{Options,,Options,ld.info,Using LD})
2110
2111 @item
2112 script command @code{TARGET}
2113 (@pxref{Option Commands,,Option Commands,ld.info,Using LD})
2114
2115 @item
2116 environment variable @code{GNUTARGET}
2117 (@pxref{Environment,,Environment,ld.info,Using LD})
2118
2119 @item
2120 the default target of the selected linker emulation
2121 (@pxref{Linker Emulation Selection})
2122 @end enumerate
2123
2124 @subheading Linker Output Target
2125
2126 Ways to specify:
2127
2128 @enumerate
2129 @item
2130 command line option: @samp{-oformat}
2131 (@pxref{Options,,Options,ld.info,Using LD})
2132
2133 @item
2134 script command @code{OUTPUT_FORMAT}
2135 (@pxref{Option Commands,,Option Commands,ld.info,Using LD})
2136
2137 @item
2138 the linker input target (see ``Linker Input Target'' above)
2139 @end enumerate
2140
2141 @node Architecture Selection
2142 @section Architecture selection
2143
2144 An @dfn{architecture} is a type of @sc{cpu} on which an object file is
2145 to run. Its name may contain a colon, separating the name of the
2146 processor family from the name of the particular @sc{cpu}.
2147
2148 The command to list valid architecture values is @samp{objdump -i} (the
2149 second column contains the relevant information).
2150
2151 Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
2152
2153 @subheading @code{objdump} Architecture
2154
2155 Ways to specify:
2156
2157 @enumerate
2158 @item
2159 command line option: @samp{-m} or @samp{--architecture}
2160
2161 @item
2162 deduced from the input file
2163 @end enumerate
2164
2165 @subheading @code{objcopy}, @code{nm}, @code{size}, @code{strings} Architecture
2166
2167 Ways to specify:
2168
2169 @enumerate
2170 @item
2171 deduced from the input file
2172 @end enumerate
2173
2174 @subheading Linker Input Architecture
2175
2176 Ways to specify:
2177
2178 @enumerate
2179 @item
2180 deduced from the input file
2181 @end enumerate
2182
2183 @subheading Linker Output Architecture
2184
2185 Ways to specify:
2186
2187 @enumerate
2188 @item
2189 script command @code{OUTPUT_ARCH}
2190 (@pxref{Option Commands,,Option Commands,ld.info,Using LD})
2191
2192 @item
2193 the default architecture from the linker output target
2194 (@pxref{Target Selection})
2195 @end enumerate
2196
2197 @node Linker Emulation Selection
2198 @section Linker emulation selection
2199
2200 A linker @dfn{emulation} is a ``personality'' of the linker, which gives
2201 the linker default values for the other aspects of the target system.
2202 In particular, it consists of
2203
2204 @itemize @bullet
2205 @item
2206 the linker script
2207
2208 @item
2209 the target
2210
2211 @item
2212 several ``hook'' functions that are run at certain stages of the linking
2213 process to do special things that some targets require
2214 @end itemize
2215
2216 The command to list valid linker emulation values is @samp{ld -V}.
2217
2218 Sample values: @samp{hp300bsd}, @samp{mipslit}, @samp{sun4}.
2219
2220 Ways to specify:
2221
2222 @enumerate
2223 @item
2224 command line option: @samp{-m}
2225 (@pxref{Options,,Options,ld.info,Using LD})
2226
2227 @item
2228 environment variable @code{LDEMULATION}
2229
2230 @item
2231 compiled-in @code{DEFAULT_EMULATION} from @file{Makefile},
2232 which comes from @code{EMUL} in @file{config/@var{target}.mt}
2233 @end enumerate
2234
2235 @node Reporting Bugs
2236 @chapter Reporting Bugs
2237 @cindex bugs
2238 @cindex reporting bugs
2239
2240 Your bug reports play an essential role in making the binary utilities
2241 reliable.
2242
2243 Reporting a bug may help you by bringing a solution to your problem, or
2244 it may not. But in any case the principal function of a bug report is
2245 to help the entire community by making the next version of the binary
2246 utilities work better. Bug reports are your contribution to their
2247 maintenance.
2248
2249 In order for a bug report to serve its purpose, you must include the
2250 information that enables us to fix the bug.
2251
2252 @menu
2253 * Bug Criteria:: Have you found a bug?
2254 * Bug Reporting:: How to report bugs
2255 @end menu
2256
2257 @node Bug Criteria
2258 @section Have you found a bug?
2259 @cindex bug criteria
2260
2261 If you are not sure whether you have found a bug, here are some guidelines:
2262
2263 @itemize @bullet
2264 @cindex fatal signal
2265 @cindex crash
2266 @item
2267 If a binary utility gets a fatal signal, for any input whatever, that is
2268 a bug. Reliable utilities never crash.
2269
2270 @cindex error on valid input
2271 @item
2272 If a binary utility produces an error message for valid input, that is a
2273 bug.
2274
2275 @item
2276 If you are an experienced user of binary utilities, your suggestions for
2277 improvement are welcome in any case.
2278 @end itemize
2279
2280 @node Bug Reporting
2281 @section How to report bugs
2282 @cindex bug reports
2283 @cindex bugs, reporting
2284
2285 A number of companies and individuals offer support for @sc{gnu}
2286 products. If you obtained the binary utilities from a support
2287 organization, we recommend you contact that organization first.
2288
2289 You can find contact information for many support companies and
2290 individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
2291 distribution.
2292
2293 In any event, we also recommend that you send bug reports for the binary
2294 utilities to @samp{bug-gnu-utils@@prep.ai.mit.edu}.
2295
2296 The fundamental principle of reporting bugs usefully is this:
2297 @strong{report all the facts}. If you are not sure whether to state a
2298 fact or leave it out, state it!
2299
2300 Often people omit facts because they think they know what causes the
2301 problem and assume that some details do not matter. Thus, you might
2302 assume that the name of a file you use in an example does not matter.
2303 Well, probably it does not, but one cannot be sure. Perhaps the bug is
2304 a stray memory reference which happens to fetch from the location where
2305 that pathname is stored in memory; perhaps, if the pathname were
2306 different, the contents of that location would fool the utility into
2307 doing the right thing despite the bug. Play it safe and give a
2308 specific, complete example. That is the easiest thing for you to do,
2309 and the most helpful.
2310
2311 Keep in mind that the purpose of a bug report is to enable us to fix the bug if
2312 it is new to us. Therefore, always write your bug reports on the assumption
2313 that the bug has not been reported previously.
2314
2315 Sometimes people give a few sketchy facts and ask, ``Does this ring a
2316 bell?'' Those bug reports are useless, and we urge everyone to
2317 @emph{refuse to respond to them} except to chide the sender to report
2318 bugs properly.
2319
2320 To enable us to fix the bug, you should include all these things:
2321
2322 @itemize @bullet
2323 @item
2324 The version of the utility. Each utility announces it if you start it
2325 with the @samp{--version} argument.
2326
2327 Without this, we will not know whether there is any point in looking for
2328 the bug in the current version of the binary utilities.
2329
2330 @item
2331 Any patches you may have applied to the source, including any patches
2332 made to the @code{BFD} library.
2333
2334 @item
2335 The type of machine you are using, and the operating system name and
2336 version number.
2337
2338 @item
2339 What compiler (and its version) was used to compile the utilities---e.g.
2340 ``@code{gcc-2.7}''.
2341
2342 @item
2343 The command arguments you gave the utility to observe the bug. To
2344 guarantee you will not omit something important, list them all. A copy
2345 of the Makefile (or the output from make) is sufficient.
2346
2347 If we were to try to guess the arguments, we would probably guess wrong
2348 and then we might not encounter the bug.
2349
2350 @item
2351 A complete input file, or set of input files, that will reproduce the
2352 bug. If the utility is reading an object file or files, then it is
2353 generally most helpful to send the actual object files, uuencoded if
2354 necessary to get them through the mail system. Making them available
2355 for anonymous FTP is not as good, but may be the only reasonable choice
2356 for large object files.
2357
2358 If the source files were produced exclusively using @sc{gnu} programs
2359 (e.g., @code{gcc}, @code{gas}, and/or the @sc{gnu} @code{ld}), then it
2360 may be OK to send the source files rather than the object files. In
2361 this case, be sure to say exactly what version of @code{gcc}, or
2362 whatever, was used to produce the object files. Also say how
2363 @code{gcc}, or whatever, was configured.
2364
2365 @item
2366 A description of what behavior you observe that you believe is
2367 incorrect. For example, ``It gets a fatal signal.''
2368
2369 Of course, if the bug is that the utility gets a fatal signal, then we
2370 will certainly notice it. But if the bug is incorrect output, we might
2371 not notice unless it is glaringly wrong. You might as well not give us
2372 a chance to make a mistake.
2373
2374 Even if the problem you experience is a fatal signal, you should still
2375 say so explicitly. Suppose something strange is going on, such as, your
2376 copy of the utility is out of synch, or you have encountered a bug in
2377 the C library on your system. (This has happened!) Your copy might
2378 crash and ours would not. If you told us to expect a crash, then when
2379 ours fails to crash, we would know that the bug was not happening for
2380 us. If you had not told us to expect a crash, then we would not be able
2381 to draw any conclusion from our observations.
2382
2383 @item
2384 If you wish to suggest changes to the source, send us context diffs, as
2385 generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p}
2386 option. Always send diffs from the old file to the new file. If you
2387 even discuss something in the @code{ld} source, refer to it by context,
2388 not by line number.
2389
2390 The line numbers in our development sources will not match those in your
2391 sources. Your line numbers would convey no useful information to us.
2392 @end itemize
2393
2394 Here are some things that are not necessary:
2395
2396 @itemize @bullet
2397 @item
2398 A description of the envelope of the bug.
2399
2400 Often people who encounter a bug spend a lot of time investigating
2401 which changes to the input file will make the bug go away and which
2402 changes will not affect it.
2403
2404 This is often time consuming and not very useful, because the way we
2405 will find the bug is by running a single example under the debugger
2406 with breakpoints, not by pure deduction from a series of examples.
2407 We recommend that you save your time for something else.
2408
2409 Of course, if you can find a simpler example to report @emph{instead}
2410 of the original one, that is a convenience for us. Errors in the
2411 output will be easier to spot, running under the debugger will take
2412 less time, and so on.
2413
2414 However, simplification is not vital; if you do not want to do this,
2415 report the bug anyway and send us the entire test case you used.
2416
2417 @item
2418 A patch for the bug.
2419
2420 A patch for the bug does help us if it is a good one. But do not omit
2421 the necessary information, such as the test case, on the assumption that
2422 a patch is all we need. We might see problems with your patch and decide
2423 to fix the problem another way, or we might not understand it at all.
2424
2425 Sometimes with programs as complicated as the binary utilities it is
2426 very hard to construct an example that will make the program follow a
2427 certain path through the code. If you do not send us the example, we
2428 will not be able to construct one, so we will not be able to verify that
2429 the bug is fixed.
2430
2431 And if we cannot understand what bug you are trying to fix, or why your
2432 patch should be an improvement, we will not install it. A test case will
2433 help us to understand.
2434
2435 @item
2436 A guess about what the bug is or what it depends on.
2437
2438 Such guesses are usually wrong. Even we cannot guess right about such
2439 things without first using the debugger to find the facts.
2440 @end itemize
2441
2442 @node Index
2443 @unnumbered Index
2444
2445 @printindex cp
2446
2447 @contents
2448 @bye
This page took 0.103884 seconds and 4 git commands to generate.