binutils/
[deliverable/binutils-gdb.git] / binutils / doc / binutils.texi
... / ...
CommitLineData
1\input texinfo @c -*- Texinfo -*-
2@setfilename binutils.info
3@settitle @sc{gnu} Binary Utilities
4@finalout
5@synindex ky cp
6
7@c man begin INCLUDE
8@include bfdver.texi
9@c man end
10
11@copying
12@c man begin COPYRIGHT
13Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
141999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
152010, 2011, 2012, 2013
16Free Software Foundation, Inc.
17
18Permission is granted to copy, distribute and/or modify this document
19under the terms of the GNU Free Documentation License, Version 1.3
20or any later version published by the Free Software Foundation;
21with no Invariant Sections, with no Front-Cover Texts, and with no
22Back-Cover Texts. A copy of the license is included in the
23section entitled ``GNU Free Documentation License''.
24
25@c man end
26@end copying
27
28@dircategory Software development
29@direntry
30* Binutils: (binutils). The GNU binary utilities.
31@end direntry
32
33@dircategory Individual utilities
34@direntry
35* addr2line: (binutils)addr2line. Convert addresses to file and line.
36* ar: (binutils)ar. Create, modify, and extract from archives.
37* c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols.
38* cxxfilt: (binutils)c++filt. MS-DOS name for c++filt.
39* dlltool: (binutils)dlltool. Create files needed to build and use DLLs.
40* nlmconv: (binutils)nlmconv. Converts object code into an NLM.
41* nm: (binutils)nm. List symbols from object files.
42* objcopy: (binutils)objcopy. Copy and translate object files.
43* objdump: (binutils)objdump. Display information from object files.
44* ranlib: (binutils)ranlib. Generate index to archive contents.
45* readelf: (binutils)readelf. Display the contents of ELF format files.
46* size: (binutils)size. List section sizes and total size.
47* strings: (binutils)strings. List printable strings from files.
48* strip: (binutils)strip. Discard symbols.
49* elfedit: (binutils)elfedit. Update the ELF header of ELF files.
50* windmc: (binutils)windmc. Generator for Windows message resources.
51* windres: (binutils)windres. Manipulate Windows resources.
52@end direntry
53
54@titlepage
55@title The @sc{gnu} Binary Utilities
56@ifset VERSION_PACKAGE
57@subtitle @value{VERSION_PACKAGE}
58@end ifset
59@subtitle Version @value{VERSION}
60@sp 1
61@subtitle @value{UPDATED}
62@author Roland H. Pesch
63@author Jeffrey M. Osier
64@author Cygnus Support
65@page
66
67@tex
68{\parskip=0pt \hfill Cygnus Support\par \hfill
69Texinfo \texinfoversion\par }
70@end tex
71
72@vskip 0pt plus 1filll
73@insertcopying
74@end titlepage
75@contents
76
77@node Top
78@top Introduction
79
80@cindex version
81This brief manual contains documentation for the @sc{gnu} binary
82utilities
83@ifset VERSION_PACKAGE
84@value{VERSION_PACKAGE}
85@end ifset
86version @value{VERSION}:
87
88@iftex
89@table @code
90@item ar
91Create, modify, and extract from archives
92
93@item nm
94List symbols from object files
95
96@item objcopy
97Copy and translate object files
98
99@item objdump
100Display information from object files
101
102@item ranlib
103Generate index to archive contents
104
105@item readelf
106Display the contents of ELF format files.
107
108@item size
109List file section sizes and total size
110
111@item strings
112List printable strings from files
113
114@item strip
115Discard symbols
116
117@item elfedit
118Update the ELF header of ELF files.
119
120@item c++filt
121Demangle encoded C++ symbols (on MS-DOS, this program is named
122@code{cxxfilt})
123
124@item addr2line
125Convert addresses into file names and line numbers
126
127@item nlmconv
128Convert object code into a Netware Loadable Module
129
130@item windres
131Manipulate Windows resources
132
133@item windmc
134Generator for Windows message resources
135
136@item dlltool
137Create the files needed to build and use Dynamic Link Libraries
138@end table
139@end iftex
140
141This document is distributed under the terms of the GNU Free
142Documentation License version 1.3. A copy of the license is included
143in the section entitled ``GNU Free Documentation License''.
144
145@menu
146* ar:: Create, modify, and extract from archives
147* nm:: List symbols from object files
148* objcopy:: Copy and translate object files
149* objdump:: Display information from object files
150* ranlib:: Generate index to archive contents
151* size:: List section sizes and total size
152* strings:: List printable strings from files
153* strip:: Discard symbols
154* c++filt:: Filter to demangle encoded C++ symbols
155* cxxfilt: c++filt. MS-DOS name for c++filt
156* addr2line:: Convert addresses to file and line
157* nlmconv:: Converts object code into an NLM
158* windmc:: Generator for Windows message resources
159* windres:: Manipulate Windows resources
160* dlltool:: Create files needed to build and use DLLs
161* readelf:: Display the contents of ELF format files
162* elfedit:: Update the ELF header of ELF files
163* Common Options:: Command-line options for all utilities
164* Selecting the Target System:: How these utilities determine the target
165* Reporting Bugs:: Reporting Bugs
166* GNU Free Documentation License:: GNU Free Documentation License
167* Binutils Index:: Binutils Index
168@end menu
169
170@node ar
171@chapter ar
172
173@kindex ar
174@cindex archives
175@cindex collections of files
176
177@c man title ar create, modify, and extract from archives
178
179@smallexample
180ar [@option{--plugin} @var{name}] [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] [@option{--target} @var{bfdname}] @var{archive} [@var{member}@dots{}]
181ar -M [ <mri-script ]
182@end smallexample
183
184@c man begin DESCRIPTION ar
185
186The @sc{gnu} @command{ar} program creates, modifies, and extracts from
187archives. An @dfn{archive} is a single file holding a collection of
188other files in a structure that makes it possible to retrieve
189the original individual files (called @dfn{members} of the archive).
190
191The original files' contents, mode (permissions), timestamp, owner, and
192group are preserved in the archive, and can be restored on
193extraction.
194
195@cindex name length
196@sc{gnu} @command{ar} can maintain archives whose members have names of any
197length; however, depending on how @command{ar} is configured on your
198system, a limit on member-name length may be imposed for compatibility
199with archive formats maintained with other tools. If it exists, the
200limit is often 15 characters (typical of formats related to a.out) or 16
201characters (typical of formats related to coff).
202
203@cindex libraries
204@command{ar} is considered a binary utility because archives of this sort
205are most often used as @dfn{libraries} holding commonly needed
206subroutines.
207
208@cindex symbol index
209@command{ar} creates an index to the symbols defined in relocatable
210object modules in the archive when you specify the modifier @samp{s}.
211Once created, this index is updated in the archive whenever @command{ar}
212makes a change to its contents (save for the @samp{q} update operation).
213An archive with such an index speeds up linking to the library, and
214allows routines in the library to call each other without regard to
215their placement in the archive.
216
217You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
218table. If an archive lacks the table, another form of @command{ar} called
219@command{ranlib} can be used to add just the table.
220
221@cindex thin archives
222@sc{gnu} @command{ar} can optionally create a @emph{thin} archive,
223which contains a symbol index and references to the original copies
224of the member files of the archives. Such an archive is useful
225for building libraries for use within a local build, where the
226relocatable objects are expected to remain available, and copying the
227contents of each object would only waste time and space. Thin archives
228are also @emph{flattened}, so that adding one or more archives to a
229thin archive will add the elements of the nested archive individually.
230The paths to the elements of the archive are stored relative to the
231archive itself.
232
233@cindex compatibility, @command{ar}
234@cindex @command{ar} compatibility
235@sc{gnu} @command{ar} is designed to be compatible with two different
236facilities. You can control its activity using command-line options,
237like the different varieties of @command{ar} on Unix systems; or, if you
238specify the single command-line option @option{-M}, you can control it
239with a script supplied via standard input, like the MRI ``librarian''
240program.
241
242@c man end
243
244@menu
245* ar cmdline:: Controlling @command{ar} on the command line
246* ar scripts:: Controlling @command{ar} with a script
247@end menu
248
249@page
250@node ar cmdline
251@section Controlling @command{ar} on the Command Line
252
253@smallexample
254@c man begin SYNOPSIS ar
255ar [@option{--plugin} @var{name}] [@option{-X32_64}] [@option{-}]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] [@option{--target} @var{bfdname}] @var{archive} [@var{member}@dots{}]
256@c man end
257@end smallexample
258
259@cindex Unix compatibility, @command{ar}
260When you use @command{ar} in the Unix style, @command{ar} insists on at least two
261arguments to execute: one keyletter specifying the @emph{operation}
262(optionally accompanied by other keyletters specifying
263@emph{modifiers}), and the archive name to act on.
264
265Most operations can also accept further @var{member} arguments,
266specifying particular files to operate on.
267
268@c man begin OPTIONS ar
269
270@sc{gnu} @command{ar} allows you to mix the operation code @var{p} and modifier
271flags @var{mod} in any order, within the first command-line argument.
272
273If you wish, you may begin the first command-line argument with a
274dash.
275
276@cindex operations on archive
277The @var{p} keyletter specifies what operation to execute; it may be
278any of the following, but you must specify only one of them:
279
280@table @samp
281@item d
282@cindex deleting from archive
283@emph{Delete} modules from the archive. Specify the names of modules to
284be deleted as @var{member}@dots{}; the archive is untouched if you
285specify no files to delete.
286
287If you specify the @samp{v} modifier, @command{ar} lists each module
288as it is deleted.
289
290@item m
291@cindex moving in archive
292Use this operation to @emph{move} members in an archive.
293
294The ordering of members in an archive can make a difference in how
295programs are linked using the library, if a symbol is defined in more
296than one member.
297
298If no modifiers are used with @code{m}, any members you name in the
299@var{member} arguments are moved to the @emph{end} of the archive;
300you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
301specified place instead.
302
303@item p
304@cindex printing from archive
305@emph{Print} the specified members of the archive, to the standard
306output file. If the @samp{v} modifier is specified, show the member
307name before copying its contents to standard output.
308
309If you specify no @var{member} arguments, all the files in the archive are
310printed.
311
312@item q
313@cindex quick append to archive
314@emph{Quick append}; Historically, add the files @var{member}@dots{} to the end of
315@var{archive}, without checking for replacement.
316
317The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
318operation; new members are always placed at the end of the archive.
319
320The modifier @samp{v} makes @command{ar} list each file as it is appended.
321
322Since the point of this operation is speed, the archive's symbol table
323index is not updated, even if it already existed; you can use @samp{ar s} or
324@command{ranlib} explicitly to update the symbol table index.
325
326However, too many different systems assume quick append rebuilds the
327index, so @sc{gnu} @command{ar} implements @samp{q} as a synonym for @samp{r}.
328
329@item r
330@cindex replacement in archive
331Insert the files @var{member}@dots{} into @var{archive} (with
332@emph{replacement}). This operation differs from @samp{q} in that any
333previously existing members are deleted if their names match those being
334added.
335
336If one of the files named in @var{member}@dots{} does not exist, @command{ar}
337displays an error message, and leaves undisturbed any existing members
338of the archive matching that name.
339
340By default, new members are added at the end of the file; but you may
341use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
342placement relative to some existing member.
343
344The modifier @samp{v} used with this operation elicits a line of
345output for each file inserted, along with one of the letters @samp{a} or
346@samp{r} to indicate whether the file was appended (no old member
347deleted) or replaced.
348
349@item s
350@cindex ranlib
351Add an index to the archive, or update it if it already exists. Note
352this command is an exception to the rule that there can only be one
353command letter, as it is possible to use it as either a command or a
354modifier. In either case it does the same thing.
355
356@item t
357@cindex contents of archive
358Display a @emph{table} listing the contents of @var{archive}, or those
359of the files listed in @var{member}@dots{} that are present in the
360archive. Normally only the member name is shown; if you also want to
361see the modes (permissions), timestamp, owner, group, and size, you can
362request that by also specifying the @samp{v} modifier.
363
364If you do not specify a @var{member}, all files in the archive
365are listed.
366
367@cindex repeated names in archive
368@cindex name duplication in archive
369If there is more than one file with the same name (say, @samp{fie}) in
370an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
371first instance; to see them all, you must ask for a complete
372listing---in our example, @samp{ar t b.a}.
373@c WRS only; per Gumby, this is implementation-dependent, and in a more
374@c recent case in fact works the other way.
375
376@item x
377@cindex extract from archive
378@emph{Extract} members (named @var{member}) from the archive. You can
379use the @samp{v} modifier with this operation, to request that
380@command{ar} list each name as it extracts it.
381
382If you do not specify a @var{member}, all files in the archive
383are extracted.
384
385Files cannot be extracted from a thin archive.
386
387@item --help
388Displays the list of command line options supported by @command{ar}
389and then exits.
390
391@item --version
392Displays the version information of @command{ar} and then exits.
393
394@end table
395
396A number of modifiers (@var{mod}) may immediately follow the @var{p}
397keyletter, to specify variations on an operation's behavior:
398
399@table @samp
400@item a
401@cindex relative placement in archive
402Add new files @emph{after} an existing member of the
403archive. If you use the modifier @samp{a}, the name of an existing archive
404member must be present as the @var{relpos} argument, before the
405@var{archive} specification.
406
407@item b
408Add new files @emph{before} an existing member of the
409archive. If you use the modifier @samp{b}, the name of an existing archive
410member must be present as the @var{relpos} argument, before the
411@var{archive} specification. (same as @samp{i}).
412
413@item c
414@cindex creating archives
415@emph{Create} the archive. The specified @var{archive} is always
416created if it did not exist, when you request an update. But a warning is
417issued unless you specify in advance that you expect to create it, by
418using this modifier.
419
420@item D
421@cindex deterministic archives
422@kindex --enable-deterministic-archives
423Operate in @emph{deterministic} mode. When adding files and the archive
424index use zero for UIDs, GIDs, timestamps, and use consistent file modes
425for all files. When this option is used, if @command{ar} is used with
426identical options and identical input files, multiple runs will create
427identical output files regardless of the input files' owners, groups,
428file modes, or modification times.
429
430If @file{binutils} was configured with
431@option{--enable-deterministic-archives}, then this mode is on by default.
432It can be disabled with the @samp{U} modifier, below.
433
434@item f
435Truncate names in the archive. @sc{gnu} @command{ar} will normally permit file
436names of any length. This will cause it to create archives which are
437not compatible with the native @command{ar} program on some systems. If
438this is a concern, the @samp{f} modifier may be used to truncate file
439names when putting them in the archive.
440
441@item i
442Insert new files @emph{before} an existing member of the
443archive. If you use the modifier @samp{i}, the name of an existing archive
444member must be present as the @var{relpos} argument, before the
445@var{archive} specification. (same as @samp{b}).
446
447@item l
448This modifier is accepted but not used.
449@c whaffor ar l modifier??? presumably compat; with
450@c what???---doc@@cygnus.com, 25jan91
451
452@item N
453Uses the @var{count} parameter. This is used if there are multiple
454entries in the archive with the same name. Extract or delete instance
455@var{count} of the given name from the archive.
456
457@item o
458@cindex dates in archive
459Preserve the @emph{original} dates of members when extracting them. If
460you do not specify this modifier, files extracted from the archive
461are stamped with the time of extraction.
462
463@item P
464Use the full path name when matching names in the archive. @sc{gnu}
465@command{ar} can not create an archive with a full path name (such archives
466are not POSIX complaint), but other archive creators can. This option
467will cause @sc{gnu} @command{ar} to match file names using a complete path
468name, which can be convenient when extracting a single file from an
469archive created by another tool.
470
471@item s
472@cindex writing archive index
473Write an object-file index into the archive, or update an existing one,
474even if no other change is made to the archive. You may use this modifier
475flag either with any operation, or alone. Running @samp{ar s} on an
476archive is equivalent to running @samp{ranlib} on it.
477
478@item S
479@cindex not writing archive index
480Do not generate an archive symbol table. This can speed up building a
481large library in several steps. The resulting archive can not be used
482with the linker. In order to build a symbol table, you must omit the
483@samp{S} modifier on the last execution of @samp{ar}, or you must run
484@samp{ranlib} on the archive.
485
486@item T
487@cindex creating thin archive
488Make the specified @var{archive} a @emph{thin} archive. If it already
489exists and is a regular archive, the existing members must be present
490in the same directory as @var{archive}.
491
492@item u
493@cindex updating an archive
494Normally, @samp{ar r}@dots{} inserts all files
495listed into the archive. If you would like to insert @emph{only} those
496of the files you list that are newer than existing members of the same
497names, use this modifier. The @samp{u} modifier is allowed only for the
498operation @samp{r} (replace). In particular, the combination @samp{qu} is
499not allowed, since checking the timestamps would lose any speed
500advantage from the operation @samp{q}.
501
502@item U
503@cindex deterministic archives
504@kindex --enable-deterministic-archives
505Do @emph{not} operate in @emph{deterministic} mode. This is the inverse
506of the @samp{D} modifier, above: added files and the archive index will
507get their actual UID, GID, timestamp, and file mode values.
508
509This is the default unless @file{binutils} was configured with
510@option{--enable-deterministic-archives}.
511
512@item v
513This modifier requests the @emph{verbose} version of an operation. Many
514operations display additional information, such as filenames processed,
515when the modifier @samp{v} is appended.
516
517@item V
518This modifier shows the version number of @command{ar}.
519@end table
520
521@command{ar} ignores an initial option spelt @samp{-X32_64}, for
522compatibility with AIX. The behaviour produced by this option is the
523default for @sc{gnu} @command{ar}. @command{ar} does not support any of the other
524@samp{-X} options; in particular, it does not support @option{-X32}
525which is the default for AIX @command{ar}.
526
527The optional command line switch @option{--plugin} @var{name} causes
528@command{ar} to load the plugin called @var{name} which adds support
529for more file formats. This option is only available if the toolchain
530has been built with plugin support enabled.
531
532The optional command line switch @option{--target} @var{bfdname}
533specifies that the archive members are in an object code format
534different from your system's default format. See
535@xref{Target Selection}, for more information.
536
537@c man end
538
539@ignore
540@c man begin SEEALSO ar
541nm(1), ranlib(1), and the Info entries for @file{binutils}.
542@c man end
543@end ignore
544
545@node ar scripts
546@section Controlling @command{ar} with a Script
547
548@smallexample
549ar -M [ <@var{script} ]
550@end smallexample
551
552@cindex MRI compatibility, @command{ar}
553@cindex scripts, @command{ar}
554If you use the single command-line option @samp{-M} with @command{ar}, you
555can control its operation with a rudimentary command language. This
556form of @command{ar} operates interactively if standard input is coming
557directly from a terminal. During interactive use, @command{ar} prompts for
558input (the prompt is @samp{AR >}), and continues executing even after
559errors. If you redirect standard input to a script file, no prompts are
560issued, and @command{ar} abandons execution (with a nonzero exit code)
561on any error.
562
563The @command{ar} command language is @emph{not} designed to be equivalent
564to the command-line options; in fact, it provides somewhat less control
565over archives. The only purpose of the command language is to ease the
566transition to @sc{gnu} @command{ar} for developers who already have scripts
567written for the MRI ``librarian'' program.
568
569The syntax for the @command{ar} command language is straightforward:
570@itemize @bullet
571@item
572commands are recognized in upper or lower case; for example, @code{LIST}
573is the same as @code{list}. In the following descriptions, commands are
574shown in upper case for clarity.
575
576@item
577a single command may appear on each line; it is the first word on the
578line.
579
580@item
581empty lines are allowed, and have no effect.
582
583@item
584comments are allowed; text after either of the characters @samp{*}
585or @samp{;} is ignored.
586
587@item
588Whenever you use a list of names as part of the argument to an @command{ar}
589command, you can separate the individual names with either commas or
590blanks. Commas are shown in the explanations below, for clarity.
591
592@item
593@samp{+} is used as a line continuation character; if @samp{+} appears
594at the end of a line, the text on the following line is considered part
595of the current command.
596@end itemize
597
598Here are the commands you can use in @command{ar} scripts, or when using
599@command{ar} interactively. Three of them have special significance:
600
601@code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
602a temporary file required for most of the other commands.
603
604@code{SAVE} commits the changes so far specified by the script. Prior
605to @code{SAVE}, commands affect only the temporary copy of the current
606archive.
607
608@table @code
609@item ADDLIB @var{archive}
610@itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
611Add all the contents of @var{archive} (or, if specified, each named
612@var{module} from @var{archive}) to the current archive.
613
614Requires prior use of @code{OPEN} or @code{CREATE}.
615
616@item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
617@c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
618@c else like "ar q..."
619Add each named @var{member} as a module in the current archive.
620
621Requires prior use of @code{OPEN} or @code{CREATE}.
622
623@item CLEAR
624Discard the contents of the current archive, canceling the effect of
625any operations since the last @code{SAVE}. May be executed (with no
626effect) even if no current archive is specified.
627
628@item CREATE @var{archive}
629Creates an archive, and makes it the current archive (required for many
630other commands). The new archive is created with a temporary name; it
631is not actually saved as @var{archive} until you use @code{SAVE}.
632You can overwrite existing archives; similarly, the contents of any
633existing file named @var{archive} will not be destroyed until @code{SAVE}.
634
635@item DELETE @var{module}, @var{module}, @dots{} @var{module}
636Delete each listed @var{module} from the current archive; equivalent to
637@samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
638
639Requires prior use of @code{OPEN} or @code{CREATE}.
640
641@item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
642@itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
643List each named @var{module} present in @var{archive}. The separate
644command @code{VERBOSE} specifies the form of the output: when verbose
645output is off, output is like that of @samp{ar -t @var{archive}
646@var{module}@dots{}}. When verbose output is on, the listing is like
647@samp{ar -tv @var{archive} @var{module}@dots{}}.
648
649Output normally goes to the standard output stream; however, if you
650specify @var{outputfile} as a final argument, @command{ar} directs the
651output to that file.
652
653@item END
654Exit from @command{ar}, with a @code{0} exit code to indicate successful
655completion. This command does not save the output file; if you have
656changed the current archive since the last @code{SAVE} command, those
657changes are lost.
658
659@item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
660Extract each named @var{module} from the current archive, writing them
661into the current directory as separate files. Equivalent to @samp{ar -x
662@var{archive} @var{module}@dots{}}.
663
664Requires prior use of @code{OPEN} or @code{CREATE}.
665
666@ignore
667@c FIXME Tokens but no commands???
668@item FULLDIR
669
670@item HELP
671@end ignore
672
673@item LIST
674Display full contents of the current archive, in ``verbose'' style
675regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
676tv @var{archive}}. (This single command is a @sc{gnu} @command{ar}
677enhancement, rather than present for MRI compatibility.)
678
679Requires prior use of @code{OPEN} or @code{CREATE}.
680
681@item OPEN @var{archive}
682Opens an existing archive for use as the current archive (required for
683many other commands). Any changes as the result of subsequent commands
684will not actually affect @var{archive} until you next use @code{SAVE}.
685
686@item REPLACE @var{module}, @var{module}, @dots{} @var{module}
687In the current archive, replace each existing @var{module} (named in
688the @code{REPLACE} arguments) from files in the current working directory.
689To execute this command without errors, both the file, and the module in
690the current archive, must exist.
691
692Requires prior use of @code{OPEN} or @code{CREATE}.
693
694@item VERBOSE
695Toggle an internal flag governing the output from @code{DIRECTORY}.
696When the flag is on, @code{DIRECTORY} output matches output from
697@samp{ar -tv }@dots{}.
698
699@item SAVE
700Commit your changes to the current archive, and actually save it as a
701file with the name specified in the last @code{CREATE} or @code{OPEN}
702command.
703
704Requires prior use of @code{OPEN} or @code{CREATE}.
705
706@end table
707
708@iftex
709@node ld
710@chapter ld
711@cindex linker
712@kindex ld
713The @sc{gnu} linker @command{ld} is now described in a separate manual.
714@xref{Top,, Overview,, Using LD: the @sc{gnu} linker}.
715@end iftex
716
717@node nm
718@chapter nm
719@cindex symbols
720@kindex nm
721
722@c man title nm list symbols from object files
723
724@smallexample
725@c man begin SYNOPSIS nm
726nm [@option{-A}|@option{-o}|@option{--print-file-name}] [@option{-a}|@option{--debug-syms}]
727 [@option{-B}|@option{--format=bsd}] [@option{-C}|@option{--demangle}[=@var{style}]]
728 [@option{-D}|@option{--dynamic}] [@option{-f}@var{format}|@option{--format=}@var{format}]
729 [@option{-g}|@option{--extern-only}] [@option{-h}|@option{--help}]
730 [@option{-l}|@option{--line-numbers}] [@option{-n}|@option{-v}|@option{--numeric-sort}]
731 [@option{-P}|@option{--portability}] [@option{-p}|@option{--no-sort}]
732 [@option{-r}|@option{--reverse-sort}] [@option{-S}|@option{--print-size}]
733 [@option{-s}|@option{--print-armap}] [@option{-t} @var{radix}|@option{--radix=}@var{radix}]
734 [@option{-u}|@option{--undefined-only}] [@option{-V}|@option{--version}]
735 [@option{-X 32_64}] [@option{--defined-only}] [@option{--no-demangle}]
736 [@option{--plugin} @var{name}] [@option{--size-sort}] [@option{--special-syms}]
737 [@option{--synthetic}] [@option{--target=}@var{bfdname}]
738 [@var{objfile}@dots{}]
739@c man end
740@end smallexample
741
742@c man begin DESCRIPTION nm
743@sc{gnu} @command{nm} lists the symbols from object files @var{objfile}@dots{}.
744If no object files are listed as arguments, @command{nm} assumes the file
745@file{a.out}.
746
747For each symbol, @command{nm} shows:
748
749@itemize @bullet
750@item
751The symbol value, in the radix selected by options (see below), or
752hexadecimal by default.
753
754@item
755The symbol type. At least the following types are used; others are, as
756well, depending on the object file format. If lowercase, the symbol is
757usually local; if uppercase, the symbol is global (external). There
758are however a few lowercase symbols that are shown for special global
759symbols (@code{u}, @code{v} and @code{w}).
760
761@c Some more detail on exactly what these symbol types are used for
762@c would be nice.
763@table @code
764@item A
765The symbol's value is absolute, and will not be changed by further
766linking.
767
768@item B
769@itemx b
770The symbol is in the uninitialized data section (known as BSS).
771
772@item C
773The symbol is common. Common symbols are uninitialized data. When
774linking, multiple common symbols may appear with the same name. If the
775symbol is defined anywhere, the common symbols are treated as undefined
776references.
777@ifclear man
778For more details on common symbols, see the discussion of
779--warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}.
780@end ifclear
781
782@item D
783@itemx d
784The symbol is in the initialized data section.
785
786@item G
787@itemx g
788The symbol is in an initialized data section for small objects. Some
789object file formats permit more efficient access to small data objects,
790such as a global int variable as opposed to a large global array.
791
792@item i
793For PE format files this indicates that the symbol is in a section
794specific to the implementation of DLLs. For ELF format files this
795indicates that the symbol is an indirect function. This is a GNU
796extension to the standard set of ELF symbol types. It indicates a
797symbol which if referenced by a relocation does not evaluate to its
798address, but instead must be invoked at runtime. The runtime
799execution will then return the value to be used in the relocation.
800
801@item N
802The symbol is a debugging symbol.
803
804@item p
805The symbols is in a stack unwind section.
806
807@item R
808@itemx r
809The symbol is in a read only data section.
810
811@item S
812@itemx s
813The symbol is in an uninitialized data section for small objects.
814
815@item T
816@itemx t
817The symbol is in the text (code) section.
818
819@item U
820The symbol is undefined.
821
822@item u
823The symbol is a unique global symbol. This is a GNU extension to the
824standard set of ELF symbol bindings. For such a symbol the dynamic linker
825will make sure that in the entire process there is just one symbol with
826this name and type in use.
827
828@item V
829@itemx v
830The symbol is a weak object. When a weak defined symbol is linked with
831a normal defined symbol, the normal defined symbol is used with no error.
832When a weak undefined symbol is linked and the symbol is not defined,
833the value of the weak symbol becomes zero with no error. On some
834systems, uppercase indicates that a default value has been specified.
835
836@item W
837@itemx w
838The symbol is a weak symbol that has not been specifically tagged as a
839weak object symbol. When a weak defined symbol is linked with a normal
840defined symbol, the normal defined symbol is used with no error.
841When a weak undefined symbol is linked and the symbol is not defined,
842the value of the symbol is determined in a system-specific manner without
843error. On some systems, uppercase indicates that a default value has been
844specified.
845
846@item -
847The symbol is a stabs symbol in an a.out object file. In this case, the
848next values printed are the stabs other field, the stabs desc field, and
849the stab type. Stabs symbols are used to hold debugging information.
850@ifclear man
851For more information, see @ref{Top,Stabs,Stabs Overview,stabs.info, The
852``stabs'' debug format}.
853@end ifclear
854
855@item ?
856The symbol type is unknown, or object file format specific.
857@end table
858
859@item
860The symbol name.
861@end itemize
862
863@c man end
864
865@c man begin OPTIONS nm
866The long and short forms of options, shown here as alternatives, are
867equivalent.
868
869@table @env
870@item -A
871@itemx -o
872@itemx --print-file-name
873@cindex input file name
874@cindex file name
875@cindex source file name
876Precede each symbol by the name of the input file (or archive member)
877in which it was found, rather than identifying the input file once only,
878before all of its symbols.
879
880@item -a
881@itemx --debug-syms
882@cindex debugging symbols
883Display all symbols, even debugger-only symbols; normally these are not
884listed.
885
886@item -B
887@cindex @command{nm} format
888@cindex @command{nm} compatibility
889The same as @option{--format=bsd} (for compatibility with the MIPS @command{nm}).
890
891@item -C
892@itemx --demangle[=@var{style}]
893@cindex demangling in nm
894Decode (@dfn{demangle}) low-level symbol names into user-level names.
895Besides removing any initial underscore prepended by the system, this
896makes C++ function names readable. Different compilers have different
897mangling styles. The optional demangling style argument can be used to
898choose an appropriate demangling style for your compiler. @xref{c++filt},
899for more information on demangling.
900
901@item --no-demangle
902Do not demangle low-level symbol names. This is the default.
903
904@item -D
905@itemx --dynamic
906@cindex dynamic symbols
907Display the dynamic symbols rather than the normal symbols. This is
908only meaningful for dynamic objects, such as certain types of shared
909libraries.
910
911@item -f @var{format}
912@itemx --format=@var{format}
913@cindex @command{nm} format
914@cindex @command{nm} compatibility
915Use the output format @var{format}, which can be @code{bsd},
916@code{sysv}, or @code{posix}. The default is @code{bsd}.
917Only the first character of @var{format} is significant; it can be
918either upper or lower case.
919
920@item -g
921@itemx --extern-only
922@cindex external symbols
923Display only external symbols.
924
925@item -h
926@itemx --help
927Show a summary of the options to @command{nm} and exit.
928
929@item -l
930@itemx --line-numbers
931@cindex symbol line numbers
932For each symbol, use debugging information to try to find a filename and
933line number. For a defined symbol, look for the line number of the
934address of the symbol. For an undefined symbol, look for the line
935number of a relocation entry which refers to the symbol. If line number
936information can be found, print it after the other symbol information.
937
938@item -n
939@itemx -v
940@itemx --numeric-sort
941Sort symbols numerically by their addresses, rather than alphabetically
942by their names.
943
944@item -p
945@itemx --no-sort
946@cindex sorting symbols
947Do not bother to sort the symbols in any order; print them in the order
948encountered.
949
950@item -P
951@itemx --portability
952Use the POSIX.2 standard output format instead of the default format.
953Equivalent to @samp{-f posix}.
954
955@item -r
956@itemx --reverse-sort
957Reverse the order of the sort (whether numeric or alphabetic); let the
958last come first.
959
960@item -S
961@itemx --print-size
962Print both value and size of defined symbols for the @code{bsd} output style.
963This option has no effect for object formats that do not record symbol
964sizes, unless @samp{--size-sort} is also used in which case a
965calculated size is displayed.
966
967@item -s
968@itemx --print-armap
969@cindex symbol index, listing
970When listing symbols from archive members, include the index: a mapping
971(stored in the archive by @command{ar} or @command{ranlib}) of which modules
972contain definitions for which names.
973
974@item -t @var{radix}
975@itemx --radix=@var{radix}
976Use @var{radix} as the radix for printing the symbol values. It must be
977@samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
978
979@item -u
980@itemx --undefined-only
981@cindex external symbols
982@cindex undefined symbols
983Display only undefined symbols (those external to each object file).
984
985@item -V
986@itemx --version
987Show the version number of @command{nm} and exit.
988
989@item -X
990This option is ignored for compatibility with the AIX version of
991@command{nm}. It takes one parameter which must be the string
992@option{32_64}. The default mode of AIX @command{nm} corresponds
993to @option{-X 32}, which is not supported by @sc{gnu} @command{nm}.
994
995@item --defined-only
996@cindex external symbols
997@cindex undefined symbols
998Display only defined symbols for each object file.
999
1000@item --plugin @var{name}
1001@cindex load plugin
1002Load the plugin called @var{name} to add support for extra target
1003types. This option is only available if the toolchain has been built
1004with plugin support enabled.
1005
1006@item --size-sort
1007Sort symbols by size. The size is computed as the difference between
1008the value of the symbol and the value of the symbol with the next higher
1009value. If the @code{bsd} output format is used the size of the symbol
1010is printed, rather than the value, and @samp{-S} must be used in order
1011both size and value to be printed.
1012
1013@item --special-syms
1014Display symbols which have a target-specific special meaning. These
1015symbols are usually used by the target for some special processing and
1016are not normally helpful when included included in the normal symbol
1017lists. For example for ARM targets this option would skip the mapping
1018symbols used to mark transitions between ARM code, THUMB code and
1019data.
1020
1021@item --synthetic
1022Include synthetic symbols in the output. These are special symbols
1023created by the linker for various purposes. They are not shown by
1024default since they are not part of the binary's original source code.
1025
1026@item --target=@var{bfdname}
1027@cindex object code format
1028Specify an object code format other than your system's default format.
1029@xref{Target Selection}, for more information.
1030
1031@end table
1032
1033@c man end
1034
1035@ignore
1036@c man begin SEEALSO nm
1037ar(1), objdump(1), ranlib(1), and the Info entries for @file{binutils}.
1038@c man end
1039@end ignore
1040
1041@node objcopy
1042@chapter objcopy
1043
1044@c man title objcopy copy and translate object files
1045
1046@smallexample
1047@c man begin SYNOPSIS objcopy
1048objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
1049 [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
1050 [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
1051 [@option{-B} @var{bfdarch}|@option{--binary-architecture=}@var{bfdarch}]
1052 [@option{-S}|@option{--strip-all}]
1053 [@option{-g}|@option{--strip-debug}]
1054 [@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}]
1055 [@option{-N} @var{symbolname}|@option{--strip-symbol=}@var{symbolname}]
1056 [@option{--strip-unneeded-symbol=}@var{symbolname}]
1057 [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}]
1058 [@option{--localize-hidden}]
1059 [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}]
1060 [@option{--globalize-symbol=}@var{symbolname}]
1061 [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}]
1062 [@option{-w}|@option{--wildcard}]
1063 [@option{-x}|@option{--discard-all}]
1064 [@option{-X}|@option{--discard-locals}]
1065 [@option{-b} @var{byte}|@option{--byte=}@var{byte}]
1066 [@option{-i} [@var{breadth}]|@option{--interleave}[=@var{breadth}]]
1067 [@option{--interleave-width=}@var{width}]
1068 [@option{-j} @var{sectionname}|@option{--only-section=}@var{sectionname}]
1069 [@option{-R} @var{sectionname}|@option{--remove-section=}@var{sectionname}]
1070 [@option{-p}|@option{--preserve-dates}]
1071 [@option{-D}|@option{--enable-deterministic-archives}]
1072 [@option{-U}|@option{--disable-deterministic-archives}]
1073 [@option{--debugging}]
1074 [@option{--gap-fill=}@var{val}]
1075 [@option{--pad-to=}@var{address}]
1076 [@option{--set-start=}@var{val}]
1077 [@option{--adjust-start=}@var{incr}]
1078 [@option{--change-addresses=}@var{incr}]
1079 [@option{--change-section-address} @var{section}@{=,+,-@}@var{val}]
1080 [@option{--change-section-lma} @var{section}@{=,+,-@}@var{val}]
1081 [@option{--change-section-vma} @var{section}@{=,+,-@}@var{val}]
1082 [@option{--change-warnings}] [@option{--no-change-warnings}]
1083 [@option{--set-section-flags} @var{section}=@var{flags}]
1084 [@option{--add-section} @var{sectionname}=@var{filename}]
1085 [@option{--rename-section} @var{oldname}=@var{newname}[,@var{flags}]]
1086 [@option{--long-section-names} @{enable,disable,keep@}]
1087 [@option{--change-leading-char}] [@option{--remove-leading-char}]
1088 [@option{--reverse-bytes=}@var{num}]
1089 [@option{--srec-len=}@var{ival}] [@option{--srec-forceS3}]
1090 [@option{--redefine-sym} @var{old}=@var{new}]
1091 [@option{--redefine-syms=}@var{filename}]
1092 [@option{--weaken}]
1093 [@option{--keep-symbols=}@var{filename}]
1094 [@option{--strip-symbols=}@var{filename}]
1095 [@option{--strip-unneeded-symbols=}@var{filename}]
1096 [@option{--keep-global-symbols=}@var{filename}]
1097 [@option{--localize-symbols=}@var{filename}]
1098 [@option{--globalize-symbols=}@var{filename}]
1099 [@option{--weaken-symbols=}@var{filename}]
1100 [@option{--alt-machine-code=}@var{index}]
1101 [@option{--prefix-symbols=}@var{string}]
1102 [@option{--prefix-sections=}@var{string}]
1103 [@option{--prefix-alloc-sections=}@var{string}]
1104 [@option{--add-gnu-debuglink=}@var{path-to-file}]
1105 [@option{--keep-file-symbols}]
1106 [@option{--only-keep-debug}]
1107 [@option{--strip-dwo}]
1108 [@option{--extract-dwo}]
1109 [@option{--extract-symbol}]
1110 [@option{--writable-text}]
1111 [@option{--readonly-text}]
1112 [@option{--pure}]
1113 [@option{--impure}]
1114 [@option{--file-alignment=}@var{num}]
1115 [@option{--heap=}@var{size}]
1116 [@option{--image-base=}@var{address}]
1117 [@option{--section-alignment=}@var{num}]
1118 [@option{--stack=}@var{size}]
1119 [@option{--subsystem=}@var{which}:@var{major}.@var{minor}]
1120 [@option{--compress-debug-sections}]
1121 [@option{--decompress-debug-sections}]
1122 [@option{--dwarf-depth=@var{n}}]
1123 [@option{--dwarf-start=@var{n}}]
1124 [@option{-v}|@option{--verbose}]
1125 [@option{-V}|@option{--version}]
1126 [@option{--help}] [@option{--info}]
1127 @var{infile} [@var{outfile}]
1128@c man end
1129@end smallexample
1130
1131@c man begin DESCRIPTION objcopy
1132The @sc{gnu} @command{objcopy} utility copies the contents of an object
1133file to another. @command{objcopy} uses the @sc{gnu} @sc{bfd} Library to
1134read and write the object files. It can write the destination object
1135file in a format different from that of the source object file. The
1136exact behavior of @command{objcopy} is controlled by command-line options.
1137Note that @command{objcopy} should be able to copy a fully linked file
1138between any two formats. However, copying a relocatable object file
1139between any two formats may not work as expected.
1140
1141@command{objcopy} creates temporary files to do its translations and
1142deletes them afterward. @command{objcopy} uses @sc{bfd} to do all its
1143translation work; it has access to all the formats described in @sc{bfd}
1144and thus is able to recognize most formats without being told
1145explicitly. @xref{BFD,,BFD,ld.info,Using LD}.
1146
1147@command{objcopy} can be used to generate S-records by using an output
1148target of @samp{srec} (e.g., use @samp{-O srec}).
1149
1150@command{objcopy} can be used to generate a raw binary file by using an
1151output target of @samp{binary} (e.g., use @option{-O binary}). When
1152@command{objcopy} generates a raw binary file, it will essentially produce
1153a memory dump of the contents of the input object file. All symbols and
1154relocation information will be discarded. The memory dump will start at
1155the load address of the lowest section copied into the output file.
1156
1157When generating an S-record or a raw binary file, it may be helpful to
1158use @option{-S} to remove sections containing debugging information. In
1159some cases @option{-R} will be useful to remove sections which contain
1160information that is not needed by the binary file.
1161
1162Note---@command{objcopy} is not able to change the endianness of its input
1163files. If the input format has an endianness (some formats do not),
1164@command{objcopy} can only copy the inputs into file formats that have the
1165same endianness or which have no endianness (e.g., @samp{srec}).
1166(However, see the @option{--reverse-bytes} option.)
1167
1168@c man end
1169
1170@c man begin OPTIONS objcopy
1171
1172@table @env
1173@item @var{infile}
1174@itemx @var{outfile}
1175The input and output files, respectively.
1176If you do not specify @var{outfile}, @command{objcopy} creates a
1177temporary file and destructively renames the result with
1178the name of @var{infile}.
1179
1180@item -I @var{bfdname}
1181@itemx --input-target=@var{bfdname}
1182Consider the source file's object format to be @var{bfdname}, rather than
1183attempting to deduce it. @xref{Target Selection}, for more information.
1184
1185@item -O @var{bfdname}
1186@itemx --output-target=@var{bfdname}
1187Write the output file using the object format @var{bfdname}.
1188@xref{Target Selection}, for more information.
1189
1190@item -F @var{bfdname}
1191@itemx --target=@var{bfdname}
1192Use @var{bfdname} as the object format for both the input and the output
1193file; i.e., simply transfer data from source to destination with no
1194translation. @xref{Target Selection}, for more information.
1195
1196@item -B @var{bfdarch}
1197@itemx --binary-architecture=@var{bfdarch}
1198Useful when transforming a architecture-less input file into an object file.
1199In this case the output architecture can be set to @var{bfdarch}. This
1200option will be ignored if the input file has a known @var{bfdarch}. You
1201can access this binary data inside a program by referencing the special
1202symbols that are created by the conversion process. These symbols are
1203called _binary_@var{objfile}_start, _binary_@var{objfile}_end and
1204_binary_@var{objfile}_size. e.g. you can transform a picture file into
1205an object file and then access it in your code using these symbols.
1206
1207@item -j @var{sectionname}
1208@itemx --only-section=@var{sectionname}
1209Copy only the named section from the input file to the output file.
1210This option may be given more than once. Note that using this option
1211inappropriately may make the output file unusable.
1212
1213@item -R @var{sectionname}
1214@itemx --remove-section=@var{sectionname}
1215Remove any section named @var{sectionname} from the output file. This
1216option may be given more than once. Note that using this option
1217inappropriately may make the output file unusable.
1218
1219@item -S
1220@itemx --strip-all
1221Do not copy relocation and symbol information from the source file.
1222
1223@item -g
1224@itemx --strip-debug
1225Do not copy debugging symbols or sections from the source file.
1226
1227@item --strip-unneeded
1228Strip all symbols that are not needed for relocation processing.
1229
1230@item -K @var{symbolname}
1231@itemx --keep-symbol=@var{symbolname}
1232When stripping symbols, keep symbol @var{symbolname} even if it would
1233normally be stripped. This option may be given more than once.
1234
1235@item -N @var{symbolname}
1236@itemx --strip-symbol=@var{symbolname}
1237Do not copy symbol @var{symbolname} from the source file. This option
1238may be given more than once.
1239
1240@item --strip-unneeded-symbol=@var{symbolname}
1241Do not copy symbol @var{symbolname} from the source file unless it is needed
1242by a relocation. This option may be given more than once.
1243
1244@item -G @var{symbolname}
1245@itemx --keep-global-symbol=@var{symbolname}
1246Keep only symbol @var{symbolname} global. Make all other symbols local
1247to the file, so that they are not visible externally. This option may
1248be given more than once.
1249
1250@item --localize-hidden
1251In an ELF object, mark all symbols that have hidden or internal visibility
1252as local. This option applies on top of symbol-specific localization options
1253such as @option{-L}.
1254
1255@item -L @var{symbolname}
1256@itemx --localize-symbol=@var{symbolname}
1257Make symbol @var{symbolname} local to the file, so that it is not
1258visible externally. This option may be given more than once.
1259
1260@item -W @var{symbolname}
1261@itemx --weaken-symbol=@var{symbolname}
1262Make symbol @var{symbolname} weak. This option may be given more than once.
1263
1264@item --globalize-symbol=@var{symbolname}
1265Give symbol @var{symbolname} global scoping so that it is visible
1266outside of the file in which it is defined. This option may be given
1267more than once.
1268
1269@item -w
1270@itemx --wildcard
1271Permit regular expressions in @var{symbolname}s used in other command
1272line options. The question mark (?), asterisk (*), backslash (\) and
1273square brackets ([]) operators can be used anywhere in the symbol
1274name. If the first character of the symbol name is the exclamation
1275point (!) then the sense of the switch is reversed for that symbol.
1276For example:
1277
1278@smallexample
1279 -w -W !foo -W fo*
1280@end smallexample
1281
1282would cause objcopy to weaken all symbols that start with ``fo''
1283except for the symbol ``foo''.
1284
1285@item -x
1286@itemx --discard-all
1287Do not copy non-global symbols from the source file.
1288@c FIXME any reason to prefer "non-global" to "local" here?
1289
1290@item -X
1291@itemx --discard-locals
1292Do not copy compiler-generated local symbols.
1293(These usually start with @samp{L} or @samp{.}.)
1294
1295@item -b @var{byte}
1296@itemx --byte=@var{byte}
1297If interleaving has been enabled via the @option{--interleave} option
1298then start the range of bytes to keep at the @var{byte}th byte.
1299@var{byte} can be in the range from 0 to @var{breadth}-1, where
1300@var{breadth} is the value given by the @option{--interleave} option.
1301
1302@item -i [@var{breadth}]
1303@itemx --interleave[=@var{breadth}]
1304Only copy a range out of every @var{breadth} bytes. (Header data is
1305not affected). Select which byte in the range begins the copy with
1306the @option{--byte} option. Select the width of the range with the
1307@option{--interleave-width} option.
1308
1309This option is useful for creating files to program @sc{rom}. It is
1310typically used with an @code{srec} output target. Note that
1311@command{objcopy} will complain if you do not specify the
1312@option{--byte} option as well.
1313
1314The default interleave breadth is 4, so with @option{--byte} set to 0,
1315@command{objcopy} would copy the first byte out of every four bytes
1316from the input to the output.
1317
1318@item --interleave-width=@var{width}
1319When used with the @option{--interleave} option, copy @var{width}
1320bytes at a time. The start of the range of bytes to be copied is set
1321by the @option{--byte} option, and the extent of the range is set with
1322the @option{--interleave} option.
1323
1324The default value for this option is 1. The value of @var{width} plus
1325the @var{byte} value set by the @option{--byte} option must not exceed
1326the interleave breadth set by the @option{--interleave} option.
1327
1328This option can be used to create images for two 16-bit flashes interleaved
1329in a 32-bit bus by passing @option{-b 0 -i 4 --interleave-width=2}
1330and @option{-b 2 -i 4 --interleave-width=2} to two @command{objcopy}
1331commands. If the input was '12345678' then the outputs would be
1332'1256' and '3478' respectively.
1333
1334@item -p
1335@itemx --preserve-dates
1336Set the access and modification dates of the output file to be the same
1337as those of the input file.
1338
1339@item -D
1340@itemx --enable-deterministic-archives
1341@cindex deterministic archives
1342@kindex --enable-deterministic-archives
1343Operate in @emph{deterministic} mode. When copying archive members
1344and writing the archive index, use zero for UIDs, GIDs, timestamps,
1345and use consistent file modes for all files.
1346
1347If @file{binutils} was configured with
1348@option{--enable-deterministic-archives}, then this mode is on by default.
1349It can be disabled with the @samp{-U} option, below.
1350
1351@item -U
1352@itemx --disable-deterministic-archives
1353@cindex deterministic archives
1354@kindex --enable-deterministic-archives
1355Do @emph{not} operate in @emph{deterministic} mode. This is the
1356inverse of the @option{-D} option, above: when copying archive members
1357and writing the archive index, use their actual UID, GID, timestamp,
1358and file mode values.
1359
1360This is the default unless @file{binutils} was configured with
1361@option{--enable-deterministic-archives}.
1362
1363@item --debugging
1364Convert debugging information, if possible. This is not the default
1365because only certain debugging formats are supported, and the
1366conversion process can be time consuming.
1367
1368@item --gap-fill @var{val}
1369Fill gaps between sections with @var{val}. This operation applies to
1370the @emph{load address} (LMA) of the sections. It is done by increasing
1371the size of the section with the lower address, and filling in the extra
1372space created with @var{val}.
1373
1374@item --pad-to @var{address}
1375Pad the output file up to the load address @var{address}. This is
1376done by increasing the size of the last section. The extra space is
1377filled in with the value specified by @option{--gap-fill} (default zero).
1378
1379@item --set-start @var{val}
1380Set the start address of the new file to @var{val}. Not all object file
1381formats support setting the start address.
1382
1383@item --change-start @var{incr}
1384@itemx --adjust-start @var{incr}
1385@cindex changing start address
1386Change the start address by adding @var{incr}. Not all object file
1387formats support setting the start address.
1388
1389@item --change-addresses @var{incr}
1390@itemx --adjust-vma @var{incr}
1391@cindex changing object addresses
1392Change the VMA and LMA addresses of all sections, as well as the start
1393address, by adding @var{incr}. Some object file formats do not permit
1394section addresses to be changed arbitrarily. Note that this does not
1395relocate the sections; if the program expects sections to be loaded at a
1396certain address, and this option is used to change the sections such
1397that they are loaded at a different address, the program may fail.
1398
1399@item --change-section-address @var{section}@{=,+,-@}@var{val}
1400@itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val}
1401@cindex changing section address
1402Set or change both the VMA address and the LMA address of the named
1403@var{section}. If @samp{=} is used, the section address is set to
1404@var{val}. Otherwise, @var{val} is added to or subtracted from the
1405section address. See the comments under @option{--change-addresses},
1406above. If @var{section} does not exist in the input file, a warning will
1407be issued, unless @option{--no-change-warnings} is used.
1408
1409@item --change-section-lma @var{section}@{=,+,-@}@var{val}
1410@cindex changing section LMA
1411Set or change the LMA address of the named @var{section}. The LMA
1412address is the address where the section will be loaded into memory at
1413program load time. Normally this is the same as the VMA address, which
1414is the address of the section at program run time, but on some systems,
1415especially those where a program is held in ROM, the two can be
1416different. If @samp{=} is used, the section address is set to
1417@var{val}. Otherwise, @var{val} is added to or subtracted from the
1418section address. See the comments under @option{--change-addresses},
1419above. If @var{section} does not exist in the input file, a warning
1420will be issued, unless @option{--no-change-warnings} is used.
1421
1422@item --change-section-vma @var{section}@{=,+,-@}@var{val}
1423@cindex changing section VMA
1424Set or change the VMA address of the named @var{section}. The VMA
1425address is the address where the section will be located once the
1426program has started executing. Normally this is the same as the LMA
1427address, which is the address where the section will be loaded into
1428memory, but on some systems, especially those where a program is held in
1429ROM, the two can be different. If @samp{=} is used, the section address
1430is set to @var{val}. Otherwise, @var{val} is added to or subtracted
1431from the section address. See the comments under
1432@option{--change-addresses}, above. If @var{section} does not exist in
1433the input file, a warning will be issued, unless
1434@option{--no-change-warnings} is used.
1435
1436@item --change-warnings
1437@itemx --adjust-warnings
1438If @option{--change-section-address} or @option{--change-section-lma} or
1439@option{--change-section-vma} is used, and the named section does not
1440exist, issue a warning. This is the default.
1441
1442@item --no-change-warnings
1443@itemx --no-adjust-warnings
1444Do not issue a warning if @option{--change-section-address} or
1445@option{--adjust-section-lma} or @option{--adjust-section-vma} is used, even
1446if the named section does not exist.
1447
1448@item --set-section-flags @var{section}=@var{flags}
1449Set the flags for the named section. The @var{flags} argument is a
1450comma separated string of flag names. The recognized names are
1451@samp{alloc}, @samp{contents}, @samp{load}, @samp{noload},
1452@samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, @samp{share}, and
1453@samp{debug}. You can set the @samp{contents} flag for a section which
1454does not have contents, but it is not meaningful to clear the
1455@samp{contents} flag of a section which does have contents--just remove
1456the section instead. Not all flags are meaningful for all object file
1457formats.
1458
1459@item --add-section @var{sectionname}=@var{filename}
1460Add a new section named @var{sectionname} while copying the file. The
1461contents of the new section are taken from the file @var{filename}. The
1462size of the section will be the size of the file. This option only
1463works on file formats which can support sections with arbitrary names.
1464
1465@item --rename-section @var{oldname}=@var{newname}[,@var{flags}]
1466Rename a section from @var{oldname} to @var{newname}, optionally
1467changing the section's flags to @var{flags} in the process. This has
1468the advantage over usng a linker script to perform the rename in that
1469the output stays as an object file and does not become a linked
1470executable.
1471
1472This option is particularly helpful when the input format is binary,
1473since this will always create a section called .data. If for example,
1474you wanted instead to create a section called .rodata containing binary
1475data you could use the following command line to achieve it:
1476
1477@smallexample
1478 objcopy -I binary -O <output_format> -B <architecture> \
1479 --rename-section .data=.rodata,alloc,load,readonly,data,contents \
1480 <input_binary_file> <output_object_file>
1481@end smallexample
1482
1483@item --long-section-names @{enable,disable,keep@}
1484Controls the handling of long section names when processing @code{COFF}
1485and @code{PE-COFF} object formats. The default behaviour, @samp{keep},
1486is to preserve long section names if any are present in the input file.
1487The @samp{enable} and @samp{disable} options forcibly enable or disable
1488the use of long section names in the output object; when @samp{disable}
1489is in effect, any long section names in the input object will be truncated.
1490The @samp{enable} option will only emit long section names if any are
1491present in the inputs; this is mostly the same as @samp{keep}, but it
1492is left undefined whether the @samp{enable} option might force the
1493creation of an empty string table in the output file.
1494
1495@item --change-leading-char
1496Some object file formats use special characters at the start of
1497symbols. The most common such character is underscore, which compilers
1498often add before every symbol. This option tells @command{objcopy} to
1499change the leading character of every symbol when it converts between
1500object file formats. If the object file formats use the same leading
1501character, this option has no effect. Otherwise, it will add a
1502character, or remove a character, or change a character, as
1503appropriate.
1504
1505@item --remove-leading-char
1506If the first character of a global symbol is a special symbol leading
1507character used by the object file format, remove the character. The
1508most common symbol leading character is underscore. This option will
1509remove a leading underscore from all global symbols. This can be useful
1510if you want to link together objects of different file formats with
1511different conventions for symbol names. This is different from
1512@option{--change-leading-char} because it always changes the symbol name
1513when appropriate, regardless of the object file format of the output
1514file.
1515
1516@item --reverse-bytes=@var{num}
1517Reverse the bytes in a section with output contents. A section length must
1518be evenly divisible by the value given in order for the swap to be able to
1519take place. Reversing takes place before the interleaving is performed.
1520
1521This option is used typically in generating ROM images for problematic
1522target systems. For example, on some target boards, the 32-bit words
1523fetched from 8-bit ROMs are re-assembled in little-endian byte order
1524regardless of the CPU byte order. Depending on the programming model, the
1525endianness of the ROM may need to be modified.
1526
1527Consider a simple file with a section containing the following eight
1528bytes: @code{12345678}.
1529
1530Using @samp{--reverse-bytes=2} for the above example, the bytes in the
1531output file would be ordered @code{21436587}.
1532
1533Using @samp{--reverse-bytes=4} for the above example, the bytes in the
1534output file would be ordered @code{43218765}.
1535
1536By using @samp{--reverse-bytes=2} for the above example, followed by
1537@samp{--reverse-bytes=4} on the output file, the bytes in the second
1538output file would be ordered @code{34127856}.
1539
1540@item --srec-len=@var{ival}
1541Meaningful only for srec output. Set the maximum length of the Srecords
1542being produced to @var{ival}. This length covers both address, data and
1543crc fields.
1544
1545@item --srec-forceS3
1546Meaningful only for srec output. Avoid generation of S1/S2 records,
1547creating S3-only record format.
1548
1549@item --redefine-sym @var{old}=@var{new}
1550Change the name of a symbol @var{old}, to @var{new}. This can be useful
1551when one is trying link two things together for which you have no
1552source, and there are name collisions.
1553
1554@item --redefine-syms=@var{filename}
1555Apply @option{--redefine-sym} to each symbol pair "@var{old} @var{new}"
1556listed in the file @var{filename}. @var{filename} is simply a flat file,
1557with one symbol pair per line. Line comments may be introduced by the hash
1558character. This option may be given more than once.
1559
1560@item --weaken
1561Change all global symbols in the file to be weak. This can be useful
1562when building an object which will be linked against other objects using
1563the @option{-R} option to the linker. This option is only effective when
1564using an object file format which supports weak symbols.
1565
1566@item --keep-symbols=@var{filename}
1567Apply @option{--keep-symbol} option to each symbol listed in the file
1568@var{filename}. @var{filename} is simply a flat file, with one symbol
1569name per line. Line comments may be introduced by the hash character.
1570This option may be given more than once.
1571
1572@item --strip-symbols=@var{filename}
1573Apply @option{--strip-symbol} option to each symbol listed in the file
1574@var{filename}. @var{filename} is simply a flat file, with one symbol
1575name per line. Line comments may be introduced by the hash character.
1576This option may be given more than once.
1577
1578@item --strip-unneeded-symbols=@var{filename}
1579Apply @option{--strip-unneeded-symbol} option to each symbol listed in
1580the file @var{filename}. @var{filename} is simply a flat file, with one
1581symbol name per line. Line comments may be introduced by the hash
1582character. This option may be given more than once.
1583
1584@item --keep-global-symbols=@var{filename}
1585Apply @option{--keep-global-symbol} option to each symbol listed in the
1586file @var{filename}. @var{filename} is simply a flat file, with one
1587symbol name per line. Line comments may be introduced by the hash
1588character. This option may be given more than once.
1589
1590@item --localize-symbols=@var{filename}
1591Apply @option{--localize-symbol} option to each symbol listed in the file
1592@var{filename}. @var{filename} is simply a flat file, with one symbol
1593name per line. Line comments may be introduced by the hash character.
1594This option may be given more than once.
1595
1596@item --globalize-symbols=@var{filename}
1597Apply @option{--globalize-symbol} option to each symbol listed in the file
1598@var{filename}. @var{filename} is simply a flat file, with one symbol
1599name per line. Line comments may be introduced by the hash character.
1600This option may be given more than once.
1601
1602@item --weaken-symbols=@var{filename}
1603Apply @option{--weaken-symbol} option to each symbol listed in the file
1604@var{filename}. @var{filename} is simply a flat file, with one symbol
1605name per line. Line comments may be introduced by the hash character.
1606This option may be given more than once.
1607
1608@item --alt-machine-code=@var{index}
1609If the output architecture has alternate machine codes, use the
1610@var{index}th code instead of the default one. This is useful in case
1611a machine is assigned an official code and the tool-chain adopts the
1612new code, but other applications still depend on the original code
1613being used. For ELF based architectures if the @var{index}
1614alternative does not exist then the value is treated as an absolute
1615number to be stored in the e_machine field of the ELF header.
1616
1617@item --writable-text
1618Mark the output text as writable. This option isn't meaningful for all
1619object file formats.
1620
1621@item --readonly-text
1622Make the output text write protected. This option isn't meaningful for all
1623object file formats.
1624
1625@item --pure
1626Mark the output file as demand paged. This option isn't meaningful for all
1627object file formats.
1628
1629@item --impure
1630Mark the output file as impure. This option isn't meaningful for all
1631object file formats.
1632
1633@item --prefix-symbols=@var{string}
1634Prefix all symbols in the output file with @var{string}.
1635
1636@item --prefix-sections=@var{string}
1637Prefix all section names in the output file with @var{string}.
1638
1639@item --prefix-alloc-sections=@var{string}
1640Prefix all the names of all allocated sections in the output file with
1641@var{string}.
1642
1643@item --add-gnu-debuglink=@var{path-to-file}
1644Creates a .gnu_debuglink section which contains a reference to @var{path-to-file}
1645and adds it to the output file.
1646
1647@item --keep-file-symbols
1648When stripping a file, perhaps with @option{--strip-debug} or
1649@option{--strip-unneeded}, retain any symbols specifying source file names,
1650which would otherwise get stripped.
1651
1652@item --only-keep-debug
1653Strip a file, removing contents of any sections that would not be
1654stripped by @option{--strip-debug} and leaving the debugging sections
1655intact. In ELF files, this preserves all note sections in the output.
1656
1657The intention is that this option will be used in conjunction with
1658@option{--add-gnu-debuglink} to create a two part executable. One a
1659stripped binary which will occupy less space in RAM and in a
1660distribution and the second a debugging information file which is only
1661needed if debugging abilities are required. The suggested procedure
1662to create these files is as follows:
1663
1664@enumerate
1665@item Link the executable as normal. Assuming that is is called
1666@code{foo} then...
1667@item Run @code{objcopy --only-keep-debug foo foo.dbg} to
1668create a file containing the debugging info.
1669@item Run @code{objcopy --strip-debug foo} to create a
1670stripped executable.
1671@item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
1672to add a link to the debugging info into the stripped executable.
1673@end enumerate
1674
1675Note---the choice of @code{.dbg} as an extension for the debug info
1676file is arbitrary. Also the @code{--only-keep-debug} step is
1677optional. You could instead do this:
1678
1679@enumerate
1680@item Link the executable as normal.
1681@item Copy @code{foo} to @code{foo.full}
1682@item Run @code{objcopy --strip-debug foo}
1683@item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
1684@end enumerate
1685
1686i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
1687full executable. It does not have to be a file created by the
1688@option{--only-keep-debug} switch.
1689
1690Note---this switch is only intended for use on fully linked files. It
1691does not make sense to use it on object files where the debugging
1692information may be incomplete. Besides the gnu_debuglink feature
1693currently only supports the presence of one filename containing
1694debugging information, not multiple filenames on a one-per-object-file
1695basis.
1696
1697@item --strip-dwo
1698Remove the contents of all DWARF .dwo sections, leaving the
1699remaining debugging sections and all symbols intact.
1700This option is intended for use by the compiler as part of
1701the @option{-gsplit-dwarf} option, which splits debug information
1702between the .o file and a separate .dwo file. The compiler
1703generates all debug information in the same file, then uses
1704the @option{--extract-dwo} option to copy the .dwo sections to
1705the .dwo file, then the @option{--strip-dwo} option to remove
1706those sections from the original .o file.
1707
1708@item --extract-dwo
1709Extract the contents of all DWARF .dwo sections. See the
1710@option{--strip-dwo} option for more information.
1711
1712@item --file-alignment @var{num}
1713Specify the file alignment. Sections in the file will always begin at
1714file offsets which are multiples of this number. This defaults to
1715512.
1716[This option is specific to PE targets.]
1717
1718@item --heap @var{reserve}
1719@itemx --heap @var{reserve},@var{commit}
1720Specify the number of bytes of memory to reserve (and optionally commit)
1721to be used as heap for this program.
1722[This option is specific to PE targets.]
1723
1724@item --image-base @var{value}
1725Use @var{value} as the base address of your program or dll. This is
1726the lowest memory location that will be used when your program or dll
1727is loaded. To reduce the need to relocate and improve performance of
1728your dlls, each should have a unique base address and not overlap any
1729other dlls. The default is 0x400000 for executables, and 0x10000000
1730for dlls.
1731[This option is specific to PE targets.]
1732
1733@item --section-alignment @var{num}
1734Sets the section alignment. Sections in memory will always begin at
1735addresses which are a multiple of this number. Defaults to 0x1000.
1736[This option is specific to PE targets.]
1737
1738@item --stack @var{reserve}
1739@itemx --stack @var{reserve},@var{commit}
1740Specify the number of bytes of memory to reserve (and optionally commit)
1741to be used as stack for this program.
1742[This option is specific to PE targets.]
1743
1744@item --subsystem @var{which}
1745@itemx --subsystem @var{which}:@var{major}
1746@itemx --subsystem @var{which}:@var{major}.@var{minor}
1747Specifies the subsystem under which your program will execute. The
1748legal values for @var{which} are @code{native}, @code{windows},
1749@code{console}, @code{posix}, @code{efi-app}, @code{efi-bsd},
1750@code{efi-rtd}, @code{sal-rtd}, and @code{xbox}. You may optionally set
1751the subsystem version also. Numeric values are also accepted for
1752@var{which}.
1753[This option is specific to PE targets.]
1754
1755@item --extract-symbol
1756Keep the file's section flags and symbols but remove all section data.
1757Specifically, the option:
1758
1759@itemize
1760@item removes the contents of all sections;
1761@item sets the size of every section to zero; and
1762@item sets the file's start address to zero.
1763@end itemize
1764
1765This option is used to build a @file{.sym} file for a VxWorks kernel.
1766It can also be a useful way of reducing the size of a @option{--just-symbols}
1767linker input file.
1768
1769@item --compress-debug-sections
1770Compress DWARF debug sections using zlib.
1771
1772@item --decompress-debug-sections
1773Decompress DWARF debug sections using zlib.
1774
1775@item -V
1776@itemx --version
1777Show the version number of @command{objcopy}.
1778
1779@item -v
1780@itemx --verbose
1781Verbose output: list all object files modified. In the case of
1782archives, @samp{objcopy -V} lists all members of the archive.
1783
1784@item --help
1785Show a summary of the options to @command{objcopy}.
1786
1787@item --info
1788Display a list showing all architectures and object formats available.
1789@end table
1790
1791@c man end
1792
1793@ignore
1794@c man begin SEEALSO objcopy
1795ld(1), objdump(1), and the Info entries for @file{binutils}.
1796@c man end
1797@end ignore
1798
1799@node objdump
1800@chapter objdump
1801
1802@cindex object file information
1803@kindex objdump
1804
1805@c man title objdump display information from object files.
1806
1807@smallexample
1808@c man begin SYNOPSIS objdump
1809objdump [@option{-a}|@option{--archive-headers}]
1810 [@option{-b} @var{bfdname}|@option{--target=@var{bfdname}}]
1811 [@option{-C}|@option{--demangle}[=@var{style}] ]
1812 [@option{-d}|@option{--disassemble}]
1813 [@option{-D}|@option{--disassemble-all}]
1814 [@option{-z}|@option{--disassemble-zeroes}]
1815 [@option{-EB}|@option{-EL}|@option{--endian=}@{big | little @}]
1816 [@option{-f}|@option{--file-headers}]
1817 [@option{-F}|@option{--file-offsets}]
1818 [@option{--file-start-context}]
1819 [@option{-g}|@option{--debugging}]
1820 [@option{-e}|@option{--debugging-tags}]
1821 [@option{-h}|@option{--section-headers}|@option{--headers}]
1822 [@option{-i}|@option{--info}]
1823 [@option{-j} @var{section}|@option{--section=}@var{section}]
1824 [@option{-l}|@option{--line-numbers}]
1825 [@option{-S}|@option{--source}]
1826 [@option{-m} @var{machine}|@option{--architecture=}@var{machine}]
1827 [@option{-M} @var{options}|@option{--disassembler-options=}@var{options}]
1828 [@option{-p}|@option{--private-headers}]
1829 [@option{-P} @var{options}|@option{--private=}@var{options}]
1830 [@option{-r}|@option{--reloc}]
1831 [@option{-R}|@option{--dynamic-reloc}]
1832 [@option{-s}|@option{--full-contents}]
1833 [@option{-W[lLiaprmfFsoRt]}|
1834 @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
1835 [@option{-G}|@option{--stabs}]
1836 [@option{-t}|@option{--syms}]
1837 [@option{-T}|@option{--dynamic-syms}]
1838 [@option{-x}|@option{--all-headers}]
1839 [@option{-w}|@option{--wide}]
1840 [@option{--start-address=}@var{address}]
1841 [@option{--stop-address=}@var{address}]
1842 [@option{--prefix-addresses}]
1843 [@option{--[no-]show-raw-insn}]
1844 [@option{--adjust-vma=}@var{offset}]
1845 [@option{--special-syms}]
1846 [@option{--prefix=}@var{prefix}]
1847 [@option{--prefix-strip=}@var{level}]
1848 [@option{--insn-width=}@var{width}]
1849 [@option{-V}|@option{--version}]
1850 [@option{-H}|@option{--help}]
1851 @var{objfile}@dots{}
1852@c man end
1853@end smallexample
1854
1855@c man begin DESCRIPTION objdump
1856
1857@command{objdump} displays information about one or more object files.
1858The options control what particular information to display. This
1859information is mostly useful to programmers who are working on the
1860compilation tools, as opposed to programmers who just want their
1861program to compile and work.
1862
1863@var{objfile}@dots{} are the object files to be examined. When you
1864specify archives, @command{objdump} shows information on each of the member
1865object files.
1866
1867@c man end
1868
1869@c man begin OPTIONS objdump
1870
1871The long and short forms of options, shown here as alternatives, are
1872equivalent. At least one option from the list
1873@option{-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-P,-r,-R,-s,-S,-t,-T,-V,-x} must be given.
1874
1875@table @env
1876@item -a
1877@itemx --archive-header
1878@cindex archive headers
1879If any of the @var{objfile} files are archives, display the archive
1880header information (in a format similar to @samp{ls -l}). Besides the
1881information you could list with @samp{ar tv}, @samp{objdump -a} shows
1882the object file format of each archive member.
1883
1884@item --adjust-vma=@var{offset}
1885@cindex section addresses in objdump
1886@cindex VMA in objdump
1887When dumping information, first add @var{offset} to all the section
1888addresses. This is useful if the section addresses do not correspond to
1889the symbol table, which can happen when putting sections at particular
1890addresses when using a format which can not represent section addresses,
1891such as a.out.
1892
1893@item -b @var{bfdname}
1894@itemx --target=@var{bfdname}
1895@cindex object code format
1896Specify that the object-code format for the object files is
1897@var{bfdname}. This option may not be necessary; @var{objdump} can
1898automatically recognize many formats.
1899
1900For example,
1901@example
1902objdump -b oasys -m vax -h fu.o
1903@end example
1904@noindent
1905displays summary information from the section headers (@option{-h}) of
1906@file{fu.o}, which is explicitly identified (@option{-m}) as a VAX object
1907file in the format produced by Oasys compilers. You can list the
1908formats available with the @option{-i} option.
1909@xref{Target Selection}, for more information.
1910
1911@item -C
1912@itemx --demangle[=@var{style}]
1913@cindex demangling in objdump
1914Decode (@dfn{demangle}) low-level symbol names into user-level names.
1915Besides removing any initial underscore prepended by the system, this
1916makes C++ function names readable. Different compilers have different
1917mangling styles. The optional demangling style argument can be used to
1918choose an appropriate demangling style for your compiler. @xref{c++filt},
1919for more information on demangling.
1920
1921@item -g
1922@itemx --debugging
1923Display debugging information. This attempts to parse STABS and IEEE
1924debugging format information stored in the file and print it out using
1925a C like syntax. If neither of these formats are found this option
1926falls back on the @option{-W} option to print any DWARF information in
1927the file.
1928
1929@item -e
1930@itemx --debugging-tags
1931Like @option{-g}, but the information is generated in a format compatible
1932with ctags tool.
1933
1934@item -d
1935@itemx --disassemble
1936@cindex disassembling object code
1937@cindex machine instructions
1938Display the assembler mnemonics for the machine instructions from
1939@var{objfile}. This option only disassembles those sections which are
1940expected to contain instructions.
1941
1942@item -D
1943@itemx --disassemble-all
1944Like @option{-d}, but disassemble the contents of all sections, not just
1945those expected to contain instructions.
1946
1947If the target is an ARM architecture this switch also has the effect
1948of forcing the disassembler to decode pieces of data found in code
1949sections as if they were instructions.
1950
1951@item --prefix-addresses
1952When disassembling, print the complete address on each line. This is
1953the older disassembly format.
1954
1955@item -EB
1956@itemx -EL
1957@itemx --endian=@{big|little@}
1958@cindex endianness
1959@cindex disassembly endianness
1960Specify the endianness of the object files. This only affects
1961disassembly. This can be useful when disassembling a file format which
1962does not describe endianness information, such as S-records.
1963
1964@item -f
1965@itemx --file-headers
1966@cindex object file header
1967Display summary information from the overall header of
1968each of the @var{objfile} files.
1969
1970@item -F
1971@itemx --file-offsets
1972@cindex object file offsets
1973When disassembling sections, whenever a symbol is displayed, also
1974display the file offset of the region of data that is about to be
1975dumped. If zeroes are being skipped, then when disassembly resumes,
1976tell the user how many zeroes were skipped and the file offset of the
1977location from where the disassembly resumes. When dumping sections,
1978display the file offset of the location from where the dump starts.
1979
1980@item --file-start-context
1981@cindex source code context
1982Specify that when displaying interlisted source code/disassembly
1983(assumes @option{-S}) from a file that has not yet been displayed, extend the
1984context to the start of the file.
1985
1986@item -h
1987@itemx --section-headers
1988@itemx --headers
1989@cindex section headers
1990Display summary information from the section headers of the
1991object file.
1992
1993File segments may be relocated to nonstandard addresses, for example by
1994using the @option{-Ttext}, @option{-Tdata}, or @option{-Tbss} options to
1995@command{ld}. However, some object file formats, such as a.out, do not
1996store the starting address of the file segments. In those situations,
1997although @command{ld} relocates the sections correctly, using @samp{objdump
1998-h} to list the file section headers cannot show the correct addresses.
1999Instead, it shows the usual addresses, which are implicit for the
2000target.
2001
2002@item -H
2003@itemx --help
2004Print a summary of the options to @command{objdump} and exit.
2005
2006@item -i
2007@itemx --info
2008@cindex architectures available
2009@cindex object formats available
2010Display a list showing all architectures and object formats available
2011for specification with @option{-b} or @option{-m}.
2012
2013@item -j @var{name}
2014@itemx --section=@var{name}
2015@cindex section information
2016Display information only for section @var{name}.
2017
2018@item -l
2019@itemx --line-numbers
2020@cindex source filenames for object files
2021Label the display (using debugging information) with the filename and
2022source line numbers corresponding to the object code or relocs shown.
2023Only useful with @option{-d}, @option{-D}, or @option{-r}.
2024
2025@item -m @var{machine}
2026@itemx --architecture=@var{machine}
2027@cindex architecture
2028@cindex disassembly architecture
2029Specify the architecture to use when disassembling object files. This
2030can be useful when disassembling object files which do not describe
2031architecture information, such as S-records. You can list the available
2032architectures with the @option{-i} option.
2033
2034If the target is an ARM architecture then this switch has an
2035additional effect. It restricts the disassembly to only those
2036instructions supported by the architecture specified by @var{machine}.
2037If it is necessary to use this switch because the input file does not
2038contain any architecture information, but it is also desired to
2039disassemble all the instructions use @option{-marm}.
2040
2041@item -M @var{options}
2042@itemx --disassembler-options=@var{options}
2043Pass target specific information to the disassembler. Only supported on
2044some targets. If it is necessary to specify more than one
2045disassembler option then multiple @option{-M} options can be used or
2046can be placed together into a comma separated list.
2047
2048If the target is an ARM architecture then this switch can be used to
2049select which register name set is used during disassembler. Specifying
2050@option{-M reg-names-std} (the default) will select the register names as
2051used in ARM's instruction set documentation, but with register 13 called
2052'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying
2053@option{-M reg-names-apcs} will select the name set used by the ARM
2054Procedure Call Standard, whilst specifying @option{-M reg-names-raw} will
2055just use @samp{r} followed by the register number.
2056
2057There are also two variants on the APCS register naming scheme enabled
2058by @option{-M reg-names-atpcs} and @option{-M reg-names-special-atpcs} which
2059use the ARM/Thumb Procedure Call Standard naming conventions. (Either
2060with the normal register names or the special register names).
2061
2062This option can also be used for ARM architectures to force the
2063disassembler to interpret all instructions as Thumb instructions by
2064using the switch @option{--disassembler-options=force-thumb}. This can be
2065useful when attempting to disassemble thumb code produced by other
2066compilers.
2067
2068For the x86, some of the options duplicate functions of the @option{-m}
2069switch, but allow finer grained control. Multiple selections from the
2070following may be specified as a comma separated string.
2071@option{x86-64}, @option{i386} and @option{i8086} select disassembly for
2072the given architecture. @option{intel} and @option{att} select between
2073intel syntax mode and AT&T syntax mode.
2074@option{intel-mnemonic} and @option{att-mnemonic} select between
2075intel mnemonic mode and AT&T mnemonic mode. @option{intel-mnemonic}
2076implies @option{intel} and @option{att-mnemonic} implies @option{att}.
2077@option{addr64}, @option{addr32},
2078@option{addr16}, @option{data32} and @option{data16} specify the default
2079address size and operand size. These four options will be overridden if
2080@option{x86-64}, @option{i386} or @option{i8086} appear later in the
2081option string. Lastly, @option{suffix}, when in AT&T mode,
2082instructs the disassembler to print a mnemonic suffix even when the
2083suffix could be inferred by the operands.
2084
2085For PowerPC, @option{booke} controls the disassembly of BookE
2086instructions. @option{32} and @option{64} select PowerPC and
2087PowerPC64 disassembly, respectively. @option{e300} selects
2088disassembly for the e300 family. @option{440} selects disassembly for
2089the PowerPC 440. @option{ppcps} selects disassembly for the paired
2090single instructions of the PPC750CL.
2091
2092For MIPS, this option controls the printing of instruction mnemonic
2093names and register names in disassembled instructions. Multiple
2094selections from the following may be specified as a comma separated
2095string, and invalid options are ignored:
2096
2097@table @code
2098@item no-aliases
2099Print the 'raw' instruction mnemonic instead of some pseudo
2100instruction mnemonic. I.e., print 'daddu' or 'or' instead of 'move',
2101'sll' instead of 'nop', etc.
2102
2103@item gpr-names=@var{ABI}
2104Print GPR (general-purpose register) names as appropriate
2105for the specified ABI. By default, GPR names are selected according to
2106the ABI of the binary being disassembled.
2107
2108@item fpr-names=@var{ABI}
2109Print FPR (floating-point register) names as
2110appropriate for the specified ABI. By default, FPR numbers are printed
2111rather than names.
2112
2113@item cp0-names=@var{ARCH}
2114Print CP0 (system control coprocessor; coprocessor 0) register names
2115as appropriate for the CPU or architecture specified by
2116@var{ARCH}. By default, CP0 register names are selected according to
2117the architecture and CPU of the binary being disassembled.
2118
2119@item hwr-names=@var{ARCH}
2120Print HWR (hardware register, used by the @code{rdhwr} instruction) names
2121as appropriate for the CPU or architecture specified by
2122@var{ARCH}. By default, HWR names are selected according to
2123the architecture and CPU of the binary being disassembled.
2124
2125@item reg-names=@var{ABI}
2126Print GPR and FPR names as appropriate for the selected ABI.
2127
2128@item reg-names=@var{ARCH}
2129Print CPU-specific register names (CP0 register and HWR names)
2130as appropriate for the selected CPU or architecture.
2131@end table
2132
2133For any of the options listed above, @var{ABI} or
2134@var{ARCH} may be specified as @samp{numeric} to have numbers printed
2135rather than names, for the selected types of registers.
2136You can list the available values of @var{ABI} and @var{ARCH} using
2137the @option{--help} option.
2138
2139For VAX, you can specify function entry addresses with @option{-M
2140entry:0xf00ba}. You can use this multiple times to properly
2141disassemble VAX binary files that don't contain symbol tables (like
2142ROM dumps). In these cases, the function entry mask would otherwise
2143be decoded as VAX instructions, which would probably lead the rest
2144of the function being wrongly disassembled.
2145
2146@item -p
2147@itemx --private-headers
2148Print information that is specific to the object file format. The exact
2149information printed depends upon the object file format. For some
2150object file formats, no additional information is printed.
2151
2152@item -P @var{options}
2153@itemx --private=@var{options}
2154Print information that is specific to the object file format. The
2155argument @var{options} is a comma separated list that depends on the
2156format (the lists of options is displayed with the help).
2157
2158For XCOFF, the available options are: @option{header}, @option{aout},
2159@option{sections}, @option{syms}, @option{relocs}, @option{lineno},
2160@option{loader}, @option{except}, @option{typchk}, @option{traceback}
2161and @option{toc}.
2162
2163@item -r
2164@itemx --reloc
2165@cindex relocation entries, in object file
2166Print the relocation entries of the file. If used with @option{-d} or
2167@option{-D}, the relocations are printed interspersed with the
2168disassembly.
2169
2170@item -R
2171@itemx --dynamic-reloc
2172@cindex dynamic relocation entries, in object file
2173Print the dynamic relocation entries of the file. This is only
2174meaningful for dynamic objects, such as certain types of shared
2175libraries. As for @option{-r}, if used with @option{-d} or
2176@option{-D}, the relocations are printed interspersed with the
2177disassembly.
2178
2179@item -s
2180@itemx --full-contents
2181@cindex sections, full contents
2182@cindex object file sections
2183Display the full contents of any sections requested. By default all
2184non-empty sections are displayed.
2185
2186@item -S
2187@itemx --source
2188@cindex source disassembly
2189@cindex disassembly, with source
2190Display source code intermixed with disassembly, if possible. Implies
2191@option{-d}.
2192
2193@item --prefix=@var{prefix}
2194@cindex Add prefix to absolute paths
2195Specify @var{prefix} to add to the absolute paths when used with
2196@option{-S}.
2197
2198@item --prefix-strip=@var{level}
2199@cindex Strip absolute paths
2200Indicate how many initial directory names to strip off the hardwired
2201absolute paths. It has no effect without @option{--prefix=}@var{prefix}.
2202
2203@item --show-raw-insn
2204When disassembling instructions, print the instruction in hex as well as
2205in symbolic form. This is the default except when
2206@option{--prefix-addresses} is used.
2207
2208@item --no-show-raw-insn
2209When disassembling instructions, do not print the instruction bytes.
2210This is the default when @option{--prefix-addresses} is used.
2211
2212@item --insn-width=@var{width}
2213@cindex Instruction width
2214Display @var{width} bytes on a single line when disassembling
2215instructions.
2216
2217@item -W[lLiaprmfFsoRt]
2218@itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]
2219@cindex DWARF
2220@cindex debug symbols
2221Displays the contents of the debug sections in the file, if any are
2222present. If one of the optional letters or words follows the switch
2223then only data found in those specific sections will be dumped.
2224
2225Note that there is no single letter option to display the content of
2226trace sections or .gdb_index.
2227
2228Note: the output from the @option{=info} option can also be affected
2229by the options @option{--dwarf-depth}, the @option{--dwarf-start} and
2230the @option{--dwarf-check}.
2231
2232@item --dwarf-depth=@var{n}
2233Limit the dump of the @code{.debug_info} section to @var{n} children.
2234This is only useful with @option{--dwarf=info}. The default is
2235to print all DIEs; the special value 0 for @var{n} will also have this
2236effect.
2237
2238With a non-zero value for @var{n}, DIEs at or deeper than @var{n}
2239levels will not be printed. The range for @var{n} is zero-based.
2240
2241@item --dwarf-start=@var{n}
2242Print only DIEs beginning with the DIE numbered @var{n}. This is only
2243useful with @option{--dwarf=info}.
2244
2245If specified, this option will suppress printing of any header
2246information and all DIEs before the DIE numbered @var{n}. Only
2247siblings and children of the specified DIE will be printed.
2248
2249This can be used in conjunction with @option{--dwarf-depth}.
2250
2251@item --dwarf-check
2252Enable additional checks for consistency of Dwarf information.
2253
2254@item -G
2255@itemx --stabs
2256@cindex stab
2257@cindex .stab
2258@cindex debug symbols
2259@cindex ELF object file format
2260Display the full contents of any sections requested. Display the
2261contents of the .stab and .stab.index and .stab.excl sections from an
2262ELF file. This is only useful on systems (such as Solaris 2.0) in which
2263@code{.stab} debugging symbol-table entries are carried in an ELF
2264section. In most other file formats, debugging symbol-table entries are
2265interleaved with linkage symbols, and are visible in the @option{--syms}
2266output.
2267@ifclear man
2268For more information on stabs symbols, see @ref{Top,Stabs,Stabs
2269Overview,stabs.info, The ``stabs'' debug format}.
2270@end ifclear
2271
2272@item --start-address=@var{address}
2273@cindex start-address
2274Start displaying data at the specified address. This affects the output
2275of the @option{-d}, @option{-r} and @option{-s} options.
2276
2277@item --stop-address=@var{address}
2278@cindex stop-address
2279Stop displaying data at the specified address. This affects the output
2280of the @option{-d}, @option{-r} and @option{-s} options.
2281
2282@item -t
2283@itemx --syms
2284@cindex symbol table entries, printing
2285Print the symbol table entries of the file.
2286This is similar to the information provided by the @samp{nm} program,
2287although the display format is different. The format of the output
2288depends upon the format of the file being dumped, but there are two main
2289types. One looks like this:
2290
2291@smallexample
2292[ 4](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
2293[ 6](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 fred
2294@end smallexample
2295
2296where the number inside the square brackets is the number of the entry
2297in the symbol table, the @var{sec} number is the section number, the
2298@var{fl} value are the symbol's flag bits, the @var{ty} number is the
2299symbol's type, the @var{scl} number is the symbol's storage class and
2300the @var{nx} value is the number of auxilary entries associated with
2301the symbol. The last two fields are the symbol's value and its name.
2302
2303The other common output format, usually seen with ELF based files,
2304looks like this:
2305
2306@smallexample
230700000000 l d .bss 00000000 .bss
230800000000 g .text 00000000 fred
2309@end smallexample
2310
2311Here the first number is the symbol's value (sometimes refered to as
2312its address). The next field is actually a set of characters and
2313spaces indicating the flag bits that are set on the symbol. These
2314characters are described below. Next is the section with which the
2315symbol is associated or @emph{*ABS*} if the section is absolute (ie
2316not connected with any section), or @emph{*UND*} if the section is
2317referenced in the file being dumped, but not defined there.
2318
2319After the section name comes another field, a number, which for common
2320symbols is the alignment and for other symbol is the size. Finally
2321the symbol's name is displayed.
2322
2323The flag characters are divided into 7 groups as follows:
2324@table @code
2325@item l
2326@itemx g
2327@itemx u
2328@itemx !
2329The symbol is a local (l), global (g), unique global (u), neither
2330global nor local (a space) or both global and local (!). A
2331symbol can be neither local or global for a variety of reasons, e.g.,
2332because it is used for debugging, but it is probably an indication of
2333a bug if it is ever both local and global. Unique global symbols are
2334a GNU extension to the standard set of ELF symbol bindings. For such
2335a symbol the dynamic linker will make sure that in the entire process
2336there is just one symbol with this name and type in use.
2337
2338@item w
2339The symbol is weak (w) or strong (a space).
2340
2341@item C
2342The symbol denotes a constructor (C) or an ordinary symbol (a space).
2343
2344@item W
2345The symbol is a warning (W) or a normal symbol (a space). A warning
2346symbol's name is a message to be displayed if the symbol following the
2347warning symbol is ever referenced.
2348
2349@item I
2350@item i
2351The symbol is an indirect reference to another symbol (I), a function
2352to be evaluated during reloc processing (i) or a normal symbol (a
2353space).
2354
2355@item d
2356@itemx D
2357The symbol is a debugging symbol (d) or a dynamic symbol (D) or a
2358normal symbol (a space).
2359
2360@item F
2361@item f
2362@item O
2363The symbol is the name of a function (F) or a file (f) or an object
2364(O) or just a normal symbol (a space).
2365@end table
2366
2367@item -T
2368@itemx --dynamic-syms
2369@cindex dynamic symbol table entries, printing
2370Print the dynamic symbol table entries of the file. This is only
2371meaningful for dynamic objects, such as certain types of shared
2372libraries. This is similar to the information provided by the @samp{nm}
2373program when given the @option{-D} (@option{--dynamic}) option.
2374
2375@item --special-syms
2376When displaying symbols include those which the target considers to be
2377special in some way and which would not normally be of interest to the
2378user.
2379
2380@item -V
2381@itemx --version
2382Print the version number of @command{objdump} and exit.
2383
2384@item -x
2385@itemx --all-headers
2386@cindex all header information, object file
2387@cindex header information, all
2388Display all available header information, including the symbol table and
2389relocation entries. Using @option{-x} is equivalent to specifying all of
2390@option{-a -f -h -p -r -t}.
2391
2392@item -w
2393@itemx --wide
2394@cindex wide output, printing
2395Format some lines for output devices that have more than 80 columns.
2396Also do not truncate symbol names when they are displayed.
2397
2398@item -z
2399@itemx --disassemble-zeroes
2400Normally the disassembly output will skip blocks of zeroes. This
2401option directs the disassembler to disassemble those blocks, just like
2402any other data.
2403@end table
2404
2405@c man end
2406
2407@ignore
2408@c man begin SEEALSO objdump
2409nm(1), readelf(1), and the Info entries for @file{binutils}.
2410@c man end
2411@end ignore
2412
2413@node ranlib
2414@chapter ranlib
2415
2416@kindex ranlib
2417@cindex archive contents
2418@cindex symbol index
2419
2420@c man title ranlib generate index to archive.
2421
2422@smallexample
2423@c man begin SYNOPSIS ranlib
2424ranlib [@option{--plugin} @var{name}] [@option{-DhHvVt}] @var{archive}
2425@c man end
2426@end smallexample
2427
2428@c man begin DESCRIPTION ranlib
2429
2430@command{ranlib} generates an index to the contents of an archive and
2431stores it in the archive. The index lists each symbol defined by a
2432member of an archive that is a relocatable object file.
2433
2434You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
2435
2436An archive with such an index speeds up linking to the library and
2437allows routines in the library to call each other without regard to
2438their placement in the archive.
2439
2440The @sc{gnu} @command{ranlib} program is another form of @sc{gnu} @command{ar}; running
2441@command{ranlib} is completely equivalent to executing @samp{ar -s}.
2442@xref{ar}.
2443
2444@c man end
2445
2446@c man begin OPTIONS ranlib
2447
2448@table @env
2449@item -h
2450@itemx -H
2451@itemx --help
2452Show usage information for @command{ranlib}.
2453
2454@item -v
2455@itemx -V
2456@itemx --version
2457Show the version number of @command{ranlib}.
2458
2459@item -D
2460@cindex deterministic archives
2461@kindex --enable-deterministic-archives
2462Operate in @emph{deterministic} mode. The symbol map archive member's
2463header will show zero for the UID, GID, and timestamp. When this
2464option is used, multiple runs will produce identical output files.
2465
2466This is the default unless @file{binutils} was configured with
2467@option{--enable-deterministic-archives}.
2468
2469@item -t
2470Update the timestamp of the symbol map of an archive.
2471
2472@item -U
2473@cindex deterministic archives
2474@kindex --enable-deterministic-archives
2475Do @emph{not} operate in @emph{deterministic} mode. This is the
2476inverse of the @samp{-D} option, above: the archive index will get
2477actual UID, GID, timestamp, and file mode values.
2478
2479This is the default unless @file{binutils} was configured with
2480@option{--enable-deterministic-archives}.
2481@end table
2482
2483@c man end
2484
2485@ignore
2486@c man begin SEEALSO ranlib
2487ar(1), nm(1), and the Info entries for @file{binutils}.
2488@c man end
2489@end ignore
2490
2491@node size
2492@chapter size
2493
2494@kindex size
2495@cindex section sizes
2496
2497@c man title size list section sizes and total size.
2498
2499@smallexample
2500@c man begin SYNOPSIS size
2501size [@option{-A}|@option{-B}|@option{--format=}@var{compatibility}]
2502 [@option{--help}]
2503 [@option{-d}|@option{-o}|@option{-x}|@option{--radix=}@var{number}]
2504 [@option{--common}]
2505 [@option{-t}|@option{--totals}]
2506 [@option{--target=}@var{bfdname}] [@option{-V}|@option{--version}]
2507 [@var{objfile}@dots{}]
2508@c man end
2509@end smallexample
2510
2511@c man begin DESCRIPTION size
2512
2513The @sc{gnu} @command{size} utility lists the section sizes---and the total
2514size---for each of the object or archive files @var{objfile} in its
2515argument list. By default, one line of output is generated for each
2516object file or each module in an archive.
2517
2518@var{objfile}@dots{} are the object files to be examined.
2519If none are specified, the file @code{a.out} will be used.
2520
2521@c man end
2522
2523@c man begin OPTIONS size
2524
2525The command line options have the following meanings:
2526
2527@table @env
2528@item -A
2529@itemx -B
2530@itemx --format=@var{compatibility}
2531@cindex @command{size} display format
2532Using one of these options, you can choose whether the output from @sc{gnu}
2533@command{size} resembles output from System V @command{size} (using @option{-A},
2534or @option{--format=sysv}), or Berkeley @command{size} (using @option{-B}, or
2535@option{--format=berkeley}). The default is the one-line format similar to
2536Berkeley's.
2537@c Bonus for doc-source readers: you can also say --format=strange (or
2538@c anything else that starts with 's') for sysv, and --format=boring (or
2539@c anything else that starts with 'b') for Berkeley.
2540
2541Here is an example of the Berkeley (default) format of output from
2542@command{size}:
2543@smallexample
2544$ size --format=Berkeley ranlib size
2545text data bss dec hex filename
2546294880 81920 11592 388392 5ed28 ranlib
2547294880 81920 11888 388688 5ee50 size
2548@end smallexample
2549
2550@noindent
2551This is the same data, but displayed closer to System V conventions:
2552
2553@smallexample
2554$ size --format=SysV ranlib size
2555ranlib :
2556section size addr
2557.text 294880 8192
2558.data 81920 303104
2559.bss 11592 385024
2560Total 388392
2561
2562
2563size :
2564section size addr
2565.text 294880 8192
2566.data 81920 303104
2567.bss 11888 385024
2568Total 388688
2569@end smallexample
2570
2571@item --help
2572Show a summary of acceptable arguments and options.
2573
2574@item -d
2575@itemx -o
2576@itemx -x
2577@itemx --radix=@var{number}
2578@cindex @command{size} number format
2579@cindex radix for section sizes
2580Using one of these options, you can control whether the size of each
2581section is given in decimal (@option{-d}, or @option{--radix=10}); octal
2582(@option{-o}, or @option{--radix=8}); or hexadecimal (@option{-x}, or
2583@option{--radix=16}). In @option{--radix=@var{number}}, only the three
2584values (8, 10, 16) are supported. The total size is always given in two
2585radices; decimal and hexadecimal for @option{-d} or @option{-x} output, or
2586octal and hexadecimal if you're using @option{-o}.
2587
2588@item --common
2589Print total size of common symbols in each file. When using Berkeley
2590format these are included in the bss size.
2591
2592@item -t
2593@itemx --totals
2594Show totals of all objects listed (Berkeley format listing mode only).
2595
2596@item --target=@var{bfdname}
2597@cindex object code format
2598Specify that the object-code format for @var{objfile} is
2599@var{bfdname}. This option may not be necessary; @command{size} can
2600automatically recognize many formats.
2601@xref{Target Selection}, for more information.
2602
2603@item -V
2604@itemx --version
2605Display the version number of @command{size}.
2606@end table
2607
2608@c man end
2609
2610@ignore
2611@c man begin SEEALSO size
2612ar(1), objdump(1), readelf(1), and the Info entries for @file{binutils}.
2613@c man end
2614@end ignore
2615
2616@node strings
2617@chapter strings
2618@kindex strings
2619@cindex listings strings
2620@cindex printing strings
2621@cindex strings, printing
2622
2623@c man title strings print the strings of printable characters in files.
2624
2625@smallexample
2626@c man begin SYNOPSIS strings
2627strings [@option{-afovV}] [@option{-}@var{min-len}]
2628 [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}]
2629 [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
2630 [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
2631 [@option{-}] [@option{--all}] [@option{--print-file-name}]
2632 [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
2633 [@option{--help}] [@option{--version}] @var{file}@dots{}
2634@c man end
2635@end smallexample
2636
2637@c man begin DESCRIPTION strings
2638
2639For each @var{file} given, @sc{gnu} @command{strings} prints the printable
2640character sequences that are at least 4 characters long (or the number
2641given with the options below) and are followed by an unprintable
2642character. By default, it only prints the strings from the initialized
2643and loaded sections of object files; for other types of files, it prints
2644the strings from the whole file.
2645
2646@command{strings} is mainly useful for determining the contents of non-text
2647files.
2648
2649@c man end
2650
2651@c man begin OPTIONS strings
2652
2653@table @env
2654@item -a
2655@itemx --all
2656@itemx -
2657Do not scan only the initialized and loaded sections of object files;
2658scan the whole files.
2659
2660@item -f
2661@itemx --print-file-name
2662Print the name of the file before each string.
2663
2664@item --help
2665Print a summary of the program usage on the standard output and exit.
2666
2667@item -@var{min-len}
2668@itemx -n @var{min-len}
2669@itemx --bytes=@var{min-len}
2670Print sequences of characters that are at least @var{min-len} characters
2671long, instead of the default 4.
2672
2673@item -o
2674Like @samp{-t o}. Some other versions of @command{strings} have @option{-o}
2675act like @samp{-t d} instead. Since we can not be compatible with both
2676ways, we simply chose one.
2677
2678@item -t @var{radix}
2679@itemx --radix=@var{radix}
2680Print the offset within the file before each string. The single
2681character argument specifies the radix of the offset---@samp{o} for
2682octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
2683
2684@item -e @var{encoding}
2685@itemx --encoding=@var{encoding}
2686Select the character encoding of the strings that are to be found.
2687Possible values for @var{encoding} are: @samp{s} = single-7-bit-byte
2688characters (ASCII, ISO 8859, etc., default), @samp{S} =
2689single-8-bit-byte characters, @samp{b} = 16-bit bigendian, @samp{l} =
269016-bit littleendian, @samp{B} = 32-bit bigendian, @samp{L} = 32-bit
2691littleendian. Useful for finding wide character strings. (@samp{l}
2692and @samp{b} apply to, for example, Unicode UTF-16/UCS-2 encodings).
2693
2694@item -T @var{bfdname}
2695@itemx --target=@var{bfdname}
2696@cindex object code format
2697Specify an object code format other than your system's default format.
2698@xref{Target Selection}, for more information.
2699
2700@item -v
2701@itemx -V
2702@itemx --version
2703Print the program version number on the standard output and exit.
2704@end table
2705
2706@c man end
2707
2708@ignore
2709@c man begin SEEALSO strings
2710ar(1), nm(1), objdump(1), ranlib(1), readelf(1)
2711and the Info entries for @file{binutils}.
2712@c man end
2713@end ignore
2714
2715@node strip
2716@chapter strip
2717
2718@kindex strip
2719@cindex removing symbols
2720@cindex discarding symbols
2721@cindex symbols, discarding
2722
2723@c man title strip Discard symbols from object files.
2724
2725@smallexample
2726@c man begin SYNOPSIS strip
2727strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
2728 [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname}]
2729 [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname}]
2730 [@option{-s}|@option{--strip-all}]
2731 [@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}]
2732 [@option{--strip-dwo}]
2733 [@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname}]
2734 [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname}]
2735 [@option{-w}|@option{--wildcard}]
2736 [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
2737 [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
2738 [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
2739 [@option{-D}|@option{--enable-deterministic-archives}]
2740 [@option{-U}|@option{--disable-deterministic-archives}]
2741 [@option{--keep-file-symbols}]
2742 [@option{--only-keep-debug}]
2743 [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
2744 [@option{--help}] [@option{--info}]
2745 @var{objfile}@dots{}
2746@c man end
2747@end smallexample
2748
2749@c man begin DESCRIPTION strip
2750
2751@sc{gnu} @command{strip} discards all symbols from object files
2752@var{objfile}. The list of object files may include archives.
2753At least one object file must be given.
2754
2755@command{strip} modifies the files named in its argument,
2756rather than writing modified copies under different names.
2757
2758@c man end
2759
2760@c man begin OPTIONS strip
2761
2762@table @env
2763@item -F @var{bfdname}
2764@itemx --target=@var{bfdname}
2765Treat the original @var{objfile} as a file with the object
2766code format @var{bfdname}, and rewrite it in the same format.
2767@xref{Target Selection}, for more information.
2768
2769@item --help
2770Show a summary of the options to @command{strip} and exit.
2771
2772@item --info
2773Display a list showing all architectures and object formats available.
2774
2775@item -I @var{bfdname}
2776@itemx --input-target=@var{bfdname}
2777Treat the original @var{objfile} as a file with the object
2778code format @var{bfdname}.
2779@xref{Target Selection}, for more information.
2780
2781@item -O @var{bfdname}
2782@itemx --output-target=@var{bfdname}
2783Replace @var{objfile} with a file in the output format @var{bfdname}.
2784@xref{Target Selection}, for more information.
2785
2786@item -R @var{sectionname}
2787@itemx --remove-section=@var{sectionname}
2788Remove any section named @var{sectionname} from the output file. This
2789option may be given more than once. Note that using this option
2790inappropriately may make the output file unusable.
2791
2792@item -s
2793@itemx --strip-all
2794Remove all symbols.
2795
2796@item -g
2797@itemx -S
2798@itemx -d
2799@itemx --strip-debug
2800Remove debugging symbols only.
2801
2802@item --strip-dwo
2803Remove the contents of all DWARF .dwo sections, leaving the
2804remaining debugging sections and all symbols intact.
2805See the description of this option in the @command{objcopy} section
2806for more information.
2807
2808@item --strip-unneeded
2809Remove all symbols that are not needed for relocation processing.
2810
2811@item -K @var{symbolname}
2812@itemx --keep-symbol=@var{symbolname}
2813When stripping symbols, keep symbol @var{symbolname} even if it would
2814normally be stripped. This option may be given more than once.
2815
2816@item -N @var{symbolname}
2817@itemx --strip-symbol=@var{symbolname}
2818Remove symbol @var{symbolname} from the source file. This option may be
2819given more than once, and may be combined with strip options other than
2820@option{-K}.
2821
2822@item -o @var{file}
2823Put the stripped output in @var{file}, rather than replacing the
2824existing file. When this argument is used, only one @var{objfile}
2825argument may be specified.
2826
2827@item -p
2828@itemx --preserve-dates
2829Preserve the access and modification dates of the file.
2830
2831@item -D
2832@itemx --enable-deterministic-archives
2833@cindex deterministic archives
2834@kindex --enable-deterministic-archives
2835Operate in @emph{deterministic} mode. When copying archive members
2836and writing the archive index, use zero for UIDs, GIDs, timestamps,
2837and use consistent file modes for all files.
2838
2839If @file{binutils} was configured with
2840@option{--enable-deterministic-archives}, then this mode is on by default.
2841It can be disabled with the @samp{-U} option, below.
2842
2843@item -U
2844@itemx --disable-deterministic-archives
2845@cindex deterministic archives
2846@kindex --enable-deterministic-archives
2847Do @emph{not} operate in @emph{deterministic} mode. This is the
2848inverse of the @option{-D} option, above: when copying archive members
2849and writing the archive index, use their actual UID, GID, timestamp,
2850and file mode values.
2851
2852This is the default unless @file{binutils} was configured with
2853@option{--enable-deterministic-archives}.
2854
2855@item -w
2856@itemx --wildcard
2857Permit regular expressions in @var{symbolname}s used in other command
2858line options. The question mark (?), asterisk (*), backslash (\) and
2859square brackets ([]) operators can be used anywhere in the symbol
2860name. If the first character of the symbol name is the exclamation
2861point (!) then the sense of the switch is reversed for that symbol.
2862For example:
2863
2864@smallexample
2865 -w -K !foo -K fo*
2866@end smallexample
2867
2868would cause strip to only keep symbols that start with the letters
2869``fo'', but to discard the symbol ``foo''.
2870
2871@item -x
2872@itemx --discard-all
2873Remove non-global symbols.
2874
2875@item -X
2876@itemx --discard-locals
2877Remove compiler-generated local symbols.
2878(These usually start with @samp{L} or @samp{.}.)
2879
2880@item --keep-file-symbols
2881When stripping a file, perhaps with @option{--strip-debug} or
2882@option{--strip-unneeded}, retain any symbols specifying source file names,
2883which would otherwise get stripped.
2884
2885@item --only-keep-debug
2886Strip a file, removing contents of any sections that would not be
2887stripped by @option{--strip-debug} and leaving the debugging sections
2888intact. In ELF files, this preserves all note sections in the output.
2889
2890The intention is that this option will be used in conjunction with
2891@option{--add-gnu-debuglink} to create a two part executable. One a
2892stripped binary which will occupy less space in RAM and in a
2893distribution and the second a debugging information file which is only
2894needed if debugging abilities are required. The suggested procedure
2895to create these files is as follows:
2896
2897@enumerate
2898@item Link the executable as normal. Assuming that is is called
2899@code{foo} then...
2900@item Run @code{objcopy --only-keep-debug foo foo.dbg} to
2901create a file containing the debugging info.
2902@item Run @code{objcopy --strip-debug foo} to create a
2903stripped executable.
2904@item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
2905to add a link to the debugging info into the stripped executable.
2906@end enumerate
2907
2908Note---the choice of @code{.dbg} as an extension for the debug info
2909file is arbitrary. Also the @code{--only-keep-debug} step is
2910optional. You could instead do this:
2911
2912@enumerate
2913@item Link the executable as normal.
2914@item Copy @code{foo} to @code{foo.full}
2915@item Run @code{strip --strip-debug foo}
2916@item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
2917@end enumerate
2918
2919i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
2920full executable. It does not have to be a file created by the
2921@option{--only-keep-debug} switch.
2922
2923Note---this switch is only intended for use on fully linked files. It
2924does not make sense to use it on object files where the debugging
2925information may be incomplete. Besides the gnu_debuglink feature
2926currently only supports the presence of one filename containing
2927debugging information, not multiple filenames on a one-per-object-file
2928basis.
2929
2930@item -V
2931@itemx --version
2932Show the version number for @command{strip}.
2933
2934@item -v
2935@itemx --verbose
2936Verbose output: list all object files modified. In the case of
2937archives, @samp{strip -v} lists all members of the archive.
2938@end table
2939
2940@c man end
2941
2942@ignore
2943@c man begin SEEALSO strip
2944the Info entries for @file{binutils}.
2945@c man end
2946@end ignore
2947
2948@node c++filt, addr2line, strip, Top
2949@chapter c++filt
2950
2951@kindex c++filt
2952@cindex demangling C++ symbols
2953
2954@c man title cxxfilt Demangle C++ and Java symbols.
2955
2956@smallexample
2957@c man begin SYNOPSIS cxxfilt
2958c++filt [@option{-_}|@option{--strip-underscore}]
2959 [@option{-n}|@option{--no-strip-underscore}]
2960 [@option{-p}|@option{--no-params}]
2961 [@option{-t}|@option{--types}]
2962 [@option{-i}|@option{--no-verbose}]
2963 [@option{-s} @var{format}|@option{--format=}@var{format}]
2964 [@option{--help}] [@option{--version}] [@var{symbol}@dots{}]
2965@c man end
2966@end smallexample
2967
2968@c man begin DESCRIPTION cxxfilt
2969
2970@kindex cxxfilt
2971The C++ and Java languages provide function overloading, which means
2972that you can write many functions with the same name, providing that
2973each function takes parameters of different types. In order to be
2974able to distinguish these similarly named functions C++ and Java
2975encode them into a low-level assembler name which uniquely identifies
2976each different version. This process is known as @dfn{mangling}. The
2977@command{c++filt}
2978@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
2979MS-DOS this program is named @command{CXXFILT}.}
2980program does the inverse mapping: it decodes (@dfn{demangles}) low-level
2981names into user-level names so that they can be read.
2982
2983Every alphanumeric word (consisting of letters, digits, underscores,
2984dollars, or periods) seen in the input is a potential mangled name.
2985If the name decodes into a C++ name, the C++ name replaces the
2986low-level name in the output, otherwise the original word is output.
2987In this way you can pass an entire assembler source file, containing
2988mangled names, through @command{c++filt} and see the same source file
2989containing demangled names.
2990
2991You can also use @command{c++filt} to decipher individual symbols by
2992passing them on the command line:
2993
2994@example
2995c++filt @var{symbol}
2996@end example
2997
2998If no @var{symbol} arguments are given, @command{c++filt} reads symbol
2999names from the standard input instead. All the results are printed on
3000the standard output. The difference between reading names from the
3001command line versus reading names from the standard input is that
3002command line arguments are expected to be just mangled names and no
3003checking is performed to separate them from surrounding text. Thus
3004for example:
3005
3006@smallexample
3007c++filt -n _Z1fv
3008@end smallexample
3009
3010will work and demangle the name to ``f()'' whereas:
3011
3012@smallexample
3013c++filt -n _Z1fv,
3014@end smallexample
3015
3016will not work. (Note the extra comma at the end of the mangled
3017name which makes it invalid). This command however will work:
3018
3019@smallexample
3020echo _Z1fv, | c++filt -n
3021@end smallexample
3022
3023and will display ``f(),'', i.e., the demangled name followed by a
3024trailing comma. This behaviour is because when the names are read
3025from the standard input it is expected that they might be part of an
3026assembler source file where there might be extra, extraneous
3027characters trailing after a mangled name. For example:
3028
3029@smallexample
3030 .type _Z1fv, @@function
3031@end smallexample
3032
3033@c man end
3034
3035@c man begin OPTIONS cxxfilt
3036
3037@table @env
3038@item -_
3039@itemx --strip-underscore
3040On some systems, both the C and C++ compilers put an underscore in front
3041of every name. For example, the C name @code{foo} gets the low-level
3042name @code{_foo}. This option removes the initial underscore. Whether
3043@command{c++filt} removes the underscore by default is target dependent.
3044
3045@item -n
3046@itemx --no-strip-underscore
3047Do not remove the initial underscore.
3048
3049@item -p
3050@itemx --no-params
3051When demangling the name of a function, do not display the types of
3052the function's parameters.
3053
3054@item -t
3055@itemx --types
3056Attempt to demangle types as well as function names. This is disabled
3057by default since mangled types are normally only used internally in
3058the compiler, and they can be confused with non-mangled names. For example,
3059a function called ``a'' treated as a mangled type name would be
3060demangled to ``signed char''.
3061
3062@item -i
3063@itemx --no-verbose
3064Do not include implementation details (if any) in the demangled
3065output.
3066
3067@item -s @var{format}
3068@itemx --format=@var{format}
3069@command{c++filt} can decode various methods of mangling, used by
3070different compilers. The argument to this option selects which
3071method it uses:
3072
3073@table @code
3074@item auto
3075Automatic selection based on executable (the default method)
3076@item gnu
3077the one used by the @sc{gnu} C++ compiler (g++)
3078@item lucid
3079the one used by the Lucid compiler (lcc)
3080@item arm
3081the one specified by the C++ Annotated Reference Manual
3082@item hp
3083the one used by the HP compiler (aCC)
3084@item edg
3085the one used by the EDG compiler
3086@item gnu-v3
3087the one used by the @sc{gnu} C++ compiler (g++) with the V3 ABI.
3088@item java
3089the one used by the @sc{gnu} Java compiler (gcj)
3090@item gnat
3091the one used by the @sc{gnu} Ada compiler (GNAT).
3092@end table
3093
3094@item --help
3095Print a summary of the options to @command{c++filt} and exit.
3096
3097@item --version
3098Print the version number of @command{c++filt} and exit.
3099@end table
3100
3101@c man end
3102
3103@ignore
3104@c man begin SEEALSO cxxfilt
3105the Info entries for @file{binutils}.
3106@c man end
3107@end ignore
3108
3109@quotation
3110@emph{Warning:} @command{c++filt} is a new utility, and the details of its
3111user interface are subject to change in future releases. In particular,
3112a command-line option may be required in the future to decode a name
3113passed as an argument on the command line; in other words,
3114
3115@example
3116c++filt @var{symbol}
3117@end example
3118
3119@noindent
3120may in a future release become
3121
3122@example
3123c++filt @var{option} @var{symbol}
3124@end example
3125@end quotation
3126
3127@node addr2line
3128@chapter addr2line
3129
3130@kindex addr2line
3131@cindex address to file name and line number
3132
3133@c man title addr2line convert addresses into file names and line numbers.
3134
3135@smallexample
3136@c man begin SYNOPSIS addr2line
3137addr2line [@option{-a}|@option{--addresses}]
3138 [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
3139 [@option{-C}|@option{--demangle}[=@var{style}]]
3140 [@option{-e} @var{filename}|@option{--exe=}@var{filename}]
3141 [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
3142 [@option{-i}|@option{--inlines}]
3143 [@option{-p}|@option{--pretty-print}]
3144 [@option{-j}|@option{--section=}@var{name}]
3145 [@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
3146 [addr addr @dots{}]
3147@c man end
3148@end smallexample
3149
3150@c man begin DESCRIPTION addr2line
3151
3152@command{addr2line} translates addresses into file names and line numbers.
3153Given an address in an executable or an offset in a section of a relocatable
3154object, it uses the debugging information to figure out which file name and
3155line number are associated with it.
3156
3157The executable or relocatable object to use is specified with the @option{-e}
3158option. The default is the file @file{a.out}. The section in the relocatable
3159object to use is specified with the @option{-j} option.
3160
3161@command{addr2line} has two modes of operation.
3162
3163In the first, hexadecimal addresses are specified on the command line,
3164and @command{addr2line} displays the file name and line number for each
3165address.
3166
3167In the second, @command{addr2line} reads hexadecimal addresses from
3168standard input, and prints the file name and line number for each
3169address on standard output. In this mode, @command{addr2line} may be used
3170in a pipe to convert dynamically chosen addresses.
3171
3172The format of the output is @samp{FILENAME:LINENO}. The file name and
3173line number for each input address is printed on separate lines.
3174
3175If the @option{-f} option is used, then each @samp{FILENAME:LINENO}
3176line is preceded by @samp{FUNCTIONNAME} which is the name of the
3177function containing the address.
3178
3179If the @option{-i} option is used and the code at the given address is
3180present there because of inlining by the compiler then the
3181@samp{@{FUNCTIONNAME@} FILENAME:LINENO} information for the inlining
3182function will be displayed afterwards. This continues recursively
3183until there is no more inlining to report.
3184
3185If the @option{-a} option is used then the output is prefixed by the
3186input address.
3187
3188If the @option{-p} option is used then the output for each input
3189address is displayed on one, possibly quite long, line. If
3190@option{-p} is not used then the output is broken up into multiple
3191lines, based on the paragraphs above.
3192
3193If the file name or function name can not be determined,
3194@command{addr2line} will print two question marks in their place. If the
3195line number can not be determined, @command{addr2line} will print 0.
3196
3197@c man end
3198
3199@c man begin OPTIONS addr2line
3200
3201The long and short forms of options, shown here as alternatives, are
3202equivalent.
3203
3204@table @env
3205@item -a
3206@itemx --addresses
3207Display the address before the function name, file and line number
3208information. The address is printed with a @samp{0x} prefix to easily
3209identify it.
3210
3211@item -b @var{bfdname}
3212@itemx --target=@var{bfdname}
3213@cindex object code format
3214Specify that the object-code format for the object files is
3215@var{bfdname}.
3216
3217@item -C
3218@itemx --demangle[=@var{style}]
3219@cindex demangling in objdump
3220Decode (@dfn{demangle}) low-level symbol names into user-level names.
3221Besides removing any initial underscore prepended by the system, this
3222makes C++ function names readable. Different compilers have different
3223mangling styles. The optional demangling style argument can be used to
3224choose an appropriate demangling style for your compiler. @xref{c++filt},
3225for more information on demangling.
3226
3227@item -e @var{filename}
3228@itemx --exe=@var{filename}
3229Specify the name of the executable for which addresses should be
3230translated. The default file is @file{a.out}.
3231
3232@item -f
3233@itemx --functions
3234Display function names as well as file and line number information.
3235
3236@item -s
3237@itemx --basenames
3238Display only the base of each file name.
3239
3240@item -i
3241@itemx --inlines
3242If the address belongs to a function that was inlined, the source
3243information for all enclosing scopes back to the first non-inlined
3244function will also be printed. For example, if @code{main} inlines
3245@code{callee1} which inlines @code{callee2}, and address is from
3246@code{callee2}, the source information for @code{callee1} and @code{main}
3247will also be printed.
3248
3249@item -j
3250@itemx --section
3251Read offsets relative to the specified section instead of absolute addresses.
3252
3253@item -p
3254@itemx --pretty-print
3255Make the output more human friendly: each location are printed on one line.
3256If option @option{-i} is specified, lines for all enclosing scopes are
3257prefixed with @samp{(inlined by)}.
3258@end table
3259
3260@c man end
3261
3262@ignore
3263@c man begin SEEALSO addr2line
3264Info entries for @file{binutils}.
3265@c man end
3266@end ignore
3267
3268@node nlmconv
3269@chapter nlmconv
3270
3271@command{nlmconv} converts a relocatable object file into a NetWare
3272Loadable Module.
3273
3274@ignore
3275@command{nlmconv} currently works with @samp{i386} object
3276files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
3277object files in @sc{elf}, or @code{a.out} format@footnote{
3278@command{nlmconv} should work with any @samp{i386} or @sc{sparc} object
3279format in the Binary File Descriptor library. It has only been tested
3280with the above formats.}.
3281@end ignore
3282
3283@quotation
3284@emph{Warning:} @command{nlmconv} is not always built as part of the binary
3285utilities, since it is only useful for NLM targets.
3286@end quotation
3287
3288@c man title nlmconv converts object code into an NLM.
3289
3290@smallexample
3291@c man begin SYNOPSIS nlmconv
3292nlmconv [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
3293 [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
3294 [@option{-T} @var{headerfile}|@option{--header-file=}@var{headerfile}]
3295 [@option{-d}|@option{--debug}] [@option{-l} @var{linker}|@option{--linker=}@var{linker}]
3296 [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
3297 @var{infile} @var{outfile}
3298@c man end
3299@end smallexample
3300
3301@c man begin DESCRIPTION nlmconv
3302
3303@command{nlmconv} converts the relocatable @samp{i386} object file
3304@var{infile} into the NetWare Loadable Module @var{outfile}, optionally
3305reading @var{headerfile} for NLM header information. For instructions
3306on writing the NLM command file language used in header files, see the
3307@samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
3308Development and Tools Overview}, which is part of the NLM Software
3309Developer's Kit (``NLM SDK''), available from Novell, Inc.
3310@command{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
3311@var{infile};
3312@ifclear man
3313see @ref{BFD,,BFD,ld.info,Using LD}, for more information.
3314@end ifclear
3315
3316@command{nlmconv} can perform a link step. In other words, you can list
3317more than one object file for input if you list them in the definitions
3318file (rather than simply specifying one input file on the command line).
3319In this case, @command{nlmconv} calls the linker for you.
3320
3321@c man end
3322
3323@c man begin OPTIONS nlmconv
3324
3325@table @env
3326@item -I @var{bfdname}
3327@itemx --input-target=@var{bfdname}
3328Object format of the input file. @command{nlmconv} can usually determine
3329the format of a given file (so no default is necessary).
3330@xref{Target Selection}, for more information.
3331
3332@item -O @var{bfdname}
3333@itemx --output-target=@var{bfdname}
3334Object format of the output file. @command{nlmconv} infers the output
3335format based on the input format, e.g. for a @samp{i386} input file the
3336output format is @samp{nlm32-i386}.
3337@xref{Target Selection}, for more information.
3338
3339@item -T @var{headerfile}
3340@itemx --header-file=@var{headerfile}
3341Reads @var{headerfile} for NLM header information. For instructions on
3342writing the NLM command file language used in header files, see@ see the
3343@samp{linkers} section, of the @cite{NLM Development and Tools
3344Overview}, which is part of the NLM Software Developer's Kit, available
3345from Novell, Inc.
3346
3347@item -d
3348@itemx --debug
3349Displays (on standard error) the linker command line used by @command{nlmconv}.
3350
3351@item -l @var{linker}
3352@itemx --linker=@var{linker}
3353Use @var{linker} for any linking. @var{linker} can be an absolute or a
3354relative pathname.
3355
3356@item -h
3357@itemx --help
3358Prints a usage summary.
3359
3360@item -V
3361@itemx --version
3362Prints the version number for @command{nlmconv}.
3363@end table
3364
3365@c man end
3366
3367@ignore
3368@c man begin SEEALSO nlmconv
3369the Info entries for @file{binutils}.
3370@c man end
3371@end ignore
3372
3373@node windmc
3374@chapter windmc
3375
3376@command{windmc} may be used to generator Windows message resources.
3377
3378@quotation
3379@emph{Warning:} @command{windmc} is not always built as part of the binary
3380utilities, since it is only useful for Windows targets.
3381@end quotation
3382
3383@c man title windmc generates Windows message resources.
3384
3385@smallexample
3386@c man begin SYNOPSIS windmc
3387windmc [options] input-file
3388@c man end
3389@end smallexample
3390
3391@c man begin DESCRIPTION windmc
3392
3393@command{windmc} reads message definitions from an input file (.mc) and
3394translate them into a set of output files. The output files may be of
3395four kinds:
3396
3397@table @code
3398@item h
3399A C header file containing the message definitions.
3400
3401@item rc
3402A resource file compilable by the @command{windres} tool.
3403
3404@item bin
3405One or more binary files containing the resource data for a specific
3406message language.
3407
3408@item dbg
3409A C include file that maps message id's to their symbolic name.
3410@end table
3411
3412The exact description of these different formats is available in
3413documentation from Microsoft.
3414
3415When @command{windmc} converts from the @code{mc} format to the @code{bin}
3416format, @code{rc}, @code{h}, and optional @code{dbg} it is acting like the
3417Windows Message Compiler.
3418
3419@c man end
3420
3421@c man begin OPTIONS windmc
3422
3423@table @env
3424@item -a
3425@itemx --ascii_in
3426Specifies that the input file specified is ASCII. This is the default
3427behaviour.
3428
3429@item -A
3430@itemx --ascii_out
3431Specifies that messages in the output @code{bin} files should be in ASCII
3432format.
3433
3434@item -b
3435@itemx --binprefix
3436Specifies that @code{bin} filenames should have to be prefixed by the
3437basename of the source file.
3438
3439@item -c
3440@itemx --customflag
3441Sets the customer bit in all message id's.
3442
3443@item -C @var{codepage}
3444@itemx --codepage_in @var{codepage}
3445Sets the default codepage to be used to convert input file to UTF16. The
3446default is ocdepage 1252.
3447
3448@item -d
3449@itemx --decimal_values
3450Outputs the constants in the header file in decimal. Default is using
3451hexadecimal output.
3452
3453@item -e @var{ext}
3454@itemx --extension @var{ext}
3455The extension for the header file. The default is .h extension.
3456
3457@item -F @var{target}
3458@itemx --target @var{target}
3459Specify the BFD format to use for a bin file as output. This
3460is a BFD target name; you can use the @option{--help} option to see a list
3461of supported targets. Normally @command{windmc} will use the default
3462format, which is the first one listed by the @option{--help} option.
3463@ifclear man
3464@ref{Target Selection}.
3465@end ifclear
3466
3467@item -h @var{path}
3468@itemx --headerdir @var{path}
3469The target directory of the generated header file. The default is the
3470current directory.
3471
3472@item -H
3473@itemx --help
3474Displays a list of command line options and then exits.
3475
3476@item -m @var{characters}
3477@itemx --maxlength @var{characters}
3478Instructs @command{windmc} to generate a warning if the length
3479of any message exceeds the number specified.
3480
3481@item -n
3482@itemx --nullterminate
3483Terminate message text in @code{bin} files by zero. By default they are
3484terminated by CR/LF.
3485
3486@item -o
3487@itemx --hresult_use
3488Not yet implemented. Instructs @code{windmc} to generate an OLE2 header
3489file, using HRESULT definitions. Status codes are used if the flag is not
3490specified.
3491
3492@item -O @var{codepage}
3493@itemx --codepage_out @var{codepage}
3494Sets the default codepage to be used to output text files. The default
3495is ocdepage 1252.
3496
3497@item -r @var{path}
3498@itemx --rcdir @var{path}
3499The target directory for the generated @code{rc} script and the generated
3500@code{bin} files that the resource compiler script includes. The default
3501is the current directory.
3502
3503@item -u
3504@itemx --unicode_in
3505Specifies that the input file is UTF16.
3506
3507@item -U
3508@itemx --unicode_out
3509Specifies that messages in the output @code{bin} file should be in UTF16
3510format. This is the default behaviour.
3511
3512@item -v
3513@item --verbose
3514Enable verbose mode.
3515
3516@item -V
3517@item --version
3518Prints the version number for @command{windmc}.
3519
3520@item -x @var{path}
3521@itemx --xdgb @var{path}
3522The path of the @code{dbg} C include file that maps message id's to the
3523symbolic name. No such file is generated without specifying the switch.
3524@end table
3525
3526@c man end
3527
3528@ignore
3529@c man begin SEEALSO windmc
3530the Info entries for @file{binutils}.
3531@c man end
3532@end ignore
3533
3534@node windres
3535@chapter windres
3536
3537@command{windres} may be used to manipulate Windows resources.
3538
3539@quotation
3540@emph{Warning:} @command{windres} is not always built as part of the binary
3541utilities, since it is only useful for Windows targets.
3542@end quotation
3543
3544@c man title windres manipulate Windows resources.
3545
3546@smallexample
3547@c man begin SYNOPSIS windres
3548windres [options] [input-file] [output-file]
3549@c man end
3550@end smallexample
3551
3552@c man begin DESCRIPTION windres
3553
3554@command{windres} reads resources from an input file and copies them into
3555an output file. Either file may be in one of three formats:
3556
3557@table @code
3558@item rc
3559A text format read by the Resource Compiler.
3560
3561@item res
3562A binary format generated by the Resource Compiler.
3563
3564@item coff
3565A COFF object or executable.
3566@end table
3567
3568The exact description of these different formats is available in
3569documentation from Microsoft.
3570
3571When @command{windres} converts from the @code{rc} format to the @code{res}
3572format, it is acting like the Windows Resource Compiler. When
3573@command{windres} converts from the @code{res} format to the @code{coff}
3574format, it is acting like the Windows @code{CVTRES} program.
3575
3576When @command{windres} generates an @code{rc} file, the output is similar
3577but not identical to the format expected for the input. When an input
3578@code{rc} file refers to an external filename, an output @code{rc} file
3579will instead include the file contents.
3580
3581If the input or output format is not specified, @command{windres} will
3582guess based on the file name, or, for the input file, the file contents.
3583A file with an extension of @file{.rc} will be treated as an @code{rc}
3584file, a file with an extension of @file{.res} will be treated as a
3585@code{res} file, and a file with an extension of @file{.o} or
3586@file{.exe} will be treated as a @code{coff} file.
3587
3588If no output file is specified, @command{windres} will print the resources
3589in @code{rc} format to standard output.
3590
3591The normal use is for you to write an @code{rc} file, use @command{windres}
3592to convert it to a COFF object file, and then link the COFF file into
3593your application. This will make the resources described in the
3594@code{rc} file available to Windows.
3595
3596@c man end
3597
3598@c man begin OPTIONS windres
3599
3600@table @env
3601@item -i @var{filename}
3602@itemx --input @var{filename}
3603The name of the input file. If this option is not used, then
3604@command{windres} will use the first non-option argument as the input file
3605name. If there are no non-option arguments, then @command{windres} will
3606read from standard input. @command{windres} can not read a COFF file from
3607standard input.
3608
3609@item -o @var{filename}
3610@itemx --output @var{filename}
3611The name of the output file. If this option is not used, then
3612@command{windres} will use the first non-option argument, after any used
3613for the input file name, as the output file name. If there is no
3614non-option argument, then @command{windres} will write to standard output.
3615@command{windres} can not write a COFF file to standard output. Note,
3616for compatibility with @command{rc} the option @option{-fo} is also
3617accepted, but its use is not recommended.
3618
3619@item -J @var{format}
3620@itemx --input-format @var{format}
3621The input format to read. @var{format} may be @samp{res}, @samp{rc}, or
3622@samp{coff}. If no input format is specified, @command{windres} will
3623guess, as described above.
3624
3625@item -O @var{format}
3626@itemx --output-format @var{format}
3627The output format to generate. @var{format} may be @samp{res},
3628@samp{rc}, or @samp{coff}. If no output format is specified,
3629@command{windres} will guess, as described above.
3630
3631@item -F @var{target}
3632@itemx --target @var{target}
3633Specify the BFD format to use for a COFF file as input or output. This
3634is a BFD target name; you can use the @option{--help} option to see a list
3635of supported targets. Normally @command{windres} will use the default
3636format, which is the first one listed by the @option{--help} option.
3637@ifclear man
3638@ref{Target Selection}.
3639@end ifclear
3640
3641@item --preprocessor @var{program}
3642When @command{windres} reads an @code{rc} file, it runs it through the C
3643preprocessor first. This option may be used to specify the preprocessor
3644to use, including any leading arguments. The default preprocessor
3645argument is @code{gcc -E -xc-header -DRC_INVOKED}.
3646
3647@item --preprocessor-arg @var{option}
3648When @command{windres} reads an @code{rc} file, it runs it through
3649the C preprocessor first. This option may be used to specify additional
3650text to be passed to preprocessor on its command line.
3651This option can be used multiple times to add multiple options to the
3652preprocessor command line.
3653
3654@item -I @var{directory}
3655@itemx --include-dir @var{directory}
3656Specify an include directory to use when reading an @code{rc} file.
3657@command{windres} will pass this to the preprocessor as an @option{-I}
3658option. @command{windres} will also search this directory when looking for
3659files named in the @code{rc} file. If the argument passed to this command
3660matches any of the supported @var{formats} (as described in the @option{-J}
3661option), it will issue a deprecation warning, and behave just like the
3662@option{-J} option. New programs should not use this behaviour. If a
3663directory happens to match a @var{format}, simple prefix it with @samp{./}
3664to disable the backward compatibility.
3665
3666@item -D @var{target}
3667@itemx --define @var{sym}[=@var{val}]
3668Specify a @option{-D} option to pass to the preprocessor when reading an
3669@code{rc} file.
3670
3671@item -U @var{target}
3672@itemx --undefine @var{sym}
3673Specify a @option{-U} option to pass to the preprocessor when reading an
3674@code{rc} file.
3675
3676@item -r
3677Ignored for compatibility with rc.
3678
3679@item -v
3680Enable verbose mode. This tells you what the preprocessor is if you
3681didn't specify one.
3682
3683@item -c @var{val}
3684@item --codepage @var{val}
3685Specify the default codepage to use when reading an @code{rc} file.
3686@var{val} should be a hexadecimal prefixed by @samp{0x} or decimal
3687codepage code. The valid range is from zero up to 0xffff, but the
3688validity of the codepage is host and configuration dependent.
3689
3690@item -l @var{val}
3691@item --language @var{val}
3692Specify the default language to use when reading an @code{rc} file.
3693@var{val} should be a hexadecimal language code. The low eight bits are
3694the language, and the high eight bits are the sublanguage.
3695
3696@item --use-temp-file
3697Use a temporary file to instead of using popen to read the output of
3698the preprocessor. Use this option if the popen implementation is buggy
3699on the host (eg., certain non-English language versions of Windows 95 and
3700Windows 98 are known to have buggy popen where the output will instead
3701go the console).
3702
3703@item --no-use-temp-file
3704Use popen, not a temporary file, to read the output of the preprocessor.
3705This is the default behaviour.
3706
3707@item -h
3708@item --help
3709Prints a usage summary.
3710
3711@item -V
3712@item --version
3713Prints the version number for @command{windres}.
3714
3715@item --yydebug
3716If @command{windres} is compiled with @code{YYDEBUG} defined as @code{1},
3717this will turn on parser debugging.
3718@end table
3719
3720@c man end
3721
3722@ignore
3723@c man begin SEEALSO windres
3724the Info entries for @file{binutils}.
3725@c man end
3726@end ignore
3727
3728@node dlltool
3729@chapter dlltool
3730@cindex DLL
3731@kindex dlltool
3732
3733@command{dlltool} is used to create the files needed to create dynamic
3734link libraries (DLLs) on systems which understand PE format image
3735files such as Windows. A DLL contains an export table which contains
3736information that the runtime loader needs to resolve references from a
3737referencing program.
3738
3739The export table is generated by this program by reading in a
3740@file{.def} file or scanning the @file{.a} and @file{.o} files which
3741will be in the DLL. A @file{.o} file can contain information in
3742special @samp{.drectve} sections with export information.
3743
3744@quotation
3745@emph{Note:} @command{dlltool} is not always built as part of the
3746binary utilities, since it is only useful for those targets which
3747support DLLs.
3748@end quotation
3749
3750@c man title dlltool Create files needed to build and use DLLs.
3751
3752@smallexample
3753@c man begin SYNOPSIS dlltool
3754dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
3755 [@option{-b}|@option{--base-file} @var{base-file-name}]
3756 [@option{-e}|@option{--output-exp} @var{exports-file-name}]
3757 [@option{-z}|@option{--output-def} @var{def-file-name}]
3758 [@option{-l}|@option{--output-lib} @var{library-file-name}]
3759 [@option{-y}|@option{--output-delaylib} @var{library-file-name}]
3760 [@option{--export-all-symbols}] [@option{--no-export-all-symbols}]
3761 [@option{--exclude-symbols} @var{list}]
3762 [@option{--no-default-excludes}]
3763 [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}]
3764 [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
3765 [@option{-a}|@option{--add-indirect}]
3766 [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}]
3767 [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
3768 [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
3769 [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}]
3770 [@option{--use-nul-prefixed-import-tables}]
3771 [@option{-I}|@option{--identify} @var{library-file-name}] [@option{--identify-strict}]
3772 [@option{-i}|@option{--interwork}]
3773 [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
3774 [@option{-v}|@option{--verbose}]
3775 [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
3776 [@option{--no-leading-underscore}] [@option{--leading-underscore}]
3777 [object-file @dots{}]
3778@c man end
3779@end smallexample
3780
3781@c man begin DESCRIPTION dlltool
3782
3783@command{dlltool} reads its inputs, which can come from the @option{-d} and
3784@option{-b} options as well as object files specified on the command
3785line. It then processes these inputs and if the @option{-e} option has
3786been specified it creates a exports file. If the @option{-l} option
3787has been specified it creates a library file and if the @option{-z} option
3788has been specified it creates a def file. Any or all of the @option{-e},
3789@option{-l} and @option{-z} options can be present in one invocation of
3790dlltool.
3791
3792When creating a DLL, along with the source for the DLL, it is necessary
3793to have three other files. @command{dlltool} can help with the creation of
3794these files.
3795
3796The first file is a @file{.def} file which specifies which functions are
3797exported from the DLL, which functions the DLL imports, and so on. This
3798is a text file and can be created by hand, or @command{dlltool} can be used
3799to create it using the @option{-z} option. In this case @command{dlltool}
3800will scan the object files specified on its command line looking for
3801those functions which have been specially marked as being exported and
3802put entries for them in the @file{.def} file it creates.
3803
3804In order to mark a function as being exported from a DLL, it needs to
3805have an @option{-export:<name_of_function>} entry in the @samp{.drectve}
3806section of the object file. This can be done in C by using the
3807asm() operator:
3808
3809@smallexample
3810 asm (".section .drectve");
3811 asm (".ascii \"-export:my_func\"");
3812
3813 int my_func (void) @{ @dots{} @}
3814@end smallexample
3815
3816The second file needed for DLL creation is an exports file. This file
3817is linked with the object files that make up the body of the DLL and it
3818handles the interface between the DLL and the outside world. This is a
3819binary file and it can be created by giving the @option{-e} option to
3820@command{dlltool} when it is creating or reading in a @file{.def} file.
3821
3822The third file needed for DLL creation is the library file that programs
3823will link with in order to access the functions in the DLL (an `import
3824library'). This file can be created by giving the @option{-l} option to
3825dlltool when it is creating or reading in a @file{.def} file.
3826
3827If the @option{-y} option is specified, dlltool generates a delay-import
3828library that can be used instead of the normal import library to allow
3829a program to link to the dll only as soon as an imported function is
3830called for the first time. The resulting executable will need to be
3831linked to the static delayimp library containing __delayLoadHelper2(),
3832which in turn will import LoadLibraryA and GetProcAddress from kernel32.
3833
3834@command{dlltool} builds the library file by hand, but it builds the
3835exports file by creating temporary files containing assembler statements
3836and then assembling these. The @option{-S} command line option can be
3837used to specify the path to the assembler that dlltool will use,
3838and the @option{-f} option can be used to pass specific flags to that
3839assembler. The @option{-n} can be used to prevent dlltool from deleting
3840these temporary assembler files when it is done, and if @option{-n} is
3841specified twice then this will prevent dlltool from deleting the
3842temporary object files it used to build the library.
3843
3844Here is an example of creating a DLL from a source file @samp{dll.c} and
3845also creating a program (from an object file called @samp{program.o})
3846that uses that DLL:
3847
3848@smallexample
3849 gcc -c dll.c
3850 dlltool -e exports.o -l dll.lib dll.o
3851 gcc dll.o exports.o -o dll.dll
3852 gcc program.o dll.lib -o program
3853@end smallexample
3854
3855
3856@command{dlltool} may also be used to query an existing import library
3857to determine the name of the DLL to which it is associated. See the
3858description of the @option{-I} or @option{--identify} option.
3859
3860@c man end
3861
3862@c man begin OPTIONS dlltool
3863
3864The command line options have the following meanings:
3865
3866@table @env
3867
3868@item -d @var{filename}
3869@itemx --input-def @var{filename}
3870@cindex input .def file
3871Specifies the name of a @file{.def} file to be read in and processed.
3872
3873@item -b @var{filename}
3874@itemx --base-file @var{filename}
3875@cindex base files
3876Specifies the name of a base file to be read in and processed. The
3877contents of this file will be added to the relocation section in the
3878exports file generated by dlltool.
3879
3880@item -e @var{filename}
3881@itemx --output-exp @var{filename}
3882Specifies the name of the export file to be created by dlltool.
3883
3884@item -z @var{filename}
3885@itemx --output-def @var{filename}
3886Specifies the name of the @file{.def} file to be created by dlltool.
3887
3888@item -l @var{filename}
3889@itemx --output-lib @var{filename}
3890Specifies the name of the library file to be created by dlltool.
3891
3892@item -y @var{filename}
3893@itemx --output-delaylib @var{filename}
3894Specifies the name of the delay-import library file to be created by dlltool.
3895
3896@item --export-all-symbols
3897Treat all global and weak defined symbols found in the input object
3898files as symbols to be exported. There is a small list of symbols which
3899are not exported by default; see the @option{--no-default-excludes}
3900option. You may add to the list of symbols to not export by using the
3901@option{--exclude-symbols} option.
3902
3903@item --no-export-all-symbols
3904Only export symbols explicitly listed in an input @file{.def} file or in
3905@samp{.drectve} sections in the input object files. This is the default
3906behaviour. The @samp{.drectve} sections are created by @samp{dllexport}
3907attributes in the source code.
3908
3909@item --exclude-symbols @var{list}
3910Do not export the symbols in @var{list}. This is a list of symbol names
3911separated by comma or colon characters. The symbol names should not
3912contain a leading underscore. This is only meaningful when
3913@option{--export-all-symbols} is used.
3914
3915@item --no-default-excludes
3916When @option{--export-all-symbols} is used, it will by default avoid
3917exporting certain special symbols. The current list of symbols to avoid
3918exporting is @samp{DllMain@@12}, @samp{DllEntryPoint@@0},
3919@samp{impure_ptr}. You may use the @option{--no-default-excludes} option
3920to go ahead and export these special symbols. This is only meaningful
3921when @option{--export-all-symbols} is used.
3922
3923@item -S @var{path}
3924@itemx --as @var{path}
3925Specifies the path, including the filename, of the assembler to be used
3926to create the exports file.
3927
3928@item -f @var{options}
3929@itemx --as-flags @var{options}
3930Specifies any specific command line options to be passed to the
3931assembler when building the exports file. This option will work even if
3932the @option{-S} option is not used. This option only takes one argument,
3933and if it occurs more than once on the command line, then later
3934occurrences will override earlier occurrences. So if it is necessary to
3935pass multiple options to the assembler they should be enclosed in
3936double quotes.
3937
3938@item -D @var{name}
3939@itemx --dll-name @var{name}
3940Specifies the name to be stored in the @file{.def} file as the name of
3941the DLL when the @option{-e} option is used. If this option is not
3942present, then the filename given to the @option{-e} option will be
3943used as the name of the DLL.
3944
3945@item -m @var{machine}
3946@itemx -machine @var{machine}
3947Specifies the type of machine for which the library file should be
3948built. @command{dlltool} has a built in default type, depending upon how
3949it was created, but this option can be used to override that. This is
3950normally only useful when creating DLLs for an ARM processor, when the
3951contents of the DLL are actually encode using Thumb instructions.
3952
3953@item -a
3954@itemx --add-indirect
3955Specifies that when @command{dlltool} is creating the exports file it
3956should add a section which allows the exported functions to be
3957referenced without using the import library. Whatever the hell that
3958means!
3959
3960@item -U
3961@itemx --add-underscore
3962Specifies that when @command{dlltool} is creating the exports file it
3963should prepend an underscore to the names of @emph{all} exported symbols.
3964
3965@item --no-leading-underscore
3966@item --leading-underscore
3967Specifies whether standard symbol should be forced to be prefixed, or
3968not.
3969
3970@item --add-stdcall-underscore
3971Specifies that when @command{dlltool} is creating the exports file it
3972should prepend an underscore to the names of exported @emph{stdcall}
3973functions. Variable names and non-stdcall function names are not modified.
3974This option is useful when creating GNU-compatible import libs for third
3975party DLLs that were built with MS-Windows tools.
3976
3977@item -k
3978@itemx --kill-at
3979Specifies that when @command{dlltool} is creating the exports file it
3980should not append the string @samp{@@ <number>}. These numbers are
3981called ordinal numbers and they represent another way of accessing the
3982function in a DLL, other than by name.
3983
3984@item -A
3985@itemx --add-stdcall-alias
3986Specifies that when @command{dlltool} is creating the exports file it
3987should add aliases for stdcall symbols without @samp{@@ <number>}
3988in addition to the symbols with @samp{@@ <number>}.
3989
3990@item -p
3991@itemx --ext-prefix-alias @var{prefix}
3992Causes @command{dlltool} to create external aliases for all DLL
3993imports with the specified prefix. The aliases are created for both
3994external and import symbols with no leading underscore.
3995
3996@item -x
3997@itemx --no-idata4
3998Specifies that when @command{dlltool} is creating the exports and library
3999files it should omit the @code{.idata4} section. This is for compatibility
4000with certain operating systems.
4001
4002@item --use-nul-prefixed-import-tables
4003Specifies that when @command{dlltool} is creating the exports and library
4004files it should prefix the @code{.idata4} and @code{.idata5} by zero an
4005element. This emulates old gnu import library generation of
4006@code{dlltool}. By default this option is turned off.
4007
4008@item -c
4009@itemx --no-idata5
4010Specifies that when @command{dlltool} is creating the exports and library
4011files it should omit the @code{.idata5} section. This is for compatibility
4012with certain operating systems.
4013
4014@item -I @var{filename}
4015@itemx --identify @var{filename}
4016Specifies that @command{dlltool} should inspect the import library
4017indicated by @var{filename} and report, on @code{stdout}, the name(s)
4018of the associated DLL(s). This can be performed in addition to any
4019other operations indicated by the other options and arguments.
4020@command{dlltool} fails if the import library does not exist or is not
4021actually an import library. See also @option{--identify-strict}.
4022
4023@item --identify-strict
4024Modifies the behavior of the @option{--identify} option, such
4025that an error is reported if @var{filename} is associated with
4026more than one DLL.
4027
4028@item -i
4029@itemx --interwork
4030Specifies that @command{dlltool} should mark the objects in the library
4031file and exports file that it produces as supporting interworking
4032between ARM and Thumb code.
4033
4034@item -n
4035@itemx --nodelete
4036Makes @command{dlltool} preserve the temporary assembler files it used to
4037create the exports file. If this option is repeated then dlltool will
4038also preserve the temporary object files it uses to create the library
4039file.
4040
4041@item -t @var{prefix}
4042@itemx --temp-prefix @var{prefix}
4043Makes @command{dlltool} use @var{prefix} when constructing the names of
4044temporary assembler and object files. By default, the temp file prefix
4045is generated from the pid.
4046
4047@item -v
4048@itemx --verbose
4049Make dlltool describe what it is doing.
4050
4051@item -h
4052@itemx --help
4053Displays a list of command line options and then exits.
4054
4055@item -V
4056@itemx --version
4057Displays dlltool's version number and then exits.
4058
4059@end table
4060
4061@c man end
4062
4063@menu
4064* def file format:: The format of the dlltool @file{.def} file
4065@end menu
4066
4067@node def file format
4068@section The format of the @command{dlltool} @file{.def} file
4069
4070A @file{.def} file contains any number of the following commands:
4071
4072@table @asis
4073
4074@item @code{NAME} @var{name} @code{[ ,} @var{base} @code{]}
4075The result is going to be named @var{name}@code{.exe}.
4076
4077@item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]}
4078The result is going to be named @var{name}@code{.dll}.
4079Note: If you want to use LIBRARY as name then you need to quote. Otherwise
4080this will fail due a necessary hack for libtool (see PR binutils/13710 for more
4081details).
4082
4083@item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2} @code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.} @var{external-name} @code{) ) [ == } @var{its_name} @code{]}
4084@item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *}
4085Declares @var{name1} as an exported symbol from the DLL, with optional
4086ordinal number @var{integer}, or declares @var{name1} as an alias
4087(forward) of the function @var{external-name} in the DLL.
4088If @var{its_name} is specified, this name is used as string in export table.
4089@var{module-name}.
4090Note: The @code{EXPORTS} has to be the last command in .def file, as keywords
4091are treated - beside @code{LIBRARY} - as simple name-identifiers.
4092If you want to use LIBRARY as name then you need to quote it.
4093
4094@item @code{IMPORTS ( (} @var{internal-name} @code{=} @var{module-name} @code{.} @var{integer} @code{) | [} @var{internal-name} @code{= ]} @var{module-name} @code{.} @var{external-name} @code{) [ == ) @var{its_name} @code{]} *}
4095Declares that @var{external-name} or the exported function whose
4096ordinal number is @var{integer} is to be imported from the file
4097@var{module-name}. If @var{internal-name} is specified then this is
4098the name that the imported function will be referred to in the body of
4099the DLL.
4100If @var{its_name} is specified, this name is used as string in import table.
4101Note: The @code{IMPORTS} has to be the last command in .def file, as keywords
4102are treated - beside @code{LIBRARY} - as simple name-identifiers.
4103If you want to use LIBRARY as name then you need to quote it.
4104
4105@item @code{DESCRIPTION} @var{string}
4106Puts @var{string} into the output @file{.exp} file in the
4107@code{.rdata} section.
4108
4109@item @code{STACKSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
4110@item @code{HEAPSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
4111Generates @code{--stack} or @code{--heap}
4112@var{number-reserve},@var{number-commit} in the output @code{.drectve}
4113section. The linker will see this and act upon it.
4114
4115@item @code{CODE} @var{attr} @code{+}
4116@item @code{DATA} @var{attr} @code{+}
4117@item @code{SECTIONS (} @var{section-name} @var{attr}@code{ + ) *}
4118Generates @code{--attr} @var{section-name} @var{attr} in the output
4119@code{.drectve} section, where @var{attr} is one of @code{READ},
4120@code{WRITE}, @code{EXECUTE} or @code{SHARED}. The linker will see
4121this and act upon it.
4122
4123@end table
4124
4125@ignore
4126@c man begin SEEALSO dlltool
4127The Info pages for @file{binutils}.
4128@c man end
4129@end ignore
4130
4131@node readelf
4132@chapter readelf
4133
4134@cindex ELF file information
4135@kindex readelf
4136
4137@c man title readelf Displays information about ELF files.
4138
4139@smallexample
4140@c man begin SYNOPSIS readelf
4141readelf [@option{-a}|@option{--all}]
4142 [@option{-h}|@option{--file-header}]
4143 [@option{-l}|@option{--program-headers}|@option{--segments}]
4144 [@option{-S}|@option{--section-headers}|@option{--sections}]
4145 [@option{-g}|@option{--section-groups}]
4146 [@option{-t}|@option{--section-details}]
4147 [@option{-e}|@option{--headers}]
4148 [@option{-s}|@option{--syms}|@option{--symbols}]
4149 [@option{--dyn-syms}]
4150 [@option{-n}|@option{--notes}]
4151 [@option{-r}|@option{--relocs}]
4152 [@option{-u}|@option{--unwind}]
4153 [@option{-d}|@option{--dynamic}]
4154 [@option{-V}|@option{--version-info}]
4155 [@option{-A}|@option{--arch-specific}]
4156 [@option{-D}|@option{--use-dynamic}]
4157 [@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
4158 [@option{-p} <number or name>|@option{--string-dump=}<number or name>]
4159 [@option{-R} <number or name>|@option{--relocated-dump=}<number or name>]
4160 [@option{-c}|@option{--archive-index}]
4161 [@option{-w[lLiaprmfFsoRt]}|
4162 @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
4163 [@option{--dwarf-depth=@var{n}}]
4164 [@option{--dwarf-start=@var{n}}]
4165 [@option{-I}|@option{--histogram}]
4166 [@option{-v}|@option{--version}]
4167 [@option{-W}|@option{--wide}]
4168 [@option{-H}|@option{--help}]
4169 @var{elffile}@dots{}
4170@c man end
4171@end smallexample
4172
4173@c man begin DESCRIPTION readelf
4174
4175@command{readelf} displays information about one or more ELF format object
4176files. The options control what particular information to display.
4177
4178@var{elffile}@dots{} are the object files to be examined. 32-bit and
417964-bit ELF files are supported, as are archives containing ELF files.
4180
4181This program performs a similar function to @command{objdump} but it
4182goes into more detail and it exists independently of the @sc{bfd}
4183library, so if there is a bug in @sc{bfd} then readelf will not be
4184affected.
4185
4186@c man end
4187
4188@c man begin OPTIONS readelf
4189
4190The long and short forms of options, shown here as alternatives, are
4191equivalent. At least one option besides @samp{-v} or @samp{-H} must be
4192given.
4193
4194@table @env
4195@item -a
4196@itemx --all
4197Equivalent to specifying @option{--file-header},
4198@option{--program-headers}, @option{--sections}, @option{--symbols},
4199@option{--relocs}, @option{--dynamic}, @option{--notes} and
4200@option{--version-info}.
4201
4202@item -h
4203@itemx --file-header
4204@cindex ELF file header information
4205Displays the information contained in the ELF header at the start of the
4206file.
4207
4208@item -l
4209@itemx --program-headers
4210@itemx --segments
4211@cindex ELF program header information
4212@cindex ELF segment information
4213Displays the information contained in the file's segment headers, if it
4214has any.
4215
4216@item -S
4217@itemx --sections
4218@itemx --section-headers
4219@cindex ELF section information
4220Displays the information contained in the file's section headers, if it
4221has any.
4222
4223@item -g
4224@itemx --section-groups
4225@cindex ELF section group information
4226Displays the information contained in the file's section groups, if it
4227has any.
4228
4229@item -t
4230@itemx --section-details
4231@cindex ELF section information
4232Displays the detailed section information. Implies @option{-S}.
4233
4234@item -s
4235@itemx --symbols
4236@itemx --syms
4237@cindex ELF symbol table information
4238Displays the entries in symbol table section of the file, if it has one.
4239
4240@item --dyn-syms
4241@cindex ELF dynamic symbol table information
4242Displays the entries in dynamic symbol table section of the file, if it
4243has one.
4244
4245@item -e
4246@itemx --headers
4247Display all the headers in the file. Equivalent to @option{-h -l -S}.
4248
4249@item -n
4250@itemx --notes
4251@cindex ELF notes
4252Displays the contents of the NOTE segments and/or sections, if any.
4253
4254@item -r
4255@itemx --relocs
4256@cindex ELF reloc information
4257Displays the contents of the file's relocation section, if it has one.
4258
4259@item -u
4260@itemx --unwind
4261@cindex unwind information
4262Displays the contents of the file's unwind section, if it has one. Only
4263the unwind sections for IA64 ELF files, as well as ARM unwind tables
4264(@code{.ARM.exidx} / @code{.ARM.extab}) are currently supported.
4265
4266@item -d
4267@itemx --dynamic
4268@cindex ELF dynamic section information
4269Displays the contents of the file's dynamic section, if it has one.
4270
4271@item -V
4272@itemx --version-info
4273@cindex ELF version sections information
4274Displays the contents of the version sections in the file, it they
4275exist.
4276
4277@item -A
4278@itemx --arch-specific
4279Displays architecture-specific information in the file, if there
4280is any.
4281
4282@item -D
4283@itemx --use-dynamic
4284When displaying symbols, this option makes @command{readelf} use the
4285symbol hash tables in the file's dynamic section, rather than the
4286symbol table sections.
4287
4288@item -x <number or name>
4289@itemx --hex-dump=<number or name>
4290Displays the contents of the indicated section as a hexadecimal bytes.
4291A number identifies a particular section by index in the section table;
4292any other string identifies all sections with that name in the object file.
4293
4294@item -R <number or name>
4295@itemx --relocated-dump=<number or name>
4296Displays the contents of the indicated section as a hexadecimal
4297bytes. A number identifies a particular section by index in the
4298section table; any other string identifies all sections with that name
4299in the object file. The contents of the section will be relocated
4300before they are displayed.
4301
4302@item -p <number or name>
4303@itemx --string-dump=<number or name>
4304Displays the contents of the indicated section as printable strings.
4305A number identifies a particular section by index in the section table;
4306any other string identifies all sections with that name in the object file.
4307
4308@item -c
4309@itemx --archive-index
4310@cindex Archive file symbol index information
4311Displays the file symbol index information contained in the header part
4312of binary archives. Performs the same function as the @option{t}
4313command to @command{ar}, but without using the BFD library. @xref{ar}.
4314
4315@item -w[lLiaprmfFsoRt]
4316@itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]
4317Displays the contents of the debug sections in the file, if any are
4318present. If one of the optional letters or words follows the switch
4319then only data found in those specific sections will be dumped.
4320
4321Note that there is no single letter option to display the content of
4322trace sections or .gdb_index.
4323
4324Note: the @option{=decodedline} option will display the interpreted
4325contents of a .debug_line section whereas the @option{=rawline} option
4326dumps the contents in a raw format.
4327
4328Note: the @option{=frames-interp} option will display the interpreted
4329contents of a .debug_frame section whereas the @option{=frames} option
4330dumps the contents in a raw format.
4331
4332Note: the output from the @option{=info} option can also be affected
4333by the options @option{--dwarf-depth} and @option{--dwarf-start}.
4334
4335@item --dwarf-depth=@var{n}
4336Limit the dump of the @code{.debug_info} section to @var{n} children.
4337This is only useful with @option{--debug-dump=info}. The default is
4338to print all DIEs; the special value 0 for @var{n} will also have this
4339effect.
4340
4341With a non-zero value for @var{n}, DIEs at or deeper than @var{n}
4342levels will not be printed. The range for @var{n} is zero-based.
4343
4344@item --dwarf-start=@var{n}
4345Print only DIEs beginning with the DIE numbered @var{n}. This is only
4346useful with @option{--debug-dump=info}.
4347
4348If specified, this option will suppress printing of any header
4349information and all DIEs before the DIE numbered @var{n}. Only
4350siblings and children of the specified DIE will be printed.
4351
4352This can be used in conjunction with @option{--dwarf-depth}.
4353
4354@item -I
4355@itemx --histogram
4356Display a histogram of bucket list lengths when displaying the contents
4357of the symbol tables.
4358
4359@item -v
4360@itemx --version
4361Display the version number of readelf.
4362
4363@item -W
4364@itemx --wide
4365Don't break output lines to fit into 80 columns. By default
4366@command{readelf} breaks section header and segment listing lines for
436764-bit ELF files, so that they fit into 80 columns. This option causes
4368@command{readelf} to print each section header resp. each segment one a
4369single line, which is far more readable on terminals wider than 80 columns.
4370
4371@item -H
4372@itemx --help
4373Display the command line options understood by @command{readelf}.
4374
4375@end table
4376
4377@c man end
4378
4379@ignore
4380@c man begin SEEALSO readelf
4381objdump(1), and the Info entries for @file{binutils}.
4382@c man end
4383@end ignore
4384
4385@node elfedit
4386@chapter elfedit
4387
4388@cindex Update ELF header
4389@kindex elfedit
4390
4391@c man title elfedit Update the ELF header of ELF files.
4392
4393@smallexample
4394@c man begin SYNOPSIS elfedit
4395elfedit [@option{--input-mach=}@var{machine}]
4396 [@option{--input-type=}@var{type}]
4397 [@option{--input-osabi=}@var{osabi}]
4398 @option{--output-mach=}@var{machine}
4399 @option{--output-type=}@var{type}
4400 @option{--output-osabi=}@var{osabi}
4401 [@option{-v}|@option{--version}]
4402 [@option{-h}|@option{--help}]
4403 @var{elffile}@dots{}
4404@c man end
4405@end smallexample
4406
4407@c man begin DESCRIPTION elfedit
4408
4409@command{elfedit} updates the ELF header of ELF files which have
4410the matching ELF machine and file types. The options control how and
4411which fields in the ELF header should be updated.
4412
4413@var{elffile}@dots{} are the ELF files to be updated. 32-bit and
441464-bit ELF files are supported, as are archives containing ELF files.
4415@c man end
4416
4417@c man begin OPTIONS elfedit
4418
4419The long and short forms of options, shown here as alternatives, are
4420equivalent. At least one of the @option{--output-mach},
4421@option{--output-type} and @option{--output-osabi} options must be given.
4422
4423@table @env
4424
4425@item --input-mach=@var{machine}
4426Set the matching input ELF machine type to @var{machine}. If
4427@option{--input-mach} isn't specified, it will match any ELF
4428machine types.
4429
4430The supported ELF machine types are, @var{L1OM}, @var{K1OM} and
4431@var{x86-64}.
4432
4433@item --output-mach=@var{machine}
4434Change the ELF machine type in the ELF header to @var{machine}. The
4435supported ELF machine types are the same as @option{--input-mach}.
4436
4437@item --input-type=@var{type}
4438Set the matching input ELF file type to @var{type}. If
4439@option{--input-type} isn't specified, it will match any ELF file types.
4440
4441The supported ELF file types are, @var{rel}, @var{exec} and @var{dyn}.
4442
4443@item --output-type=@var{type}
4444Change the ELF file type in the ELF header to @var{type}. The
4445supported ELF types are the same as @option{--input-type}.
4446
4447@item --input-osabi=@var{osabi}
4448Set the matching input ELF file OSABI to @var{osabi}. If
4449@option{--input-osabi} isn't specified, it will match any ELF OSABIs.
4450
4451The supported ELF OSABIs are, @var{none}, @var{HPUX}, @var{NetBSD},
4452@var{GNU}, @var{Linux} (alias for @var{GNU}),
4453@var{Solaris}, @var{AIX}, @var{Irix},
4454@var{FreeBSD}, @var{TRU64}, @var{Modesto}, @var{OpenBSD}, @var{OpenVMS},
4455@var{NSK}, @var{AROS} and @var{FenixOS}.
4456
4457@item --output-osabi=@var{osabi}
4458Change the ELF OSABI in the ELF header to @var{osabi}. The
4459supported ELF OSABI are the same as @option{--input-osabi}.
4460
4461@item -v
4462@itemx --version
4463Display the version number of @command{elfedit}.
4464
4465@item -h
4466@itemx --help
4467Display the command line options understood by @command{elfedit}.
4468
4469@end table
4470
4471@c man end
4472
4473@ignore
4474@c man begin SEEALSO elfedit
4475readelf(1), and the Info entries for @file{binutils}.
4476@c man end
4477@end ignore
4478
4479@node Common Options
4480@chapter Common Options
4481
4482The following command-line options are supported by all of the
4483programs described in this manual.
4484
4485@c man begin OPTIONS
4486@table @env
4487@include at-file.texi
4488@c man end
4489
4490@item --help
4491Display the command-line options supported by the program.
4492
4493@item --version
4494Display the version number of the program.
4495
4496@c man begin OPTIONS
4497@end table
4498@c man end
4499
4500@node Selecting the Target System
4501@chapter Selecting the Target System
4502
4503You can specify two aspects of the target system to the @sc{gnu}
4504binary file utilities, each in several ways:
4505
4506@itemize @bullet
4507@item
4508the target
4509
4510@item
4511the architecture
4512@end itemize
4513
4514In the following summaries, the lists of ways to specify values are in
4515order of decreasing precedence. The ways listed first override those
4516listed later.
4517
4518The commands to list valid values only list the values for which the
4519programs you are running were configured. If they were configured with
4520@option{--enable-targets=all}, the commands list most of the available
4521values, but a few are left out; not all targets can be configured in at
4522once because some of them can only be configured @dfn{native} (on hosts
4523with the same type as the target system).
4524
4525@menu
4526* Target Selection::
4527* Architecture Selection::
4528@end menu
4529
4530@node Target Selection
4531@section Target Selection
4532
4533A @dfn{target} is an object file format. A given target may be
4534supported for multiple architectures (@pxref{Architecture Selection}).
4535A target selection may also have variations for different operating
4536systems or architectures.
4537
4538The command to list valid target values is @samp{objdump -i}
4539(the first column of output contains the relevant information).
4540
4541Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
4542@samp{a.out-sunos-big}.
4543
4544You can also specify a target using a configuration triplet. This is
4545the same sort of name that is passed to @file{configure} to specify a
4546target. When you use a configuration triplet as an argument, it must be
4547fully canonicalized. You can see the canonical version of a triplet by
4548running the shell script @file{config.sub} which is included with the
4549sources.
4550
4551Some sample configuration triplets are: @samp{m68k-hp-bsd},
4552@samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}.
4553
4554@subheading @command{objdump} Target
4555
4556Ways to specify:
4557
4558@enumerate
4559@item
4560command line option: @option{-b} or @option{--target}
4561
4562@item
4563environment variable @code{GNUTARGET}
4564
4565@item
4566deduced from the input file
4567@end enumerate
4568
4569@subheading @command{objcopy} and @command{strip} Input Target
4570
4571Ways to specify:
4572
4573@enumerate
4574@item
4575command line options: @option{-I} or @option{--input-target}, or @option{-F} or @option{--target}
4576
4577@item
4578environment variable @code{GNUTARGET}
4579
4580@item
4581deduced from the input file
4582@end enumerate
4583
4584@subheading @command{objcopy} and @command{strip} Output Target
4585
4586Ways to specify:
4587
4588@enumerate
4589@item
4590command line options: @option{-O} or @option{--output-target}, or @option{-F} or @option{--target}
4591
4592@item
4593the input target (see ``@command{objcopy} and @command{strip} Input Target'' above)
4594
4595@item
4596environment variable @code{GNUTARGET}
4597
4598@item
4599deduced from the input file
4600@end enumerate
4601
4602@subheading @command{nm}, @command{size}, and @command{strings} Target
4603
4604Ways to specify:
4605
4606@enumerate
4607@item
4608command line option: @option{--target}
4609
4610@item
4611environment variable @code{GNUTARGET}
4612
4613@item
4614deduced from the input file
4615@end enumerate
4616
4617@node Architecture Selection
4618@section Architecture Selection
4619
4620An @dfn{architecture} is a type of @sc{cpu} on which an object file is
4621to run. Its name may contain a colon, separating the name of the
4622processor family from the name of the particular @sc{cpu}.
4623
4624The command to list valid architecture values is @samp{objdump -i} (the
4625second column contains the relevant information).
4626
4627Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
4628
4629@subheading @command{objdump} Architecture
4630
4631Ways to specify:
4632
4633@enumerate
4634@item
4635command line option: @option{-m} or @option{--architecture}
4636
4637@item
4638deduced from the input file
4639@end enumerate
4640
4641@subheading @command{objcopy}, @command{nm}, @command{size}, @command{strings} Architecture
4642
4643Ways to specify:
4644
4645@enumerate
4646@item
4647deduced from the input file
4648@end enumerate
4649
4650@node Reporting Bugs
4651@chapter Reporting Bugs
4652@cindex bugs
4653@cindex reporting bugs
4654
4655Your bug reports play an essential role in making the binary utilities
4656reliable.
4657
4658Reporting a bug may help you by bringing a solution to your problem, or
4659it may not. But in any case the principal function of a bug report is
4660to help the entire community by making the next version of the binary
4661utilities work better. Bug reports are your contribution to their
4662maintenance.
4663
4664In order for a bug report to serve its purpose, you must include the
4665information that enables us to fix the bug.
4666
4667@menu
4668* Bug Criteria:: Have you found a bug?
4669* Bug Reporting:: How to report bugs
4670@end menu
4671
4672@node Bug Criteria
4673@section Have You Found a Bug?
4674@cindex bug criteria
4675
4676If you are not sure whether you have found a bug, here are some guidelines:
4677
4678@itemize @bullet
4679@cindex fatal signal
4680@cindex crash
4681@item
4682If a binary utility gets a fatal signal, for any input whatever, that is
4683a bug. Reliable utilities never crash.
4684
4685@cindex error on valid input
4686@item
4687If a binary utility produces an error message for valid input, that is a
4688bug.
4689
4690@item
4691If you are an experienced user of binary utilities, your suggestions for
4692improvement are welcome in any case.
4693@end itemize
4694
4695@node Bug Reporting
4696@section How to Report Bugs
4697@cindex bug reports
4698@cindex bugs, reporting
4699
4700A number of companies and individuals offer support for @sc{gnu}
4701products. If you obtained the binary utilities from a support
4702organization, we recommend you contact that organization first.
4703
4704You can find contact information for many support companies and
4705individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
4706distribution.
4707
4708@ifset BUGURL
4709In any event, we also recommend that you send bug reports for the binary
4710utilities to @value{BUGURL}.
4711@end ifset
4712
4713The fundamental principle of reporting bugs usefully is this:
4714@strong{report all the facts}. If you are not sure whether to state a
4715fact or leave it out, state it!
4716
4717Often people omit facts because they think they know what causes the
4718problem and assume that some details do not matter. Thus, you might
4719assume that the name of a file you use in an example does not matter.
4720Well, probably it does not, but one cannot be sure. Perhaps the bug is
4721a stray memory reference which happens to fetch from the location where
4722that pathname is stored in memory; perhaps, if the pathname were
4723different, the contents of that location would fool the utility into
4724doing the right thing despite the bug. Play it safe and give a
4725specific, complete example. That is the easiest thing for you to do,
4726and the most helpful.
4727
4728Keep in mind that the purpose of a bug report is to enable us to fix the bug if
4729it is new to us. Therefore, always write your bug reports on the assumption
4730that the bug has not been reported previously.
4731
4732Sometimes people give a few sketchy facts and ask, ``Does this ring a
4733bell?'' This cannot help us fix a bug, so it is basically useless. We
4734respond by asking for enough details to enable us to investigate.
4735You might as well expedite matters by sending them to begin with.
4736
4737To enable us to fix the bug, you should include all these things:
4738
4739@itemize @bullet
4740@item
4741The version of the utility. Each utility announces it if you start it
4742with the @option{--version} argument.
4743
4744Without this, we will not know whether there is any point in looking for
4745the bug in the current version of the binary utilities.
4746
4747@item
4748Any patches you may have applied to the source, including any patches
4749made to the @code{BFD} library.
4750
4751@item
4752The type of machine you are using, and the operating system name and
4753version number.
4754
4755@item
4756What compiler (and its version) was used to compile the utilities---e.g.
4757``@code{gcc-2.7}''.
4758
4759@item
4760The command arguments you gave the utility to observe the bug. To
4761guarantee you will not omit something important, list them all. A copy
4762of the Makefile (or the output from make) is sufficient.
4763
4764If we were to try to guess the arguments, we would probably guess wrong
4765and then we might not encounter the bug.
4766
4767@item
4768A complete input file, or set of input files, that will reproduce the
4769bug. If the utility is reading an object file or files, then it is
4770generally most helpful to send the actual object files.
4771
4772If the source files were produced exclusively using @sc{gnu} programs
4773(e.g., @command{gcc}, @command{gas}, and/or the @sc{gnu} @command{ld}), then it
4774may be OK to send the source files rather than the object files. In
4775this case, be sure to say exactly what version of @command{gcc}, or
4776whatever, was used to produce the object files. Also say how
4777@command{gcc}, or whatever, was configured.
4778
4779@item
4780A description of what behavior you observe that you believe is
4781incorrect. For example, ``It gets a fatal signal.''
4782
4783Of course, if the bug is that the utility gets a fatal signal, then we
4784will certainly notice it. But if the bug is incorrect output, we might
4785not notice unless it is glaringly wrong. You might as well not give us
4786a chance to make a mistake.
4787
4788Even if the problem you experience is a fatal signal, you should still
4789say so explicitly. Suppose something strange is going on, such as your
4790copy of the utility is out of sync, or you have encountered a bug in
4791the C library on your system. (This has happened!) Your copy might
4792crash and ours would not. If you told us to expect a crash, then when
4793ours fails to crash, we would know that the bug was not happening for
4794us. If you had not told us to expect a crash, then we would not be able
4795to draw any conclusion from our observations.
4796
4797@item
4798If you wish to suggest changes to the source, send us context diffs, as
4799generated by @command{diff} with the @option{-u}, @option{-c}, or @option{-p}
4800option. Always send diffs from the old file to the new file. If you
4801wish to discuss something in the @command{ld} source, refer to it by
4802context, not by line number.
4803
4804The line numbers in our development sources will not match those in your
4805sources. Your line numbers would convey no useful information to us.
4806@end itemize
4807
4808Here are some things that are not necessary:
4809
4810@itemize @bullet
4811@item
4812A description of the envelope of the bug.
4813
4814Often people who encounter a bug spend a lot of time investigating
4815which changes to the input file will make the bug go away and which
4816changes will not affect it.
4817
4818This is often time consuming and not very useful, because the way we
4819will find the bug is by running a single example under the debugger
4820with breakpoints, not by pure deduction from a series of examples.
4821We recommend that you save your time for something else.
4822
4823Of course, if you can find a simpler example to report @emph{instead}
4824of the original one, that is a convenience for us. Errors in the
4825output will be easier to spot, running under the debugger will take
4826less time, and so on.
4827
4828However, simplification is not vital; if you do not want to do this,
4829report the bug anyway and send us the entire test case you used.
4830
4831@item
4832A patch for the bug.
4833
4834A patch for the bug does help us if it is a good one. But do not omit
4835the necessary information, such as the test case, on the assumption that
4836a patch is all we need. We might see problems with your patch and decide
4837to fix the problem another way, or we might not understand it at all.
4838
4839Sometimes with programs as complicated as the binary utilities it is
4840very hard to construct an example that will make the program follow a
4841certain path through the code. If you do not send us the example, we
4842will not be able to construct one, so we will not be able to verify that
4843the bug is fixed.
4844
4845And if we cannot understand what bug you are trying to fix, or why your
4846patch should be an improvement, we will not install it. A test case will
4847help us to understand.
4848
4849@item
4850A guess about what the bug is or what it depends on.
4851
4852Such guesses are usually wrong. Even we cannot guess right about such
4853things without first using the debugger to find the facts.
4854@end itemize
4855
4856@node GNU Free Documentation License
4857@appendix GNU Free Documentation License
4858
4859@include fdl.texi
4860
4861@node Binutils Index
4862@unnumbered Binutils Index
4863
4864@printindex cp
4865
4866@bye
This page took 0.063738 seconds and 4 git commands to generate.