Thu May 7 17:01:12 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
[deliverable/binutils-gdb.git] / binutils / binutils.texi
CommitLineData
765a273f 1\input texinfo @c -*- Texinfo -*-
c72af735
RP
2@setfilename binutils.info
3
9abcc3b8
RP
4@ifinfo
5@format
6START-INFO-DIR-ENTRY
7
c72af735
RP
8* Binutils: (binutils).
9 The GNU binary utilities "ar", "ld", "objdump", "nm",
10 "size", "strip", and "ranlib".
9abcc3b8
RP
11
12END-INFO-DIR-ENTRY
13@end format
14@end ifinfo
c72af735
RP
15
16@synindex ky cp
17@c
18@c This file documents the GNU binary utilities "ar", "ld", "objdump", "nm",
19@c "size", "strip", and "ranlib".
20@c
21@c Copyright (C) 1991 Free Software Foundation, Inc.
22@c
23@c This text may be freely distributed under the terms of the GNU
24@c General Public License.
25@c
26@c $Id$
27@iftex
28@finalout
29@c @smallbook
30@end iftex
31@c @cropmarks
32@setchapternewpage odd
33@settitle GNU Binary Utilities
34@titlepage
35@title The GNU Binary Utilities
36@subtitle Version 1.90
37@sp 1
38@subtitle October 1991
39@author Roland H. Pesch
40@author Cygnus Support
41@page
42
43@tex
44\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
45\xdef\manvers{\$Revision$} % For use in headers, footers too
46{\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par \hfill
47\TeX{}info \texinfoversion\par }
48@end tex
49
50@vskip 0pt plus 1filll
51Copyright @copyright{} 1991 Free Software Foundation, Inc.
52
53Permission is granted to make and distribute verbatim copies of
54this manual provided the copyright notice and this permission notice
55are preserved on all copies.
56
57Permission is granted to copy and distribute modified versions of this
58manual under the conditions for verbatim copying, provided also that
59the entire resulting derived work is distributed under the terms of a
60permission notice identical to this one.
61
62Permission is granted to copy and distribute translations of this manual
63into another language, under the above conditions for modified versions.
64@end titlepage
65
66@node Top, ar, (dir), (dir)
67@chapter Introduction
68
69@cindex version
70This brief manual contains preliminary documentation for the GNU binary
71utilities (collectively version 1.90):
72@table @code
73@item ar
74Create, modify, and extract from archives
75
76@item nm
77List symbols from object files
78
79@item objdump
80Display information from object files
81
82@item ranlib
83Generate index to archive contents
84
85@item size
86List section sizes and total size
87
88@item strip
89Discard symbols
90@end table
91
92@ifinfo
93Copyright @copyright{} 1991 Free Software Foundation, Inc.
94
95Permission is granted to make and distribute verbatim copies of
96this manual provided the copyright notice and this permission notice
97are preserved on all copies.
98
99@ignore
100Permission is granted to process this file through TeX and print the
101results, provided the printed document carries a copying permission
102notice identical to this one except for the removal of this paragraph
103(this paragraph not being relevant to the printed manual).
104
105@end ignore
106
107Permission is granted to copy and distribute modified versions of this
108manual under the conditions for verbatim copying, provided also that
109the entire resulting derived work is distributed under the terms of a
110permission notice identical to this one.
111
112Permission is granted to copy and distribute translations of this manual
113into another language, under the above conditions for modified versions.
114@end ifinfo
115
116@menu
765a273f
RP
117* ar:: ar
118* ld:: ld
119* nm:: nm
120* objdump:: objdump
121* ranlib:: ranlib
122* size:: size
123* strip:: strip
124* Index:: Index
125
126 --- The Detailed Node Listing ---
127
128ar
129
130* ar-cmdline:: Controlling @code{ar} on the command line
131* ar-scripts:: Controlling @code{ar} with a script
c72af735
RP
132@end menu
133
134@node ar, ld, Top, Top
135@chapter ar
136
137@kindex ar
138@cindex archives
139@cindex collections of files
140@smallexample
141 ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{files}@dots{}
765a273f 142 ar -M [ <mri-script ]
c72af735
RP
143@end smallexample
144
145The GNU @code{ar} program creates, modifies, and extracts from
146archives. An @dfn{archive} is a single file holding a collection of
147other files in a structure that makes it possible to retrieve
148the original individual files (called @dfn{members} of the archive).
149
150The original files' contents, mode (permissions), timestamp, owner, and
151group are preserved in the archive, and may be reconstituted on
152extraction.
153
154@cindex name length
155GNU @code{ar} can maintain archives whose members have names of any
156length; however, depending on how @code{ar} is configured on your
157system, a limit on member-name length may be imposed (for compatibility
158with archive formats maintained with other tools). If it exists, the
159limit is often 15 characters (typical of formats related to a.out) or 16
160characters (typical of formats related to coff).
161
162@cindex libraries
163@code{ar} is considered a binary utility because archives of this sort
164are most often used as @dfn{libraries} holding commonly needed
165subroutines.
166
167@cindex symbol index
168@code{ar} will create an index to the symbols defined in relocatable
169object modules in the archive when you specify the modifier @samp{s}.
170Once created, this index is updated in the archive whenever @code{ar}
171makes a change to its contents (save for the @samp{q} update operation).
172An archive with such an index speeds up linking to the library, and
173allows routines in the library to call each other without regard to
174their placement in the archive.
175
176You may use @samp{nm -s} or @samp{nm +print-armap} to list this index
177table. If an archive lacks the table, another form of @code{ar} called
178@code{ranlib} can be used to add just the table.
179
765a273f
RP
180@cindex compatibility, @code{ar}
181@cindex @code{ar} compatibility
182GNU @code{ar} is designed to be compatible with two different
183facilities. You can control its activity using command-line options,
184like the different varieties of @code{ar} on Unix systems; or, if you
185specify the single command-line option @samp{-M}, you can control it
186with a script supplied via standard input, like the MRI ``librarian''
187program.
188
189@menu
190* ar-cmdline:: Controlling @code{ar} on the command line
191* ar-scripts:: Controlling @code{ar} with a script
192@end menu
193
194@page
195@node ar-cmdline, ar-scripts, ar, ar
196@section Controlling @code{ar} on the command line
197
198@smallexample
199 ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{files}@dots{}
200@end smallexample
201
202@cindex Unix compatibility, @code{ar}
203When you use @code{ar} in the Unix style, @code{ar} insists on at least two
204arguments to execute: one keyletter specifying the @emph{operation}
205(optionally accompanied by other keyletters specifying
206@emph{modifiers}), and the archive name to act on.
c72af735
RP
207
208Most operations can also accept further @var{files} arguments,
209specifying particular files to operate on.
210
211GNU @code{ar} allows you to mix the operation code @var{p} and modifier
212flags @var{mod} in any order, within the first command-line argument.
213
214If you wish, you may begin the first command-line argument with a
215dash.
216
217@cindex operations on archive
218The @var{p} keyletter specifies what operation to execute; it may be
219any of the following, but you must specify only one of them:
220
221@table @code
222@item d
223@cindex deleting from archive
224@emph{Delete} modules from the archive. Specify the names of modules to
225be deleted as @var{files}; the archive is untouched if you
226specify no files to delete.
227
228If you specify the @samp{v} modifier, @code{ar} will list each module
229as it is deleted.
230
231@item m
232@cindex moving in archive
233Use this operation to @emph{move} members in an archive.
234
235The ordering of members in an archive can make a difference in how
236programs are linked using the library, if a symbol is defined in more
237than one member.
238
239If no modifiers are used with @code{m}, any members you name in the
240@var{files} arguments are moved to the @emph{end} of the archive;
241you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
242specified place instead.
243
244@item p
245@cindex printing from archive
246@emph{Print} the specified members of the archive, to the standard
247output file. If the @samp{v} modifier is specified, show the member
248name before copying its contents to standard output.
249
250If you specify no @var{files}, all the files in the archive are printed.
251
252@item q
253@cindex quick append to archive
254@emph{Quick append}; add @var{files} to the end of @var{archive},
255without checking for replacement.
256
257The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
258operation; new members are always placed at the end of the archive.
259
260The modifier @samp{v} makes @code{ar} list each file as it is appended.
261
262Since the point of this operation is speed, the archive's symbol table
263index is not updated, even if it already existed; you can use @samp{ar s} or
264@code{ranlib} explicitly to update the symbol table index.
265
266@item r
267@cindex replacement in archive
268Insert @var{files} into @var{archive} (with @emph{replacement}). This
269operation differs from @samp{q} in that any previously existing members
270are deleted if their names match those being added.
271
272If one of the files named in @var{files} doesn't exist, @code{ar}
273displays an error message, and leaves undisturbed any existing members
274of the archive matching that name.
275
276By default, new members are added at the end of the file; but you may
277use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
278placement relative to some existing member.
279
280The modifier @samp{v} used with this operation elicits a line of
281output 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
283deleted) or replaced.
284
285@item t
286@cindex contents of archive
287Display a @emph{table} listing the contents of @var{archive}, or those
288of the files listed in @var{files} that are present in the
289archive. Normally only the member name is shown; if you also want to
290see the modes (permissions), timestamp, owner, group, and size, you can
291request that by also specifying the @samp{v} modifier.
292
293If you do not specify any @var{files}, all files in the archive
294are listed.
295
296@cindex repeated names in archive
297@cindex name duplication in archive
298If there is more than one file with the same name (say, @samp{fie}) in
299an archive (say @samp{b.a}), @samp{ar t b.a fie} will list only the
300first instance; to see them all, you must ask for a complete
301listing---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.
304
305@item x
306@cindex extract from archive
307@emph{Extract} members (named @var{files}) from the archive. You can
308use the @samp{v} modifier with this operation, to request that
309@code{ar} list each name as it extracts it.
310
311If you do not specify any @var{files}, all files in the archive
312are extracted.
313
314@end table
315
316A number of modifiers (@var{mod}) may immediately follow the @var{p}
317keyletter, to specify variations on an operation's behavior:
318
319@table @code
320@item a
321@cindex relative placement in archive
322Add new files @emph{after} an existing member of the
323archive. If you use the modifier @code{a}, the name of an existing archive
324member must be present as the @var{membername} argument, before the
325@var{archive} specification.
326
327@item b
328Add new files @emph{before} an existing member of the
329archive. If you use the modifier @code{b}, the name of an existing archive
330member must be present as the @var{membername} argument, before the
331@var{archive} specification. (same as @samp{i}).
332
333@item c
334@cindex creating archives
335@emph{Create} the archive. The specified @var{archive} is always
336created if it didn't exist, when you request an update. But a warning is
337issued unless you specify in advance that you expect to create it, by
338using this modifier.
339
340@item i
341Insert new files @emph{before} an existing member of the
342archive. If you use the modifier @code{i}, the name of an existing archive
343member must be present as the @var{membername} argument, before the
344@var{archive} specification. (same as @samp{b}).
345
346@item l
347This modifier is accepted but not used.
348@c whaffor ar l modifier??? presumably compat; with
349@c what???---pesch@@cygnus.com, 25jan91
350
351@item o
352@cindex dates in archive
353Preserve the @emph{original} dates of members when extracting them. If
354you do not specify this modifier, files extracted from the archive
355will be stamped with the time of extraction.
356
357@item s
358@cindex writing archive index
359Write an object-file index into the archive, or update an existing one,
360even if no other change is made to the archive. You may use this modifier
361flag either with any operation, or alone. Running @samp{ar s} on an
362archive is equivalent to running @samp{ranlib} on it.
363
364@item u
365@cindex updating an archive
366Normally, @code{ar r}@dots{} inserts all files
367listed into the archive. If you would like to insert @emph{only} those
368of the files you list that are newer than existing members of the same
369names, use this modifier. The @samp{u} modifier is allowed only for the
370operation @samp{r} (replace). In particular, the combination @samp{qu} is
371not allowed, since checking the timestamps would lose any speed
372advantage from the operation @samp{q}.
373
374@item v
375This modifier requests the @emph{verbose} version of an operation. Many
376operations display additional information, such as filenames processed,
377when the modifier @samp{v} is appended.
765a273f
RP
378@end table
379
380@node ar-scripts, , ar-cmdline, ar
381@section Controlling @code{ar} with a script
382
383@smallexample
384ar -M [ <@var{script} ]
385@end smallexample
386
387@cindex MRI compatibility, @code{ar}
388@cindex scripts, @code{ar}
389If you use the single command-line option @samp{-M} with @code{ar}, you
390can control its operation with a rudimentary command language. This
391form of @code{ar} will operate interactively if standard input is coming
392directly from a terminal. During interactive use, @code{ar} prompts for
393input (the prompt is @samp{AR >}), and continues executing even after
394errors. If you redirect standard input to a script file, no prompts are
395issued, and @code{ar} will abandon execution (with a nonzero exit code)
396on any error.
397
398The @code{ar} command language is @emph{not} designed to be equivalent
399to the command-line options; in fact, it provides somewhat less control
400over archives. The only purpose of the command language is to ease the
401transition to GNU @code{ar} for developers who already have scripts
402written for the MRI ``librarian'' program.
403
404The syntax for the @code{ar} command language is straightforward:
405@itemize @bullet
406@item
407commands are recognized in upper or lower case; for example, @code{LIST}
408is the same as @code{list}. In the following descriptions, commands are
409shown in upper case for clarity.
410
411@item
412a single command may appear on each line; it is the first word on the
413line.
414
415@item
416empty lines are allowed, and have no effect.
417
418@item
419comments are allowed; text after either of the characters @samp{*}
420or @samp{;} is ignored.
421
422@item
423Whenever you use a list of names as part of the argument to an @code{ar}
424command, you can separate the individual names with either commas or
425blanks. Commas are shown in the explanations below, for clarity.
426
427@item
428@samp{+} is used as a line continuation character; if @samp{+} appears
429at the end of a line, the text on the following line is considered part
430of the current command.
431@end itemize
432
433Here are the commands you can use in @code{ar} scripts, or when using
434@code{ar} interactively. Three of them have special significance:
435
436@code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
437a temporary file required for most of the other commands.
438
439@code{SAVE} commits the changes so far specified by the script. Prior
440to @code{SAVE}, commands affect only the temporary copy of the current
441archive.
442
443@table @code
444@item ADDLIB @var{archive}
445@itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
446Add all the contents of @var{archive} (or, if specified, each named
447@var{module} from @var{archive}) to the current archive.
448
449Requires prior use of @code{OPEN} or @code{CREATE}.
450
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..."
454Add each named @var{file} as a module in the current archive.
455
456Requires prior use of @code{OPEN} or @code{CREATE}.
457
458@item CLEAR
459Discard the contents of the current archive, cancelling the effect of
460any operations since the last @code{SAVE}. May be executed (with no
461effect) even if no current archive is specified.
462
463@item CREATE @var{archive}
464Creates an archive, and makes it the current archive (required for many
465other commands). The new archive is created with a temporary name; it
466is not actually saved as @var{archive} until you use @code{SAVE}.
467You can overwrite existing archives; similarly, the contents of any
468existing file named @var{archive} will not be destroyed until @code{SAVE}.
469
470@item DELETE @var{module}, @var{module}, @dots{} @var{module}
471Delete each listed @var{module} from the current archive; equivalent to
472@samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
473
474Requires prior use of @code{OPEN} or @code{CREATE}.
475
476@item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
477@itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
478List each named @var{module} present in @var{archive}. The separate
479command @code{VERBOSE} specifies the form of the output: when verbose
480output 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{}}.
483
484Output normally goes to the standard output stream; however, if you
485specify @var{outputfile} as a final argument, @code{ar} directs the
486output to that file.
487
488@item END
489Exit from @code{ar}, with a @code{0} exit code to indicate successful
490completion. This command does not save the output file; if you have
491changed the current archive since the last @code{SAVE} command, those
492changes are lost.
493
494@item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
495Extract each named @var{module} from the current archive, writing them
496into the current directory as separate files. Equivalent to @samp{ar -x
497@var{archive} @var{module}@dots{}}.
498
499Requires prior use of @code{OPEN} or @code{CREATE}.
500
501@ignore
502@c FIXME Tokens but no commands???
503@item FULLDIR
504
505@item HELP
506@end ignore
507
508@item LIST
509Display full contents of the current archive, in ``verbose'' style
510regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
511tv @var{archive}}). (This single command is a GNU @code{ld}
512enhancement, rather than present for MRI compatibility.)
513
514Requires prior use of @code{OPEN} or @code{CREATE}.
515
516@item OPEN @var{archive}
517Opens an existing archive for use as the current archive (required for
518many other commands). Any changes as the result of subsequent commands
519will not actually affect @var{archive} until you next use @code{SAVE}.
520
521@item REPLACE @var{module}, @var{module}, @dots{} @var{module}
522In the current archive, replace each existing @var{module} (named in
523the @code{REPLACE} arguments) from files in the current working directory.
524To execute this command without errors, both the file, and the module in
525the current archive, must exist.
526
527Requires prior use of @code{OPEN} or @code{CREATE}.
528
529@item VERBOSE
530Toggle an internal flag governing the output from @code{DIRECTORY}.
531When the flag is on, @code{DIRECTORY} output matches output from
532@samp{ar -tv @dots{}}.
533
534@item SAVE
535Commit your changes to the current archive, and actually save it as a
536file with the name specified in the last @code{CREATE} or @code{OPEN}
537command.
538
539Requires prior use of @code{OPEN} or @code{CREATE}.
c72af735
RP
540
541@end table
542
765a273f 543
c72af735
RP
544@node ld, nm, ar, Top
545@chapter ld
546@cindex linker
547@kindex ld
548The GNU linker @code{ld} is now described in a separate manual.
549@xref{Top,, Overview,, GLD: the GNU linker}.
550
551@node nm, objdump, ld, Top
552@chapter nm
553@cindex symbols
554@kindex nm
555
556@smallexample
557 nm [ -a | +debug-syms ] [ -g | +extern-only ]
558 [ -s | +print-armap ] [ -o | +print-file-name ]
559 [ -n | +numeric-sort ] [ -p | +no-sort ]
560 [ -r | +reverse-sort ] [ -u | +undefined-only ]
561 [ +target @var{bfdname} ]
562 [ @var{objfiles}@dots{} ]
563@end smallexample
564
565GNU @code{nm} will list the symbols from object files @var{objfiles}.
566
567The long and short forms of options, shown here as alternatives, are
568equivalent.
569
570@table @code
571@item @var{objfiles}@dots{}
572@kindex a.out
573Object files whose symbols are to be listed. If no object files are
574listed as arguments, @code{nm} assumes @samp{a.out}.
575
576@item -a
577@itemx +debug-syms
578@cindex debugging symbols
579Display debugger-only symbols; normally these are not listed.
580
581@item -g
582@itemx +extern-only
583@cindex external symbols
584Display only external symbols.
585
586@item -p
587@itemx +no-sort
588@cindex sorting symbols
589Don't bother to sort the symbols in any order; just print them in the
590order encountered.
591
592@item -n
593@itemx +numeric-sort
594Sort symbols numerically by their addresses, not alphabetically by their
595names.
596
597@item -s
598@itemx +print-armap
599@cindex symbol index, listing
600When listing symbols from archive members, include the index: a mapping
601(stored in the archive by @code{ar} or @code{ranlib}) of what modules
602contain definitions for what names.
603
604@item -o
605@itemx +print-file-name
606@cindex input file name
607@cindex file name
608@cindex source file name
609Precede each symbol by the name of the input file where it was found,
610rather than identifying the input file once only before all of its
611symbols.
612
613@item -r
614@itemx +reverse-sort
615Reverse the sense of the sort (whether numeric or alphabetic); let the
616last come first.
617
618@item +target @var{bfdname}
619@c @item +target
620@cindex object code format
621Specify an object code format other than your system's default format.
622@xref{objdump}, for information on listing available formats.
623@c FIXME what *does* +target/no arg do?
624
625@item -u
626@itemx +undefined-only
627@cindex external symbols
628@cindex undefined symbols
629Display only undefined symbols (those external to each object file).
630
631@end table
632
633@node objdump, ranlib, nm, Top
634@chapter objdump
635
636@cindex object file information
637@kindex objdump
638
639@smallexample
640 objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
641 [ -h | +header ] [ -i ] [ -j @var{section} ] [ -l ]
642 [ -m @var{machine} ] [ -r | +reloc ] [ -s ]
643 [ -t | +syms ] [ -x ]
644 @var{objfiles}@dots{}
645@end smallexample
646
647@code{objdump} displays information about one or more object files.
648The options control what particular information to display. This
649information is mostly useful to programmers who are working on the
650compilation tools, as opposed to programmers who just want their
651program to compile and work.
652
653The long and short forms of options, shown here as alternatives, are
654equivalent.
655
656@table @code
657@item @var{objfiles}@dots{}
658The object files to be examined. When you specify archives,
659@code{objdump} shows information on each of the member object files.
660
661@item -a
662@c print_arelt_descr
663@cindex archive headers
664If any files from @var{objfiles} are archives, display the archive
665header information (in a format similar to @samp{ls -l}). Besides the
666information you could list with @samp{ar tv}, @samp{objdump -a} shows
667the object file format of each archive member.
668
669@c suggest longname +target or +format or +bfd
670@item -b @var{bfdname}
671@cindex object code format
672You can specify a particular object-code format for your object files as
673@var{bfdname}. This may not be necessary; @var{objdump} can
674automatically recognize many formats. For example,
675@example
676objdump -b oasys -m vax -h fu.o
677@end example
678@noindent
679Displays summary information from the section headers (@samp{-h}) of
680@file{fu.o}, which is explicitly identified (@samp{-m}) as a Vax object
681file in the format produced by Oasys compilers. You can list the
682formats available with the @samp{-i} option.
683
684@item -d
685@cindex disassembling object code
686@cindex machine instructions
687Disassemble. Display the assembler mnemonics for the machine
688instructions from @var{objfiles}.
689
690@item -f
691@cindex object file header
692File header. Display summary information from the overall header of
693each file in @var{objfiles}.
694
695@item -h
696@itemx +header
697@cindex section headers
698Header. Display summary information from the section headers of the
699object file.
700
701@item -i
702@cindex architectures available
703@cindex object formats available
704Display a list showing all architectures and object formats available
705for specification with @code{-b} or @code{-m}.
706
707@c suggest longname +section
708@item -j @var{name}
709@cindex section information
710Display information only for section @var{name}
711
712@c suggest longname +label or +linespec
713@item -l
714@cindex source filenames for object files
715Label the display (using debugging information) with the source filename
716and line numbers corresponding to the object code shown.
717
718@c suggest longname +architecture
719@item -m @var{machine}
720@cindex architecture
721Specify the object files @var{objfiles} are for architecture
722@var{machine}. You can list available architectures using the @samp{-i}
723option.
724
725@item -r
726@itemx +reloc
727@cindex relocation entries, in object file
728Relocation. Print the relocation entries of the file.
729
730@item -s
731@cindex sections, full contents
732@cindex object file sections
733Display the full contents of any sections requested.
734
735@item -t
736@itemx +syms
737@cindex symbol table entries, printing
738Symbol Table. Print the symbol table entries of the file.
739This is similar to the information provided by the @samp{nm} program.
740
741@item -x
742@cindex all header information, object file
743@cindex header information, all
744Display all available header information, including the symbol table and
745relocation entries. Using @samp{-x} is equivalent to specifying all of
746@samp{-a -f -h -r -t}.
747
748@end table
749
750@node ranlib, size, objdump, Top
751@chapter ranlib
752
753@kindex ranlib
754@cindex archive contents
755@cindex symbol index
756
757@smallexample
758 ranlib @var{archive}
759@end smallexample
760
761@code{ranlib} generates an index to the contents of an archive, and
762stores it in the archive. The index lists each symbol defined by a
763member of an archive that is a relocatable object file.
764
765You may use @samp{nm -s} or @samp{nm +print-armap} to list this index.
766
767An archive with such an index speeds up linking to the library, and
768allows routines in the library to call each other without regard to
769their placement in the archive.
770
771The GNU @code{ranlib} program is another form of GNU @code{ar}; running
772@code{ranlib} is completely equivalent to executing @samp{ar -s}.
773@xref{ar}.
774
775@node size, strip, ranlib, Top
776@chapter size
777
778@kindex size
779@cindex section sizes
780
781@smallexample
782 size [ -A | -B | +format @var{compatibility} ]
783 [ +help ] [ -d | -o | -x | +radix @var{number} ]
784 [ +target @var{bfdname} ] [ -V | +version ]
785 @var{objfiles}@dots{}
786@end smallexample
787
788The GNU @code{size} utility lists the section sizes---and the total
789size---for each of the object files @var{objfiles} in its argument list.
790By default, one line of output is generated for each object file or each
791module in an archive.
792
793The command line options have the following meanings:
794@table @code
795@item @var{objfiles}@dots{}
796The object files to be examined.
797
798@item -A
799@itemx -B
800@itemx +format @var{compatibility}
801@cindex size display format
802Using one of these options, you can choose whether the output from GNU
803@code{size} resembles output from System V @code{size} (using @samp{-A},
804or @samp{+format sysv}), or Berkeley @code{size} (using @samp{-B}, or
805@samp{+format berkeley}). The default is the one-line format similar to
806Berkeley's.
807@c Bonus for doc-source readers: you can also say +format=strange (or
808@c anything else that starts with 's') for sysv, and +format=boring (or
809@c anything else that starts with 'b') for Berkeley.
810
811Here is an example of the Berkeley (default) format of output from
812@code{size}:
813@smallexample
814 eg$ size +format Berkeley ranlib size
815text data bss dec hex filename
816294880 81920 11592 388392 5ed28 ranlib
817294880 81920 11888 388688 5ee50 size
818@end smallexample
819
820@noindent
821This is the same data, but displayed closer to System V conventions:
822
823@smallexample
824 eg$ size +format SysV ranlib size
825ranlib :
826section size addr
827.text 294880 8192
828.data 81920 303104
829.bss 11592 385024
830Total 388392
831
832
833size :
834section size addr
835.text 294880 8192
836.data 81920 303104
837.bss 11888 385024
838Total 388688
839@end smallexample
840
841@item +help
842Show a summary of acceptable arguments and options.
843
844@item -d
845@itemx -o
846@itemx -x
847@itemx +radix @var{number}
848@cindex size number format
849@cindex radix for section sizes
850Using one of these options, you can control whether the size of each
851section is given in decimal (@samp{-d}, or @samp{+radix 10}); octal
852(@samp{-o}, or @samp{+radix 8}); or hexadecimal (@samp{-x}, or
853@samp{+radix 16}). In @samp{+radix @var{number}}, only the three
854values (8, 10, 16) are supported. The total size is always given in two
855radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
856octal and hexadecimal if you're using @samp{-o}.
857
858@item +target @var{bfdname}
859@cindex object code format
860You can specify a particular object-code format for @var{objfiles} as
861@var{bfdname}. This may not be necessary; @var{size} can
862automatically recognize many formats. @xref{objdump}, for information
863on listing available formats.
864
865@item -V
866@itemx +version
867Display version number information on @code{size} itself.
868
869@end table
870
871@node strip, Index, size, Top
872@chapter strip
873
874@kindex strip
875@cindex removing symbols
876@cindex discarding symbols
877
878@smallexample
879 strip [ -s | +strip-all ] [ -g | -S | +strip-debug ]
880 [ -x | +discard-all ] [ -X | +discard-locals ]
881 [ -T @var{bfdname} ]
882 @var{objfiles}@dots{}
883@end smallexample
884
885GNU @code{strip} will discard all symbols from object files
886@var{objfiles}, if no options are specified; or only certain symbols,
887depending on its command-line options.
888
889@code{strip} will not execute unless at least one object file is listed.
890
891@quotation
892@emph{WARNING:} @code{strip} modifies the files named in its argument,
893rather than writing modified copies under different names.
894@end quotation
895
896The long and short forms of options, shown here as alternatives, are
897equivalent.
898
899@table @code
900@item -s
901@itemx +strip-all
902@cindex all symbols, discarding
903This is the default case: strip all symbol entries from @var{objfiles}.
904
905@item -g
906@itemx -S
907@itemx +strip-debug
908@cindex debugging symbols, discarding
909Discard only debugging symbol information from @var{objfiles}.
910
911@item -x
912@itemx +discard-all
913@cindex local symbols, discarding
914Discard all symbols local to each file in @var{objfiles}.
915@emph{WARNING:} Note that @code{+discard-all} discards only @emph{local}
916symbols, in spite of its name.
917
918@item -X
919@itemx +discard-locals
920Discard local symbols starting with @samp{L} from each file in
921@var{objfiles}. (Some compilers produce internally-used symbols that
922begin with @samp{L}.)
923
924@item -T @var{bfdname}
925@cindex object code format
926You can specify a particular object-code format @var{bfdname} for
927@var{objfiles}. This may not be necessary; @var{strip} can automatically
928recognize many formats. @xref{objdump}, for information on listing
929available formats.
930@end table
931
765a273f 932@node Index, , strip, Top
c72af735
RP
933@unnumbered Index
934
935@printindex cp
936
937@contents
938@bye
This page took 0.071226 seconds and 4 git commands to generate.