1 \input texinfo @c -*- Texinfo -*-
2 @setfilename binutils.info
7 * Binutils:: The GNU binary utilities "ar", "ld", "objcopy",
8 "objdump", "nm", "size", "strings", "strip", and "ranlib".
14 Copyright @copyright{} 1991, 1992, 1993 Free Software Foundation, Inc.
16 Permission is granted to make and distribute verbatim copies of
17 this manual provided the copyright notice and this permission notice
18 are preserved on all copies.
21 Permission is granted to process this file through TeX and print the
22 results, provided the printed document carries a copying permission
23 notice identical to this one except for the removal of this paragraph
24 (this paragraph not being relevant to the printed manual).
28 Permission is granted to copy and distribute modified versions of this
29 manual under the conditions for verbatim copying, provided also that
30 the entire resulting derived work is distributed under the terms of a
31 permission notice identical to this one.
33 Permission is granted to copy and distribute translations of this manual
34 into another language, under the above conditions for modified versions.
39 @c This file documents the GNU binary utilities "ar", "ld", "objcopy",
40 @c "objdump", "nm", "size", "strings", "strip", and "ranlib".
42 @c Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
44 @c This text may be freely distributed under the terms of the GNU
45 @c General Public License.
48 @setchapternewpage odd
49 @settitle GNU Binary Utilities
54 @title The GNU Binary Utilities
58 @author Roland H. Pesch
59 @author Cygnus Support
63 {\parskip=0pt \hfill Cygnus Support\par \hfill
64 \TeX{}info \texinfoversion\par }
67 @vskip 0pt plus 1filll
68 Copyright @copyright{} 1991, 1992, 1993 Free Software Foundation, Inc.
70 Permission is granted to make and distribute verbatim copies of
71 this manual provided the copyright notice and this permission notice
72 are preserved on all copies.
74 Permission is granted to copy and distribute modified versions of this
75 manual under the conditions for verbatim copying, provided also that
76 the entire resulting derived work is distributed under the terms of a
77 permission notice identical to this one.
79 Permission is granted to copy and distribute translations of this manual
80 into another language, under the above conditions for modified versions.
83 @node Top, ar, (dir), (dir)
87 This brief manual contains preliminary documentation for the GNU binary
88 utilities (collectively version 2.2):
93 Create, modify, and extract from archives
96 Copy and translate object files
99 List symbols from object files
102 Display information from object files
105 Generate index to archive contents
108 List section sizes and total size
111 List printable strings from files
119 * ar:: Create, modify, and extract from archives
120 * objcopy:: Copy and translate object files
121 * ld:(ld)Overview. Combine object and archive files
122 * nm:: List symbols from object files
123 * objdump:: Display information from object files
124 * ranlib:: Generate index to archive contents
125 * size:: List section sizes and total size
126 * strings:: List printable strings from files
127 * strip:: Discard symbols
128 * c++filt:: Filter to demangle encoded C++ symbols
132 @node ar, objcopy, Top, Top
137 @cindex collections of files
139 ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
140 ar -M [ <mri-script ]
143 The GNU @code{ar} program creates, modifies, and extracts from
144 archives. An @dfn{archive} is a single file holding a collection of
145 other files in a structure that makes it possible to retrieve
146 the original individual files (called @dfn{members} of the archive).
148 The original files' contents, mode (permissions), timestamp, owner, and
149 group are preserved in the archive, and can be restored on
153 GNU @code{ar} can maintain archives whose members have names of any
154 length; however, depending on how @code{ar} is configured on your
155 system, a limit on member-name length may be imposed for compatibility
156 with archive formats maintained with other tools. If it exists, the
157 limit is often 15 characters (typical of formats related to a.out) or 16
158 characters (typical of formats related to coff).
161 @code{ar} is considered a binary utility because archives of this sort
162 are most often used as @dfn{libraries} holding commonly needed
166 @code{ar} creates an index to the symbols defined in relocatable
167 object modules in the archive when you specify the modifier @samp{s}.
168 Once created, this index is updated in the archive whenever @code{ar}
169 makes a change to its contents (save for the @samp{q} update operation).
170 An archive with such an index speeds up linking to the library, and
171 allows routines in the library to call each other without regard to
172 their placement in the archive.
174 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
175 table. If an archive lacks the table, another form of @code{ar} called
176 @code{ranlib} can be used to add just the table.
178 @cindex compatibility, @code{ar}
179 @cindex @code{ar} compatibility
180 GNU @code{ar} is designed to be compatible with two different
181 facilities. You can control its activity using command-line options,
182 like the different varieties of @code{ar} on Unix systems; or, if you
183 specify the single command-line option @samp{-M}, you can control it
184 with a script supplied via standard input, like the MRI ``librarian''
188 * ar-cmdline:: Controlling @code{ar} on the command line
189 * ar-scripts:: Controlling @code{ar} with a script
193 @node ar-cmdline, ar-scripts, ar, ar
194 @section Controlling @code{ar} on the command line
197 ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
200 @cindex Unix compatibility, @code{ar}
201 When you use @code{ar} in the Unix style, @code{ar} insists on at least two
202 arguments to execute: one keyletter specifying the @emph{operation}
203 (optionally accompanied by other keyletters specifying
204 @emph{modifiers}), and the archive name to act on.
206 Most operations can also accept further @var{member} arguments,
207 specifying particular files to operate on.
209 GNU @code{ar} allows you to mix the operation code @var{p} and modifier
210 flags @var{mod} in any order, within the first command-line argument.
212 If you wish, you may begin the first command-line argument with a
215 @cindex operations on archive
216 The @var{p} keyletter specifies what operation to execute; it may be
217 any of the following, but you must specify only one of them:
221 @cindex deleting from archive
222 @emph{Delete} modules from the archive. Specify the names of modules to
223 be deleted as @var{member}@dots{}; the archive is untouched if you
224 specify no files to delete.
226 If you specify the @samp{v} modifier, @code{ar} lists each module
230 @cindex moving in archive
231 Use this operation to @emph{move} members in an archive.
233 The ordering of members in an archive can make a difference in how
234 programs are linked using the library, if a symbol is defined in more
237 If no modifiers are used with @code{m}, any members you name in the
238 @var{member} arguments are moved to the @emph{end} of the archive;
239 you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
240 specified place instead.
243 @cindex printing from archive
244 @emph{Print} the specified members of the archive, to the standard
245 output file. If the @samp{v} modifier is specified, show the member
246 name before copying its contents to standard output.
248 If you specify no @var{member} arguments, all the files in the archive are
252 @cindex quick append to archive
253 @emph{Quick append}; add the files @var{member}@dots{} to the end of
254 @var{archive}, without checking for replacement.
256 The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
257 operation; new members are always placed at the end of the archive.
259 The modifier @samp{v} makes @code{ar} list each file as it is appended.
261 Since the point of this operation is speed, the archive's symbol table
262 index is not updated, even if it already existed; you can use @samp{ar s} or
263 @code{ranlib} explicitly to update the symbol table index.
266 @cindex replacement in archive
267 Insert the files @var{member}@dots{} into @var{archive} (with
268 @emph{replacement}). This operation differs from @samp{q} in that any
269 previously existing members are deleted if their names match those being
272 If one of the files named in @var{member}@dots{} does not exist, @code{ar}
273 displays an error message, and leaves undisturbed any existing members
274 of the archive matching that name.
276 By default, new members are added at the end of the file; but you may
277 use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
278 placement relative to some existing member.
280 The modifier @samp{v} used with this operation elicits a line of
281 output for each file inserted, along with one of the letters @samp{a} or
282 @samp{r} to indicate whether the file was appended (no old member
283 deleted) or replaced.
286 @cindex contents of archive
287 Display a @emph{table} listing the contents of @var{archive}, or those
288 of the files listed in @var{member}@dots{} that are present in the
289 archive. Normally only the member name is shown; if you also want to
290 see the modes (permissions), timestamp, owner, group, and size, you can
291 request that by also specifying the @samp{v} modifier.
293 If you do not specify a @var{member}, all files in the archive
296 @cindex repeated names in archive
297 @cindex name duplication in archive
298 If there is more than one file with the same name (say, @samp{fie}) in
299 an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
300 first instance; to see them all, you must ask for a complete
301 listing---in our example, @samp{ar t b.a}.
302 @c WRS only; per Gumby, this is implementation-dependent, and in a more
303 @c recent case in fact works the other way.
306 @cindex extract from archive
307 @emph{Extract} members (named @var{member}) from the archive. You can
308 use the @samp{v} modifier with this operation, to request that
309 @code{ar} list each name as it extracts it.
311 If you do not specify a @var{member}, all files in the archive
316 A number of modifiers (@var{mod}) may immediately follow the @var{p}
317 keyletter, to specify variations on an operation's behavior:
321 @cindex relative placement in archive
322 Add new files @emph{after} an existing member of the
323 archive. If you use the modifier @samp{a}, the name of an existing archive
324 member must be present as the @var{relpos} argument, before the
325 @var{archive} specification.
328 Add new files @emph{before} an existing member of the
329 archive. If you use the modifier @samp{b}, the name of an existing archive
330 member must be present as the @var{relpos} argument, before the
331 @var{archive} specification. (same as @samp{i}).
334 @cindex creating archives
335 @emph{Create} the archive. The specified @var{archive} is always
336 created if it did not exist, when you request an update. But a warning is
337 issued unless you specify in advance that you expect to create it, by
341 Insert new files @emph{before} an existing member of the
342 archive. If you use the modifier @samp{i}, the name of an existing archive
343 member must be present as the @var{relpos} argument, before the
344 @var{archive} specification. (same as @samp{b}).
347 This modifier is accepted but not used.
348 @c whaffor ar l modifier??? presumably compat; with
349 @c what???---pesch@@cygnus.com, 25jan91
352 @cindex dates in archive
353 Preserve the @emph{original} dates of members when extracting them. If
354 you do not specify this modifier, files extracted from the archive
355 are stamped with the time of extraction.
358 @cindex writing archive index
359 Write an object-file index into the archive, or update an existing one,
360 even if no other change is made to the archive. You may use this modifier
361 flag either with any operation, or alone. Running @samp{ar s} on an
362 archive is equivalent to running @samp{ranlib} on it.
365 @cindex updating an archive
366 Normally, @samp{ar r}@dots{} inserts all files
367 listed into the archive. If you would like to insert @emph{only} those
368 of the files you list that are newer than existing members of the same
369 names, use this modifier. The @samp{u} modifier is allowed only for the
370 operation @samp{r} (replace). In particular, the combination @samp{qu} is
371 not allowed, since checking the timestamps would lose any speed
372 advantage from the operation @samp{q}.
375 This modifier requests the @emph{verbose} version of an operation. Many
376 operations display additional information, such as filenames processed,
377 when the modifier @samp{v} is appended.
380 This modifier shows the version number of @code{ar}.
383 @node ar-scripts, , ar-cmdline, ar
384 @section Controlling @code{ar} with a script
387 ar -M [ <@var{script} ]
390 @cindex MRI compatibility, @code{ar}
391 @cindex scripts, @code{ar}
392 If you use the single command-line option @samp{-M} with @code{ar}, you
393 can control its operation with a rudimentary command language. This
394 form of @code{ar} operates interactively if standard input is coming
395 directly from a terminal. During interactive use, @code{ar} prompts for
396 input (the prompt is @samp{AR >}), and continues executing even after
397 errors. If you redirect standard input to a script file, no prompts are
398 issued, and @code{ar} abandons execution (with a nonzero exit code)
401 The @code{ar} command language is @emph{not} designed to be equivalent
402 to the command-line options; in fact, it provides somewhat less control
403 over archives. The only purpose of the command language is to ease the
404 transition to GNU @code{ar} for developers who already have scripts
405 written for the MRI ``librarian'' program.
407 The syntax for the @code{ar} command language is straightforward:
410 commands are recognized in upper or lower case; for example, @code{LIST}
411 is the same as @code{list}. In the following descriptions, commands are
412 shown in upper case for clarity.
415 a single command may appear on each line; it is the first word on the
419 empty lines are allowed, and have no effect.
422 comments are allowed; text after either of the characters @samp{*}
423 or @samp{;} is ignored.
426 Whenever you use a list of names as part of the argument to an @code{ar}
427 command, you can separate the individual names with either commas or
428 blanks. Commas are shown in the explanations below, for clarity.
431 @samp{+} is used as a line continuation character; if @samp{+} appears
432 at the end of a line, the text on the following line is considered part
433 of the current command.
436 Here are the commands you can use in @code{ar} scripts, or when using
437 @code{ar} interactively. Three of them have special significance:
439 @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
440 a temporary file required for most of the other commands.
442 @code{SAVE} commits the changes so far specified by the script. Prior
443 to @code{SAVE}, commands affect only the temporary copy of the current
447 @item ADDLIB @var{archive}
448 @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
449 Add all the contents of @var{archive} (or, if specified, each named
450 @var{module} from @var{archive}) to the current archive.
452 Requires prior use of @code{OPEN} or @code{CREATE}.
454 @item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
455 @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
456 @c else like "ar q..."
457 Add each named @var{member} as a module in the current archive.
459 Requires prior use of @code{OPEN} or @code{CREATE}.
462 Discard the contents of the current archive, cancelling the effect of
463 any operations since the last @code{SAVE}. May be executed (with no
464 effect) even if no current archive is specified.
466 @item CREATE @var{archive}
467 Creates an archive, and makes it the current archive (required for many
468 other commands). The new archive is created with a temporary name; it
469 is not actually saved as @var{archive} until you use @code{SAVE}.
470 You can overwrite existing archives; similarly, the contents of any
471 existing file named @var{archive} will not be destroyed until @code{SAVE}.
473 @item DELETE @var{module}, @var{module}, @dots{} @var{module}
474 Delete each listed @var{module} from the current archive; equivalent to
475 @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
477 Requires prior use of @code{OPEN} or @code{CREATE}.
479 @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
480 @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
481 List each named @var{module} present in @var{archive}. The separate
482 command @code{VERBOSE} specifies the form of the output: when verbose
483 output is off, output is like that of @samp{ar -t @var{archive}
484 @var{module}@dots{}}. When verbose output is on, the listing is like
485 @samp{ar -tv @var{archive} @var{module}@dots{}}.
487 Output normally goes to the standard output stream; however, if you
488 specify @var{outputfile} as a final argument, @code{ar} directs the
492 Exit from @code{ar}, with a @code{0} exit code to indicate successful
493 completion. This command does not save the output file; if you have
494 changed the current archive since the last @code{SAVE} command, those
497 @item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
498 Extract each named @var{module} from the current archive, writing them
499 into the current directory as separate files. Equivalent to @samp{ar -x
500 @var{archive} @var{module}@dots{}}.
502 Requires prior use of @code{OPEN} or @code{CREATE}.
505 @c FIXME Tokens but no commands???
512 Display full contents of the current archive, in ``verbose'' style
513 regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
514 tv @var{archive}}). (This single command is a GNU @code{ld}
515 enhancement, rather than present for MRI compatibility.)
517 Requires prior use of @code{OPEN} or @code{CREATE}.
519 @item OPEN @var{archive}
520 Opens an existing archive for use as the current archive (required for
521 many other commands). Any changes as the result of subsequent commands
522 will not actually affect @var{archive} until you next use @code{SAVE}.
524 @item REPLACE @var{module}, @var{module}, @dots{} @var{module}
525 In the current archive, replace each existing @var{module} (named in
526 the @code{REPLACE} arguments) from files in the current working directory.
527 To execute this command without errors, both the file, and the module in
528 the current archive, must exist.
530 Requires prior use of @code{OPEN} or @code{CREATE}.
533 Toggle an internal flag governing the output from @code{DIRECTORY}.
534 When the flag is on, @code{DIRECTORY} output matches output from
535 @samp{ar -tv }@dots{}.
538 Commit your changes to the current archive, and actually save it as a
539 file with the name specified in the last @code{CREATE} or @code{OPEN}
542 Requires prior use of @code{OPEN} or @code{CREATE}.
546 @node objcopy, nm, ar, Top
550 objcopy [ -F @var{format} | --format=@var{format} ]
551 [ -I @var{format} | --input-format=@var{format} ]
552 [ -O @var{format} | --output-format=@var{format} ]
553 [ -S | --strip-all ] [ -g | --strip-debug ]
554 [ -x | --discard-all ] [ -X | --discard-locals ]
555 [ -v | --verbose ] [ -V | --version ] [ --help ]
556 @var{infile} [@var{outfile}]
559 The GNU @code{objcopy} utility copies the contents of an object file to
560 another. @code{objcopy} uses the GNU BFD Library to read and write the
561 object files. It can write the destination object file in a format
562 different from that of the source object file. The exact behavior of
563 @code{objcopy} is controlled by command-line options.
565 @code{objcopy} creates temporary files to do its translations and
566 deletes them afterward. @code{objcopy} uses BFD to do all its
567 translation work; it knows about all the formats BFD knows about, and
568 thus is able to recognize most formats without being told explicitly.
569 @xref{BFD,,BFD,ld.info,Using LD, the GNU linker}.
574 The source and output files respectively.
575 If you do not specify @var{outfile}, @code{objcopy} creates a
576 temporary file and destructively renames the result with
577 the name of the input file.
579 @item -I @var{format}
580 @itemx --input-format=@var{format}
581 Consider the source file's object format to be @var{format}, rather than
582 attempting to deduce it.
584 @item -O @var{format}
585 @itemx --output-format=@var{format}
586 Write the output file using the object format @var{format}.
588 @item -F @var{format}
589 @itemx --format=@var{format}
590 Use @var{format} as the object format for both the input and the output
591 file; i.e. simply transfer data from source to destination with no
596 Do not copy relocation and symbol information from the source file.
600 Do not copy debugging symbols from the source file.
604 Do not copy non-global symbols from the source file.
605 @c FIXME any reason to prefer "non-global" to "local" here?
608 @itemx --discard-locals
609 Do not copy compiler-generated local symbols.
610 (These usually start with @samp{L} or @samp{.}.)
614 Show the version number of @code{objcopy}.
618 Verbose output: list all object files modified. In the case of
619 archives, @samp{objcopy -V} lists all members of the archive.
622 Show a summary of the options to @code{objcopy}.
630 The GNU linker @code{ld} is now described in a separate manual.
631 @xref{Top,, Overview,, Using LD: the GNU linker}.
634 @node nm, objdump, objcopy, Top
640 nm [ -a | --debug-syms ] [ -g | --extern-only ]
641 [ -B ] [ -C | --demangle ]
642 [ -s | --print-armap ] [ -A | -o | --print-file-name ]
643 [ -n | -v | --numeric-sort ] [ -p | --no-sort ]
644 [ -r | --reverse-sort ] [ -u | --undefined-only ]
645 [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
646 [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
647 [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ]
650 GNU @code{nm} lists the symbols from object files @var{objfile}@dots{}.
651 If no object files are listed as arguments, @code{nm} assumes
654 For each symbol, @code{nm} shows:
658 The symbol value, in the radix selected by options (see below), or
659 hexadecimal by default.
662 The symbol type. At least the following types are used; others are, as
663 well, depending on the object file format. If lowercase, the symbol is
664 local; if uppercase, the symbol is global (external).
666 @c Some more detail on exactly what these symbol types are used for
673 BSS (uninitialized data).
695 The long and short forms of options, shown here as alternatives, are
701 @itemx --print-file-name
702 @cindex input file name
704 @cindex source file name
705 Precede each symbol by the name of the input file (or archive element)
706 in which it was found, rather than identifying the input file once only,
707 before all of its symbols.
711 @cindex debugging symbols
712 Display all symbols, even debugger-only symbols; normally these are not
716 @cindex @code{nm} format
717 @cindex @code{nm} compatibility
718 The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}).
722 @cindex demangling C++ symbols
723 Decode (@dfn{demangle}) low-level symbol names into user-level names.
724 Besides removing any initial underscore prepended by the system, this
725 makes C++ function names readable. @xref{c++filt}, for more information
728 @item -f @var{format}
729 @itemx --format=@var{format}
730 @cindex @code{nm} format
731 @cindex @code{nm} compatibility
732 Use the output format @var{format}, which can be @code{bsd},
733 @code{sysv}, or @code{posix}. The default is @code{bsd}.
734 Only the first character of @var{format} is significant; it can be
735 either upper or lower case.
739 @cindex external symbols
740 Display only external symbols.
744 @itemx --numeric-sort
745 Sort symbols numerically by their addresses, rather than alphabetically
750 @cindex sorting symbols
751 Do not bother to sort the symbols in any order; print them in the order
756 Use the POSIX.2 standard output format instead of the default format.
757 Equivalent to @samp{-f posix}.
761 @cindex symbol index, listing
762 When listing symbols from archive members, include the index: a mapping
763 (stored in the archive by @code{ar} or @code{ranlib}) of which modules
764 contain definitions for which names.
767 @itemx --reverse-sort
768 Reverse the order of the sort (whether numeric or alphabetic); let the
772 @itemx --radix=@var{radix}
773 Use @var{radix} as the radix for printing the symbol values. It must be
774 @samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
776 @item --target=@var{bfdname}
777 @cindex object code format
778 Specify an object code format other than your system's default format.
779 @xref{objdump}, for information on listing available formats.
782 @itemx --undefined-only
783 @cindex external symbols
784 @cindex undefined symbols
785 Display only undefined symbols (those external to each object file).
789 Show the version number of @code{nm} and exit.
792 Show a summary of the options to @code{nm} and exit.
795 @node objdump, ranlib, nm, Top
798 @cindex object file information
802 objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
803 [ -h | --header ] [ -i ] [ -j @var{section} ] [ -l ]
804 [ -m @var{machine} ] [ -r | --reloc ] [ -s ] [ --stabs ]
805 [ -t | --syms ] [ -x ] [ --version ] [ --help ]
809 @code{objdump} displays information about one or more object files.
810 The options control what particular information to display. This
811 information is mostly useful to programmers who are working on the
812 compilation tools, as opposed to programmers who just want their
813 program to compile and work.
815 @var{objfile}@dots{} are the object files to be examined. When you
816 specify archives, @code{objdump} shows information on each of the member
819 The long and short forms of options, shown here as alternatives, are
820 equivalent. At least one option besides @samp{-l} must be given.
825 @cindex archive headers
826 If any of the @var{objfile} files are archives, display the archive
827 header information (in a format similar to @samp{ls -l}). Besides the
828 information you could list with @samp{ar tv}, @samp{objdump -a} shows
829 the object file format of each archive member.
831 @c suggest longname --target or --format or --bfd
832 @item -b @var{bfdname}
833 @cindex object code format
834 Specify that the object-code format for the object files is
835 @var{bfdname}. This option may not be necessary; @var{objdump} can
836 automatically recognize many formats.
840 objdump -b oasys -m vax -h fu.o
843 displays summary information from the section headers (@samp{-h}) of
844 @file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object
845 file in the format produced by Oasys compilers. You can list the
846 formats available with the @samp{-i} option.
849 @cindex disassembling object code
850 @cindex machine instructions
851 Disassemble. Display the assembler mnemonics for the machine
852 instructions from @var{objfile}.
855 @cindex object file header
856 File header. Display summary information from the overall header of
857 each of the @var{objfile} files.
861 @cindex section headers
862 Header. Display summary information from the section headers of the
866 Print a summary of the options to @code{objdump} and exit.
869 @cindex architectures available
870 @cindex object formats available
871 Display a list showing all architectures and object formats available
872 for specification with @samp{-b} or @samp{-m}.
874 @c suggest longname --section
876 @cindex section information
877 Display information only for section @var{name}.
879 @c suggest longname --label or --linespec
881 @cindex source filenames for object files
882 Label the display (using debugging information) with the source filename
883 and line numbers corresponding to the object code shown.
885 @c suggest longname --architecture
886 @item -m @var{machine}
888 Specify that the object files @var{objfile} are for architecture
889 @var{machine}. You can list available architectures using the @samp{-i}
894 @cindex relocation entries, in object file
895 Relocation. Print the relocation entries of the file.
898 @cindex sections, full contents
899 @cindex object file sections
900 Display the full contents of any sections requested.
905 @cindex debug symbols
906 @cindex ELF object file format
907 Display the full contents of any sections requested. Display the
908 contents of the .stab and .stab.index and .stab.excl sections from an
909 ELF file. This is only useful on systems (such as Solaris 2.0) in which
910 @code{.stab} debugging symbol-table entries are carried in an ELF
911 section. In most other file formats, debugging symbol-table entries are
912 interleaved with linkage symbols, and are visible in the @samp{--syms}
917 @cindex symbol table entries, printing
918 Symbol Table. Print the symbol table entries of the file.
919 This is similar to the information provided by the @samp{nm} program.
922 Print the version number of @code{objdump} and exit.
925 @cindex all header information, object file
926 @cindex header information, all
927 Display all available header information, including the symbol table and
928 relocation entries. Using @samp{-x} is equivalent to specifying all of
929 @samp{-a -f -h -r -t}.
932 @node ranlib, size, objdump, Top
936 @cindex archive contents
940 ranlib [-vV] @var{archive}
943 @code{ranlib} generates an index to the contents of an archive and
944 stores it in the archive. The index lists each symbol defined by a
945 member of an archive that is a relocatable object file.
947 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
949 An archive with such an index speeds up linking to the library and
950 allows routines in the library to call each other without regard to
951 their placement in the archive.
953 The GNU @code{ranlib} program is another form of GNU @code{ar}; running
954 @code{ranlib} is completely equivalent to executing @samp{ar -s}.
960 Show the version number of @code{ranlib}.
963 @node size, strings, ranlib, Top
967 @cindex section sizes
970 size [ -A | -B | --format=@var{compatibility} ]
971 [ --help ] [ -d | -o | -x | --radix=@var{number} ]
972 [ --target=@var{bfdname} ] [ -V | --version ]
976 The GNU @code{size} utility lists the section sizes---and the total
977 size---for each of the object or archive files @var{objfile} in its
978 argument list. By default, one line of output is generated for each
979 object file or each module in an archive.
981 @var{objfile}@dots{} are the object files to be examined.
983 The command line options have the following meanings:
988 @itemx --format=@var{compatibility}
989 @cindex @code{size} display format
990 Using one of these options, you can choose whether the output from GNU
991 @code{size} resembles output from System V @code{size} (using @samp{-A},
992 or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or
993 @samp{--format=berkeley}). The default is the one-line format similar to
995 @c Bonus for doc-source readers: you can also say --format=strange (or
996 @c anything else that starts with 's') for sysv, and --format=boring (or
997 @c anything else that starts with 'b') for Berkeley.
999 Here is an example of the Berkeley (default) format of output from
1002 size --format Berkeley ranlib size
1003 text data bss dec hex filename
1004 294880 81920 11592 388392 5ed28 ranlib
1005 294880 81920 11888 388688 5ee50 size
1009 This is the same data, but displayed closer to System V conventions:
1012 size --format SysV ranlib size
1030 Show a summary of acceptable arguments and options.
1035 @itemx --radix=@var{number}
1036 @cindex @code{size} number format
1037 @cindex radix for section sizes
1038 Using one of these options, you can control whether the size of each
1039 section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal
1040 (@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or
1041 @samp{--radix=16}). In @samp{--radix=@var{number}}, only the three
1042 values (8, 10, 16) are supported. The total size is always given in two
1043 radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
1044 octal and hexadecimal if you're using @samp{-o}.
1046 @item --target=@var{bfdname}
1047 @cindex object code format
1048 Specify that the object-code format for @var{objfile} is
1049 @var{bfdname}. This option may not be necessary; @code{size} can
1050 automatically recognize many formats. @xref{objdump}, for information
1051 on listing available formats.
1055 Display the version number of @code{size}.
1058 @node strings, strip, size, Top
1061 @cindex listings strings
1062 @cindex printing strings
1063 @cindex strings, printing
1066 strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-]
1067 [--all] [--print-file-name] [--bytes=@var{min-len}]
1068 [--radix=@var{radix}] [--help] [--version] @var{file}@dots{}
1071 For each @var{file} given, GNU @code{strings} prints the printable
1072 character sequences that are at least 4 characters long (or the number
1073 given with the options below) and are followed by a NUL or newline
1074 character. By default, it only prints the strings from the initialized
1075 data sections of object files; for other types of files, it prints the
1076 strings from the whole file.
1078 @code{strings} is mainly useful for determining the contents of non-text
1085 Do not scan only the initialized data section of object files; scan
1089 @itemx --print-file-name
1090 Print the name of the file before each string.
1093 Print a summary of the program usage on the standard output and exit.
1095 @itemx -@var{min-len}
1096 @item -n @var{min-len}
1097 @itemx --bytes=@var{min-len}
1098 Print sequences of characters that are at least @var{min-len} characters
1099 long, instead of the default 4.
1102 Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o}
1103 act like @samp{-t d} instead. Since we can not be compatible with both
1104 ways, we simply chose one.
1106 @item -t @var{radix}
1107 @itemx --radix=@var{radix}
1108 Print the offset within the file before each string. The single
1109 character argument specifies the radix of the offset---@samp{o} for
1110 octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
1114 Print the program version number on the standard output and exit.
1117 @node strip, c++filt, strings, Top
1121 @cindex removing symbols
1122 @cindex discarding symbols
1123 @cindex symbols, discarding
1126 strip [ -F @var{format} | --format=@var{format} | --target=@var{format} ]
1127 [ -I @var{format} | --input-format=@var{format} ]
1128 [ -O @var{format} | --output-format=@var{format} ]
1129 [ -s | --strip-all ] [ -S | -g | --strip-debug ]
1130 [ -x | --discard-all ] [ -X | --discard-locals ]
1131 [ -v | --verbose ] [ -V | --version ] [ --help ]
1132 @var{objfile}@dots{}
1135 GNU @code{strip} discards all symbols from object files
1136 @var{objfile}. The list of object files may include archives.
1137 At least one object file must be given.
1139 @code{strip} modifies the files named in its argument,
1140 rather than writing modified copies under different names.
1143 @item -F @var{format}
1144 @itemx --format=@var{format}
1145 @itemx --target=@var{format}
1146 Treat the original @var{objfile} as a file with the object
1147 code format @var{format}, and rewrite it in the same format.
1150 Show a summary of the options to @code{strip} and exit.
1152 @item -I @var{format}
1153 @itemx --input-format=@var{format}
1154 Treat the original @var{objfile} as a file with the object
1155 code format @var{format}.
1157 @item -O @var{format}
1158 @itemx --output-format=@var{format}
1159 Replace @var{objfile} with a file in the output format @var{format}.
1167 @itemx --strip-debug
1168 Remove debugging symbols only.
1171 @itemx --discard-all
1172 Remove non-global symbols.
1175 @itemx --discard-locals
1176 Remove compiler-generated local symbols.
1177 (These usually start with @samp{L} or @samp{.}.)
1181 Show the version number for @code{strip}.
1185 Verbose output: list all object files modified. In the case of
1186 archives, @samp{strip -v} lists all members of the archive.
1189 @node c++filt, Index, strip, Top
1193 @cindex demangling C++ symbols
1196 c++filt [ -_ | --strip-underscores ]
1197 [ -s @var{format} | --format=@var{format} ]
1198 [ --help ] [ --version ] [ @var{symbol}@dots{} ]
1201 The C++ language provides function overloading, which means that you can
1202 write many functions with the same name (providing each takes parameters
1203 of different types). All C++ function names are encoded into a
1204 low-level assembly label (this process is known as
1205 @dfn{mangling}). The @code{c++filt} program does the inverse mapping: it
1206 decodes (@dfn{demangles}) low-level names into user-level names so that
1207 the linker can keep these overloaded functions from clashing.
1209 Every alphanumeric word (consisting of letters, digits, underscores,
1210 dollars, or periods) seen in the input is a potential label. If the
1211 label decodes into a C++ name, the C++ name replaces the low-level
1214 You can use @code{c++filt} to decipher individual symbols:
1217 c++filt @var{symbol}
1220 If no @var{symbol} arguments are given, @code{c++filt} reads symbol
1221 names from the standard input and writes the demangled names to the
1222 standard output. All results are printed on the standard output.
1226 @item --strip-underscores
1227 On some systems, both the C and C++ compilers put an underscore in front
1228 of every name. For example, the C name @code{foo} gets the low-level
1229 name @code{_foo}. This option removes the initial underscore.
1231 @item -s @var{format}
1232 @itemx --format=@var{format}
1233 GNU @code{nm} can decode three different methods of mangling, used by
1234 different C++ compilers. The argument to this option selects which
1239 the one used by the GNU compiler (the default method)
1241 the one used by the Lucid compiler
1243 the one specified by the C++ Annotated Reference Manual
1247 Print a summary of the options to @code{c++filt} and exit.
1250 Print the version number of @code{c++filt} and exit.
1254 @emph{Warning:} @code{c++filt} is a new utility, and the details of its
1255 user interface are subject to change in future releases. In particular,
1256 a command-line option may be required in the the future to decode a name
1257 passed as an argument on the command line; in other words,
1260 c++filt @var{symbol}
1264 may in a future release become
1267 c++filt @var{option} @var{symbol}
1271 @node Index, , c++filt, Top