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