1 \input texinfo @c -*- Texinfo -*-
2 @setfilename binutils.info
7 * Binutils: (binutils). The GNU binary utilities "ar", "ld", "copy",
8 "objdump", "nm", "size", "strip", and "ranlib".
14 Copyright @copyright{} 1991 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", "copy", "objdump",
40 @c "nm", "size", "strip", and "ranlib".
42 @c Copyright (C) 1991 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
55 @subtitle Version 2.01
58 @author Roland H. Pesch
59 @author Cygnus Support
63 \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
64 \xdef\manvers{\$Revision$} % For use in headers, footers too
65 {\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par \hfill
66 \TeX{}info \texinfoversion\par }
69 @vskip 0pt plus 1filll
70 Copyright @copyright{} 1991 Free Software Foundation, Inc.
72 Permission is granted to make and distribute verbatim copies of
73 this manual provided the copyright notice and this permission notice
74 are preserved on all copies.
76 Permission is granted to copy and distribute modified versions of this
77 manual under the conditions for verbatim copying, provided also that
78 the entire resulting derived work is distributed under the terms of a
79 permission notice identical to this one.
81 Permission is granted to copy and distribute translations of this manual
82 into another language, under the above conditions for modified versions.
85 @node Top, ar, (dir), (dir)
89 This brief manual contains preliminary documentation for the GNU binary
90 utilities (collectively version 2.1):
95 Create, modify, and extract from archives
98 Copy and translate object files
101 List symbols from object files
104 Display information from object files
107 Generate index to archive contents
110 List section sizes and total size
118 * ar:: Create, modify, and extract from archives
119 * copy:: Copy and translate object files
120 * ld:(ld)Overview. Combine object and archive files
121 * nm:: List symbols from object files
122 * objdump:: Display information from object files
123 * ranlib:: Generate index to archive contents
124 * size:: List section sizes and total size
125 * strip:: Discard symbols
129 @node ar, copy, Top, Top
134 @cindex collections of files
136 ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{file}@dots{}
137 ar -M [ <mri-script ]
140 The GNU @code{ar} program creates, modifies, and extracts from
141 archives. An @dfn{archive} is a single file holding a collection of
142 other files in a structure that makes it possible to retrieve
143 the original individual files (called @dfn{members} of the archive).
145 The original files' contents, mode (permissions), timestamp, owner, and
146 group are preserved in the archive, and can be restored on
150 GNU @code{ar} can maintain archives whose members have names of any
151 length; however, depending on how @code{ar} is configured on your
152 system, a limit on member-name length may be imposed for compatibility
153 with archive formats maintained with other tools. If it exists, the
154 limit is often 15 characters (typical of formats related to a.out) or 16
155 characters (typical of formats related to coff).
158 @code{ar} is considered a binary utility because archives of this sort
159 are most often used as @dfn{libraries} holding commonly needed
163 @code{ar} creates an index to the symbols defined in relocatable
164 object modules in the archive when you specify the modifier @samp{s}.
165 Once created, this index is updated in the archive whenever @code{ar}
166 makes a change to its contents (save for the @samp{q} update operation).
167 An archive with such an index speeds up linking to the library, and
168 allows routines in the library to call each other without regard to
169 their placement in the archive.
171 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
172 table. If an archive lacks the table, another form of @code{ar} called
173 @code{ranlib} can be used to add just the table.
175 @cindex compatibility, @code{ar}
176 @cindex @code{ar} compatibility
177 GNU @code{ar} is designed to be compatible with two different
178 facilities. You can control its activity using command-line options,
179 like the different varieties of @code{ar} on Unix systems; or, if you
180 specify the single command-line option @samp{-M}, you can control it
181 with a script supplied via standard input, like the MRI ``librarian''
185 * ar-cmdline:: Controlling @code{ar} on the command line
186 * ar-scripts:: Controlling @code{ar} with a script
190 @node ar-cmdline, ar-scripts, ar, ar
191 @section Controlling @code{ar} on the command line
194 ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{file}@dots{}
197 @cindex Unix compatibility, @code{ar}
198 When you use @code{ar} in the Unix style, @code{ar} insists on at least two
199 arguments to execute: one keyletter specifying the @emph{operation}
200 (optionally accompanied by other keyletters specifying
201 @emph{modifiers}), and the archive name to act on.
203 Most operations can also accept further @var{file} arguments,
204 specifying particular files to operate on.
206 GNU @code{ar} allows you to mix the operation code @var{p} and modifier
207 flags @var{mod} in any order, within the first command-line argument.
209 If you wish, you may begin the first command-line argument with a
212 @cindex operations on archive
213 The @var{p} keyletter specifies what operation to execute; it may be
214 any of the following, but you must specify only one of them:
218 @cindex deleting from archive
219 @emph{Delete} modules from the archive. Specify the names of modules to
220 be deleted as @var{file}@dots{}; the archive is untouched if you
221 specify no files to delete.
223 If you specify the @samp{v} modifier, @code{ar} lists each module
227 @cindex moving in archive
228 Use this operation to @emph{move} members in an archive.
230 The ordering of members in an archive can make a difference in how
231 programs are linked using the library, if a symbol is defined in more
234 If no modifiers are used with @code{m}, any members you name in the
235 @var{file} arguments are moved to the @emph{end} of the archive;
236 you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
237 specified place instead.
240 @cindex printing from archive
241 @emph{Print} the specified members of the archive, to the standard
242 output file. If the @samp{v} modifier is specified, show the member
243 name before copying its contents to standard output.
245 If you specify no @var{file} arguments, all the files in the archive are
249 @cindex quick append to archive
250 @emph{Quick append}; add the files @var{file}@dots{} to the end of
251 @var{archive}, without checking for replacement.
253 The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
254 operation; new members are always placed at the end of the archive.
256 The modifier @samp{v} makes @code{ar} list each file as it is appended.
258 Since the point of this operation is speed, the archive's symbol table
259 index is not updated, even if it already existed; you can use @samp{ar s} or
260 @code{ranlib} explicitly to update the symbol table index.
263 @cindex replacement in archive
264 Insert the files @var{file}@dots{} into @var{archive} (with
265 @emph{replacement}). This operation differs from @samp{q} in that any
266 previously existing members are deleted if their names match those being
269 If one of the files named in @var{file}@dots{} doesn't exist, @code{ar}
270 displays an error message, and leaves undisturbed any existing members
271 of the archive matching that name.
273 By default, new members are added at the end of the file; but you may
274 use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
275 placement relative to some existing member.
277 The modifier @samp{v} used with this operation elicits a line of
278 output for each file inserted, along with one of the letters @samp{a} or
279 @samp{r} to indicate whether the file was appended (no old member
280 deleted) or replaced.
283 @cindex contents of archive
284 Display a @emph{table} listing the contents of @var{archive}, or those
285 of the files listed in @var{file}@dots{} that are present in the
286 archive. Normally only the member name is shown; if you also want to
287 see the modes (permissions), timestamp, owner, group, and size, you can
288 request that by also specifying the @samp{v} modifier.
290 If you do not specify a @var{file}, all files in the archive
293 @cindex repeated names in archive
294 @cindex name duplication in archive
295 If there is more than one file with the same name (say, @samp{fie}) in
296 an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
297 first instance; to see them all, you must ask for a complete
298 listing---in our example, @samp{ar t b.a}.
299 @c WRS only; per Gumby, this is implementation-dependent, and in a more
300 @c recent case in fact works the other way.
303 @cindex extract from archive
304 @emph{Extract} members (named @var{file}) from the archive. You can
305 use the @samp{v} modifier with this operation, to request that
306 @code{ar} list each name as it extracts it.
308 If you do not specify a @var{file}, all files in the archive
313 A number of modifiers (@var{mod}) may immediately follow the @var{p}
314 keyletter, to specify variations on an operation's behavior:
318 @cindex relative placement in archive
319 Add new files @emph{after} an existing member of the
320 archive. If you use the modifier @samp{a}, the name of an existing archive
321 member must be present as the @var{membername} argument, before the
322 @var{archive} specification.
325 Add new files @emph{before} an existing member of the
326 archive. If you use the modifier @samp{b}, the name of an existing archive
327 member must be present as the @var{membername} argument, before the
328 @var{archive} specification. (same as @samp{i}).
331 @cindex creating archives
332 @emph{Create} the archive. The specified @var{archive} is always
333 created if it didn't exist, when you request an update. But a warning is
334 issued unless you specify in advance that you expect to create it, by
338 Insert new files @emph{before} an existing member of the
339 archive. If you use the modifier @samp{i}, the name of an existing archive
340 member must be present as the @var{membername} argument, before the
341 @var{archive} specification. (same as @samp{b}).
344 This modifier is accepted but not used.
345 @c whaffor ar l modifier??? presumably compat; with
346 @c what???---pesch@@cygnus.com, 25jan91
349 @cindex dates in archive
350 Preserve the @emph{original} dates of members when extracting them. If
351 you do not specify this modifier, files extracted from the archive
352 are stamped with the time of extraction.
355 @cindex writing archive index
356 Write an object-file index into the archive, or update an existing one,
357 even if no other change is made to the archive. You may use this modifier
358 flag either with any operation, or alone. Running @samp{ar s} on an
359 archive is equivalent to running @samp{ranlib} on it.
362 @cindex updating an archive
363 Normally, @samp{ar r}@dots{} inserts all files
364 listed into the archive. If you would like to insert @emph{only} those
365 of the files you list that are newer than existing members of the same
366 names, use this modifier. The @samp{u} modifier is allowed only for the
367 operation @samp{r} (replace). In particular, the combination @samp{qu} is
368 not allowed, since checking the timestamps would lose any speed
369 advantage from the operation @samp{q}.
372 This modifier requests the @emph{verbose} version of an operation. Many
373 operations display additional information, such as filenames processed,
374 when the modifier @samp{v} is appended.
377 This modifier shows the version number of @code{ar}.
380 @node ar-scripts, , ar-cmdline, ar
381 @section Controlling @code{ar} with a script
384 ar -M [ <@var{script} ]
387 @cindex MRI compatibility, @code{ar}
388 @cindex scripts, @code{ar}
389 If you use the single command-line option @samp{-M} with @code{ar}, you
390 can control its operation with a rudimentary command language. This
391 form of @code{ar} operates interactively if standard input is coming
392 directly from a terminal. During interactive use, @code{ar} prompts for
393 input (the prompt is @samp{AR >}), and continues executing even after
394 errors. If you redirect standard input to a script file, no prompts are
395 issued, and @code{ar} abandons execution (with a nonzero exit code)
398 The @code{ar} command language is @emph{not} designed to be equivalent
399 to the command-line options; in fact, it provides somewhat less control
400 over archives. The only purpose of the command language is to ease the
401 transition to GNU @code{ar} for developers who already have scripts
402 written for the MRI ``librarian'' program.
404 The syntax for the @code{ar} command language is straightforward:
407 commands are recognized in upper or lower case; for example, @code{LIST}
408 is the same as @code{list}. In the following descriptions, commands are
409 shown in upper case for clarity.
412 a single command may appear on each line; it is the first word on the
416 empty lines are allowed, and have no effect.
419 comments are allowed; text after either of the characters @samp{*}
420 or @samp{;} is ignored.
423 Whenever you use a list of names as part of the argument to an @code{ar}
424 command, you can separate the individual names with either commas or
425 blanks. Commas are shown in the explanations below, for clarity.
428 @samp{+} is used as a line continuation character; if @samp{+} appears
429 at the end of a line, the text on the following line is considered part
430 of the current command.
433 Here are the commands you can use in @code{ar} scripts, or when using
434 @code{ar} interactively. Three of them have special significance:
436 @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
437 a temporary file required for most of the other commands.
439 @code{SAVE} commits the changes so far specified by the script. Prior
440 to @code{SAVE}, commands affect only the temporary copy of the current
444 @item ADDLIB @var{archive}
445 @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
446 Add all the contents of @var{archive} (or, if specified, each named
447 @var{module} from @var{archive}) to the current archive.
449 Requires prior use of @code{OPEN} or @code{CREATE}.
451 @item ADDMOD @var{file}, @var{file}, @dots{} @var{file}
452 @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
453 @c else like "ar q..."
454 Add each named @var{file} as a module in the current archive.
456 Requires prior use of @code{OPEN} or @code{CREATE}.
459 Discard the contents of the current archive, cancelling the effect of
460 any operations since the last @code{SAVE}. May be executed (with no
461 effect) even if no current archive is specified.
463 @item CREATE @var{archive}
464 Creates an archive, and makes it the current archive (required for many
465 other commands). The new archive is created with a temporary name; it
466 is not actually saved as @var{archive} until you use @code{SAVE}.
467 You can overwrite existing archives; similarly, the contents of any
468 existing file named @var{archive} will not be destroyed until @code{SAVE}.
470 @item DELETE @var{module}, @var{module}, @dots{} @var{module}
471 Delete each listed @var{module} from the current archive; equivalent to
472 @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
474 Requires prior use of @code{OPEN} or @code{CREATE}.
476 @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
477 @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
478 List each named @var{module} present in @var{archive}. The separate
479 command @code{VERBOSE} specifies the form of the output: when verbose
480 output is off, output is like that of @samp{ar -t @var{archive}
481 @var{module}@dots{}}. When verbose output is on, the listing is like
482 @samp{ar -tv @var{archive} @var{module}@dots{}}.
484 Output normally goes to the standard output stream; however, if you
485 specify @var{outputfile} as a final argument, @code{ar} directs the
489 Exit from @code{ar}, with a @code{0} exit code to indicate successful
490 completion. This command does not save the output file; if you have
491 changed the current archive since the last @code{SAVE} command, those
494 @item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
495 Extract each named @var{module} from the current archive, writing them
496 into the current directory as separate files. Equivalent to @samp{ar -x
497 @var{archive} @var{module}@dots{}}.
499 Requires prior use of @code{OPEN} or @code{CREATE}.
502 @c FIXME Tokens but no commands???
509 Display full contents of the current archive, in ``verbose'' style
510 regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
511 tv @var{archive}}). (This single command is a GNU @code{ld}
512 enhancement, rather than present for MRI compatibility.)
514 Requires prior use of @code{OPEN} or @code{CREATE}.
516 @item OPEN @var{archive}
517 Opens an existing archive for use as the current archive (required for
518 many other commands). Any changes as the result of subsequent commands
519 will not actually affect @var{archive} until you next use @code{SAVE}.
521 @item REPLACE @var{module}, @var{module}, @dots{} @var{module}
522 In the current archive, replace each existing @var{module} (named in
523 the @code{REPLACE} arguments) from files in the current working directory.
524 To execute this command without errors, both the file, and the module in
525 the current archive, must exist.
527 Requires prior use of @code{OPEN} or @code{CREATE}.
530 Toggle an internal flag governing the output from @code{DIRECTORY}.
531 When the flag is on, @code{DIRECTORY} output matches output from
532 @samp{ar -tv }@dots{}.
535 Commit your changes to the current archive, and actually save it as a
536 file with the name specified in the last @code{CREATE} or @code{OPEN}
539 Requires prior use of @code{OPEN} or @code{CREATE}.
543 @node copy, nm, ar, Top
547 copy [ -F @var{format} | --format=@var{format} ]
548 [ -I @var{format} | --input-format=@var{format} ]
549 [ -O @var{format} | --output-format=@var{format} ]
550 [ -S | --strip-all ] [ -g | --strip-debug ]
551 [ -x | --discard-all ] [ -X | --discard-locals ]
552 [ -v | --verbose ] [ -V | --version ]
553 @var{infile} [@var{outfile}]
556 The GNU @code{copy} utility copies the contents of an object file to
557 another. @code{copy} uses the GNU BFD Library to read and write the
558 object files. It can write the destination object file in a format
559 different from that of the source object file. The exact behavior of
560 @code{copy} is controlled by command-line options.
562 @code{copy} creates temporary files to do its translations and
563 deletes them afterward. @code{copy} uses BFD to do all its
564 translation work; it knows about all the formats BFD knows about, and
565 thus is able to recognize most formats without being told explicitly.
566 @xref{BFD,,BFD,ld.info,Using LD, the GNU linker}.
571 The source and output files respectively.
572 If you do not specify @var{outfile}, @code{copy} creates a
573 temporary file and destructively renames the result with
574 the name of the input file.
576 @item -I @var{format}
577 @itemx --input-format=@var{format}
578 Consider the source file's object format to be @var{format}, rather than
579 attempting to deduce it.
581 @item -O @var{format}
582 @itemx --output-format=@var{format}
583 Write the output file using the object format @var{format}.
585 @item -F @var{format}
586 @itemx --format=@var{format}
587 Use @var{format} as the object format for both the input and the output
588 file; i.e. simply transfer data from source to destination with no
593 Do not copy relocation and symbol information from the source file.
597 Do not copy debugging symbols from the source file.
601 Do not copy non-global symbols from the source file.
602 @c FIXME any reason to prefer "non-global" to "local" here?
605 @itemx --discard-locals
606 Do not copy compiler-generated local symbols.
607 (These usually start with @samp{L} or @samp{.}.)
611 Show the version number of @code{copy}.
615 Verbose output: list all object files modified. In the case of
616 archives, @samp{copy -V} lists all members of the archive.
624 The GNU linker @code{ld} is now described in a separate manual.
625 @xref{Top,, Overview,, Using LD: the GNU linker}.
628 @node nm, objdump, copy, Top
634 nm [ -a | --debug-syms ] [ -g | --extern-only ]
635 [ -s | --print-armap ] [ -o | --print-file-name ]
636 [ -n | --numeric-sort ] [ -p | --no-sort ]
637 [ -r | --reverse-sort ] [ -u | --undefined-only ]
638 [ --target=@var{bfdname} ]
639 [ @var{objfile}@dots{} ]
642 GNU @code{nm} lists the symbols from object files @var{objfile}@dots{}.
644 The long and short forms of options, shown here as alternatives, are
648 @item @var{objfile}@dots{}
650 Object files whose symbols are to be listed. If no object files are
651 listed as arguments, @code{nm} assumes @samp{a.out}.
655 @cindex debugging symbols
656 Display debugger-only symbols; normally these are not listed.
660 @cindex external symbols
661 Display only external symbols.
665 @cindex sorting symbols
666 Don't bother to sort the symbols in any order; just print them in the
670 @itemx --numeric-sort
671 Sort symbols numerically by their addresses, rather than alphabetically
676 @cindex symbol index, listing
677 When listing symbols from archive members, include the index: a mapping
678 (stored in the archive by @code{ar} or @code{ranlib}) of which modules
679 contain definitions for which names.
682 @itemx --print-file-name
683 @cindex input file name
685 @cindex source file name
686 Precede each symbol by the name of the input file where it was found,
687 rather than identifying the input file once only before all of its
691 @itemx --reverse-sort
692 Reverse the order of the sort (whether numeric or alphabetic); let the
695 @item --target=@var{bfdname}
697 @cindex object code format
698 Specify an object code format other than your system's default format.
699 @xref{objdump}, for information on listing available formats.
700 @c FIXME what *does* --target/no arg do?
703 @itemx --undefined-only
704 @cindex external symbols
705 @cindex undefined symbols
706 Display only undefined symbols (those external to each object file).
710 @node objdump, ranlib, nm, Top
713 @cindex object file information
717 objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
718 [ -h | --header ] [ -i ] [ -j @var{section} ] [ -l ]
719 [ -m @var{machine} ] [ -r | --reloc ] [ -s ]
720 [ --stabs ] [ -t | --syms ] [ -x ]
724 @code{objdump} displays information about one or more object files.
725 The options control what particular information to display. This
726 information is mostly useful to programmers who are working on the
727 compilation tools, as opposed to programmers who just want their
728 program to compile and work.
730 The long and short forms of options, shown here as alternatives, are
734 @item @var{objfile}@dots{}
735 The object files to be examined. When you specify archives,
736 @code{objdump} shows information on each of the member object files.
740 @cindex archive headers
741 If any of the @var{objfile} files are archives, display the archive
742 header information (in a format similar to @samp{ls -l}). Besides the
743 information you could list with @samp{ar tv}, @samp{objdump -a} shows
744 the object file format of each archive member.
746 @c suggest longname --target or --format or --bfd
747 @item -b @var{bfdname}
748 @cindex object code format
749 Specify that the object-code format for the object files is
750 @var{bfdname}. This option may not be necessary; @var{objdump} can
751 automatically recognize many formats.
755 objdump -b oasys -m vax -h fu.o
758 displays summary information from the section headers (@samp{-h}) of
759 @file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object
760 file in the format produced by Oasys compilers. You can list the
761 formats available with the @samp{-i} option.
764 @cindex disassembling object code
765 @cindex machine instructions
766 Disassemble. Display the assembler mnemonics for the machine
767 instructions from @var{objfile}.
770 @cindex object file header
771 File header. Display summary information from the overall header of
772 each of the @var{objfile} files.
776 @cindex section headers
777 Header. Display summary information from the section headers of the
781 @cindex architectures available
782 @cindex object formats available
783 Display a list showing all architectures and object formats available
784 for specification with @samp{-b} or @samp{-m}.
786 @c suggest longname --section
788 @cindex section information
789 Display information only for section @var{name}.
791 @c suggest longname --label or --linespec
793 @cindex source filenames for object files
794 Label the display (using debugging information) with the source filename
795 and line numbers corresponding to the object code shown.
797 @c suggest longname --architecture
798 @item -m @var{machine}
800 Specify that the object files @var{objfile} are for architecture
801 @var{machine}. You can list available architectures using the @samp{-i}
806 @cindex relocation entries, in object file
807 Relocation. Print the relocation entries of the file.
810 @cindex sections, full contents
811 @cindex object file sections
812 Display the full contents of any sections requested.
817 @cindex debug symbols
818 @cindex ELF object file format
819 Display the full contents of any sections requested. Display the
820 contents of the .stab and .stab.index and .stab.excl sections from an
821 ELF file. This is only useful on systems (such as Solaris 2.0) in which
822 @code{.stab} debugging symbol-table entries are carried in an ELF
823 section. In most other file formats, debugging symbol-table entries are
824 interleaved with linkage symbols, and are visible in the @samp{--syms}
829 @cindex symbol table entries, printing
830 Symbol Table. Print the symbol table entries of the file.
831 This is similar to the information provided by the @samp{nm} program.
834 @cindex all header information, object file
835 @cindex header information, all
836 Display all available header information, including the symbol table and
837 relocation entries. Using @samp{-x} is equivalent to specifying all of
838 @samp{-a -f -h -r -t}.
842 @node ranlib, size, objdump, Top
846 @cindex archive contents
850 ranlib [-vV] @var{archive}
853 @code{ranlib} generates an index to the contents of an archive and
854 stores it in the archive. The index lists each symbol defined by a
855 member of an archive that is a relocatable object file.
857 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
859 An archive with such an index speeds up linking to the library and
860 allows routines in the library to call each other without regard to
861 their placement in the archive.
863 The GNU @code{ranlib} program is another form of GNU @code{ar}; running
864 @code{ranlib} is completely equivalent to executing @samp{ar -s}.
870 Show the version number of @code{ranlib}.
873 @node size, strip, ranlib, Top
877 @cindex section sizes
880 size [ -A | -B | --format=@var{compatibility} ]
881 [ --help ] [ -d | -o | -x | --radix=@var{number} ]
882 [ --target=@var{bfdname} ] [ -V | --version ]
886 The GNU @code{size} utility lists the section sizes---and the total
887 size---for each of the object or archive files @var{objfile} in its
888 argument list. By default, one line of output is generated for each
889 object file or each module in an archive.
891 The command line options have the following meanings:
893 @item @var{objfile}@dots{}
894 The object files to be examined.
898 @itemx --format=@var{compatibility}
899 @cindex size display format
900 Using one of these options, you can choose whether the output from GNU
901 @code{size} resembles output from System V @code{size} (using @samp{-A},
902 or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or
903 @samp{--format=berkeley}). The default is the one-line format similar to
905 @c Bonus for doc-source readers: you can also say --format=strange (or
906 @c anything else that starts with 's') for sysv, and --format=boring (or
907 @c anything else that starts with 'b') for Berkeley.
909 Here is an example of the Berkeley (default) format of output from
912 size --format Berkeley ranlib size
913 text data bss dec hex filename
914 294880 81920 11592 388392 5ed28 ranlib
915 294880 81920 11888 388688 5ee50 size
919 This is the same data, but displayed closer to System V conventions:
922 size --format SysV ranlib size
940 Show a summary of acceptable arguments and options.
945 @itemx --radix=@var{number}
946 @cindex size number format
947 @cindex radix for section sizes
948 Using one of these options, you can control whether the size of each
949 section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal
950 (@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or
951 @samp{--radix=16}). In @samp{--radix=@var{number}}, only the three
952 values (8, 10, 16) are supported. The total size is always given in two
953 radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
954 octal and hexadecimal if you're using @samp{-o}.
956 @item --target=@var{bfdname}
957 @cindex object code format
958 Specify that the object-code format for @var{objfile} is
959 @var{bfdname}. This option may not be necessary; @code{size} can
960 automatically recognize many formats. @xref{objdump}, for information
961 on listing available formats.
965 Display the version number of @code{size}.
968 @node strip, Index, size, Top
972 @cindex removing symbols
973 @cindex discarding symbols
974 @cindex symbols, discarding
977 strip [ -F @var{format} | --format=@var{format} | --target=@var{format} ]
978 [ -I @var{format} | --input-format=@var{format} ]
979 [ -O @var{format} | --output-format=@var{format} ]
980 [ -s | --strip-all ] [ -S | -g | --strip-debug ]
981 [ -x | --discard-all ] [ -X | --discard-locals ]
982 [ -v | --verbose ] [ -V | --version ]
986 GNU @code{strip} discards all symbols from object files
987 @var{objfile}. The list of object files may include archives.
989 @code{strip} will not execute unless at least one object file is listed.
991 @code{strip} modifies the files named in its argument,
992 rather than writing modified copies under different names.
995 @item -I @var{format}
996 @itemx --input-format=@var{format}
997 Treat the original @var{objfile} as a file with the object
998 code format @var{format}.
1000 @item -O @var{format}
1001 @itemx --output-format=@var{format}
1002 Replace @var{objfile} with a file in the output format @var{format}.
1004 @item -F @var{format}
1005 @itemx --format=@var{format}
1006 @itemx --target=@var{format}
1007 Treat the original @var{objfile} as a file with the object
1008 code format @var{format}, and rewrite it in the same format.
1016 @itemx --strip-debug
1017 Remove debugging symbols only.
1020 @itemx --discard-all
1021 Remove non-global symbols.
1024 @itemx --discard-locals
1025 Remove compiler-generated local symbols.
1026 (These usually start with @samp{L} or @samp{.}.)
1030 Show the version number for @code{strip}.
1034 Verbose output: list all object files modified. In the case of
1035 archives, @samp{strip -V} lists all members of the archive.
1038 @node Index, , strip, Top