More widely useful INFO-DIR fragment.
[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
8981cac5 7* Binutils: (binutils). The GNU binary utilities "ar", "ld", "objcopy",
ba7c8e29 8 "objdump", "nm", "size", "strings", "strip", and "ranlib".
9abcc3b8
RP
9END-INFO-DIR-ENTRY
10@end format
11@end ifinfo
c72af735 12
8b2c2275 13@ifinfo
8981cac5 14Copyright @copyright{} 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
8b2c2275
RP
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
df14d957 39@c This file documents the GNU binary utilities "ar", "ld", "objcopy",
ba7c8e29 40@c "objdump", "nm", "size", "strings", "strip", and "ranlib".
c72af735 41@c
e32341a7 42@c Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
c72af735
RP
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
4928b97b
RP
50@titlepage
51@finalout
c72af735 52@title The GNU Binary Utilities
b6216af2 53@subtitle Version 2.2
c72af735 54@sp 1
e32341a7 55@subtitle May 1993
c72af735 56@author Roland H. Pesch
4961ce5b 57@author Jeffrey M. Osier
c72af735
RP
58@author Cygnus Support
59@page
60
61@tex
650a49f0 62{\parskip=0pt \hfill Cygnus Support\par \hfill
c72af735
RP
63\TeX{}info \texinfoversion\par }
64@end tex
65
66@vskip 0pt plus 1filll
8981cac5 67Copyright @copyright{} 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
c72af735
RP
68
69Permission is granted to make and distribute verbatim copies of
70this manual provided the copyright notice and this permission notice
71are preserved on all copies.
72
73Permission is granted to copy and distribute modified versions of this
74manual under the conditions for verbatim copying, provided also that
75the entire resulting derived work is distributed under the terms of a
76permission notice identical to this one.
77
78Permission is granted to copy and distribute translations of this manual
79into another language, under the above conditions for modified versions.
80@end titlepage
81
eae04238 82@node Top
8981cac5 83@top Introduction
c72af735
RP
84
85@cindex version
86This brief manual contains preliminary documentation for the GNU binary
b6216af2 87utilities (collectively version 2.2):
8b2c2275
RP
88
89@iftex
c72af735
RP
90@table @code
91@item ar
92Create, modify, and extract from archives
93
94@item nm
95List symbols from object files
96
eed5eeab
DM
97@item objcopy
98Copy and translate object files
99
c72af735
RP
100@item objdump
101Display information from object files
102
103@item ranlib
104Generate index to archive contents
105
106@item size
eae04238 107List file section sizes and total size
c72af735 108
ba7c8e29
DM
109@item strings
110List printable strings from files
111
c72af735
RP
112@item strip
113Discard symbols
eae04238
DM
114
115@item c++filt
116Demangle encoded C++ symbols
117
118@item nlmconv
119Convert object code into a Netware Loadable Module
c72af735 120@end table
8b2c2275 121@end iftex
c72af735
RP
122
123@menu
8b2c2275 124* ar:: Create, modify, and extract from archives
8b2c2275 125* nm:: List symbols from object files
eed5eeab 126* objcopy:: Copy and translate object files
8b2c2275
RP
127* objdump:: Display information from object files
128* ranlib:: Generate index to archive contents
129* size:: List section sizes and total size
ba7c8e29 130* strings:: List printable strings from files
8b2c2275 131* strip:: Discard symbols
b6216af2 132* c++filt:: Filter to demangle encoded C++ symbols
94e9ad77 133* nlmconv:: Converts object code into an NLM
eae04238 134* Selecting The Target System:: How these utilities determine the target.
8b2c2275 135* Index::
c72af735
RP
136@end menu
137
eae04238 138@node ar
c72af735
RP
139@chapter ar
140
141@kindex ar
142@cindex archives
143@cindex collections of files
144@smallexample
650a49f0 145ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
4d9b5d5a 146ar -M [ <mri-script ]
c72af735
RP
147@end smallexample
148
149The GNU @code{ar} program creates, modifies, and extracts from
150archives. An @dfn{archive} is a single file holding a collection of
151other files in a structure that makes it possible to retrieve
152the original individual files (called @dfn{members} of the archive).
153
154The original files' contents, mode (permissions), timestamp, owner, and
ec40bbb8 155group are preserved in the archive, and can be restored on
c72af735
RP
156extraction.
157
158@cindex name length
159GNU @code{ar} can maintain archives whose members have names of any
160length; however, depending on how @code{ar} is configured on your
ec40bbb8
DM
161system, a limit on member-name length may be imposed for compatibility
162with archive formats maintained with other tools. If it exists, the
c72af735
RP
163limit is often 15 characters (typical of formats related to a.out) or 16
164characters (typical of formats related to coff).
165
166@cindex libraries
167@code{ar} is considered a binary utility because archives of this sort
168are most often used as @dfn{libraries} holding commonly needed
169subroutines.
170
171@cindex symbol index
e31e9a8d 172@code{ar} creates an index to the symbols defined in relocatable
c72af735
RP
173object modules in the archive when you specify the modifier @samp{s}.
174Once created, this index is updated in the archive whenever @code{ar}
175makes a change to its contents (save for the @samp{q} update operation).
176An archive with such an index speeds up linking to the library, and
177allows routines in the library to call each other without regard to
178their placement in the archive.
179
918c2f61 180You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
c72af735
RP
181table. If an archive lacks the table, another form of @code{ar} called
182@code{ranlib} can be used to add just the table.
183
765a273f
RP
184@cindex compatibility, @code{ar}
185@cindex @code{ar} compatibility
186GNU @code{ar} is designed to be compatible with two different
187facilities. You can control its activity using command-line options,
188like the different varieties of @code{ar} on Unix systems; or, if you
189specify the single command-line option @samp{-M}, you can control it
190with a script supplied via standard input, like the MRI ``librarian''
191program.
192
193@menu
eae04238
DM
194* ar cmdline:: Controlling @code{ar} on the command line
195* ar scripts:: Controlling @code{ar} with a script
765a273f
RP
196@end menu
197
198@page
eae04238 199@node ar cmdline
765a273f
RP
200@section Controlling @code{ar} on the command line
201
202@smallexample
650a49f0 203ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
765a273f
RP
204@end smallexample
205
206@cindex Unix compatibility, @code{ar}
207When you use @code{ar} in the Unix style, @code{ar} insists on at least two
208arguments to execute: one keyletter specifying the @emph{operation}
209(optionally accompanied by other keyletters specifying
210@emph{modifiers}), and the archive name to act on.
c72af735 211
650a49f0 212Most operations can also accept further @var{member} arguments,
c72af735
RP
213specifying particular files to operate on.
214
215GNU @code{ar} allows you to mix the operation code @var{p} and modifier
216flags @var{mod} in any order, within the first command-line argument.
217
218If you wish, you may begin the first command-line argument with a
219dash.
220
221@cindex operations on archive
222The @var{p} keyletter specifies what operation to execute; it may be
223any of the following, but you must specify only one of them:
224
225@table @code
226@item d
227@cindex deleting from archive
228@emph{Delete} modules from the archive. Specify the names of modules to
650a49f0 229be deleted as @var{member}@dots{}; the archive is untouched if you
c72af735
RP
230specify no files to delete.
231
e31e9a8d 232If you specify the @samp{v} modifier, @code{ar} lists each module
c72af735
RP
233as it is deleted.
234
235@item m
236@cindex moving in archive
237Use this operation to @emph{move} members in an archive.
238
239The ordering of members in an archive can make a difference in how
240programs are linked using the library, if a symbol is defined in more
241than one member.
242
243If no modifiers are used with @code{m}, any members you name in the
650a49f0 244@var{member} arguments are moved to the @emph{end} of the archive;
c72af735
RP
245you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
246specified place instead.
247
248@item p
249@cindex printing from archive
250@emph{Print} the specified members of the archive, to the standard
251output file. If the @samp{v} modifier is specified, show the member
252name before copying its contents to standard output.
253
650a49f0 254If you specify no @var{member} arguments, all the files in the archive are
ec40bbb8 255printed.
c72af735
RP
256
257@item q
258@cindex quick append to archive
650a49f0 259@emph{Quick append}; add the files @var{member}@dots{} to the end of
ec40bbb8 260@var{archive}, without checking for replacement.
c72af735
RP
261
262The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
263operation; new members are always placed at the end of the archive.
264
265The modifier @samp{v} makes @code{ar} list each file as it is appended.
266
267Since the point of this operation is speed, the archive's symbol table
268index is not updated, even if it already existed; you can use @samp{ar s} or
269@code{ranlib} explicitly to update the symbol table index.
270
271@item r
272@cindex replacement in archive
650a49f0 273Insert the files @var{member}@dots{} into @var{archive} (with
ec40bbb8
DM
274@emph{replacement}). This operation differs from @samp{q} in that any
275previously existing members are deleted if their names match those being
276added.
c72af735 277
650a49f0 278If one of the files named in @var{member}@dots{} does not exist, @code{ar}
c72af735
RP
279displays an error message, and leaves undisturbed any existing members
280of the archive matching that name.
281
282By default, new members are added at the end of the file; but you may
283use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
284placement relative to some existing member.
285
286The modifier @samp{v} used with this operation elicits a line of
287output for each file inserted, along with one of the letters @samp{a} or
288@samp{r} to indicate whether the file was appended (no old member
289deleted) or replaced.
290
291@item t
292@cindex contents of archive
293Display a @emph{table} listing the contents of @var{archive}, or those
650a49f0 294of the files listed in @var{member}@dots{} that are present in the
c72af735
RP
295archive. Normally only the member name is shown; if you also want to
296see the modes (permissions), timestamp, owner, group, and size, you can
297request that by also specifying the @samp{v} modifier.
298
650a49f0 299If you do not specify a @var{member}, all files in the archive
c72af735
RP
300are listed.
301
302@cindex repeated names in archive
303@cindex name duplication in archive
304If there is more than one file with the same name (say, @samp{fie}) in
e31e9a8d 305an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
c72af735
RP
306first instance; to see them all, you must ask for a complete
307listing---in our example, @samp{ar t b.a}.
308@c WRS only; per Gumby, this is implementation-dependent, and in a more
309@c recent case in fact works the other way.
310
311@item x
312@cindex extract from archive
650a49f0 313@emph{Extract} members (named @var{member}) from the archive. You can
c72af735
RP
314use the @samp{v} modifier with this operation, to request that
315@code{ar} list each name as it extracts it.
316
650a49f0 317If you do not specify a @var{member}, all files in the archive
c72af735
RP
318are extracted.
319
320@end table
321
322A number of modifiers (@var{mod}) may immediately follow the @var{p}
323keyletter, to specify variations on an operation's behavior:
324
325@table @code
326@item a
327@cindex relative placement in archive
328Add new files @emph{after} an existing member of the
ec40bbb8 329archive. If you use the modifier @samp{a}, the name of an existing archive
650a49f0 330member must be present as the @var{relpos} argument, before the
c72af735
RP
331@var{archive} specification.
332
333@item b
334Add new files @emph{before} an existing member of the
ec40bbb8 335archive. If you use the modifier @samp{b}, the name of an existing archive
650a49f0 336member must be present as the @var{relpos} argument, before the
c72af735
RP
337@var{archive} specification. (same as @samp{i}).
338
339@item c
340@cindex creating archives
341@emph{Create} the archive. The specified @var{archive} is always
650a49f0 342created if it did not exist, when you request an update. But a warning is
c72af735
RP
343issued unless you specify in advance that you expect to create it, by
344using this modifier.
345
346@item i
347Insert new files @emph{before} an existing member of the
ec40bbb8 348archive. If you use the modifier @samp{i}, the name of an existing archive
650a49f0 349member must be present as the @var{relpos} argument, before the
c72af735
RP
350@var{archive} specification. (same as @samp{b}).
351
352@item l
353This modifier is accepted but not used.
354@c whaffor ar l modifier??? presumably compat; with
355@c what???---pesch@@cygnus.com, 25jan91
356
357@item o
358@cindex dates in archive
359Preserve the @emph{original} dates of members when extracting them. If
360you do not specify this modifier, files extracted from the archive
e31e9a8d 361are stamped with the time of extraction.
c72af735
RP
362
363@item s
364@cindex writing archive index
365Write an object-file index into the archive, or update an existing one,
366even if no other change is made to the archive. You may use this modifier
367flag either with any operation, or alone. Running @samp{ar s} on an
368archive is equivalent to running @samp{ranlib} on it.
369
370@item u
371@cindex updating an archive
b703c078 372Normally, @samp{ar r}@dots{} inserts all files
c72af735
RP
373listed into the archive. If you would like to insert @emph{only} those
374of the files you list that are newer than existing members of the same
375names, use this modifier. The @samp{u} modifier is allowed only for the
376operation @samp{r} (replace). In particular, the combination @samp{qu} is
377not allowed, since checking the timestamps would lose any speed
378advantage from the operation @samp{q}.
379
380@item v
381This modifier requests the @emph{verbose} version of an operation. Many
382operations display additional information, such as filenames processed,
383when the modifier @samp{v} is appended.
4d9b5d5a
DM
384
385@item V
386This modifier shows the version number of @code{ar}.
765a273f
RP
387@end table
388
eae04238 389@node ar scripts
765a273f
RP
390@section Controlling @code{ar} with a script
391
392@smallexample
393ar -M [ <@var{script} ]
394@end smallexample
395
396@cindex MRI compatibility, @code{ar}
397@cindex scripts, @code{ar}
398If you use the single command-line option @samp{-M} with @code{ar}, you
399can control its operation with a rudimentary command language. This
e31e9a8d 400form of @code{ar} operates interactively if standard input is coming
765a273f
RP
401directly from a terminal. During interactive use, @code{ar} prompts for
402input (the prompt is @samp{AR >}), and continues executing even after
403errors. If you redirect standard input to a script file, no prompts are
e31e9a8d 404issued, and @code{ar} abandons execution (with a nonzero exit code)
765a273f
RP
405on any error.
406
407The @code{ar} command language is @emph{not} designed to be equivalent
408to the command-line options; in fact, it provides somewhat less control
409over archives. The only purpose of the command language is to ease the
410transition to GNU @code{ar} for developers who already have scripts
411written for the MRI ``librarian'' program.
412
413The syntax for the @code{ar} command language is straightforward:
414@itemize @bullet
415@item
416commands are recognized in upper or lower case; for example, @code{LIST}
417is the same as @code{list}. In the following descriptions, commands are
418shown in upper case for clarity.
419
420@item
421a single command may appear on each line; it is the first word on the
422line.
423
424@item
425empty lines are allowed, and have no effect.
426
427@item
428comments are allowed; text after either of the characters @samp{*}
429or @samp{;} is ignored.
430
431@item
432Whenever you use a list of names as part of the argument to an @code{ar}
433command, you can separate the individual names with either commas or
434blanks. Commas are shown in the explanations below, for clarity.
435
436@item
437@samp{+} is used as a line continuation character; if @samp{+} appears
438at the end of a line, the text on the following line is considered part
439of the current command.
440@end itemize
441
442Here are the commands you can use in @code{ar} scripts, or when using
443@code{ar} interactively. Three of them have special significance:
444
445@code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
446a temporary file required for most of the other commands.
447
448@code{SAVE} commits the changes so far specified by the script. Prior
449to @code{SAVE}, commands affect only the temporary copy of the current
450archive.
451
452@table @code
453@item ADDLIB @var{archive}
454@itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
455Add all the contents of @var{archive} (or, if specified, each named
456@var{module} from @var{archive}) to the current archive.
457
458Requires prior use of @code{OPEN} or @code{CREATE}.
459
650a49f0 460@item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
765a273f
RP
461@c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
462@c else like "ar q..."
650a49f0 463Add each named @var{member} as a module in the current archive.
765a273f
RP
464
465Requires prior use of @code{OPEN} or @code{CREATE}.
466
467@item CLEAR
468Discard the contents of the current archive, cancelling the effect of
469any operations since the last @code{SAVE}. May be executed (with no
470effect) even if no current archive is specified.
471
472@item CREATE @var{archive}
473Creates an archive, and makes it the current archive (required for many
474other commands). The new archive is created with a temporary name; it
475is not actually saved as @var{archive} until you use @code{SAVE}.
476You can overwrite existing archives; similarly, the contents of any
477existing file named @var{archive} will not be destroyed until @code{SAVE}.
478
479@item DELETE @var{module}, @var{module}, @dots{} @var{module}
480Delete each listed @var{module} from the current archive; equivalent to
481@samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
482
483Requires prior use of @code{OPEN} or @code{CREATE}.
484
485@item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
486@itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
487List each named @var{module} present in @var{archive}. The separate
488command @code{VERBOSE} specifies the form of the output: when verbose
489output is off, output is like that of @samp{ar -t @var{archive}
b703c078
DM
490@var{module}@dots{}}. When verbose output is on, the listing is like
491@samp{ar -tv @var{archive} @var{module}@dots{}}.
765a273f
RP
492
493Output normally goes to the standard output stream; however, if you
494specify @var{outputfile} as a final argument, @code{ar} directs the
495output to that file.
496
497@item END
498Exit from @code{ar}, with a @code{0} exit code to indicate successful
499completion. This command does not save the output file; if you have
500changed the current archive since the last @code{SAVE} command, those
501changes are lost.
502
503@item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
504Extract each named @var{module} from the current archive, writing them
505into the current directory as separate files. Equivalent to @samp{ar -x
b703c078 506@var{archive} @var{module}@dots{}}.
765a273f
RP
507
508Requires prior use of @code{OPEN} or @code{CREATE}.
509
510@ignore
511@c FIXME Tokens but no commands???
512@item FULLDIR
513
514@item HELP
515@end ignore
516
517@item LIST
518Display full contents of the current archive, in ``verbose'' style
519regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
520tv @var{archive}}). (This single command is a GNU @code{ld}
521enhancement, rather than present for MRI compatibility.)
522
523Requires prior use of @code{OPEN} or @code{CREATE}.
524
525@item OPEN @var{archive}
526Opens an existing archive for use as the current archive (required for
527many other commands). Any changes as the result of subsequent commands
528will not actually affect @var{archive} until you next use @code{SAVE}.
529
530@item REPLACE @var{module}, @var{module}, @dots{} @var{module}
531In the current archive, replace each existing @var{module} (named in
532the @code{REPLACE} arguments) from files in the current working directory.
533To execute this command without errors, both the file, and the module in
534the current archive, must exist.
535
536Requires prior use of @code{OPEN} or @code{CREATE}.
537
538@item VERBOSE
539Toggle an internal flag governing the output from @code{DIRECTORY}.
540When the flag is on, @code{DIRECTORY} output matches output from
b703c078 541@samp{ar -tv }@dots{}.
765a273f
RP
542
543@item SAVE
544Commit your changes to the current archive, and actually save it as a
545file with the name specified in the last @code{CREATE} or @code{OPEN}
546command.
547
548Requires prior use of @code{OPEN} or @code{CREATE}.
c72af735
RP
549
550@end table
551
8b2c2275
RP
552@iftex
553@node ld
c72af735
RP
554@chapter ld
555@cindex linker
556@kindex ld
557The GNU linker @code{ld} is now described in a separate manual.
27e94bd5 558@xref{Top,, Overview,, Using LD: the GNU linker}.
8b2c2275 559@end iftex
c72af735 560
eae04238 561@node nm
c72af735
RP
562@chapter nm
563@cindex symbols
564@kindex nm
565
566@smallexample
d6a4c375
DM
567nm [ -a | --debug-syms ] [ -g | --extern-only ]
568 [ -B ] [ -C | --demangle ]
6cfbdb50
DM
569 [ -s | --print-armap ] [ -A | -o | --print-file-name ]
570 [ -n | -v | --numeric-sort ] [ -p | --no-sort ]
4d9b5d5a 571 [ -r | --reverse-sort ] [ -u | --undefined-only ]
6cfbdb50
DM
572 [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
573 [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
b26ac613 574 [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ]
c72af735
RP
575@end smallexample
576
b703c078 577GNU @code{nm} lists the symbols from object files @var{objfile}@dots{}.
6cfbdb50
DM
578If no object files are listed as arguments, @code{nm} assumes
579@file{a.out}.
580
581For each symbol, @code{nm} shows:
582
583@itemize @bullet
584@item
585The symbol value, in the radix selected by options (see below), or
586hexadecimal by default.
587
588@item
589The symbol type. At least the following types are used; others are, as
590well, depending on the object file format. If lowercase, the symbol is
591local; if uppercase, the symbol is global (external).
592
593@c Some more detail on exactly what these symbol types are used for
594@c would be nice.
595@table @code
596@item A
597Absolute.
598
599@item B
600BSS (uninitialized data).
601
602@item C
603Common.
604
605@item D
606Initialized data.
607
608@item I
609Indirect reference.
610
611@item T
612Text (program code).
613
614@item U
615Undefined.
616@end table
617
618@item
619The symbol name.
620@end itemize
c72af735
RP
621
622The long and short forms of options, shown here as alternatives, are
623equivalent.
624
625@table @code
6cfbdb50
DM
626@item -A
627@itemx -o
628@itemx --print-file-name
629@cindex input file name
630@cindex file name
631@cindex source file name
632Precede each symbol by the name of the input file (or archive element)
633in which it was found, rather than identifying the input file once only,
634before all of its symbols.
c72af735
RP
635
636@item -a
918c2f61 637@itemx --debug-syms
c72af735 638@cindex debugging symbols
6cfbdb50
DM
639Display all symbols, even debugger-only symbols; normally these are not
640listed.
641
68dd5295
DM
642@item -B
643@cindex @code{nm} format
644@cindex @code{nm} compatibility
d6a4c375
DM
645The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}).
646
647@item -C
648@itemx --demangle
649@cindex demangling C++ symbols
650Decode (@dfn{demangle}) low-level symbol names into user-level names.
651Besides removing any initial underscore prepended by the system, this
652makes C++ function names readable. @xref{c++filt}, for more information
653on demangling.
68dd5295 654
6cfbdb50
DM
655@item -f @var{format}
656@itemx --format=@var{format}
68dd5295
DM
657@cindex @code{nm} format
658@cindex @code{nm} compatibility
6cfbdb50
DM
659Use the output format @var{format}, which can be @code{bsd},
660@code{sysv}, or @code{posix}. The default is @code{bsd}.
b26ac613 661Only the first character of @var{format} is significant; it can be
6cfbdb50 662either upper or lower case.
c72af735
RP
663
664@item -g
918c2f61 665@itemx --extern-only
c72af735
RP
666@cindex external symbols
667Display only external symbols.
668
b26ac613
DM
669@item -n
670@itemx -v
671@itemx --numeric-sort
672Sort symbols numerically by their addresses, rather than alphabetically
673by their names.
674
c72af735 675@item -p
918c2f61 676@itemx --no-sort
c72af735 677@cindex sorting symbols
650a49f0 678Do not bother to sort the symbols in any order; print them in the order
6cfbdb50
DM
679encountered.
680
681@item -P
682@itemx --portability
683Use the POSIX.2 standard output format instead of the default format.
684Equivalent to @samp{-f posix}.
c72af735 685
c72af735 686@item -s
918c2f61 687@itemx --print-armap
c72af735
RP
688@cindex symbol index, listing
689When listing symbols from archive members, include the index: a mapping
ec40bbb8
DM
690(stored in the archive by @code{ar} or @code{ranlib}) of which modules
691contain definitions for which names.
c72af735 692
c72af735 693@item -r
918c2f61 694@itemx --reverse-sort
ec40bbb8 695Reverse the order of the sort (whether numeric or alphabetic); let the
c72af735
RP
696last come first.
697
6cfbdb50
DM
698@item -t @var{radix}
699@itemx --radix=@var{radix}
700Use @var{radix} as the radix for printing the symbol values. It must be
701@samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
702
ec40bbb8 703@item --target=@var{bfdname}
c72af735
RP
704@cindex object code format
705Specify an object code format other than your system's default format.
eae04238 706@xref{Target Selection}, for more information.
c72af735
RP
707
708@item -u
918c2f61 709@itemx --undefined-only
c72af735
RP
710@cindex external symbols
711@cindex undefined symbols
712Display only undefined symbols (those external to each object file).
713
6cfbdb50
DM
714@item -V
715@itemx --version
b26ac613
DM
716Show the version number of @code{nm} and exit.
717
718@item --help
719Show a summary of the options to @code{nm} and exit.
c72af735
RP
720@end table
721
eae04238 722@node objcopy
eed5eeab
DM
723@chapter objcopy
724
725@smallexample
eae04238
DM
726objcopy [ -F @var{bfdname} | --target=@var{bfdname} ]
727 [ -I @var{bfdname} | --input-target=@var{bfdname} ]
728 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
eed5eeab
DM
729 [ -S | --strip-all ] [ -g | --strip-debug ]
730 [ -x | --discard-all ] [ -X | --discard-locals ]
f7b839f7
DM
731 [ -b @var{byte} | --byte=@var{byte} ]
732 [ -i @var{interleave} | --interleave=@var{interleave} ]
733 [ -v | --verbose ] [ -V | --version ] [ --help ]
eed5eeab
DM
734 @var{infile} [@var{outfile}]
735@end smallexample
736
8981cac5
JO
737The @sc{gnu} @code{objcopy} utility copies the contents of an object
738file to another. @code{objcopy} uses the @sc{gnu} @sc{bfd} Library to
739read and write the object files. It can write the destination object
740file in a format different from that of the source object file. The
741exact behavior of @code{objcopy} is controlled by command-line options.
eed5eeab
DM
742
743@code{objcopy} creates temporary files to do its translations and
8981cac5
JO
744deletes them afterward. @code{objcopy} uses @sc{bfd} to do all its
745translation work; it has access to all the formats described in @sc{bfd}
746and thus is able to recognize most formats without being told
747explicitly. @xref{BFD,,BFD,ld.info,Using LD}.
eed5eeab
DM
748
749@table @code
750@item @var{infile}
751@itemx @var{outfile}
8981cac5 752The source and output files, respectively.
eed5eeab
DM
753If you do not specify @var{outfile}, @code{objcopy} creates a
754temporary file and destructively renames the result with
8981cac5 755the name of @var{infile}.
eed5eeab 756
eae04238
DM
757@item -I @var{bfdname}
758@itemx --input-target=@var{bfdname}
759Consider the source file's object format to be @var{bfdname}, rather than
760attempting to deduce it. @xref{Target Selection}, for more information.
eed5eeab 761
eae04238
DM
762@item -O @var{bfdname}
763@itemx --output-target=@var{bfdname}
764Write the output file using the object format @var{bfdname}.
765@xref{Target Selection}, for more information.
eed5eeab 766
eae04238
DM
767@item -F @var{bfdname}
768@itemx --target=@var{bfdname}
769Use @var{bfdname} as the object format for both the input and the output
770file; i.e., simply transfer data from source to destination with no
771translation. @xref{Target Selection}, for more information.
eed5eeab
DM
772
773@item -S
774@itemx --strip-all
775Do not copy relocation and symbol information from the source file.
776
777@item -g
778@itemx --strip-debug
779Do not copy debugging symbols from the source file.
780
781@item -x
782@itemx --discard-all
783Do not copy non-global symbols from the source file.
784@c FIXME any reason to prefer "non-global" to "local" here?
785
786@item -X
787@itemx --discard-locals
788Do not copy compiler-generated local symbols.
789(These usually start with @samp{L} or @samp{.}.)
790
db2e6adb
DM
791@item -b @var{byte}
792@itemx --byte=@var{byte}
793Keep only every @var{byte}th byte of the input file (header data is not
f7b839f7
DM
794affected). @var{byte} can be in the range from 0 to @var{interleave}-1,
795where @var{interleave} is given by the @samp{-i} or @samp{--interleave}
796option, or the default of 4. This option is useful for creating files
8981cac5 797to program @sc{rom}. It is typically used with an @code{srec} output
f7b839f7
DM
798target.
799
800@item -i @var{interleave}
801@itemx --interleave=@var{interleave}
8981cac5
JO
802Only copy one out of every @var{interleave} bytes. Select which byte to
803copy with the @var{-b} or @samp{--byte} option. The default is 4.
804@code{objcopy} ignores this option if you do not specify either @samp{-b} or
805@samp{--byte}.
db2e6adb 806
eed5eeab
DM
807@item -V
808@itemx --version
809Show the version number of @code{objcopy}.
810
811@item -v
812@itemx --verbose
813Verbose output: list all object files modified. In the case of
814archives, @samp{objcopy -V} lists all members of the archive.
815
816@item --help
817Show a summary of the options to @code{objcopy}.
818@end table
819
eae04238 820@node objdump
c72af735
RP
821@chapter objdump
822
823@cindex object file information
824@kindex objdump
825
826@smallexample
10f2a7f6
JO
827objdump [ -a | --archive-headers ]
828 [ -b @var{bfdname} | --target=@var{bfdname} ]
eae04238
DM
829 [ -d | --disassemble ] [ -f | --file-headers ]
830 [ -h | --section-headers | --headers ] [ -i | --info ]
10f2a7f6
JO
831 [ -j @var{section} | --section=@var{section} ]
832 [ -l | --line-numbers ]
eae04238
DM
833 [ -m @var{machine} | --architecture=@var{machine} ] [ -r | --reloc ]
834 [ -s | --full-contents ] [ --stabs ] [ -t | --syms ]
835 [ -x | --all-headers ] [ --version ] [ --help ]
4d9b5d5a 836 @var{objfile}@dots{}
c72af735
RP
837@end smallexample
838
839@code{objdump} displays information about one or more object files.
840The options control what particular information to display. This
841information is mostly useful to programmers who are working on the
842compilation tools, as opposed to programmers who just want their
843program to compile and work.
844
b26ac613
DM
845@var{objfile}@dots{} are the object files to be examined. When you
846specify archives, @code{objdump} shows information on each of the member
847object files.
848
c72af735 849The long and short forms of options, shown here as alternatives, are
ed78872a 850equivalent. At least one option besides @samp{-l} must be given.
c72af735
RP
851
852@table @code
c72af735 853@item -a
eae04238 854@itemx --archive-header
c72af735 855@cindex archive headers
ec40bbb8 856If any of the @var{objfile} files are archives, display the archive
c72af735
RP
857header information (in a format similar to @samp{ls -l}). Besides the
858information you could list with @samp{ar tv}, @samp{objdump -a} shows
859the object file format of each archive member.
860
c72af735 861@item -b @var{bfdname}
eae04238 862@itemx --target=@var{bfdname}
c72af735 863@cindex object code format
ec40bbb8
DM
864Specify that the object-code format for the object files is
865@var{bfdname}. This option may not be necessary; @var{objdump} can
866automatically recognize many formats.
867
868For example,
c72af735
RP
869@example
870objdump -b oasys -m vax -h fu.o
871@end example
872@noindent
ec40bbb8
DM
873displays summary information from the section headers (@samp{-h}) of
874@file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object
c72af735
RP
875file in the format produced by Oasys compilers. You can list the
876formats available with the @samp{-i} option.
eae04238 877@xref{Target Selection}, for more information.
c72af735
RP
878
879@item -d
eae04238 880@itemx --disassemble
c72af735
RP
881@cindex disassembling object code
882@cindex machine instructions
eae04238 883Display the assembler mnemonics for the machine
ec40bbb8 884instructions from @var{objfile}.
c72af735
RP
885
886@item -f
eae04238 887@itemx --file-header
c72af735 888@cindex object file header
eae04238 889Display summary information from the overall header of
ec40bbb8 890each of the @var{objfile} files.
c72af735
RP
891
892@item -h
eae04238 893@itemx --section-header
c5f0c938 894@itemx --header
c72af735 895@cindex section headers
eae04238 896Display summary information from the section headers of the
c72af735
RP
897object file.
898
db2e6adb
DM
899File segments may be relocated to nonstandard addresses, for example by
900using the @samp{-Ttext}, @samp{-Tdata}, or @samp{-Tbss} options to
901@code{ld}. However, some object file formats, such as a.out, do not
902store the starting address of the file segments. In those situations,
903although @code{ld} relocates the sections correctly, using @samp{objdump
904-h} to list the file section headers cannot show the correct addresses.
905Instead, it shows the usual addresses, which are implicit for the
906target.
907
b26ac613
DM
908@item --help
909Print a summary of the options to @code{objdump} and exit.
910
c72af735 911@item -i
eae04238 912@itemx --info
c72af735
RP
913@cindex architectures available
914@cindex object formats available
915Display a list showing all architectures and object formats available
ec40bbb8 916for specification with @samp{-b} or @samp{-m}.
c72af735 917
c72af735 918@item -j @var{name}
eae04238 919@itemx --section=@var{name}
c72af735 920@cindex section information
ec40bbb8 921Display information only for section @var{name}.
c72af735 922
c72af735 923@item -l
eae04238 924@itemx --line-numbers
c72af735 925@cindex source filenames for object files
eae04238
DM
926Label the display (using debugging information) with the filename
927and source line numbers corresponding to the object code shown.
928Only useful with @samp{-d}.
c72af735 929
c72af735 930@item -m @var{machine}
eae04238 931@itemx --architecture=@var{machine}
c72af735 932@cindex architecture
ec40bbb8 933Specify that the object files @var{objfile} are for architecture
c72af735
RP
934@var{machine}. You can list available architectures using the @samp{-i}
935option.
936
937@item -r
c5f0c938 938@itemx --reloc
c72af735 939@cindex relocation entries, in object file
eae04238 940Print the relocation entries of the file.
c72af735
RP
941
942@item -s
eae04238 943@itemx --full-contents
c72af735
RP
944@cindex sections, full contents
945@cindex object file sections
946Display the full contents of any sections requested.
947
c5f0c938
JG
948@item --stabs
949@cindex stab
950@cindex .stab
951@cindex debug symbols
952@cindex ELF object file format
c3c93fda
JG
953Display the full contents of any sections requested. Display the
954contents of the .stab and .stab.index and .stab.excl sections from an
955ELF file. This is only useful on systems (such as Solaris 2.0) in which
956@code{.stab} debugging symbol-table entries are carried in an ELF
957section. In most other file formats, debugging symbol-table entries are
c5f0c938
JG
958interleaved with linkage symbols, and are visible in the @samp{--syms}
959output.
960
c72af735 961@item -t
c5f0c938 962@itemx --syms
c72af735 963@cindex symbol table entries, printing
eae04238 964Print the symbol table entries of the file.
c72af735
RP
965This is similar to the information provided by the @samp{nm} program.
966
b26ac613
DM
967@item --version
968Print the version number of @code{objdump} and exit.
969
c72af735 970@item -x
eae04238 971@itemx --all-header
c72af735
RP
972@cindex all header information, object file
973@cindex header information, all
974Display all available header information, including the symbol table and
975relocation entries. Using @samp{-x} is equivalent to specifying all of
976@samp{-a -f -h -r -t}.
c72af735
RP
977@end table
978
eae04238 979@node ranlib
c72af735
RP
980@chapter ranlib
981
982@kindex ranlib
983@cindex archive contents
984@cindex symbol index
985
986@smallexample
4d9b5d5a 987ranlib [-vV] @var{archive}
c72af735
RP
988@end smallexample
989
ec40bbb8 990@code{ranlib} generates an index to the contents of an archive and
c72af735
RP
991stores it in the archive. The index lists each symbol defined by a
992member of an archive that is a relocatable object file.
993
918c2f61 994You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
c72af735 995
ec40bbb8 996An archive with such an index speeds up linking to the library and
c72af735
RP
997allows routines in the library to call each other without regard to
998their placement in the archive.
999
1000The GNU @code{ranlib} program is another form of GNU @code{ar}; running
1001@code{ranlib} is completely equivalent to executing @samp{ar -s}.
1002@xref{ar}.
1003
4d9b5d5a
DM
1004@table @code
1005@item -v
1006@itemx -V
1007Show the version number of @code{ranlib}.
c3f471a4 1008@end table
4d9b5d5a 1009
eae04238 1010@node size
c72af735
RP
1011@chapter size
1012
1013@kindex size
1014@cindex section sizes
1015
1016@smallexample
4d9b5d5a
DM
1017size [ -A | -B | --format=@var{compatibility} ]
1018 [ --help ] [ -d | -o | -x | --radix=@var{number} ]
1019 [ --target=@var{bfdname} ] [ -V | --version ]
1020 @var{objfile}@dots{}
c72af735
RP
1021@end smallexample
1022
1023The GNU @code{size} utility lists the section sizes---and the total
ec40bbb8
DM
1024size---for each of the object or archive files @var{objfile} in its
1025argument list. By default, one line of output is generated for each
1026object file or each module in an archive.
c72af735 1027
b26ac613
DM
1028@var{objfile}@dots{} are the object files to be examined.
1029
c72af735 1030The command line options have the following meanings:
c72af735 1031
b26ac613 1032@table @code
c72af735
RP
1033@item -A
1034@itemx -B
ec40bbb8 1035@itemx --format=@var{compatibility}
68dd5295 1036@cindex @code{size} display format
c72af735
RP
1037Using one of these options, you can choose whether the output from GNU
1038@code{size} resembles output from System V @code{size} (using @samp{-A},
ec40bbb8
DM
1039or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or
1040@samp{--format=berkeley}). The default is the one-line format similar to
c72af735 1041Berkeley's.
918c2f61
PB
1042@c Bonus for doc-source readers: you can also say --format=strange (or
1043@c anything else that starts with 's') for sysv, and --format=boring (or
c72af735
RP
1044@c anything else that starts with 'b') for Berkeley.
1045
1046Here is an example of the Berkeley (default) format of output from
1047@code{size}:
1048@smallexample
eae04238 1049size --format=Berkeley ranlib size
c72af735
RP
1050text data bss dec hex filename
1051294880 81920 11592 388392 5ed28 ranlib
1052294880 81920 11888 388688 5ee50 size
1053@end smallexample
1054
1055@noindent
1056This is the same data, but displayed closer to System V conventions:
1057
1058@smallexample
eae04238 1059size --format=SysV ranlib size
c72af735
RP
1060ranlib :
1061section size addr
1062.text 294880 8192
1063.data 81920 303104
1064.bss 11592 385024
1065Total 388392
1066
1067
1068size :
1069section size addr
1070.text 294880 8192
1071.data 81920 303104
1072.bss 11888 385024
1073Total 388688
1074@end smallexample
1075
918c2f61 1076@item --help
c72af735
RP
1077Show a summary of acceptable arguments and options.
1078
1079@item -d
1080@itemx -o
1081@itemx -x
ec40bbb8 1082@itemx --radix=@var{number}
68dd5295 1083@cindex @code{size} number format
c72af735
RP
1084@cindex radix for section sizes
1085Using one of these options, you can control whether the size of each
ec40bbb8
DM
1086section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal
1087(@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or
1088@samp{--radix=16}). In @samp{--radix=@var{number}}, only the three
c72af735
RP
1089values (8, 10, 16) are supported. The total size is always given in two
1090radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
1091octal and hexadecimal if you're using @samp{-o}.
1092
ec40bbb8 1093@item --target=@var{bfdname}
c72af735 1094@cindex object code format
ec40bbb8
DM
1095Specify that the object-code format for @var{objfile} is
1096@var{bfdname}. This option may not be necessary; @code{size} can
eae04238
DM
1097automatically recognize many formats.
1098@xref{Target Selection}, for more information.
c72af735
RP
1099
1100@item -V
918c2f61 1101@itemx --version
4d9b5d5a 1102Display the version number of @code{size}.
c72af735
RP
1103@end table
1104
eae04238 1105@node strings
ba7c8e29
DM
1106@chapter strings
1107@kindex strings
1108@cindex listings strings
1109@cindex printing strings
1110@cindex strings, printing
1111
1112@smallexample
b26ac613 1113strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-]
650a49f0 1114 [--all] [--print-file-name] [--bytes=@var{min-len}]
eae04238
DM
1115 [--radix=@var{radix}] [--target=@var{bfdname}]
1116 [--help] [--version] @var{file}@dots{}
ba7c8e29
DM
1117@end smallexample
1118
1119For each @var{file} given, GNU @code{strings} prints the printable
1120character sequences that are at least 4 characters long (or the number
1121given with the options below) and are followed by a NUL or newline
1122character. By default, it only prints the strings from the initialized
1123data sections of object files; for other types of files, it prints the
1124strings from the whole file.
1125
1126@code{strings} is mainly useful for determining the contents of non-text
1127files.
1128
1129@table @code
1130@item -a
1131@itemx --all
1132@itemx -
1133Do not scan only the initialized data section of object files; scan
1134the whole files.
1135
1136@item -f
1137@itemx --print-file-name
1138Print the name of the file before each string.
1139
b26ac613 1140@item --help
ba7c8e29
DM
1141Print a summary of the program usage on the standard output and exit.
1142
ba7c8e29 1143@itemx -@var{min-len}
b26ac613 1144@item -n @var{min-len}
ba7c8e29
DM
1145@itemx --bytes=@var{min-len}
1146Print sequences of characters that are at least @var{min-len} characters
1147long, instead of the default 4.
1148
1149@item -o
b26ac613
DM
1150Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o}
1151act like @samp{-t d} instead. Since we can not be compatible with both
1152ways, we simply chose one.
ba7c8e29
DM
1153
1154@item -t @var{radix}
1155@itemx --radix=@var{radix}
1156Print the offset within the file before each string. The single
1157character argument specifies the radix of the offset---@samp{o} for
1158octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
1159
eae04238
DM
1160@item --target=@var{bfdname}
1161@cindex object code format
1162Specify an object code format other than your system's default format.
1163@xref{Target Selection}, for more information.
1164
ba7c8e29
DM
1165@item -v
1166@itemx --version
1167Print the program version number on the standard output and exit.
1168@end table
1169
eae04238 1170@node strip
c72af735
RP
1171@chapter strip
1172
1173@kindex strip
1174@cindex removing symbols
1175@cindex discarding symbols
1815e42c 1176@cindex symbols, discarding
c72af735
RP
1177
1178@smallexample
eae04238
DM
1179strip [ -F @var{bfdname} | --target=@var{bfdname} | --target=@var{bfdname} ]
1180 [ -I @var{bfdname} | --input-target=@var{bfdname} ]
1181 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
b703c078
DM
1182 [ -s | --strip-all ] [ -S | -g | --strip-debug ]
1183 [ -x | --discard-all ] [ -X | --discard-locals ]
b26ac613 1184 [ -v | --verbose ] [ -V | --version ] [ --help ]
b703c078 1185 @var{objfile}@dots{}
c72af735
RP
1186@end smallexample
1187
e31e9a8d 1188GNU @code{strip} discards all symbols from object files
ec40bbb8 1189@var{objfile}. The list of object files may include archives.
b26ac613 1190At least one object file must be given.
c72af735 1191
ec40bbb8 1192@code{strip} modifies the files named in its argument,
c72af735 1193rather than writing modified copies under different names.
c72af735 1194
c72af735 1195@table @code
eae04238
DM
1196@item -F @var{bfdname}
1197@itemx --target=@var{bfdname}
b26ac613 1198Treat the original @var{objfile} as a file with the object
eae04238
DM
1199code format @var{bfdname}, and rewrite it in the same format.
1200@xref{Target Selection}, for more information.
b26ac613
DM
1201
1202@item --help
1203Show a summary of the options to @code{strip} and exit.
1204
eae04238
DM
1205@item -I @var{bfdname}
1206@itemx --input-target=@var{bfdname}
ec40bbb8 1207Treat the original @var{objfile} as a file with the object
eae04238
DM
1208code format @var{bfdname}.
1209@xref{Target Selection}, for more information.
918c2f61 1210
eae04238
DM
1211@item -O @var{bfdname}
1212@itemx --output-target=@var{bfdname}
1213Replace @var{objfile} with a file in the output format @var{bfdname}.
1214@xref{Target Selection}, for more information.
918c2f61 1215
b703c078
DM
1216@item -s
1217@itemx --strip-all
1218Remove all symbols.
1219
918c2f61
PB
1220@item -g
1221@itemx -S
1222@itemx --strip-debug
1223Remove debugging symbols only.
1224
1225@item -x
1226@itemx --discard-all
1227Remove non-global symbols.
1228
1229@item -X
1230@itemx --discard-locals
1231Remove compiler-generated local symbols.
ec40bbb8 1232(These usually start with @samp{L} or @samp{.}.)
918c2f61
PB
1233
1234@item -V
1235@itemx --version
ec40bbb8 1236Show the version number for @code{strip}.
918c2f61 1237
1815e42c 1238@item -v
918c2f61
PB
1239@itemx --verbose
1240Verbose output: list all object files modified. In the case of
1269d441 1241archives, @samp{strip -v} lists all members of the archive.
c72af735
RP
1242@end table
1243
eae04238 1244@node c++filt
b6216af2
PB
1245@chapter c++filt
1246
1247@kindex c++filt
1248@cindex demangling C++ symbols
1249
b26ac613
DM
1250@smallexample
1251c++filt [ -_ | --strip-underscores ]
1252 [ -s @var{format} | --format=@var{format} ]
d6a4c375 1253 [ --help ] [ --version ] [ @var{symbol}@dots{} ]
b26ac613
DM
1254@end smallexample
1255
6c69b6bd
JO
1256The C++ language provides function overloading, which means that you can
1257write many functions with the same name (providing each takes parameters
1258of different types). All C++ function names are encoded into a
b26ac613 1259low-level assembly label (this process is known as
6c69b6bd
JO
1260@dfn{mangling}). The @code{c++filt} program does the inverse mapping: it
1261decodes (@dfn{demangles}) low-level names into user-level names so that
1262the linker can keep these overloaded functions from clashing.
1263
1264Every alphanumeric word (consisting of letters, digits, underscores,
1265dollars, or periods) seen in the input is a potential label. If the
1266label decodes into a C++ name, the C++ name replaces the low-level
1267name in the output.
b6216af2 1268
d6a4c375 1269You can use @code{c++filt} to decipher individual symbols:
6c69b6bd
JO
1270
1271@example
1272c++filt @var{symbol}
1273@end example
1274
d6a4c375
DM
1275If no @var{symbol} arguments are given, @code{c++filt} reads symbol
1276names from the standard input and writes the demangled names to the
1277standard output. All results are printed on the standard output.
b6216af2 1278
b26ac613
DM
1279@table @code
1280@item -_
94e9ad77 1281@itemx --strip-underscores
b26ac613
DM
1282On some systems, both the C and C++ compilers put an underscore in front
1283of every name. For example, the C name @code{foo} gets the low-level
1284name @code{_foo}. This option removes the initial underscore.
1285
1286@item -s @var{format}
1287@itemx --format=@var{format}
1288GNU @code{nm} can decode three different methods of mangling, used by
1289different C++ compilers. The argument to this option selects which
1290method it uses:
1291
1292@table @code
1293@item gnu
1294the one used by the GNU compiler (the default method)
1295@item lucid
1296the one used by the Lucid compiler
1297@item arm
1298the one specified by the C++ Annotated Reference Manual
1299@end table
1300
1301@item --help
1302Print a summary of the options to @code{c++filt} and exit.
1303
1304@item --version
1305Print the version number of @code{c++filt} and exit.
1306@end table
b6216af2 1307
5eac46ae
JO
1308@quotation
1309@emph{Warning:} @code{c++filt} is a new utility, and the details of its
1310user interface are subject to change in future releases. In particular,
1311a command-line option may be required in the the future to decode a name
1312passed as an argument on the command line; in other words,
1313
1314@example
b26ac613 1315c++filt @var{symbol}
5eac46ae
JO
1316@end example
1317
1318@noindent
1319may in a future release become
1320
1321@example
b26ac613 1322c++filt @var{option} @var{symbol}
5eac46ae
JO
1323@end example
1324@end quotation
1325
eae04238 1326@node nlmconv
94e9ad77
JO
1327@chapter nlmconv
1328
1329@code{nlmconv} converts a relocatable object file into a NetWare
8981cac5
JO
1330Loadable Module.
1331
1332@ignore
1333@code{nlmconv} currently works with @samp{i386} object
4961ce5b
JO
1334files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
1335object files in @sc{elf}, or @code{a.out} format@footnote{
1336@code{nlmconv} should work with any @samp{i386} or @sc{sparc} object
1337format in the Binary File Descriptor library. It has only been tested
1338with the above formats.}.
8981cac5 1339@end ignore
4961ce5b
JO
1340
1341@quotation
1342@emph{Warning:} @code{nlmconv} is not always built as part of the binary
1343utilities, since it is only useful for NLM targets.
1344@end quotation
94e9ad77
JO
1345
1346@smallexample
eae04238
DM
1347nlmconv [ -I @var{bfdname} | --input-target=@var{bfdname} ]
1348 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
94e9ad77
JO
1349 [ -T @var{headerfile} | --header-file=@var{headerfile} ]
1350 [ -h | --help ] [ -V | --version ]
1351 @var{infile} @var{outfile}
1352@end smallexample
1353
1354@code{nlmconv} converts the relocatable @samp{i386} object file
1355@var{infile} into the NetWare Loadable Module @var{outfile}, optionally
1356reading @var{headerfile} for NLM header information. For instructions
5b0ba16d
JO
1357on writing the NLM command file language used in header files, see the
1358@samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
1359Development and Tools Overview}, which is part of the NLM Software
1360Developer's Kit (``NLM SDK''), available from Novell, Inc.
1361@code{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
eae04238 1362@var{infile}; see @ref{BFD,,BFD,ld.info,Using LD}, for
5b0ba16d 1363more information.
94e9ad77
JO
1364
1365@table @code
eae04238
DM
1366@item -I @var{bfdname}
1367@itemx --input-target=@var{bfdname}
94e9ad77 1368Object format of the input file. @code{nlmconv} can usually determine
eae04238
DM
1369the format of a given file (so no default is necessary).
1370@xref{Target Selection}, for more information.
94e9ad77 1371
eae04238
DM
1372@item -O @var{bfdname}
1373@itemx --output-target=@var{bfdname}
94e9ad77
JO
1374Object format of the output file. @code{nlmconv} infers the output
1375format based on the input format, e.g. for a @samp{i386} input file the
eae04238
DM
1376output format is @samp{nlm32-i386}.
1377@xref{Target Selection}, for more information.
94e9ad77
JO
1378
1379@item -T @var{headerfile}
1380@itemx --header-file=@var{headerfile}
1381Reads @var{headerfile} for NLM header information. For instructions on
5b0ba16d
JO
1382writing the NLM command file language used in header files, see@ see the
1383@samp{linkers} section, of the @cite{NLM Development and Tools
1384Overview}, which is part of the NLM Software Developer's Kit, available
1385from Novell, Inc.
94e9ad77
JO
1386
1387@item -h
1388@itemx --help
1389Prints a usage summary.
1390
1391@item -V
1392@itemx --version
1393Prints the version number for @code{nlmconv}.
1394@end table
1395
eae04238
DM
1396@node Selecting The Target System
1397@chapter Selecting the target system
1398
8981cac5
JO
1399You can specify three aspects of the target system to the @sc{gnu}
1400binary file utilities, each in several ways:
eae04238
DM
1401
1402@itemize @bullet
1403@item
8981cac5 1404the target
eae04238
DM
1405
1406@item
8981cac5 1407the architecture
eae04238
DM
1408
1409@item
8981cac5 1410the linker emulation (which applies to the linker only)
eae04238
DM
1411@end itemize
1412
1413In the following summaries, the lists of ways to specify values are in
8981cac5
JO
1414order of decreasing precedence. The ways listed first override those
1415listed later.
eae04238 1416
8981cac5
JO
1417The commands to list valid values only list the values for which the
1418programs you are running were configured. If they were configured with
eae04238
DM
1419@samp{--with-targets=all}, the commands list most of the available
1420values, but a few are left out; not all targets can be configured in at
8981cac5
JO
1421once because some of them can only be configured @dfn{native} (on hosts
1422with the same type as the target system).
eae04238
DM
1423
1424@menu
1425* Target Selection::
1426* Architecture Selection::
1427* Linker Emulation Selection::
1428@end menu
1429
1430@node Target Selection
8981cac5 1431@section Target Selection
eae04238
DM
1432
1433A @dfn{target} is an object file format. A given target may be
1434supported for multiple architectures (@pxref{Architecture Selection}).
8981cac5
JO
1435A target selection may also have variations for different operating
1436systems or architectures.
eae04238 1437
8981cac5
JO
1438The command to list valid target values is @samp{objdump -i}
1439(the first column of output contains the relevant information).
eae04238 1440
10f2a7f6
JO
1441Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
1442@samp{a.out-sunos-big}.
eae04238 1443
8981cac5 1444@subheading @code{objdump} Target
eae04238
DM
1445
1446Ways to specify:
1447
1448@enumerate
1449@item
8981cac5 1450command line option: @samp{-b} or @samp{--target}
eae04238
DM
1451
1452@item
1453environment variable @code{GNUTARGET}
1454
1455@item
1456deduced from the input file
1457@end enumerate
1458
8981cac5 1459@subheading @code{objcopy} and @code{strip} Input Target
eae04238
DM
1460
1461Ways to specify:
1462
1463@enumerate
1464@item
8981cac5 1465command line options: @samp{-I} or @samp{--input-target}, or @samp{-F} or @samp{--target}
eae04238
DM
1466
1467@item
1468environment variable @code{GNUTARGET}
1469
1470@item
1471deduced from the input file
1472@end enumerate
1473
8981cac5 1474@subheading @code{objcopy} and @code{strip} Output Target
eae04238
DM
1475
1476Ways to specify:
1477
1478@enumerate
1479@item
8981cac5 1480command line options: @samp{-O} or @samp{--output-target}, or @samp{-F} or @samp{--target}
eae04238
DM
1481
1482@item
8981cac5 1483the input target (see ``@code{objcopy} and @code{strip} Input Target'' above)
eae04238
DM
1484
1485@item
1486environment variable @code{GNUTARGET}
1487
1488@item
1489deduced from the input file
1490@end enumerate
1491
8981cac5 1492@subheading @code{nm}, @code{size}, and @code{strings} Target
eae04238
DM
1493
1494Ways to specify:
1495
1496@enumerate
1497@item
8981cac5 1498command line option: @samp{--target}
eae04238
DM
1499
1500@item
1501environment variable @code{GNUTARGET}
1502
1503@item
1504deduced from the input file
1505@end enumerate
1506
8981cac5 1507@subheading Linker Input Target
eae04238
DM
1508
1509Ways to specify:
1510
1511@enumerate
1512@item
8981cac5 1513command line option: @samp{-b} or @samp{--format}
eae04238
DM
1514(@pxref{Options,,Options,ld.info,Using LD})
1515
1516@item
1517script command @code{TARGET}
1518(@pxref{Option Commands,,Option Commands,ld.info,Using LD})
1519
1520@item
1521environment variable @code{GNUTARGET}
1522(@pxref{Environment,,Environment,ld.info,Using LD})
1523
1524@item
1525the default target of the selected linker emulation
1526(@pxref{Linker Emulation Selection})
1527@end enumerate
1528
8981cac5 1529@subheading Linker Output Target
eae04238
DM
1530
1531Ways to specify:
1532
1533@enumerate
1534@item
8981cac5 1535command line option: @samp{-oformat}
eae04238
DM
1536(@pxref{Options,,Options,ld.info,Using LD})
1537
1538@item
1539script command @code{OUTPUT_FORMAT}
1540(@pxref{Option Commands,,Option Commands,ld.info,Using LD})
1541
1542@item
8981cac5 1543the linker input target (see ``Linker Input Target'' above)
eae04238
DM
1544@end enumerate
1545
1546@node Architecture Selection
1547@section Architecture selection
1548
8981cac5
JO
1549An @dfn{architecture} is a type of @sc{cpu} on which an object file is
1550to run. Its name may contain a colon, separating the name of the
1551processor family from the name of the particular @sc{cpu}.
eae04238 1552
8981cac5
JO
1553The command to list valid architecture values is @samp{objdump -i} (the
1554second column contains the relevant information).
eae04238
DM
1555
1556Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
1557
8981cac5 1558@subheading @code{objdump} Architecture
eae04238
DM
1559
1560Ways to specify:
1561
1562@enumerate
1563@item
8981cac5 1564command line option: @samp{-m} or @samp{--architecture}
eae04238
DM
1565
1566@item
1567deduced from the input file
1568@end enumerate
1569
8981cac5 1570@subheading @code{objcopy}, @code{nm}, @code{size}, @code{strings} Architecture
eae04238
DM
1571
1572Ways to specify:
1573
1574@enumerate
1575@item
1576deduced from the input file
1577@end enumerate
1578
8981cac5 1579@subheading Linker Input Architecture
eae04238
DM
1580
1581Ways to specify:
1582
1583@enumerate
1584@item
1585deduced from the input file
1586@end enumerate
1587
8981cac5 1588@subheading Linker Output Architecture
eae04238
DM
1589
1590Ways to specify:
1591
1592@enumerate
1593@item
1594script command @code{OUTPUT_ARCH}
1595(@pxref{Option Commands,,Option Commands,ld.info,Using LD})
1596
1597@item
1598the default architecture from the linker output target
8981cac5 1599(@pxref{Target Selection})
eae04238
DM
1600@end enumerate
1601
1602@node Linker Emulation Selection
1603@section Linker emulation selection
1604
1605A linker @dfn{emulation} is a ``personality'' of the linker, which gives
1606the linker default values for the other aspects of the target system.
1607In particular, it consists of
1608
1609@itemize @bullet
1610@item
8981cac5 1611the linker script
eae04238
DM
1612
1613@item
8981cac5 1614the target
eae04238
DM
1615
1616@item
1617several ``hook'' functions that are run at certain stages of the linking
8981cac5 1618process to do special things that some targets require
eae04238
DM
1619@end itemize
1620
8981cac5 1621The command to list valid linker emulation values is @samp{ld -V}.
eae04238
DM
1622
1623Sample values: @samp{hp300bsd}, @samp{mipslit}, @samp{sun4}.
1624
1625Ways to specify:
1626
1627@enumerate
1628@item
8981cac5 1629command line option: @samp{-m}
eae04238
DM
1630(@pxref{Options,,Options,ld.info,Using LD})
1631
1632@item
1633environment variable @code{LDEMULATION}
1634
1635@item
1636compiled-in @code{DEFAULT_EMULATION} from @file{Makefile},
1637which comes from @code{EMUL} in @file{config/@var{target}.mt}
1638@end enumerate
1639
1640@node Index
c72af735
RP
1641@unnumbered Index
1642
1643@printindex cp
1644
1645@contents
1646@bye
This page took 0.203616 seconds and 4 git commands to generate.