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