Changed "make check" target to use DejaGnu.
[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
e31e9a8d
JO
7* Binutils: (binutils). The GNU binary utilities "ar", "ld", "copy",
8 "objdump", "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
e31e9a8d
JO
39@c This file documents the GNU binary utilities "ar", "ld", "copy", "objdump",
40@c "nm", "size", "strip", and "ranlib".
c72af735
RP
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
27e94bd5
RP
50@c @smallbook
51@c @cropmarks
4928b97b
RP
52@titlepage
53@finalout
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
e31e9a8d
JO
97@item copy
98Copy and translate object files
99
c72af735
RP
100@item nm
101List symbols from object files
102
103@item objdump
104Display information from object files
105
106@item ranlib
107Generate index to archive contents
108
109@item size
110List section sizes and total size
111
112@item strip
113Discard symbols
114@end table
8b2c2275 115@end iftex
c72af735
RP
116
117@menu
8b2c2275 118* ar:: Create, modify, and extract from archives
e31e9a8d 119* copy:: Copy and translate object files
8b2c2275
RP
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::
c72af735
RP
127@end menu
128
e31e9a8d 129@node ar, copy, Top, Top
c72af735
RP
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{}
765a273f 137 ar -M [ <mri-script ]
c72af735
RP
138@end smallexample
139
140The GNU @code{ar} program creates, modifies, and extracts from
141archives. An @dfn{archive} is a single file holding a collection of
142other files in a structure that makes it possible to retrieve
143the original individual files (called @dfn{members} of the archive).
144
145The original files' contents, mode (permissions), timestamp, owner, and
146group are preserved in the archive, and may be reconstituted on
147extraction.
148
149@cindex name length
150GNU @code{ar} can maintain archives whose members have names of any
151length; however, depending on how @code{ar} is configured on your
152system, a limit on member-name length may be imposed (for compatibility
153with archive formats maintained with other tools). If it exists, the
154limit is often 15 characters (typical of formats related to a.out) or 16
155characters (typical of formats related to coff).
156
157@cindex libraries
158@code{ar} is considered a binary utility because archives of this sort
159are most often used as @dfn{libraries} holding commonly needed
160subroutines.
161
162@cindex symbol index
e31e9a8d 163@code{ar} creates an index to the symbols defined in relocatable
c72af735
RP
164object modules in the archive when you specify the modifier @samp{s}.
165Once created, this index is updated in the archive whenever @code{ar}
166makes a change to its contents (save for the @samp{q} update operation).
167An archive with such an index speeds up linking to the library, and
168allows routines in the library to call each other without regard to
169their placement in the archive.
170
918c2f61 171You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
c72af735
RP
172table. If an archive lacks the table, another form of @code{ar} called
173@code{ranlib} can be used to add just the table.
174
765a273f
RP
175@cindex compatibility, @code{ar}
176@cindex @code{ar} compatibility
177GNU @code{ar} is designed to be compatible with two different
178facilities. You can control its activity using command-line options,
179like the different varieties of @code{ar} on Unix systems; or, if you
180specify the single command-line option @samp{-M}, you can control it
181with a script supplied via standard input, like the MRI ``librarian''
182program.
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}
198When you use @code{ar} in the Unix style, @code{ar} insists on at least two
199arguments 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.
c72af735
RP
202
203Most operations can also accept further @var{files} arguments,
204specifying particular files to operate on.
205
206GNU @code{ar} allows you to mix the operation code @var{p} and modifier
207flags @var{mod} in any order, within the first command-line argument.
208
209If you wish, you may begin the first command-line argument with a
210dash.
211
212@cindex operations on archive
213The @var{p} keyletter specifies what operation to execute; it may be
214any 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
220be deleted as @var{files}; the archive is untouched if you
221specify no files to delete.
222
e31e9a8d 223If you specify the @samp{v} modifier, @code{ar} lists each module
c72af735
RP
224as it is deleted.
225
226@item m
227@cindex moving in archive
228Use this operation to @emph{move} members in an archive.
229
230The ordering of members in an archive can make a difference in how
231programs are linked using the library, if a symbol is defined in more
232than one member.
233
234If 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;
236you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
237specified place instead.
238
239@item p
240@cindex printing from archive
241@emph{Print} the specified members of the archive, to the standard
242output file. If the @samp{v} modifier is specified, show the member
243name before copying its contents to standard output.
244
245If 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},
250without checking for replacement.
251
252The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
253operation; new members are always placed at the end of the archive.
254
255The modifier @samp{v} makes @code{ar} list each file as it is appended.
256
257Since the point of this operation is speed, the archive's symbol table
258index 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
263Insert @var{files} into @var{archive} (with @emph{replacement}). This
264operation differs from @samp{q} in that any previously existing members
265are deleted if their names match those being added.
266
267If one of the files named in @var{files} doesn't exist, @code{ar}
268displays an error message, and leaves undisturbed any existing members
269of the archive matching that name.
270
271By default, new members are added at the end of the file; but you may
272use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
273placement relative to some existing member.
274
275The modifier @samp{v} used with this operation elicits a line of
276output 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
278deleted) or replaced.
279
280@item t
281@cindex contents of archive
282Display a @emph{table} listing the contents of @var{archive}, or those
283of the files listed in @var{files} that are present in the
284archive. Normally only the member name is shown; if you also want to
285see the modes (permissions), timestamp, owner, group, and size, you can
286request that by also specifying the @samp{v} modifier.
287
288If you do not specify any @var{files}, all files in the archive
289are listed.
290
291@cindex repeated names in archive
292@cindex name duplication in archive
293If there is more than one file with the same name (say, @samp{fie}) in
e31e9a8d 294an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
c72af735
RP
295first instance; to see them all, you must ask for a complete
296listing---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
303use the @samp{v} modifier with this operation, to request that
304@code{ar} list each name as it extracts it.
305
306If you do not specify any @var{files}, all files in the archive
307are extracted.
308
309@end table
310
311A number of modifiers (@var{mod}) may immediately follow the @var{p}
312keyletter, to specify variations on an operation's behavior:
313
314@table @code
315@item a
316@cindex relative placement in archive
317Add new files @emph{after} an existing member of the
318archive. If you use the modifier @code{a}, the name of an existing archive
319member must be present as the @var{membername} argument, before the
320@var{archive} specification.
321
322@item b
323Add new files @emph{before} an existing member of the
324archive. If you use the modifier @code{b}, the name of an existing archive
325member 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
331created if it didn't exist, when you request an update. But a warning is
332issued unless you specify in advance that you expect to create it, by
333using this modifier.
334
335@item i
336Insert new files @emph{before} an existing member of the
337archive. If you use the modifier @code{i}, the name of an existing archive
338member must be present as the @var{membername} argument, before the
339@var{archive} specification. (same as @samp{b}).
340
341@item l
342This 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
348Preserve the @emph{original} dates of members when extracting them. If
349you do not specify this modifier, files extracted from the archive
e31e9a8d 350are stamped with the time of extraction.
c72af735
RP
351
352@item s
353@cindex writing archive index
354Write an object-file index into the archive, or update an existing one,
355even if no other change is made to the archive. You may use this modifier
356flag either with any operation, or alone. Running @samp{ar s} on an
357archive is equivalent to running @samp{ranlib} on it.
358
359@item u
360@cindex updating an archive
361Normally, @code{ar r}@dots{} inserts all files
362listed into the archive. If you would like to insert @emph{only} those
363of the files you list that are newer than existing members of the same
364names, use this modifier. The @samp{u} modifier is allowed only for the
365operation @samp{r} (replace). In particular, the combination @samp{qu} is
366not allowed, since checking the timestamps would lose any speed
367advantage from the operation @samp{q}.
368
369@item v
370This modifier requests the @emph{verbose} version of an operation. Many
371operations display additional information, such as filenames processed,
372when the modifier @samp{v} is appended.
765a273f
RP
373@end table
374
375@node ar-scripts, , ar-cmdline, ar
376@section Controlling @code{ar} with a script
377
378@smallexample
379ar -M [ <@var{script} ]
380@end smallexample
381
382@cindex MRI compatibility, @code{ar}
383@cindex scripts, @code{ar}
384If you use the single command-line option @samp{-M} with @code{ar}, you
385can control its operation with a rudimentary command language. This
e31e9a8d 386form of @code{ar} operates interactively if standard input is coming
765a273f
RP
387directly from a terminal. During interactive use, @code{ar} prompts for
388input (the prompt is @samp{AR >}), and continues executing even after
389errors. If you redirect standard input to a script file, no prompts are
e31e9a8d 390issued, and @code{ar} abandons execution (with a nonzero exit code)
765a273f
RP
391on any error.
392
393The @code{ar} command language is @emph{not} designed to be equivalent
394to the command-line options; in fact, it provides somewhat less control
395over archives. The only purpose of the command language is to ease the
396transition to GNU @code{ar} for developers who already have scripts
397written for the MRI ``librarian'' program.
398
399The syntax for the @code{ar} command language is straightforward:
400@itemize @bullet
401@item
402commands are recognized in upper or lower case; for example, @code{LIST}
403is the same as @code{list}. In the following descriptions, commands are
404shown in upper case for clarity.
405
406@item
407a single command may appear on each line; it is the first word on the
408line.
409
410@item
411empty lines are allowed, and have no effect.
412
413@item
414comments are allowed; text after either of the characters @samp{*}
415or @samp{;} is ignored.
416
417@item
418Whenever you use a list of names as part of the argument to an @code{ar}
419command, you can separate the individual names with either commas or
420blanks. Commas are shown in the explanations below, for clarity.
421
422@item
423@samp{+} is used as a line continuation character; if @samp{+} appears
424at the end of a line, the text on the following line is considered part
425of the current command.
426@end itemize
427
428Here 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
432a temporary file required for most of the other commands.
433
434@code{SAVE} commits the changes so far specified by the script. Prior
435to @code{SAVE}, commands affect only the temporary copy of the current
436archive.
437
438@table @code
439@item ADDLIB @var{archive}
440@itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
441Add all the contents of @var{archive} (or, if specified, each named
442@var{module} from @var{archive}) to the current archive.
443
444Requires 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..."
449Add each named @var{file} as a module in the current archive.
450
451Requires prior use of @code{OPEN} or @code{CREATE}.
452
453@item CLEAR
454Discard the contents of the current archive, cancelling the effect of
455any operations since the last @code{SAVE}. May be executed (with no
456effect) even if no current archive is specified.
457
458@item CREATE @var{archive}
459Creates an archive, and makes it the current archive (required for many
460other commands). The new archive is created with a temporary name; it
461is not actually saved as @var{archive} until you use @code{SAVE}.
462You can overwrite existing archives; similarly, the contents of any
463existing file named @var{archive} will not be destroyed until @code{SAVE}.
464
465@item DELETE @var{module}, @var{module}, @dots{} @var{module}
466Delete each listed @var{module} from the current archive; equivalent to
467@samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
468
469Requires 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}
473List each named @var{module} present in @var{archive}. The separate
474command @code{VERBOSE} specifies the form of the output: when verbose
475output 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
479Output normally goes to the standard output stream; however, if you
480specify @var{outputfile} as a final argument, @code{ar} directs the
481output to that file.
482
483@item END
484Exit from @code{ar}, with a @code{0} exit code to indicate successful
485completion. This command does not save the output file; if you have
486changed the current archive since the last @code{SAVE} command, those
487changes are lost.
488
489@item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
490Extract each named @var{module} from the current archive, writing them
491into the current directory as separate files. Equivalent to @samp{ar -x
492@var{archive} @var{module}@dots{}}.
493
494Requires 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
504Display full contents of the current archive, in ``verbose'' style
505regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
506tv @var{archive}}). (This single command is a GNU @code{ld}
507enhancement, rather than present for MRI compatibility.)
508
509Requires prior use of @code{OPEN} or @code{CREATE}.
510
511@item OPEN @var{archive}
512Opens an existing archive for use as the current archive (required for
513many other commands). Any changes as the result of subsequent commands
514will not actually affect @var{archive} until you next use @code{SAVE}.
515
516@item REPLACE @var{module}, @var{module}, @dots{} @var{module}
517In the current archive, replace each existing @var{module} (named in
518the @code{REPLACE} arguments) from files in the current working directory.
519To execute this command without errors, both the file, and the module in
520the current archive, must exist.
521
522Requires prior use of @code{OPEN} or @code{CREATE}.
523
524@item VERBOSE
525Toggle an internal flag governing the output from @code{DIRECTORY}.
526When the flag is on, @code{DIRECTORY} output matches output from
527@samp{ar -tv @dots{}}.
528
529@item SAVE
530Commit your changes to the current archive, and actually save it as a
531file with the name specified in the last @code{CREATE} or @code{OPEN}
532command.
533
534Requires prior use of @code{OPEN} or @code{CREATE}.
c72af735
RP
535
536@end table
537
e31e9a8d 538@node copy, nm, ar, Top
e31e9a8d
JO
539@chapter copy
540
541@smallexample
918c2f61
PB
542copy [ -F @var{format} | --format=@var{format} ]
543 [ -I @var{format} | --input-format=@var{format} ]
544 [ -O @var{format} | --output-format=@var{format} ]
545 [ -S | --strip-all ] [ -g | --strip-debug ]
546 [ -x | --discard-all ] [ -X | --discard-locals ]
547 [ -v | --verbose ] [ -V | --version ]
548 @var{infile} [@var{outfile}]
e31e9a8d
JO
549@end smallexample
550
918c2f61
PB
551The GNU @code{copy} utility copies the contents of an object file to
552another. @code{copy} uses the GNU BFD Library to read and write the
553object files. It can write the destination object file in a format
554different from that of the source object file. The exact behavior of
555@code{copy} is controlled by command-line options.
e31e9a8d
JO
556
557@code{copy} creates temporary files to do its translations and
918c2f61 558deletes them afterward. @code{copy} uses BFD to do all its
e31e9a8d
JO
559translation work; it knows about all the formats BFD knows about, and
560thus is able to recognize most formats without being told explicitly.
561@xref{BFD,,BFD,ld.info,Using LD, the GNU linker}.
562
563@table @code
918c2f61
PB
564@item @var{infile}
565@itemx @var{outfile}
566The source and output files respectively.
567If you do not specify @var{outfile}, @code{copy} creates a
568temporary file and destructively renames the result with
569the name of the input file.
570
571@item -I @var{format}
572@itemx --input-format=@var{format}
573Treat the source file's object format as specified, rather than
574attempting to deduce it.
575
576@item -O @var{format}
577@itemx --output-format=@var{format}
578Write the output file using the specified object format.
579
580@item -F @var{format}
581@itemx --format=@var{format}
582Use @var{format} as the object format for both the input and the output
583file; i.e. simply transfer data from source to destination with no
584translation.
e31e9a8d 585
918c2f61
PB
586@item -S
587@itemx --strip-all
588Do not copy relocation and symbol information from the source file.
e31e9a8d 589
918c2f61
PB
590@item -g
591@itemx --strip-debug
592Do not copy debugging symbols from the source file.
e31e9a8d 593
918c2f61
PB
594@item -x
595@itemx --discard-all
596Do not copy non-global symbols from the source file.
597@c FIXME any reason to prefer "non-global" to "local" here?
e31e9a8d 598
918c2f61
PB
599@item -X
600@itemx --discard-locals
601Do not copy compiler-generated local symbols.
602(These usually start with @samp{L} or @samp{.}.)
e31e9a8d
JO
603
604@item -V
918c2f61
PB
605@itemx --version
606Show version number.
e31e9a8d 607
918c2f61
PB
608@item -v
609@itemx --verbose
610Verbose output: list all object files modified. In the case of
611archives, @samp{copy -V} lists all members of the archive.
e31e9a8d
JO
612@end table
613
8b2c2275
RP
614@iftex
615@node ld
c72af735
RP
616@chapter ld
617@cindex linker
618@kindex ld
619The GNU linker @code{ld} is now described in a separate manual.
27e94bd5 620@xref{Top,, Overview,, Using LD: the GNU linker}.
8b2c2275 621@end iftex
c72af735 622
e31e9a8d 623@node nm, objdump, copy, Top
c72af735
RP
624@chapter nm
625@cindex symbols
626@kindex nm
627
628@smallexample
918c2f61
PB
629 nm [ -a | --debug-syms ] [ -g | --extern-only ]
630 [ -s | --print-armap ] [ -o | --print-file-name ]
631 [ -n | --numeric-sort ] [ -p | --no-sort ]
632 [ -r | --reverse-sort ] [ -u | --undefined-only ]
633 [ --target @var{bfdname} ]
c72af735
RP
634 [ @var{objfiles}@dots{} ]
635@end smallexample
636
e31e9a8d 637GNU @code{nm} lists the symbols from object files @var{objfiles}.
c72af735
RP
638
639The long and short forms of options, shown here as alternatives, are
640equivalent.
641
642@table @code
643@item @var{objfiles}@dots{}
644@kindex a.out
645Object files whose symbols are to be listed. If no object files are
646listed as arguments, @code{nm} assumes @samp{a.out}.
647
648@item -a
918c2f61 649@itemx --debug-syms
c72af735
RP
650@cindex debugging symbols
651Display debugger-only symbols; normally these are not listed.
652
653@item -g
918c2f61 654@itemx --extern-only
c72af735
RP
655@cindex external symbols
656Display only external symbols.
657
658@item -p
918c2f61 659@itemx --no-sort
c72af735
RP
660@cindex sorting symbols
661Don't bother to sort the symbols in any order; just print them in the
662order encountered.
663
664@item -n
918c2f61 665@itemx --numeric-sort
c72af735
RP
666Sort symbols numerically by their addresses, not alphabetically by their
667names.
668
669@item -s
918c2f61 670@itemx --print-armap
c72af735
RP
671@cindex symbol index, listing
672When listing symbols from archive members, include the index: a mapping
673(stored in the archive by @code{ar} or @code{ranlib}) of what modules
674contain definitions for what names.
675
676@item -o
918c2f61 677@itemx --print-file-name
c72af735
RP
678@cindex input file name
679@cindex file name
680@cindex source file name
681Precede each symbol by the name of the input file where it was found,
682rather than identifying the input file once only before all of its
683symbols.
684
685@item -r
918c2f61 686@itemx --reverse-sort
c72af735
RP
687Reverse the sense of the sort (whether numeric or alphabetic); let the
688last come first.
689
918c2f61
PB
690@item --target @var{bfdname}
691@c @item --target
c72af735
RP
692@cindex object code format
693Specify an object code format other than your system's default format.
694@xref{objdump}, for information on listing available formats.
918c2f61 695@c FIXME what *does* --target/no arg do?
c72af735
RP
696
697@item -u
918c2f61 698@itemx --undefined-only
c72af735
RP
699@cindex external symbols
700@cindex undefined symbols
701Display only undefined symbols (those external to each object file).
702
703@end table
704
705@node objdump, ranlib, nm, Top
706@chapter objdump
707
708@cindex object file information
709@kindex objdump
710
711@smallexample
712 objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ]
c5f0c938
JG
713 [ -h | --header ] [ -i ] [ -j @var{section} ] [ -l ]
714 [ -m @var{machine} ] [ -r | --reloc ] [ -s ]
715 [ --stabs ] [ -t | --syms ] [ -x ]
c72af735
RP
716 @var{objfiles}@dots{}
717@end smallexample
718
719@code{objdump} displays information about one or more object files.
720The options control what particular information to display. This
721information is mostly useful to programmers who are working on the
722compilation tools, as opposed to programmers who just want their
723program to compile and work.
724
725The long and short forms of options, shown here as alternatives, are
726equivalent.
727
728@table @code
729@item @var{objfiles}@dots{}
730The object files to be examined. When you specify archives,
731@code{objdump} shows information on each of the member object files.
732
733@item -a
734@c print_arelt_descr
735@cindex archive headers
736If any files from @var{objfiles} are archives, display the archive
737header information (in a format similar to @samp{ls -l}). Besides the
738information you could list with @samp{ar tv}, @samp{objdump -a} shows
739the object file format of each archive member.
740
c5f0c938 741@c suggest longname --target or --format or --bfd
c72af735
RP
742@item -b @var{bfdname}
743@cindex object code format
744You can specify a particular object-code format for your object files as
745@var{bfdname}. This may not be necessary; @var{objdump} can
746automatically recognize many formats. For example,
747@example
748objdump -b oasys -m vax -h fu.o
749@end example
750@noindent
751Displays summary information from the section headers (@samp{-h}) of
752@file{fu.o}, which is explicitly identified (@samp{-m}) as a Vax object
753file in the format produced by Oasys compilers. You can list the
754formats available with the @samp{-i} option.
755
756@item -d
757@cindex disassembling object code
758@cindex machine instructions
759Disassemble. Display the assembler mnemonics for the machine
760instructions from @var{objfiles}.
761
762@item -f
763@cindex object file header
764File header. Display summary information from the overall header of
765each file in @var{objfiles}.
766
767@item -h
c5f0c938 768@itemx --header
c72af735
RP
769@cindex section headers
770Header. Display summary information from the section headers of the
771object file.
772
773@item -i
774@cindex architectures available
775@cindex object formats available
776Display a list showing all architectures and object formats available
777for specification with @code{-b} or @code{-m}.
778
c5f0c938 779@c suggest longname --section
c72af735
RP
780@item -j @var{name}
781@cindex section information
782Display information only for section @var{name}
783
c5f0c938 784@c suggest longname --label or --linespec
c72af735
RP
785@item -l
786@cindex source filenames for object files
787Label the display (using debugging information) with the source filename
788and line numbers corresponding to the object code shown.
789
c5f0c938 790@c suggest longname --architecture
c72af735
RP
791@item -m @var{machine}
792@cindex architecture
793Specify the object files @var{objfiles} are for architecture
794@var{machine}. You can list available architectures using the @samp{-i}
795option.
796
797@item -r
c5f0c938 798@itemx --reloc
c72af735
RP
799@cindex relocation entries, in object file
800Relocation. Print the relocation entries of the file.
801
802@item -s
803@cindex sections, full contents
804@cindex object file sections
805Display the full contents of any sections requested.
806
c5f0c938
JG
807@item --stabs
808@cindex stab
809@cindex .stab
810@cindex debug symbols
811@cindex ELF object file format
c3c93fda
JG
812Display the full contents of any sections requested. Display the
813contents of the .stab and .stab.index and .stab.excl sections from an
814ELF file. This is only useful on systems (such as Solaris 2.0) in which
815@code{.stab} debugging symbol-table entries are carried in an ELF
816section. In most other file formats, debugging symbol-table entries are
c5f0c938
JG
817interleaved with linkage symbols, and are visible in the @samp{--syms}
818output.
819
c72af735 820@item -t
c5f0c938 821@itemx --syms
c72af735
RP
822@cindex symbol table entries, printing
823Symbol Table. Print the symbol table entries of the file.
824This is similar to the information provided by the @samp{nm} program.
825
826@item -x
827@cindex all header information, object file
828@cindex header information, all
829Display all available header information, including the symbol table and
830relocation entries. Using @samp{-x} is equivalent to specifying all of
831@samp{-a -f -h -r -t}.
832
833@end table
834
835@node ranlib, size, objdump, Top
836@chapter ranlib
837
838@kindex ranlib
839@cindex archive contents
840@cindex symbol index
841
842@smallexample
843 ranlib @var{archive}
844@end smallexample
845
846@code{ranlib} generates an index to the contents of an archive, and
847stores it in the archive. The index lists each symbol defined by a
848member of an archive that is a relocatable object file.
849
918c2f61 850You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
c72af735
RP
851
852An archive with such an index speeds up linking to the library, and
853allows routines in the library to call each other without regard to
854their placement in the archive.
855
856The GNU @code{ranlib} program is another form of GNU @code{ar}; running
857@code{ranlib} is completely equivalent to executing @samp{ar -s}.
858@xref{ar}.
859
860@node size, strip, ranlib, Top
861@chapter size
862
863@kindex size
864@cindex section sizes
865
866@smallexample
918c2f61
PB
867 size [ -A | -B | --format @var{compatibility} ]
868 [ --help ] [ -d | -o | -x | --radix @var{number} ]
869 [ --target @var{bfdname} ] [ -V | --version ]
c72af735
RP
870 @var{objfiles}@dots{}
871@end smallexample
872
873The GNU @code{size} utility lists the section sizes---and the total
874size---for each of the object files @var{objfiles} in its argument list.
875By default, one line of output is generated for each object file or each
876module in an archive.
877
878The command line options have the following meanings:
879@table @code
880@item @var{objfiles}@dots{}
881The object files to be examined.
882
883@item -A
884@itemx -B
918c2f61 885@itemx --format @var{compatibility}
c72af735
RP
886@cindex size display format
887Using one of these options, you can choose whether the output from GNU
888@code{size} resembles output from System V @code{size} (using @samp{-A},
918c2f61
PB
889or @samp{--format sysv}), or Berkeley @code{size} (using @samp{-B}, or
890@samp{--format berkeley}). The default is the one-line format similar to
c72af735 891Berkeley's.
918c2f61
PB
892@c Bonus for doc-source readers: you can also say --format=strange (or
893@c anything else that starts with 's') for sysv, and --format=boring (or
c72af735
RP
894@c anything else that starts with 'b') for Berkeley.
895
896Here is an example of the Berkeley (default) format of output from
897@code{size}:
898@smallexample
918c2f61 899 eg$ size --format Berkeley ranlib size
c72af735
RP
900text data bss dec hex filename
901294880 81920 11592 388392 5ed28 ranlib
902294880 81920 11888 388688 5ee50 size
903@end smallexample
904
905@noindent
906This is the same data, but displayed closer to System V conventions:
907
908@smallexample
918c2f61 909 eg$ size --format SysV ranlib size
c72af735
RP
910ranlib :
911section size addr
912.text 294880 8192
913.data 81920 303104
914.bss 11592 385024
915Total 388392
916
917
918size :
919section size addr
920.text 294880 8192
921.data 81920 303104
922.bss 11888 385024
923Total 388688
924@end smallexample
925
918c2f61 926@item --help
c72af735
RP
927Show a summary of acceptable arguments and options.
928
929@item -d
930@itemx -o
931@itemx -x
918c2f61 932@itemx --radix @var{number}
c72af735
RP
933@cindex size number format
934@cindex radix for section sizes
935Using one of these options, you can control whether the size of each
918c2f61
PB
936section is given in decimal (@samp{-d}, or @samp{--radix 10}); octal
937(@samp{-o}, or @samp{--radix 8}); or hexadecimal (@samp{-x}, or
938@samp{--radix 16}). In @samp{--radix @var{number}}, only the three
c72af735
RP
939values (8, 10, 16) are supported. The total size is always given in two
940radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
941octal and hexadecimal if you're using @samp{-o}.
942
918c2f61 943@item --target @var{bfdname}
c72af735
RP
944@cindex object code format
945You can specify a particular object-code format for @var{objfiles} as
946@var{bfdname}. This may not be necessary; @var{size} can
947automatically recognize many formats. @xref{objdump}, for information
948on listing available formats.
949
950@item -V
918c2f61 951@itemx --version
c72af735
RP
952Display version number information on @code{size} itself.
953
954@end table
955
956@node strip, Index, size, Top
957@chapter strip
958
959@kindex strip
960@cindex removing symbols
961@cindex discarding symbols
1815e42c 962@cindex symbols, discarding
c72af735
RP
963
964@smallexample
918c2f61
PB
965strip [-F @var{format} | --format=@var{format} ]
966 [-I @var{format} | --input-format=@var{format} ]
967 [-O @var{format} | --output-format=@var{format} ]
968 [ -v | --verbose ] [ -V | --version ]
969 @var{objfiles}@dots{}
c72af735
RP
970@end smallexample
971
e31e9a8d 972GNU @code{strip} discards all symbols from object files
1815e42c 973@var{objfiles}. The list of object files may include archives.
c72af735
RP
974
975@code{strip} will not execute unless at least one object file is listed.
976
977@quotation
978@emph{WARNING:} @code{strip} modifies the files named in its argument,
979rather than writing modified copies under different names.
980@end quotation
981
c72af735 982@table @code
918c2f61
PB
983@item -I @var{format}
984@itemx --input-format=@var{format}
985Treat the original @var{objfiles} as files with the specified object
986code format.
987
988@item -O @var{format}
989@itemx --output-format=@var{format}
990Replace @var{objfiles} with files in the output format specified.
991
992@item -F @var{format}
993@itemx --format=@var{format}
994Treat the original @var{objfiles} as files with the specified object
995code format, and rewrite them in the same format.
996
997@item -g
998@itemx -S
999@itemx --strip-debug
1000Remove debugging symbols only.
1001
1002@item -x
1003@itemx --discard-all
1004Remove non-global symbols.
1005
1006@item -X
1007@itemx --discard-locals
1008Remove compiler-generated local symbols.
1009(These usually start with @code{L} or @code{.}.)
1010
1011@item -V
1012@itemx --version
1013Show version number.
1014
1815e42c 1015@item -v
918c2f61
PB
1016@itemx --verbose
1017Verbose output: list all object files modified. In the case of
1018archives, @samp{strip -V} lists all members of the archive.
c72af735
RP
1019@end table
1020
765a273f 1021@node Index, , strip, Top
c72af735
RP
1022@unnumbered Index
1023
1024@printindex cp
1025
1026@contents
1027@bye
This page took 0.091681 seconds and 4 git commands to generate.