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