doc/Makefile: stop hiding complaints from makeinfo.
[deliverable/binutils-gdb.git] / binutils / binutils.texinfo
CommitLineData
de5fd53b
RP
1\input texinfo
2@setfilename binutils.info
3@synindex ky cp
4@c
5@c This file documents the GNU binary utilities "ar", "ld", "objdump", "nm",
6@c "size", "strip", and "ranlib".
7@c
8@c Copyright (C) 1991 Free Software Foundation, Inc.
9@c
10@c This text may be freely distributed under the terms of the GNU
11@c General Public License.
12@c
13@c $Id$
14@tex
15@finalout
16@c @smallbook
17@end tex
18@c @cropmarks
19@setchapternewpage odd
20@settitle GNU Binary Utilities
21@titlepage
22@title{The GNU Binary Utilities}
2f3c1742 23@subtitle{Version 1.9}
de5fd53b 24@sp 1
2f3c1742 25@subtitle October 1991
de5fd53b
RP
26@author{Roland H. Pesch}
27@author{Cygnus Support}
28@page
29
30@tex
31\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
32\xdef\manvers{\$Revision$} % For use in headers, footers too
33{\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par \hfill
34\TeX{}info \texinfoversion\par }
35@end tex
36
37@vskip 0pt plus 1filll
38Copyright @copyright{} 1991 Free Software Foundation, Inc.
39
40Permission is granted to make and distribute verbatim copies of
41this manual provided the copyright notice and this permission notice
42are preserved on all copies.
43
44Permission is granted to copy and distribute modified versions of this
45manual under the conditions for verbatim copying, provided also that
46the entire resulting derived work is distributed under the terms of a
47permission notice identical to this one.
48
49Permission is granted to copy and distribute translations of this manual
50into another language, under the above conditions for modified versions.
51@end titlepage
52
de5fd53b 53@node Top, ar, (dir), (dir)
2f3c1742
RP
54@chapter Introduction
55
56This brief manual contains preliminary documentation for the GNU binary
57utilities (collectively version 1.9): @samp{ar}, @samp{objdump},
58@samp{nm}, @samp{size}, @samp{strip}, and @samp{ranlib}. @refill
de5fd53b 59
2f3c1742 60@ifinfo
de5fd53b
RP
61Copyright @copyright{} 1991 Free Software Foundation, Inc.
62
63Permission is granted to make and distribute verbatim copies of
64this manual provided the copyright notice and this permission notice
65are preserved on all copies.
66
67@ignore
68Permission is granted to process this file through TeX and print the
69results, provided the printed document carries a copying permission
70notice identical to this one except for the removal of this paragraph
71(this paragraph not being relevant to the printed manual).
72
73@end ignore
74
75Permission is granted to copy and distribute modified versions of this
76manual under the conditions for verbatim copying, provided also that
77the entire resulting derived work is distributed under the terms of a
78permission notice identical to this one.
79
80Permission is granted to copy and distribute translations of this manual
81into another language, under the above conditions for modified versions.
82@end ifinfo
83
84@menu
85* ar:: ar
86* ld:: ld
87* nm:: nm
88* objdump:: objdump
89* ranlib:: ranlib
90* size:: size
91* strip:: strip
de5fd53b
RP
92@end menu
93
94@node ar, ld, Top, Top
95@chapter ar
96
97@smallexample
2f3c1742 98 ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{files}@dots{}
de5fd53b
RP
99@end smallexample
100
101The GNU @code{ar} program creates, modifies, and extracts
102archives. An @dfn{archive} is a single file holding a collection of
103other files in a structure that makes it possible to retrieve
104the original individual files (called @dfn{members} of the archive).
105
106The original files' contents, mode (permissions), timestamp, owner, and
107group are preserved in the archive, and may be reconstituted on
108extraction.
109
110Only the first fifteen characters of a file name are kept in archives.
2f3c1742 111@c FIXME: with BFD version, this depends on obj format.
de5fd53b
RP
112
113@code{ar} is considered a binary utility because archives of this sort
114are most often used as @dfn{libraries} holding commonly needed
115subroutines.
116
117@code{ar} will create an index to the symbols defined in relocatable
118object modules in the archive when you specify the option @samp{s}.
119Once created, this index is updated in the archive whenever @code{ar}
120makes a change to its contents. An archive with such an index speeds up
121linking to the library, and allows routines in the library to call each
122other without regard to their placement in the archive.
2f3c1742
RP
123@c FIXME This auto-update may happen-always only for WRS version; Gumby
124@c says, for instance, that it doesn't happen with 'q' updates elsewhere.
de5fd53b 125
2f3c1742 126You may use @samp{nm -s} or @samp{nm +print-armap} to list this index
de5fd53b
RP
127table. If an archive lacks the table, another form of @code{ar} called
128@code{ranlib} can be used to add just the table.
129
130@code{ar} insists on at least two arguments to execute: one
131keyletter specifying the @emph{operation} (optionally accompanied by other
132keyletters specifying @emph{modifiers}), and the archive name to act on.
133
134Most operations can also accept further @var{files} arguments,
135specifying particular files to operate on.
136
137GNU @code{ar} allows you to mix the operation code and modifier flags in
138any order, within the first command-line argument.
139
2f3c1742 140If you wish, you may prefix the first command-line argument with a
de5fd53b
RP
141dash.
142
2f3c1742 143The @var{p} keyletter specifies what operation to execute; it may be
de5fd53b
RP
144any of the following, but you must specify only one of them:
145
146@table @code
147@item d
148@emph{Delete} modules from the archive. Specify the names of modules to
149be deleted as @var{files}; the archive is untouched if you
150specify no files to delete.
151
152If you wish to delete an archive's index, you can use this option to do
153it; the internal name of the index (which you will need to specify in
154@var{files} to delete it) is @samp{__.SYMDEF}.
155
156If you specify the @samp{v} option flag, @code{ar} will list each module
157as it is deleted.
158
159@item m
160Use this operation to @emph{move} members in an archive.
161
162The ordering of members in an archive can make a difference in how
163programs are linked using the library, if a symbol is defined in more
164than one member.
165
166If no option flags are used with @code{m}, any members you name in the
167@var{files} arguments are moved to the @emph{end} of the archive;
168you can use the @samp{a}, @samp{b}, or @samp{i} options to move them to a
169specified place instead.
170
171@item p
172@emph{Print} the specified members of the archive, to the standard
173output file. If the @samp{v} option flag is specified, show the member
174name before copying its contents to standard output.
175
176If you specify no @var{files}, all the files in the archive are printed,
177save for the index (if any), which is listed only if you ask for it by
178name: @samp{__.SYMDEF}.
179
180@item q
181@emph{Quick append}; add @var{files} to the end of @var{archive},
182without checking for replacement.
183
184The options @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
185operation; new members are always placed at the end of the archive.
186
187The option @samp{v} makes @code{ar} list each file as it is appended.
188
2f3c1742 189@c FIXME: per Gumby, versions other than WRS of this will *not* auto-update
de5fd53b
RP
190@c SYMDEF index on 'q' updates.
191
192@item r
193Insert @var{files} into @var{archive} (with @emph{replacement}). This
194operation differs from @samp{q} in that any previously existing members
195are deleted if their names match those being added.
196
197If one of the files named in @var{files} doesn't exist, @code{ar}
198displays an error message, and leaves undisturbed any existing members
199of the archive matching that name.
200
201By default, new members are added at the end of the file; but you may
202use one of the options @samp{a}, @samp{b}, or @samp{i} to request
203placement relative to some existing member.
204
205The option flag @samp{v} used with this operation elicits a line of
206output for each file inserted, along with one of the letters @samp{a} or
207@samp{r} to indicate whether the file was appended (no old member
208deleted) or replaced.
209
210@item t
211Display a @emph{table} listing the contents of @var{archive}, or those
212of the files listed in @var{files} that are present in the
213archive. Normally only the member name is shown; if you also want to
214see the modes (permissions), timestamp, owner, group, and size, you can
215request that by also specifying the @samp{v} option flag.
216
217If you do not specify any @var{files}, all files in the archive
218are listed; but the index to symbols from relocatable modules, called
219@samp{__.SYMDEF}, is not listed unless you explicitly request it by
220name.
221
222If there is more than one file with the same name (say, @samp{fie}) in
223an archive (say @samp{b.a}), @samp{ar t b.a fie} will list only the
224first instance; to see them all, you must ask for a complete
225listing---in our example, @samp{ar t b.a}.
226@c WRS only; per Gumby, this is implementation-dependent, and in a more
227@c recent case in fact works the other way.
228
229@item x
2f3c1742
RP
230@emph{Extract} members (named @var{files}) from the archive. You can
231use the @samp{v} option flag with this operation, to request that
232@code{ar} list each name as it extracts it.
de5fd53b
RP
233
234If you do not specify any @var{files}, all files in the archive
235are extracted; but the index to symbols from relocatable modules, called
236@samp{__.SYMDEF}, is not extracted unless you explicitly request it by
237name.
2f3c1742 238@c FIXME: does __.SYMDEF appear in all BFD arch formats? If not, which?
de5fd53b
RP
239
240@end table
241
2f3c1742
RP
242A number of modifiers (@var{mod}) may immediately follow the @var{p}
243keyletter, to specify variations on an operation's behavior:
de5fd53b
RP
244
245@table @code
246@item a
247Add new files @emph{after} an existing member of the
248archive. If you use the modifier @code{a}, the name of an existing archive
249member must be present as the @var{membername} argument, before the
250@var{archive} specification.
251
252@item b
253Add new files @emph{before} an existing member of the
254archive. If you use the modifier @code{b}, the name of an existing archive
255member must be present as the @var{membername} argument, before the
256@var{archive} specification. (same as @samp{i}).
257
258@item c
259@emph{Create} the archive. The specified @var{archive} is always
260created if it didn't exist, when you request an update. But a warning is
261issued unless you specify in advance that you expect to create it, by
262using this option flag.
263
264@item i
265Insert new files @emph{before} an existing member of the
266archive. If you use the modifier @code{i}, the name of an existing archive
267member must be present as the @var{membername} argument, before the
268@var{archive} specification. (same as @samp{b}).
269
270@item l
271This option flag is recognized but not used; it is permitted for
272compatibility with other forms of @code{ar}.
2f3c1742 273@c FIXME ar l modifier???---pesch@@cygnus.com, 25jan91
de5fd53b
RP
274
275@item o
276Preserve the @emph{original} dates of members when extracting them. If
277you do not specify this option flag, files extracted from the archive
278will be stamped with the time of extraction.
279
280@item s
281Write an object-file index into the archive, or update an existing one,
282even if no other change is made to the archive. You may use this option
283flag either with any operation, or alone. Running @samp{ar s} on an
284archive is equivalent to running @samp{ranlib} on it.
285
286@item u
287Normally, @code{ar r}@dots{} or @code{ar q}@dots{} insert all files
288listed into the archive. If you would like to insert @emph{only} those
289of the files you list that are newer than existing members of the same
290names, use this option. The option-flag combination @samp{qu} is
291equivalent to @samp{ru}; checking the timestamps loses any speed
292advantage, so @code{ar} treats both commands as replace operations with
293the @samp{u} option appended.
294
de5fd53b
RP
295@item v
296This option requests the @emph{verbose} version of an operations. Many
297operations display additional information, such as filenames processed,
298when the option @samp{v} is appended.
299
300@end table
301
302@node ld, nm, ar, Top
303@chapter ld
304The GNU linker @code{ld} is now described in a separate manual.
305@xref{Top, , Overview, , GLD: the GNU linker}.
306
307@node nm, objdump, ld, Top
308@chapter nm
309
310@smallexample
311 nm [ -a | +debug-syms ] [ -g | +extern-only ]
2f3c1742
RP
312 [ -s | +print-armap ] [ -o | +print-file-name ]
313 [ -n | +numeric-sort ] [ -p | +no-sort ]
314 [ -r | +reverse-sort ] [ -u | +undefined-only ]
315 [ +target [@var{bfdname}] ]
de5fd53b
RP
316 [ @var{objfiles}@dots{} ]
317@end smallexample
318
319GNU @code{nm} will list the symbols from object files @var{objfiles}.
2f3c1742
RP
320Any command-line options must precede all object files; only the
321@samp{+target} option can be further specified with an argument.
de5fd53b
RP
322
323The long and short forms of options, shown here as alternatives, are
324equivalent.
325
326@table @code
327@item @var{objfiles}@dots{}
328Object files whose symbols are to be listed. If no object files are
329listed as arguments, @code{nm} assumes @samp{a.out}.
330
2f3c1742
RP
331@item +debug-syms
332@itemx -a
de5fd53b
RP
333Display debugger-only symbols; normally these are not listed.
334
2f3c1742
RP
335@item +extern-only
336@itemx -g
de5fd53b
RP
337Display only external symbols.
338
2f3c1742
RP
339@item +no-sort
340@itemx -p
341Don't bother to sort the symbols in any order; just print them in the
342order encountered.
343
344@item +numeric-sort
345@itemx -n
de5fd53b
RP
346Sort symbols numerically by their addresses, not alphabetically by their
347names.
348
2f3c1742
RP
349@item +print-armap
350@itemx -s
351When listing symbols from archives, list the index: a mapping (stored in
352the archive by @code{ar} or @code{ranlib} of what modules contain
353definitions for what names.
354
355@item +print-file-name
356@itemx -o
de5fd53b
RP
357Precede each symbol by the name of the input file where it was found,
358rather than identifying the input file once only before all of its
359symbols.
360
2f3c1742
RP
361@item +reverse-sort
362@itemx -r
de5fd53b
RP
363Reverse the sense of the sort (whether numeric or alphabetic); let the
364last come first.
365
2f3c1742
RP
366@item +target @var{bfdname}
367@c @item +target
368Specify an object code format other than your system's default format.
369@xref{objdump}, for information on listing available formats.
370@c FIXME what *does* +target/no arg do?
371
de5fd53b 372
2f3c1742
RP
373@item +undefined-only
374@itemx -u
de5fd53b
RP
375Display only undefined symbols (those external to each object file).
376
377@end table
378
379@node objdump, ranlib, nm, Top
380@chapter objdump
381
382@smallexample
f036c5d5
RP
383 objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
384 [ -h | +header ] [ -i ] [ -j @var{section} ] [ -l ]
385 [ -m @var{machine} ] [ -r | +reloc ] [ -s ]
386 [ -t | +syms ] [ -x ]
387 @var{objfiles}@dots{}
de5fd53b
RP
388@end smallexample
389
390@code{objdump} displays information about one or more object files.
391The options control what particular information to display. This
392information is mostly useful to programmers who are working on the
393compilation tools, as opposed to programmers who just want their
394program to compile and work.
395
396The long and short forms of options, shown here as alternatives, are
397equivalent.
398
399@table @code
400@item @var{objfiles}@dots{}
401The object files to be examined.
402
2f3c1742
RP
403@item -a
404@c print_arelt_descr
405If any files from @var{objfiles} are archives, display the archive
406header information (in a format similar to @samp{ls -l}).
407
408@c suggest longname +target or +format or +bfd
409@item -b @var{bfdname}
410You can specify a particular object-code format for your object files as
411@var{bfdname}. This may not be necessary; @var{objdump} can
412automatically recognize many formats. For example,
413@example
414objdump -b oasys -m vax -h fu.o
415@end example
416@noindent
417Displays summary information from the section headers (@samp{-h}) of
418@file{fu.o}, which is explicitly identified as a Vax (@samp{-m}) object
419file in the format produced by Oasys compilers. You can list the
420formats available with the @var{-i} option.
421
422@item -d
423Disassemble. Display the assembler mnemonics for the machine
424instructions from @var{objfiles}.
425
426@item -f
427File header. Display summary information from the overall header of
428each file in @var{objfiles}.
429
430@item +header
431@itemx -h
432Header. Display summary information from the section headers of the
433object file.
434
435@item -i
436Display a list showing all architectures and object formats available
437for specification with @code{-b} or @code{-m}.
438
439@c suggest longname +section
440@item -j @var{name}
441Display information only for section @var{name}
442
443@c suggest longname +label or +linespec
444@item -l
445Label the display (using debugging information) with the source filename
446and line numbers corresponding to the object code shown.
447
448@c suggest longname +architecture
449@item -m @var{machine}
450Specify the object files @var{objfiles} are for architecture
451@var{machine}. You can list available architectures using the @samp{-i}
452option.
453
454@item +reloc
455@itemx -r
de5fd53b
RP
456Relocation. Print the relocation entries of the file.
457
2f3c1742
RP
458@item -s
459Display the full contents of any sections requested.
460
461@item +syms
462@itemx -t
de5fd53b
RP
463Symbol Table. Print the symbol table entries of the file.
464This is similar to the information provided by the @samp{nm} program.
465
2f3c1742
RP
466@item -x
467Display all available header information, including the symbol table and
468relocation entries. @samp{-x} is equivalent to @samp{-f -a -h -r -t}.
469
de5fd53b
RP
470@end table
471
472@node ranlib, size, objdump, Top
473@chapter ranlib
474
475@smallexample
2f3c1742 476 ranlib @var{archive}
de5fd53b
RP
477@end smallexample
478
479@code{ranlib} generates the an index to the contents of an archive, and
480stores it in the archive. The index lists each symbol defined by a
481member of an archive that is a relocatable object file.
482
2f3c1742 483You may use @code{nm -s} or @code{nm +print-armap} to list this table.
de5fd53b
RP
484The index is internally stored in the archive under the name
485@samp{__.SYMDEF}.
2f3c1742 486@c FIXME does __.SYMDEF exist in archives in all flavors? (ranlib)
de5fd53b
RP
487
488An archive with such an index speeds up linking to the library, and
489allows routines in the library to call each other without regard to
490their placement in the archive.
491
492The GNU @code{ranlib} program is another form of GNU @code{ar}.
493
2f3c1742
RP
494@ignore
495@c FIXME vintage ranlib had options [ -t | +touch ] [ -v | +verbose ]
496@c which are gone here. Good or evil?
497
de5fd53b
RP
498@code{ranlib}'s options make it report on what it's doing and fake an
499update of a particular archive's index.
500
501Any command-line options must precede the archive name.
502
503The long and short forms of options, shown here as alternatives, are
504equivalent.
505
506@table @code
507
508@item -t | +touch
509You can use the ``touch'' option to fake an update of the index
510table in archives; @code{ranlib} will first set the current date for the
511index object module in the archive (to make it appear to have changed).
512
513@item -v | +verbose
514Use this option if you'd like informational messages about what
515@code{ranlib} is up to, while it loops through the specified archives.
516
517@end table
2f3c1742 518@end ignore
de5fd53b
RP
519
520@node size, strip, ranlib, Top
521@chapter size
522
523@smallexample
2f3c1742
RP
524 size [ -d | -o | -x | +radix @var{number} ]
525 [ -A | -B | +format @var{compatibility} ] [ +help ]
526 [ +target [@var{bfdname}] [ -V | +version ]
527 @var{objfiles}@dots{}
de5fd53b
RP
528@end smallexample
529
2f3c1742
RP
530The GNU @code{size} utility lists the section sizes---and the total
531size---for each of the object files @var{objfiles} in its argument list.
532By default, one line of output is generated for each object file or each
533module in an archive.
de5fd53b 534
2f3c1742
RP
535The command line options have the following meanings:
536@table @code
537@item +radix @var{number}
538@itemx -d
539@itemx -o
540@itemx -x
541Using one of these options, you can control whether the size of each
542section is given in decimal (@samp{-d}, or @samp{+radix 10}); octal
543(@samp{-o}, or @samp{+radix 8}); or hexadecimal (@samp{-x}, or
544@samp{+radix 16}). In @samp{+radix @var{number}}, only the three
545values (8, 10, 16) are supported. The total size is always given in two
546radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
547octal and hexadecimal if you're using @samp{-o}.
548
549@item +format @var{compatibility}
550@itemx -A
551@itemx -B
552Using one of these options, you can choose whether the output from GNU
553@code{size} resembles output from System V @code{size} (using @samp{-A},
554or @samp{+format sysv}, or Berkeley @code{size} (using @samp{-B}, or
555@samp{+format berkeley}. The default is the one-line format similar to
556Berkeley's.
557@c Bonus for doc-source readers: you can also say +format=strange (or
558@c anything else that starts with 's') for sysv, and +format=boring (or
559@c anything else that starts with 'b') for Berkeley.
560
561Here is an example of the Berkeley (default) format of output from
562@code{size}:
de5fd53b 563@smallexample
2f3c1742
RP
564 eg$ size +format Berkeley ranlib size
565text data bss dec hex filename
566294880 81920 11592 388392 5ed28 ranlib
567294880 81920 11888 388688 5ee50 size
568@end smallexample
569
570@noindent
571This is the same data, but displayed closer to System V conventions:
de5fd53b 572
2f3c1742 573@smallexample
2f3c1742
RP
574 eg$ size +format SysV ranlib size
575ranlib :
576section size addr
577.text 294880 8192
578.data 81920 303104
579.bss 11592 385024
580Total 388392
581
582
583size :
584section size addr
585.text 294880 8192
586.data 81920 303104
587.bss 11888 385024
588Total 388688
f036c5d5 589@end smallexample
2f3c1742
RP
590
591@item +target @var{bfdname}
592You can specify a particular object-code format for @var{objfiles} as
593@var{bfdname}. This may not be necessary; @var{size} can
594automatically recognize many formats. @xref{objdump}, for information
595on listing available formats.
596
597@item +version
598@itemx -V
599Display version number information on @code{size} itself.
600
601@end table
602
de5fd53b
RP
603
604@node strip, , size, Top
605@chapter strip
606
607@smallexample
2f3c1742 608 strip [ -s | +strip-all ] [ -g | -S | +strip-debug ]
de5fd53b 609 [ -x | +discard-all ] [ -X | +discard-locals ]
2f3c1742 610 [ -T @var{bfdname} ]
de5fd53b
RP
611 @var{objfiles}@dots{}
612@end smallexample
613
614GNU @code{strip} will discard all symbols from object files
615@var{objfiles}, if no options are specified; or only certain symbols,
616depending on its command-line options.
617
618@code{strip} will not execute unless at least one object file is listed.
619
620@emph{WARNING:} @code{strip} modifies the files named in its argument,
621rather than writing modified copies under different names.
622
623The long and short forms of options, shown here as alternatives, are
624equivalent.
625
626@table @code
2f3c1742
RP
627@item +strip-all
628@itemx -s
de5fd53b
RP
629This is the default case: strip all symbol entries from @var{objfiles}.
630
2f3c1742
RP
631@item +strip-debug
632@itemx -g
633@itemx -S
de5fd53b
RP
634Discard only debugging symbol information from @var{objfiles}.
635
2f3c1742
RP
636@item +discard-all
637@itemx -x
de5fd53b
RP
638Discard all symbols local to each file in @var{objfiles}.
639@emph{WARNING:} Note that @code{+discard-all} discards only @emph{local}
640symbols, in spite of its name.
641
2f3c1742
RP
642@item +discard-locals
643@itemx -X
de5fd53b
RP
644Discard local symbols starting with @samp{L} from each file in
645@var{objfiles}. (Some compilers produce internally-used symbols that
646begin with @samp{L}.)
de5fd53b 647
2f3c1742
RP
648@item -T @var{bfdname}
649You can specify a particular object-code format @var{bfdname} for
650@var{objfiles}. This may not be necessary; @var{strip} can automatically
651recognize many formats. @xref{objdump}, for information on listing
652available formats.
653@end table
de5fd53b
RP
654
655@contents
656@bye
657
658
This page took 0.047835 seconds and 4 git commands to generate.