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