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