Call config.sub as "/bin/sh config.sub" instead of directly. This
[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
050f05e7
RP
110GNU @code{ar} can maintain archives whose members have names of any
111length; however, depending on how @code{ar} is configured on your
112system, a limit on member-name length may be imposed (for compatibility
113with archive formats maintained with other tools). If it exists, the
114limit is often 15 characters (typical of formats related to a.out) or 16
115characters (typical of formats related to coff).
de5fd53b
RP
116
117@code{ar} is considered a binary utility because archives of this sort
118are most often used as @dfn{libraries} holding commonly needed
119subroutines.
120
121@code{ar} will create an index to the symbols defined in relocatable
c9629e6e 122object modules in the archive when you specify the modifier @samp{s}.
de5fd53b
RP
123Once created, this index is updated in the archive whenever @code{ar}
124makes a change to its contents. An archive with such an index speeds up
125linking to the library, and allows routines in the library to call each
126other without regard to their placement in the archive.
2f3c1742
RP
127@c FIXME This auto-update may happen-always only for WRS version; Gumby
128@c says, for instance, that it doesn't happen with 'q' updates elsewhere.
de5fd53b 129
2f3c1742 130You may use @samp{nm -s} or @samp{nm +print-armap} to list this index
de5fd53b
RP
131table. If an archive lacks the table, another form of @code{ar} called
132@code{ranlib} can be used to add just the table.
133
134@code{ar} insists on at least two arguments to execute: one
135keyletter specifying the @emph{operation} (optionally accompanied by other
136keyletters specifying @emph{modifiers}), and the archive name to act on.
137
138Most operations can also accept further @var{files} arguments,
139specifying particular files to operate on.
140
c9629e6e
RP
141GNU @code{ar} allows you to mix the operation code @var{p} and modifier
142flags @var{mod} in any order, within the first command-line argument.
de5fd53b 143
2f3c1742 144If you wish, you may prefix the first command-line argument with a
de5fd53b
RP
145dash.
146
2f3c1742 147The @var{p} keyletter specifies what operation to execute; it may be
de5fd53b
RP
148any of the following, but you must specify only one of them:
149
150@table @code
151@item d
152@emph{Delete} modules from the archive. Specify the names of modules to
153be deleted as @var{files}; the archive is untouched if you
154specify no files to delete.
155
c9629e6e 156If you specify the @samp{v} modifier, @code{ar} will list each module
de5fd53b
RP
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
c9629e6e 166If no modifiers are used with @code{m}, any members you name in the
de5fd53b 167@var{files} arguments are moved to the @emph{end} of the archive;
c9629e6e 168you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
de5fd53b
RP
169specified place instead.
170
171@item p
172@emph{Print} the specified members of the archive, to the standard
c9629e6e 173output file. If the @samp{v} modifier is specified, show the member
de5fd53b
RP
174name before copying its contents to standard output.
175
050f05e7 176If you specify no @var{files}, all the files in the archive are printed.
de5fd53b
RP
177
178@item q
179@emph{Quick append}; add @var{files} to the end of @var{archive},
180without checking for replacement.
181
c9629e6e 182The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
de5fd53b
RP
183operation; new members are always placed at the end of the archive.
184
c9629e6e 185The modifier @samp{v} makes @code{ar} list each file as it is appended.
de5fd53b 186
2f3c1742 187@c FIXME: per Gumby, versions other than WRS of this will *not* auto-update
de5fd53b
RP
188@c SYMDEF index on 'q' updates.
189
190@item r
191Insert @var{files} into @var{archive} (with @emph{replacement}). This
192operation differs from @samp{q} in that any previously existing members
193are deleted if their names match those being added.
194
195If one of the files named in @var{files} doesn't exist, @code{ar}
196displays an error message, and leaves undisturbed any existing members
197of the archive matching that name.
198
199By default, new members are added at the end of the file; but you may
c9629e6e 200use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
de5fd53b
RP
201placement relative to some existing member.
202
c9629e6e 203The modifier @samp{v} used with this operation elicits a line of
de5fd53b
RP
204output for each file inserted, along with one of the letters @samp{a} or
205@samp{r} to indicate whether the file was appended (no old member
206deleted) or replaced.
207
208@item t
209Display a @emph{table} listing the contents of @var{archive}, or those
210of the files listed in @var{files} that are present in the
211archive. Normally only the member name is shown; if you also want to
212see the modes (permissions), timestamp, owner, group, and size, you can
c9629e6e 213request that by also specifying the @samp{v} modifier.
de5fd53b
RP
214
215If you do not specify any @var{files}, all files in the archive
050f05e7 216are listed.
de5fd53b
RP
217
218If there is more than one file with the same name (say, @samp{fie}) in
219an archive (say @samp{b.a}), @samp{ar t b.a fie} will list only the
220first instance; to see them all, you must ask for a complete
221listing---in our example, @samp{ar t b.a}.
222@c WRS only; per Gumby, this is implementation-dependent, and in a more
223@c recent case in fact works the other way.
224
225@item x
2f3c1742 226@emph{Extract} members (named @var{files}) from the archive. You can
c9629e6e 227use the @samp{v} modifier with this operation, to request that
2f3c1742 228@code{ar} list each name as it extracts it.
de5fd53b
RP
229
230If you do not specify any @var{files}, all files in the archive
050f05e7 231are extracted.
de5fd53b
RP
232
233@end table
234
2f3c1742
RP
235A number of modifiers (@var{mod}) may immediately follow the @var{p}
236keyletter, to specify variations on an operation's behavior:
de5fd53b
RP
237
238@table @code
239@item a
240Add new files @emph{after} an existing member of the
241archive. If you use the modifier @code{a}, the name of an existing archive
242member must be present as the @var{membername} argument, before the
243@var{archive} specification.
244
245@item b
246Add new files @emph{before} an existing member of the
247archive. If you use the modifier @code{b}, the name of an existing archive
248member must be present as the @var{membername} argument, before the
249@var{archive} specification. (same as @samp{i}).
250
251@item c
252@emph{Create} the archive. The specified @var{archive} is always
253created if it didn't exist, when you request an update. But a warning is
254issued unless you specify in advance that you expect to create it, by
c9629e6e 255using this modifier.
de5fd53b
RP
256
257@item i
258Insert new files @emph{before} an existing member of the
259archive. If you use the modifier @code{i}, the name of an existing archive
260member must be present as the @var{membername} argument, before the
261@var{archive} specification. (same as @samp{b}).
262
263@item l
c9629e6e 264This modifier is accepted but not used.
050f05e7
RP
265@c whaffor ar l modifier??? presumably compat; with
266@c what???---pesch@@cygnus.com, 25jan91
de5fd53b
RP
267
268@item o
269Preserve the @emph{original} dates of members when extracting them. If
c9629e6e 270you do not specify this modifier, files extracted from the archive
de5fd53b
RP
271will be stamped with the time of extraction.
272
273@item s
274Write an object-file index into the archive, or update an existing one,
c9629e6e 275even if no other change is made to the archive. You may use this modifier
de5fd53b
RP
276flag either with any operation, or alone. Running @samp{ar s} on an
277archive is equivalent to running @samp{ranlib} on it.
278
279@item u
c9629e6e 280Normally, @code{ar r}@dots{} inserts all files
de5fd53b
RP
281listed into the archive. If you would like to insert @emph{only} those
282of the files you list that are newer than existing members of the same
c9629e6e
RP
283names, use this modifier. The @samp{u} modifier is allowed only for the
284operation @samp{r} (replace). In particular, the combination @samp{qu} is
285not allowed, since checking the timestamps would lose any speed
286advantage from the operation @samp{q}.
de5fd53b 287
de5fd53b 288@item v
c9629e6e 289This modifier requests the @emph{verbose} version of an operation. Many
de5fd53b 290operations display additional information, such as filenames processed,
c9629e6e 291when the modifier @samp{v} is appended.
de5fd53b
RP
292
293@end table
294
295@node ld, nm, ar, Top
296@chapter ld
297The GNU linker @code{ld} is now described in a separate manual.
298@xref{Top, , Overview, , GLD: the GNU linker}.
299
300@node nm, objdump, ld, Top
301@chapter nm
302
303@smallexample
304 nm [ -a | +debug-syms ] [ -g | +extern-only ]
2f3c1742
RP
305 [ -s | +print-armap ] [ -o | +print-file-name ]
306 [ -n | +numeric-sort ] [ -p | +no-sort ]
307 [ -r | +reverse-sort ] [ -u | +undefined-only ]
c9629e6e 308 [ +target @var{bfdname} ]
de5fd53b
RP
309 [ @var{objfiles}@dots{} ]
310@end smallexample
311
312GNU @code{nm} will list the symbols from object files @var{objfiles}.
de5fd53b
RP
313
314The long and short forms of options, shown here as alternatives, are
315equivalent.
316
317@table @code
318@item @var{objfiles}@dots{}
319Object files whose symbols are to be listed. If no object files are
320listed as arguments, @code{nm} assumes @samp{a.out}.
321
2f3c1742
RP
322@item +debug-syms
323@itemx -a
de5fd53b
RP
324Display debugger-only symbols; normally these are not listed.
325
2f3c1742
RP
326@item +extern-only
327@itemx -g
de5fd53b
RP
328Display only external symbols.
329
2f3c1742
RP
330@item +no-sort
331@itemx -p
332Don't bother to sort the symbols in any order; just print them in the
333order encountered.
334
335@item +numeric-sort
336@itemx -n
de5fd53b
RP
337Sort symbols numerically by their addresses, not alphabetically by their
338names.
339
2f3c1742
RP
340@item +print-armap
341@itemx -s
342When listing symbols from archives, list the index: a mapping (stored in
050f05e7 343the archive by @code{ar} or @code{ranlib}) of what modules contain
2f3c1742
RP
344definitions for what names.
345
346@item +print-file-name
347@itemx -o
de5fd53b
RP
348Precede each symbol by the name of the input file where it was found,
349rather than identifying the input file once only before all of its
350symbols.
351
2f3c1742
RP
352@item +reverse-sort
353@itemx -r
de5fd53b
RP
354Reverse the sense of the sort (whether numeric or alphabetic); let the
355last come first.
356
2f3c1742
RP
357@item +target @var{bfdname}
358@c @item +target
359Specify an object code format other than your system's default format.
360@xref{objdump}, for information on listing available formats.
361@c FIXME what *does* +target/no arg do?
362
de5fd53b 363
2f3c1742
RP
364@item +undefined-only
365@itemx -u
de5fd53b
RP
366Display only undefined symbols (those external to each object file).
367
368@end table
369
370@node objdump, ranlib, nm, Top
371@chapter objdump
372
373@smallexample
f036c5d5
RP
374 objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
375 [ -h | +header ] [ -i ] [ -j @var{section} ] [ -l ]
376 [ -m @var{machine} ] [ -r | +reloc ] [ -s ]
377 [ -t | +syms ] [ -x ]
378 @var{objfiles}@dots{}
de5fd53b
RP
379@end smallexample
380
381@code{objdump} displays information about one or more object files.
382The options control what particular information to display. This
383information is mostly useful to programmers who are working on the
384compilation tools, as opposed to programmers who just want their
385program to compile and work.
386
387The long and short forms of options, shown here as alternatives, are
388equivalent.
389
390@table @code
391@item @var{objfiles}@dots{}
392The object files to be examined.
393
2f3c1742
RP
394@item -a
395@c print_arelt_descr
396If any files from @var{objfiles} are archives, display the archive
397header information (in a format similar to @samp{ls -l}).
398
399@c suggest longname +target or +format or +bfd
400@item -b @var{bfdname}
401You can specify a particular object-code format for your object files as
402@var{bfdname}. This may not be necessary; @var{objdump} can
403automatically recognize many formats. For example,
404@example
405objdump -b oasys -m vax -h fu.o
406@end example
407@noindent
408Displays summary information from the section headers (@samp{-h}) of
c9629e6e 409@file{fu.o}, which is explicitly identified (@samp{-m}) as a Vax object
2f3c1742 410file in the format produced by Oasys compilers. You can list the
c9629e6e 411formats available with the @samp{-i} option.
2f3c1742
RP
412
413@item -d
414Disassemble. Display the assembler mnemonics for the machine
415instructions from @var{objfiles}.
416
417@item -f
418File header. Display summary information from the overall header of
419each file in @var{objfiles}.
420
421@item +header
422@itemx -h
423Header. Display summary information from the section headers of the
424object file.
425
426@item -i
427Display a list showing all architectures and object formats available
428for specification with @code{-b} or @code{-m}.
429
430@c suggest longname +section
431@item -j @var{name}
432Display information only for section @var{name}
433
434@c suggest longname +label or +linespec
435@item -l
436Label the display (using debugging information) with the source filename
437and line numbers corresponding to the object code shown.
438
439@c suggest longname +architecture
440@item -m @var{machine}
441Specify the object files @var{objfiles} are for architecture
442@var{machine}. You can list available architectures using the @samp{-i}
443option.
444
445@item +reloc
446@itemx -r
de5fd53b
RP
447Relocation. Print the relocation entries of the file.
448
2f3c1742
RP
449@item -s
450Display the full contents of any sections requested.
451
452@item +syms
453@itemx -t
de5fd53b
RP
454Symbol Table. Print the symbol table entries of the file.
455This is similar to the information provided by the @samp{nm} program.
456
2f3c1742
RP
457@item -x
458Display all available header information, including the symbol table and
c9629e6e
RP
459relocation entries. Using @samp{-x} is equivalent to specifying all of
460@samp{-f -a -h -r -t}.
2f3c1742 461
de5fd53b
RP
462@end table
463
464@node ranlib, size, objdump, Top
465@chapter ranlib
466
467@smallexample
2f3c1742 468 ranlib @var{archive}
de5fd53b
RP
469@end smallexample
470
c9629e6e 471@code{ranlib} generates an index to the contents of an archive, and
de5fd53b
RP
472stores it in the archive. The index lists each symbol defined by a
473member of an archive that is a relocatable object file.
474
c9629e6e 475You may use @code{nm -s} or @code{nm +print-armap} to list this index.
de5fd53b
RP
476
477An archive with such an index speeds up linking to the library, and
478allows routines in the library to call each other without regard to
479their placement in the archive.
480
c9629e6e
RP
481The GNU @code{ranlib} program is another form of GNU @code{ar}; running
482@code{ranlib} is completely equivalent to executing @samp{ar -s}.
483@xref{ar}.
484
de5fd53b 485
2f3c1742
RP
486@ignore
487@c FIXME vintage ranlib had options [ -t | +touch ] [ -v | +verbose ]
488@c which are gone here. Good or evil?
489
de5fd53b
RP
490@code{ranlib}'s options make it report on what it's doing and fake an
491update of a particular archive's index.
492
493Any command-line options must precede the archive name.
494
495The long and short forms of options, shown here as alternatives, are
496equivalent.
497
498@table @code
499
500@item -t | +touch
501You can use the ``touch'' option to fake an update of the index
502table in archives; @code{ranlib} will first set the current date for the
503index object module in the archive (to make it appear to have changed).
504
505@item -v | +verbose
506Use this option if you'd like informational messages about what
507@code{ranlib} is up to, while it loops through the specified archives.
508
509@end table
2f3c1742 510@end ignore
de5fd53b
RP
511
512@node size, strip, ranlib, Top
513@chapter size
514
515@smallexample
c9629e6e
RP
516 size [ -A | -B | +format @var{compatibility} ]
517 [ +help ] [ -d | -o | -x | +radix @var{number} ]
518 [ +target @var{bfdname} [ -V | +version ]
2f3c1742 519 @var{objfiles}@dots{}
de5fd53b
RP
520@end smallexample
521
2f3c1742
RP
522The GNU @code{size} utility lists the section sizes---and the total
523size---for each of the object files @var{objfiles} in its argument list.
524By default, one line of output is generated for each object file or each
525module in an archive.
de5fd53b 526
2f3c1742
RP
527The command line options have the following meanings:
528@table @code
c9629e6e
RP
529@item @var{objfiles}@dots{}
530The object files to be examined.
2f3c1742
RP
531
532@item +format @var{compatibility}
533@itemx -A
534@itemx -B
535Using one of these options, you can choose whether the output from GNU
536@code{size} resembles output from System V @code{size} (using @samp{-A},
537or @samp{+format sysv}, or Berkeley @code{size} (using @samp{-B}, or
538@samp{+format berkeley}. The default is the one-line format similar to
539Berkeley's.
540@c Bonus for doc-source readers: you can also say +format=strange (or
541@c anything else that starts with 's') for sysv, and +format=boring (or
542@c anything else that starts with 'b') for Berkeley.
543
544Here is an example of the Berkeley (default) format of output from
545@code{size}:
de5fd53b 546@smallexample
2f3c1742
RP
547 eg$ size +format Berkeley ranlib size
548text data bss dec hex filename
549294880 81920 11592 388392 5ed28 ranlib
550294880 81920 11888 388688 5ee50 size
551@end smallexample
552
553@noindent
554This is the same data, but displayed closer to System V conventions:
de5fd53b 555
2f3c1742 556@smallexample
2f3c1742
RP
557 eg$ size +format SysV ranlib size
558ranlib :
559section size addr
560.text 294880 8192
561.data 81920 303104
562.bss 11592 385024
563Total 388392
564
565
566size :
567section size addr
568.text 294880 8192
569.data 81920 303104
570.bss 11888 385024
571Total 388688
f036c5d5 572@end smallexample
2f3c1742 573
c9629e6e
RP
574@item +help
575Show a summary of acceptable arguments and options.
576
577@item +radix @var{number}
578@itemx -d
579@itemx -o
580@itemx -x
581Using one of these options, you can control whether the size of each
582section is given in decimal (@samp{-d}, or @samp{+radix 10}); octal
583(@samp{-o}, or @samp{+radix 8}); or hexadecimal (@samp{-x}, or
584@samp{+radix 16}). In @samp{+radix @var{number}}, only the three
585values (8, 10, 16) are supported. The total size is always given in two
586radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
587octal and hexadecimal if you're using @samp{-o}.
588
2f3c1742
RP
589@item +target @var{bfdname}
590You can specify a particular object-code format for @var{objfiles} as
591@var{bfdname}. This may not be necessary; @var{size} can
592automatically recognize many formats. @xref{objdump}, for information
593on listing available formats.
594
595@item +version
596@itemx -V
597Display version number information on @code{size} itself.
598
599@end table
600
de5fd53b
RP
601
602@node strip, , size, Top
603@chapter strip
604
605@smallexample
2f3c1742 606 strip [ -s | +strip-all ] [ -g | -S | +strip-debug ]
de5fd53b 607 [ -x | +discard-all ] [ -X | +discard-locals ]
2f3c1742 608 [ -T @var{bfdname} ]
de5fd53b
RP
609 @var{objfiles}@dots{}
610@end smallexample
611
612GNU @code{strip} will discard all symbols from object files
613@var{objfiles}, if no options are specified; or only certain symbols,
614depending on its command-line options.
615
616@code{strip} will not execute unless at least one object file is listed.
617
c9629e6e 618@quotation
de5fd53b
RP
619@emph{WARNING:} @code{strip} modifies the files named in its argument,
620rather than writing modified copies under different names.
c9629e6e 621@end quotation
de5fd53b
RP
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.049192 seconds and 4 git commands to generate.