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