1 \input texinfo @c -*- Texinfo -*-
2 @setfilename binutils.info
3 @settitle @sc{gnu} Binary Utilities
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
15 2010, 2011, 2012, 2013
16 Free Software Foundation, Inc.
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License, Version 1.3
20 or any later version published by the Free Software Foundation;
21 with no Invariant Sections, with no Front-Cover Texts, and with no
22 Back-Cover Texts. A copy of the license is included in the
23 section entitled ``GNU Free Documentation License''.
28 @dircategory Software development
30 * Binutils: (binutils). The GNU binary utilities.
33 @dircategory Individual utilities
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.
55 @title The @sc{gnu} Binary Utilities
56 @ifset VERSION_PACKAGE
57 @subtitle @value{VERSION_PACKAGE}
59 @subtitle Version @value{VERSION}
61 @subtitle @value{UPDATED}
62 @author Roland H. Pesch
63 @author Jeffrey M. Osier
64 @author Cygnus Support
68 {\parskip=0pt \hfill Cygnus Support\par \hfill
69 Texinfo \texinfoversion\par }
72 @vskip 0pt plus 1filll
81 This brief manual contains documentation for the @sc{gnu} binary
83 @ifset VERSION_PACKAGE
84 @value{VERSION_PACKAGE}
86 version @value{VERSION}:
91 Create, modify, and extract from archives
94 List symbols from object files
97 Copy and translate object files
100 Display information from object files
103 Generate index to archive contents
106 Display the contents of ELF format files.
109 List file section sizes and total size
112 List printable strings from files
118 Update the ELF header of ELF files.
121 Demangle encoded C++ symbols (on MS-DOS, this program is named
125 Convert addresses into file names and line numbers
128 Convert object code into a Netware Loadable Module
131 Manipulate Windows resources
134 Generator for Windows message resources
137 Create the files needed to build and use Dynamic Link Libraries
141 This document is distributed under the terms of the GNU Free
142 Documentation License version 1.3. A copy of the license is included
143 in the section entitled ``GNU Free Documentation License''.
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
175 @cindex collections of files
177 @c man title ar create, modify, and extract from archives
180 ar [@option{--plugin} @var{name}] [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] [@option{--target} @var{bfdname}] @var{archive} [@var{member}@dots{}]
181 ar -M [ <mri-script ]
184 @c man begin DESCRIPTION ar
186 The @sc{gnu} @command{ar} program creates, modifies, and extracts from
187 archives. An @dfn{archive} is a single file holding a collection of
188 other files in a structure that makes it possible to retrieve
189 the original individual files (called @dfn{members} of the archive).
191 The original files' contents, mode (permissions), timestamp, owner, and
192 group are preserved in the archive, and can be restored on
196 @sc{gnu} @command{ar} can maintain archives whose members have names of any
197 length; however, depending on how @command{ar} is configured on your
198 system, a limit on member-name length may be imposed for compatibility
199 with archive formats maintained with other tools. If it exists, the
200 limit is often 15 characters (typical of formats related to a.out) or 16
201 characters (typical of formats related to coff).
204 @command{ar} is considered a binary utility because archives of this sort
205 are most often used as @dfn{libraries} holding commonly needed
209 @command{ar} creates an index to the symbols defined in relocatable
210 object modules in the archive when you specify the modifier @samp{s}.
211 Once created, this index is updated in the archive whenever @command{ar}
212 makes a change to its contents (save for the @samp{q} update operation).
213 An archive with such an index speeds up linking to the library, and
214 allows routines in the library to call each other without regard to
215 their placement in the archive.
217 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
218 table. If an archive lacks the table, another form of @command{ar} called
219 @command{ranlib} can be used to add just the table.
221 @cindex thin archives
222 @sc{gnu} @command{ar} can optionally create a @emph{thin} archive,
223 which contains a symbol index and references to the original copies
224 of the member files of the archives. Such an archive is useful
225 for building libraries for use within a local build, where the
226 relocatable objects are expected to remain available, and copying the
227 contents of each object would only waste time and space. Thin archives
228 are also @emph{flattened}, so that adding one or more archives to a
229 thin archive will add the elements of the nested archive individually.
230 The paths to the elements of the archive are stored relative to the
233 @cindex compatibility, @command{ar}
234 @cindex @command{ar} compatibility
235 @sc{gnu} @command{ar} is designed to be compatible with two different
236 facilities. You can control its activity using command-line options,
237 like the different varieties of @command{ar} on Unix systems; or, if you
238 specify the single command-line option @option{-M}, you can control it
239 with a script supplied via standard input, like the MRI ``librarian''
245 * ar cmdline:: Controlling @command{ar} on the command line
246 * ar scripts:: Controlling @command{ar} with a script
251 @section Controlling @command{ar} on the Command Line
254 @c man begin SYNOPSIS ar
255 ar [@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{}]
259 @cindex Unix compatibility, @command{ar}
260 When you use @command{ar} in the Unix style, @command{ar} insists on at least two
261 arguments 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.
265 Most operations can also accept further @var{member} arguments,
266 specifying particular files to operate on.
268 @c man begin OPTIONS ar
270 @sc{gnu} @command{ar} allows you to mix the operation code @var{p} and modifier
271 flags @var{mod} in any order, within the first command-line argument.
273 If you wish, you may begin the first command-line argument with a
276 @cindex operations on archive
277 The @var{p} keyletter specifies what operation to execute; it may be
278 any of the following, but you must specify only one of them:
282 @cindex deleting from archive
283 @emph{Delete} modules from the archive. Specify the names of modules to
284 be deleted as @var{member}@dots{}; the archive is untouched if you
285 specify no files to delete.
287 If you specify the @samp{v} modifier, @command{ar} lists each module
291 @cindex moving in archive
292 Use this operation to @emph{move} members in an archive.
294 The ordering of members in an archive can make a difference in how
295 programs are linked using the library, if a symbol is defined in more
298 If 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;
300 you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
301 specified place instead.
304 @cindex printing from archive
305 @emph{Print} the specified members of the archive, to the standard
306 output file. If the @samp{v} modifier is specified, show the member
307 name before copying its contents to standard output.
309 If you specify no @var{member} arguments, all the files in the archive are
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.
317 The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
318 operation; new members are always placed at the end of the archive.
320 The modifier @samp{v} makes @command{ar} list each file as it is appended.
322 Since the point of this operation is speed, the archive's symbol table
323 index 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.
326 However, too many different systems assume quick append rebuilds the
327 index, so @sc{gnu} @command{ar} implements @samp{q} as a synonym for @samp{r}.
330 @cindex replacement in archive
331 Insert the files @var{member}@dots{} into @var{archive} (with
332 @emph{replacement}). This operation differs from @samp{q} in that any
333 previously existing members are deleted if their names match those being
336 If one of the files named in @var{member}@dots{} does not exist, @command{ar}
337 displays an error message, and leaves undisturbed any existing members
338 of the archive matching that name.
340 By default, new members are added at the end of the file; but you may
341 use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
342 placement relative to some existing member.
344 The modifier @samp{v} used with this operation elicits a line of
345 output 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
347 deleted) or replaced.
351 Add an index to the archive, or update it if it already exists. Note
352 this command is an exception to the rule that there can only be one
353 command letter, as it is possible to use it as either a command or a
354 modifier. In either case it does the same thing.
357 @cindex contents of archive
358 Display a @emph{table} listing the contents of @var{archive}, or those
359 of the files listed in @var{member}@dots{} that are present in the
360 archive. Normally only the member name is shown; if you also want to
361 see the modes (permissions), timestamp, owner, group, and size, you can
362 request that by also specifying the @samp{v} modifier.
364 If you do not specify a @var{member}, all files in the archive
367 @cindex repeated names in archive
368 @cindex name duplication in archive
369 If there is more than one file with the same name (say, @samp{fie}) in
370 an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
371 first instance; to see them all, you must ask for a complete
372 listing---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.
377 @cindex extract from archive
378 @emph{Extract} members (named @var{member}) from the archive. You can
379 use the @samp{v} modifier with this operation, to request that
380 @command{ar} list each name as it extracts it.
382 If you do not specify a @var{member}, all files in the archive
385 Files cannot be extracted from a thin archive.
388 Displays the list of command line options supported by @command{ar}
392 Displays the version information of @command{ar} and then exits.
396 A number of modifiers (@var{mod}) may immediately follow the @var{p}
397 keyletter, to specify variations on an operation's behavior:
401 @cindex relative placement in archive
402 Add new files @emph{after} an existing member of the
403 archive. If you use the modifier @samp{a}, the name of an existing archive
404 member must be present as the @var{relpos} argument, before the
405 @var{archive} specification.
408 Add new files @emph{before} an existing member of the
409 archive. If you use the modifier @samp{b}, the name of an existing archive
410 member must be present as the @var{relpos} argument, before the
411 @var{archive} specification. (same as @samp{i}).
414 @cindex creating archives
415 @emph{Create} the archive. The specified @var{archive} is always
416 created if it did not exist, when you request an update. But a warning is
417 issued unless you specify in advance that you expect to create it, by
421 @cindex deterministic archives
422 @kindex --enable-deterministic-archives
423 Operate in @emph{deterministic} mode. When adding files and the archive
424 index use zero for UIDs, GIDs, timestamps, and use consistent file modes
425 for all files. When this option is used, if @command{ar} is used with
426 identical options and identical input files, multiple runs will create
427 identical output files regardless of the input files' owners, groups,
428 file modes, or modification times.
430 If @file{binutils} was configured with
431 @option{--enable-deterministic-archives}, then this mode is on by default.
432 It can be disabled with the @samp{U} modifier, below.
435 Truncate names in the archive. @sc{gnu} @command{ar} will normally permit file
436 names of any length. This will cause it to create archives which are
437 not compatible with the native @command{ar} program on some systems. If
438 this is a concern, the @samp{f} modifier may be used to truncate file
439 names when putting them in the archive.
442 Insert new files @emph{before} an existing member of the
443 archive. If you use the modifier @samp{i}, the name of an existing archive
444 member must be present as the @var{relpos} argument, before the
445 @var{archive} specification. (same as @samp{b}).
448 This modifier is accepted but not used.
449 @c whaffor ar l modifier??? presumably compat; with
450 @c what???---doc@@cygnus.com, 25jan91
453 Uses the @var{count} parameter. This is used if there are multiple
454 entries in the archive with the same name. Extract or delete instance
455 @var{count} of the given name from the archive.
458 @cindex dates in archive
459 Preserve the @emph{original} dates of members when extracting them. If
460 you do not specify this modifier, files extracted from the archive
461 are stamped with the time of extraction.
464 Use 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
466 are not POSIX complaint), but other archive creators can. This option
467 will cause @sc{gnu} @command{ar} to match file names using a complete path
468 name, which can be convenient when extracting a single file from an
469 archive created by another tool.
472 @cindex writing archive index
473 Write an object-file index into the archive, or update an existing one,
474 even if no other change is made to the archive. You may use this modifier
475 flag either with any operation, or alone. Running @samp{ar s} on an
476 archive is equivalent to running @samp{ranlib} on it.
479 @cindex not writing archive index
480 Do not generate an archive symbol table. This can speed up building a
481 large library in several steps. The resulting archive can not be used
482 with 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.
487 @cindex creating thin archive
488 Make the specified @var{archive} a @emph{thin} archive. If it already
489 exists and is a regular archive, the existing members must be present
490 in the same directory as @var{archive}.
493 @cindex updating an archive
494 Normally, @samp{ar r}@dots{} inserts all files
495 listed into the archive. If you would like to insert @emph{only} those
496 of the files you list that are newer than existing members of the same
497 names, use this modifier. The @samp{u} modifier is allowed only for the
498 operation @samp{r} (replace). In particular, the combination @samp{qu} is
499 not allowed, since checking the timestamps would lose any speed
500 advantage from the operation @samp{q}.
503 @cindex deterministic archives
504 @kindex --enable-deterministic-archives
505 Do @emph{not} operate in @emph{deterministic} mode. This is the inverse
506 of the @samp{D} modifier, above: added files and the archive index will
507 get their actual UID, GID, timestamp, and file mode values.
509 This is the default unless @file{binutils} was configured with
510 @option{--enable-deterministic-archives}.
513 This modifier requests the @emph{verbose} version of an operation. Many
514 operations display additional information, such as filenames processed,
515 when the modifier @samp{v} is appended.
518 This modifier shows the version number of @command{ar}.
521 @command{ar} ignores an initial option spelt @samp{-X32_64}, for
522 compatibility with AIX. The behaviour produced by this option is the
523 default 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}
525 which is the default for AIX @command{ar}.
527 The optional command line switch @option{--plugin} @var{name} causes
528 @command{ar} to load the plugin called @var{name} which adds support
529 for more file formats. This option is only available if the toolchain
530 has been built with plugin support enabled.
532 The optional command line switch @option{--target} @var{bfdname}
533 specifies that the archive members are in an object code format
534 different from your system's default format. See
535 @xref{Target Selection}, for more information.
540 @c man begin SEEALSO ar
541 nm(1), ranlib(1), and the Info entries for @file{binutils}.
546 @section Controlling @command{ar} with a Script
549 ar -M [ <@var{script} ]
552 @cindex MRI compatibility, @command{ar}
553 @cindex scripts, @command{ar}
554 If you use the single command-line option @samp{-M} with @command{ar}, you
555 can control its operation with a rudimentary command language. This
556 form of @command{ar} operates interactively if standard input is coming
557 directly from a terminal. During interactive use, @command{ar} prompts for
558 input (the prompt is @samp{AR >}), and continues executing even after
559 errors. If you redirect standard input to a script file, no prompts are
560 issued, and @command{ar} abandons execution (with a nonzero exit code)
563 The @command{ar} command language is @emph{not} designed to be equivalent
564 to the command-line options; in fact, it provides somewhat less control
565 over archives. The only purpose of the command language is to ease the
566 transition to @sc{gnu} @command{ar} for developers who already have scripts
567 written for the MRI ``librarian'' program.
569 The syntax for the @command{ar} command language is straightforward:
572 commands are recognized in upper or lower case; for example, @code{LIST}
573 is the same as @code{list}. In the following descriptions, commands are
574 shown in upper case for clarity.
577 a single command may appear on each line; it is the first word on the
581 empty lines are allowed, and have no effect.
584 comments are allowed; text after either of the characters @samp{*}
585 or @samp{;} is ignored.
588 Whenever you use a list of names as part of the argument to an @command{ar}
589 command, you can separate the individual names with either commas or
590 blanks. Commas are shown in the explanations below, for clarity.
593 @samp{+} is used as a line continuation character; if @samp{+} appears
594 at the end of a line, the text on the following line is considered part
595 of the current command.
598 Here are the commands you can use in @command{ar} scripts, or when using
599 @command{ar} interactively. Three of them have special significance:
601 @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
602 a temporary file required for most of the other commands.
604 @code{SAVE} commits the changes so far specified by the script. Prior
605 to @code{SAVE}, commands affect only the temporary copy of the current
609 @item ADDLIB @var{archive}
610 @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
611 Add all the contents of @var{archive} (or, if specified, each named
612 @var{module} from @var{archive}) to the current archive.
614 Requires prior use of @code{OPEN} or @code{CREATE}.
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..."
619 Add each named @var{member} as a module in the current archive.
621 Requires prior use of @code{OPEN} or @code{CREATE}.
624 Discard the contents of the current archive, canceling the effect of
625 any operations since the last @code{SAVE}. May be executed (with no
626 effect) even if no current archive is specified.
628 @item CREATE @var{archive}
629 Creates an archive, and makes it the current archive (required for many
630 other commands). The new archive is created with a temporary name; it
631 is not actually saved as @var{archive} until you use @code{SAVE}.
632 You can overwrite existing archives; similarly, the contents of any
633 existing file named @var{archive} will not be destroyed until @code{SAVE}.
635 @item DELETE @var{module}, @var{module}, @dots{} @var{module}
636 Delete each listed @var{module} from the current archive; equivalent to
637 @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
639 Requires prior use of @code{OPEN} or @code{CREATE}.
641 @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
642 @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
643 List each named @var{module} present in @var{archive}. The separate
644 command @code{VERBOSE} specifies the form of the output: when verbose
645 output 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{}}.
649 Output normally goes to the standard output stream; however, if you
650 specify @var{outputfile} as a final argument, @command{ar} directs the
654 Exit from @command{ar}, with a @code{0} exit code to indicate successful
655 completion. This command does not save the output file; if you have
656 changed the current archive since the last @code{SAVE} command, those
659 @item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
660 Extract each named @var{module} from the current archive, writing them
661 into the current directory as separate files. Equivalent to @samp{ar -x
662 @var{archive} @var{module}@dots{}}.
664 Requires prior use of @code{OPEN} or @code{CREATE}.
667 @c FIXME Tokens but no commands???
674 Display full contents of the current archive, in ``verbose'' style
675 regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
676 tv @var{archive}}. (This single command is a @sc{gnu} @command{ar}
677 enhancement, rather than present for MRI compatibility.)
679 Requires prior use of @code{OPEN} or @code{CREATE}.
681 @item OPEN @var{archive}
682 Opens an existing archive for use as the current archive (required for
683 many other commands). Any changes as the result of subsequent commands
684 will not actually affect @var{archive} until you next use @code{SAVE}.
686 @item REPLACE @var{module}, @var{module}, @dots{} @var{module}
687 In the current archive, replace each existing @var{module} (named in
688 the @code{REPLACE} arguments) from files in the current working directory.
689 To execute this command without errors, both the file, and the module in
690 the current archive, must exist.
692 Requires prior use of @code{OPEN} or @code{CREATE}.
695 Toggle an internal flag governing the output from @code{DIRECTORY}.
696 When the flag is on, @code{DIRECTORY} output matches output from
697 @samp{ar -tv }@dots{}.
700 Commit your changes to the current archive, and actually save it as a
701 file with the name specified in the last @code{CREATE} or @code{OPEN}
704 Requires prior use of @code{OPEN} or @code{CREATE}.
713 The @sc{gnu} linker @command{ld} is now described in a separate manual.
714 @xref{Top,, Overview,, Using LD: the @sc{gnu} linker}.
722 @c man title nm list symbols from object files
725 @c man begin SYNOPSIS nm
726 nm [@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{}]
742 @c man begin DESCRIPTION nm
743 @sc{gnu} @command{nm} lists the symbols from object files @var{objfile}@dots{}.
744 If no object files are listed as arguments, @command{nm} assumes the file
747 For each symbol, @command{nm} shows:
751 The symbol value, in the radix selected by options (see below), or
752 hexadecimal by default.
755 The symbol type. At least the following types are used; others are, as
756 well, depending on the object file format. If lowercase, the symbol is
757 usually local; if uppercase, the symbol is global (external). There
758 are however a few lowercase symbols that are shown for special global
759 symbols (@code{u}, @code{v} and @code{w}).
761 @c Some more detail on exactly what these symbol types are used for
765 The symbol's value is absolute, and will not be changed by further
770 The symbol is in the uninitialized data section (known as BSS).
773 The symbol is common. Common symbols are uninitialized data. When
774 linking, multiple common symbols may appear with the same name. If the
775 symbol is defined anywhere, the common symbols are treated as undefined
778 For more details on common symbols, see the discussion of
779 --warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}.
784 The symbol is in the initialized data section.
788 The symbol is in an initialized data section for small objects. Some
789 object file formats permit more efficient access to small data objects,
790 such as a global int variable as opposed to a large global array.
793 For PE format files this indicates that the symbol is in a section
794 specific to the implementation of DLLs. For ELF format files this
795 indicates that the symbol is an indirect function. This is a GNU
796 extension to the standard set of ELF symbol types. It indicates a
797 symbol which if referenced by a relocation does not evaluate to its
798 address, but instead must be invoked at runtime. The runtime
799 execution will then return the value to be used in the relocation.
802 The symbol is a debugging symbol.
805 The symbols is in a stack unwind section.
809 The symbol is in a read only data section.
813 The symbol is in an uninitialized data section for small objects.
817 The symbol is in the text (code) section.
820 The symbol is undefined.
823 The symbol is a unique global symbol. This is a GNU extension to the
824 standard set of ELF symbol bindings. For such a symbol the dynamic linker
825 will make sure that in the entire process there is just one symbol with
826 this name and type in use.
830 The symbol is a weak object. When a weak defined symbol is linked with
831 a normal defined symbol, the normal defined symbol is used with no error.
832 When a weak undefined symbol is linked and the symbol is not defined,
833 the value of the weak symbol becomes zero with no error. On some
834 systems, uppercase indicates that a default value has been specified.
838 The symbol is a weak symbol that has not been specifically tagged as a
839 weak object symbol. When a weak defined symbol is linked with a normal
840 defined symbol, the normal defined symbol is used with no error.
841 When a weak undefined symbol is linked and the symbol is not defined,
842 the value of the symbol is determined in a system-specific manner without
843 error. On some systems, uppercase indicates that a default value has been
847 The symbol is a stabs symbol in an a.out object file. In this case, the
848 next values printed are the stabs other field, the stabs desc field, and
849 the stab type. Stabs symbols are used to hold debugging information.
851 For more information, see @ref{Top,Stabs,Stabs Overview,stabs.info, The
852 ``stabs'' debug format}.
856 The symbol type is unknown, or object file format specific.
865 @c man begin OPTIONS nm
866 The long and short forms of options, shown here as alternatives, are
872 @itemx --print-file-name
873 @cindex input file name
875 @cindex source file name
876 Precede each symbol by the name of the input file (or archive member)
877 in which it was found, rather than identifying the input file once only,
878 before all of its symbols.
882 @cindex debugging symbols
883 Display all symbols, even debugger-only symbols; normally these are not
887 @cindex @command{nm} format
888 @cindex @command{nm} compatibility
889 The same as @option{--format=bsd} (for compatibility with the MIPS @command{nm}).
892 @itemx --demangle[=@var{style}]
893 @cindex demangling in nm
894 Decode (@dfn{demangle}) low-level symbol names into user-level names.
895 Besides removing any initial underscore prepended by the system, this
896 makes C++ function names readable. Different compilers have different
897 mangling styles. The optional demangling style argument can be used to
898 choose an appropriate demangling style for your compiler. @xref{c++filt},
899 for more information on demangling.
902 Do not demangle low-level symbol names. This is the default.
906 @cindex dynamic symbols
907 Display the dynamic symbols rather than the normal symbols. This is
908 only meaningful for dynamic objects, such as certain types of shared
911 @item -f @var{format}
912 @itemx --format=@var{format}
913 @cindex @command{nm} format
914 @cindex @command{nm} compatibility
915 Use the output format @var{format}, which can be @code{bsd},
916 @code{sysv}, or @code{posix}. The default is @code{bsd}.
917 Only the first character of @var{format} is significant; it can be
918 either upper or lower case.
922 @cindex external symbols
923 Display only external symbols.
927 Show a summary of the options to @command{nm} and exit.
930 @itemx --line-numbers
931 @cindex symbol line numbers
932 For each symbol, use debugging information to try to find a filename and
933 line number. For a defined symbol, look for the line number of the
934 address of the symbol. For an undefined symbol, look for the line
935 number of a relocation entry which refers to the symbol. If line number
936 information can be found, print it after the other symbol information.
940 @itemx --numeric-sort
941 Sort symbols numerically by their addresses, rather than alphabetically
946 @cindex sorting symbols
947 Do not bother to sort the symbols in any order; print them in the order
952 Use the POSIX.2 standard output format instead of the default format.
953 Equivalent to @samp{-f posix}.
956 @itemx --reverse-sort
957 Reverse the order of the sort (whether numeric or alphabetic); let the
962 Print both value and size of defined symbols for the @code{bsd} output style.
963 This option has no effect for object formats that do not record symbol
964 sizes, unless @samp{--size-sort} is also used in which case a
965 calculated size is displayed.
969 @cindex symbol index, listing
970 When listing symbols from archive members, include the index: a mapping
971 (stored in the archive by @command{ar} or @command{ranlib}) of which modules
972 contain definitions for which names.
975 @itemx --radix=@var{radix}
976 Use @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.
980 @itemx --undefined-only
981 @cindex external symbols
982 @cindex undefined symbols
983 Display only undefined symbols (those external to each object file).
987 Show the version number of @command{nm} and exit.
990 This 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
993 to @option{-X 32}, which is not supported by @sc{gnu} @command{nm}.
996 @cindex external symbols
997 @cindex undefined symbols
998 Display only defined symbols for each object file.
1000 @item --plugin @var{name}
1002 Load the plugin called @var{name} to add support for extra target
1003 types. This option is only available if the toolchain has been built
1004 with plugin support enabled.
1007 Sort symbols by size. The size is computed as the difference between
1008 the value of the symbol and the value of the symbol with the next higher
1009 value. If the @code{bsd} output format is used the size of the symbol
1010 is printed, rather than the value, and @samp{-S} must be used in order
1011 both size and value to be printed.
1013 @item --special-syms
1014 Display symbols which have a target-specific special meaning. These
1015 symbols are usually used by the target for some special processing and
1016 are not normally helpful when included included in the normal symbol
1017 lists. For example for ARM targets this option would skip the mapping
1018 symbols used to mark transitions between ARM code, THUMB code and
1022 Include synthetic symbols in the output. These are special symbols
1023 created by the linker for various purposes. They are not shown by
1024 default since they are not part of the binary's original source code.
1026 @item --target=@var{bfdname}
1027 @cindex object code format
1028 Specify an object code format other than your system's default format.
1029 @xref{Target Selection}, for more information.
1036 @c man begin SEEALSO nm
1037 ar(1), objdump(1), ranlib(1), and the Info entries for @file{binutils}.
1044 @c man title objcopy copy and translate object files
1047 @c man begin SYNOPSIS objcopy
1048 objcopy [@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{--debugging}]
1073 [@option{--gap-fill=}@var{val}]
1074 [@option{--pad-to=}@var{address}]
1075 [@option{--set-start=}@var{val}]
1076 [@option{--adjust-start=}@var{incr}]
1077 [@option{--change-addresses=}@var{incr}]
1078 [@option{--change-section-address} @var{section}@{=,+,-@}@var{val}]
1079 [@option{--change-section-lma} @var{section}@{=,+,-@}@var{val}]
1080 [@option{--change-section-vma} @var{section}@{=,+,-@}@var{val}]
1081 [@option{--change-warnings}] [@option{--no-change-warnings}]
1082 [@option{--set-section-flags} @var{section}=@var{flags}]
1083 [@option{--add-section} @var{sectionname}=@var{filename}]
1084 [@option{--rename-section} @var{oldname}=@var{newname}[,@var{flags}]]
1085 [@option{--long-section-names} @{enable,disable,keep@}]
1086 [@option{--change-leading-char}] [@option{--remove-leading-char}]
1087 [@option{--reverse-bytes=}@var{num}]
1088 [@option{--srec-len=}@var{ival}] [@option{--srec-forceS3}]
1089 [@option{--redefine-sym} @var{old}=@var{new}]
1090 [@option{--redefine-syms=}@var{filename}]
1092 [@option{--keep-symbols=}@var{filename}]
1093 [@option{--strip-symbols=}@var{filename}]
1094 [@option{--strip-unneeded-symbols=}@var{filename}]
1095 [@option{--keep-global-symbols=}@var{filename}]
1096 [@option{--localize-symbols=}@var{filename}]
1097 [@option{--globalize-symbols=}@var{filename}]
1098 [@option{--weaken-symbols=}@var{filename}]
1099 [@option{--alt-machine-code=}@var{index}]
1100 [@option{--prefix-symbols=}@var{string}]
1101 [@option{--prefix-sections=}@var{string}]
1102 [@option{--prefix-alloc-sections=}@var{string}]
1103 [@option{--add-gnu-debuglink=}@var{path-to-file}]
1104 [@option{--keep-file-symbols}]
1105 [@option{--only-keep-debug}]
1106 [@option{--strip-dwo}]
1107 [@option{--extract-dwo}]
1108 [@option{--extract-symbol}]
1109 [@option{--writable-text}]
1110 [@option{--readonly-text}]
1113 [@option{--file-alignment=}@var{num}]
1114 [@option{--heap=}@var{size}]
1115 [@option{--image-base=}@var{address}]
1116 [@option{--section-alignment=}@var{num}]
1117 [@option{--stack=}@var{size}]
1118 [@option{--subsystem=}@var{which}:@var{major}.@var{minor}]
1119 [@option{--compress-debug-sections}]
1120 [@option{--decompress-debug-sections}]
1121 [@option{--dwarf-depth=@var{n}}]
1122 [@option{--dwarf-start=@var{n}}]
1123 [@option{-v}|@option{--verbose}]
1124 [@option{-V}|@option{--version}]
1125 [@option{--help}] [@option{--info}]
1126 @var{infile} [@var{outfile}]
1130 @c man begin DESCRIPTION objcopy
1131 The @sc{gnu} @command{objcopy} utility copies the contents of an object
1132 file to another. @command{objcopy} uses the @sc{gnu} @sc{bfd} Library to
1133 read and write the object files. It can write the destination object
1134 file in a format different from that of the source object file. The
1135 exact behavior of @command{objcopy} is controlled by command-line options.
1136 Note that @command{objcopy} should be able to copy a fully linked file
1137 between any two formats. However, copying a relocatable object file
1138 between any two formats may not work as expected.
1140 @command{objcopy} creates temporary files to do its translations and
1141 deletes them afterward. @command{objcopy} uses @sc{bfd} to do all its
1142 translation work; it has access to all the formats described in @sc{bfd}
1143 and thus is able to recognize most formats without being told
1144 explicitly. @xref{BFD,,BFD,ld.info,Using LD}.
1146 @command{objcopy} can be used to generate S-records by using an output
1147 target of @samp{srec} (e.g., use @samp{-O srec}).
1149 @command{objcopy} can be used to generate a raw binary file by using an
1150 output target of @samp{binary} (e.g., use @option{-O binary}). When
1151 @command{objcopy} generates a raw binary file, it will essentially produce
1152 a memory dump of the contents of the input object file. All symbols and
1153 relocation information will be discarded. The memory dump will start at
1154 the load address of the lowest section copied into the output file.
1156 When generating an S-record or a raw binary file, it may be helpful to
1157 use @option{-S} to remove sections containing debugging information. In
1158 some cases @option{-R} will be useful to remove sections which contain
1159 information that is not needed by the binary file.
1161 Note---@command{objcopy} is not able to change the endianness of its input
1162 files. If the input format has an endianness (some formats do not),
1163 @command{objcopy} can only copy the inputs into file formats that have the
1164 same endianness or which have no endianness (e.g., @samp{srec}).
1165 (However, see the @option{--reverse-bytes} option.)
1169 @c man begin OPTIONS objcopy
1173 @itemx @var{outfile}
1174 The input and output files, respectively.
1175 If you do not specify @var{outfile}, @command{objcopy} creates a
1176 temporary file and destructively renames the result with
1177 the name of @var{infile}.
1179 @item -I @var{bfdname}
1180 @itemx --input-target=@var{bfdname}
1181 Consider the source file's object format to be @var{bfdname}, rather than
1182 attempting to deduce it. @xref{Target Selection}, for more information.
1184 @item -O @var{bfdname}
1185 @itemx --output-target=@var{bfdname}
1186 Write the output file using the object format @var{bfdname}.
1187 @xref{Target Selection}, for more information.
1189 @item -F @var{bfdname}
1190 @itemx --target=@var{bfdname}
1191 Use @var{bfdname} as the object format for both the input and the output
1192 file; i.e., simply transfer data from source to destination with no
1193 translation. @xref{Target Selection}, for more information.
1195 @item -B @var{bfdarch}
1196 @itemx --binary-architecture=@var{bfdarch}
1197 Useful when transforming a architecture-less input file into an object file.
1198 In this case the output architecture can be set to @var{bfdarch}. This
1199 option will be ignored if the input file has a known @var{bfdarch}. You
1200 can access this binary data inside a program by referencing the special
1201 symbols that are created by the conversion process. These symbols are
1202 called _binary_@var{objfile}_start, _binary_@var{objfile}_end and
1203 _binary_@var{objfile}_size. e.g. you can transform a picture file into
1204 an object file and then access it in your code using these symbols.
1206 @item -j @var{sectionname}
1207 @itemx --only-section=@var{sectionname}
1208 Copy only the named section from the input file to the output file.
1209 This option may be given more than once. Note that using this option
1210 inappropriately may make the output file unusable.
1212 @item -R @var{sectionname}
1213 @itemx --remove-section=@var{sectionname}
1214 Remove any section named @var{sectionname} from the output file. This
1215 option may be given more than once. Note that using this option
1216 inappropriately may make the output file unusable.
1220 Do not copy relocation and symbol information from the source file.
1223 @itemx --strip-debug
1224 Do not copy debugging symbols or sections from the source file.
1226 @item --strip-unneeded
1227 Strip all symbols that are not needed for relocation processing.
1229 @item -K @var{symbolname}
1230 @itemx --keep-symbol=@var{symbolname}
1231 When stripping symbols, keep symbol @var{symbolname} even if it would
1232 normally be stripped. This option may be given more than once.
1234 @item -N @var{symbolname}
1235 @itemx --strip-symbol=@var{symbolname}
1236 Do not copy symbol @var{symbolname} from the source file. This option
1237 may be given more than once.
1239 @item --strip-unneeded-symbol=@var{symbolname}
1240 Do not copy symbol @var{symbolname} from the source file unless it is needed
1241 by a relocation. This option may be given more than once.
1243 @item -G @var{symbolname}
1244 @itemx --keep-global-symbol=@var{symbolname}
1245 Keep only symbol @var{symbolname} global. Make all other symbols local
1246 to the file, so that they are not visible externally. This option may
1247 be given more than once.
1249 @item --localize-hidden
1250 In an ELF object, mark all symbols that have hidden or internal visibility
1251 as local. This option applies on top of symbol-specific localization options
1252 such as @option{-L}.
1254 @item -L @var{symbolname}
1255 @itemx --localize-symbol=@var{symbolname}
1256 Make symbol @var{symbolname} local to the file, so that it is not
1257 visible externally. This option may be given more than once.
1259 @item -W @var{symbolname}
1260 @itemx --weaken-symbol=@var{symbolname}
1261 Make symbol @var{symbolname} weak. This option may be given more than once.
1263 @item --globalize-symbol=@var{symbolname}
1264 Give symbol @var{symbolname} global scoping so that it is visible
1265 outside of the file in which it is defined. This option may be given
1270 Permit regular expressions in @var{symbolname}s used in other command
1271 line options. The question mark (?), asterisk (*), backslash (\) and
1272 square brackets ([]) operators can be used anywhere in the symbol
1273 name. If the first character of the symbol name is the exclamation
1274 point (!) then the sense of the switch is reversed for that symbol.
1281 would cause objcopy to weaken all symbols that start with ``fo''
1282 except for the symbol ``foo''.
1285 @itemx --discard-all
1286 Do not copy non-global symbols from the source file.
1287 @c FIXME any reason to prefer "non-global" to "local" here?
1290 @itemx --discard-locals
1291 Do not copy compiler-generated local symbols.
1292 (These usually start with @samp{L} or @samp{.}.)
1295 @itemx --byte=@var{byte}
1296 If interleaving has been enabled via the @option{--interleave} option
1297 then start the range of bytes to keep at the @var{byte}th byte.
1298 @var{byte} can be in the range from 0 to @var{breadth}-1, where
1299 @var{breadth} is the value given by the @option{--interleave} option.
1301 @item -i [@var{breadth}]
1302 @itemx --interleave[=@var{breadth}]
1303 Only copy a range out of every @var{breadth} bytes. (Header data is
1304 not affected). Select which byte in the range begins the copy with
1305 the @option{--byte} option. Select the width of the range with the
1306 @option{--interleave-width} option.
1308 This option is useful for creating files to program @sc{rom}. It is
1309 typically used with an @code{srec} output target. Note that
1310 @command{objcopy} will complain if you do not specify the
1311 @option{--byte} option as well.
1313 The default interleave breadth is 4, so with @option{--byte} set to 0,
1314 @command{objcopy} would copy the first byte out of every four bytes
1315 from the input to the output.
1317 @item --interleave-width=@var{width}
1318 When used with the @option{--interleave} option, copy @var{width}
1319 bytes at a time. The start of the range of bytes to be copied is set
1320 by the @option{--byte} option, and the extent of the range is set with
1321 the @option{--interleave} option.
1323 The default value for this option is 1. The value of @var{width} plus
1324 the @var{byte} value set by the @option{--byte} option must not exceed
1325 the interleave breadth set by the @option{--interleave} option.
1327 This option can be used to create images for two 16-bit flashes interleaved
1328 in a 32-bit bus by passing @option{-b 0 -i 4 --interleave-width=2}
1329 and @option{-b 2 -i 4 --interleave-width=2} to two @command{objcopy}
1330 commands. If the input was '12345678' then the outputs would be
1331 '1256' and '3478' respectively.
1334 @itemx --preserve-dates
1335 Set the access and modification dates of the output file to be the same
1336 as those of the input file.
1339 @itemx --enable-deterministic-archives
1340 Operate in @emph{deterministic} mode. When copying archive members
1341 and writing the archive index, use zero for UIDs, GIDs, timestamps,
1342 and use consistent file modes for all files.
1345 Convert debugging information, if possible. This is not the default
1346 because only certain debugging formats are supported, and the
1347 conversion process can be time consuming.
1349 @item --gap-fill @var{val}
1350 Fill gaps between sections with @var{val}. This operation applies to
1351 the @emph{load address} (LMA) of the sections. It is done by increasing
1352 the size of the section with the lower address, and filling in the extra
1353 space created with @var{val}.
1355 @item --pad-to @var{address}
1356 Pad the output file up to the load address @var{address}. This is
1357 done by increasing the size of the last section. The extra space is
1358 filled in with the value specified by @option{--gap-fill} (default zero).
1360 @item --set-start @var{val}
1361 Set the start address of the new file to @var{val}. Not all object file
1362 formats support setting the start address.
1364 @item --change-start @var{incr}
1365 @itemx --adjust-start @var{incr}
1366 @cindex changing start address
1367 Change the start address by adding @var{incr}. Not all object file
1368 formats support setting the start address.
1370 @item --change-addresses @var{incr}
1371 @itemx --adjust-vma @var{incr}
1372 @cindex changing object addresses
1373 Change the VMA and LMA addresses of all sections, as well as the start
1374 address, by adding @var{incr}. Some object file formats do not permit
1375 section addresses to be changed arbitrarily. Note that this does not
1376 relocate the sections; if the program expects sections to be loaded at a
1377 certain address, and this option is used to change the sections such
1378 that they are loaded at a different address, the program may fail.
1380 @item --change-section-address @var{section}@{=,+,-@}@var{val}
1381 @itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val}
1382 @cindex changing section address
1383 Set or change both the VMA address and the LMA address of the named
1384 @var{section}. If @samp{=} is used, the section address is set to
1385 @var{val}. Otherwise, @var{val} is added to or subtracted from the
1386 section address. See the comments under @option{--change-addresses},
1387 above. If @var{section} does not exist in the input file, a warning will
1388 be issued, unless @option{--no-change-warnings} is used.
1390 @item --change-section-lma @var{section}@{=,+,-@}@var{val}
1391 @cindex changing section LMA
1392 Set or change the LMA address of the named @var{section}. The LMA
1393 address is the address where the section will be loaded into memory at
1394 program load time. Normally this is the same as the VMA address, which
1395 is the address of the section at program run time, but on some systems,
1396 especially those where a program is held in ROM, the two can be
1397 different. If @samp{=} is used, the section address is set to
1398 @var{val}. Otherwise, @var{val} is added to or subtracted from the
1399 section address. See the comments under @option{--change-addresses},
1400 above. If @var{section} does not exist in the input file, a warning
1401 will be issued, unless @option{--no-change-warnings} is used.
1403 @item --change-section-vma @var{section}@{=,+,-@}@var{val}
1404 @cindex changing section VMA
1405 Set or change the VMA address of the named @var{section}. The VMA
1406 address is the address where the section will be located once the
1407 program has started executing. Normally this is the same as the LMA
1408 address, which is the address where the section will be loaded into
1409 memory, but on some systems, especially those where a program is held in
1410 ROM, the two can be different. If @samp{=} is used, the section address
1411 is set to @var{val}. Otherwise, @var{val} is added to or subtracted
1412 from the section address. See the comments under
1413 @option{--change-addresses}, above. If @var{section} does not exist in
1414 the input file, a warning will be issued, unless
1415 @option{--no-change-warnings} is used.
1417 @item --change-warnings
1418 @itemx --adjust-warnings
1419 If @option{--change-section-address} or @option{--change-section-lma} or
1420 @option{--change-section-vma} is used, and the named section does not
1421 exist, issue a warning. This is the default.
1423 @item --no-change-warnings
1424 @itemx --no-adjust-warnings
1425 Do not issue a warning if @option{--change-section-address} or
1426 @option{--adjust-section-lma} or @option{--adjust-section-vma} is used, even
1427 if the named section does not exist.
1429 @item --set-section-flags @var{section}=@var{flags}
1430 Set the flags for the named section. The @var{flags} argument is a
1431 comma separated string of flag names. The recognized names are
1432 @samp{alloc}, @samp{contents}, @samp{load}, @samp{noload},
1433 @samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, @samp{share}, and
1434 @samp{debug}. You can set the @samp{contents} flag for a section which
1435 does not have contents, but it is not meaningful to clear the
1436 @samp{contents} flag of a section which does have contents--just remove
1437 the section instead. Not all flags are meaningful for all object file
1440 @item --add-section @var{sectionname}=@var{filename}
1441 Add a new section named @var{sectionname} while copying the file. The
1442 contents of the new section are taken from the file @var{filename}. The
1443 size of the section will be the size of the file. This option only
1444 works on file formats which can support sections with arbitrary names.
1446 @item --rename-section @var{oldname}=@var{newname}[,@var{flags}]
1447 Rename a section from @var{oldname} to @var{newname}, optionally
1448 changing the section's flags to @var{flags} in the process. This has
1449 the advantage over usng a linker script to perform the rename in that
1450 the output stays as an object file and does not become a linked
1453 This option is particularly helpful when the input format is binary,
1454 since this will always create a section called .data. If for example,
1455 you wanted instead to create a section called .rodata containing binary
1456 data you could use the following command line to achieve it:
1459 objcopy -I binary -O <output_format> -B <architecture> \
1460 --rename-section .data=.rodata,alloc,load,readonly,data,contents \
1461 <input_binary_file> <output_object_file>
1464 @item --long-section-names @{enable,disable,keep@}
1465 Controls the handling of long section names when processing @code{COFF}
1466 and @code{PE-COFF} object formats. The default behaviour, @samp{keep},
1467 is to preserve long section names if any are present in the input file.
1468 The @samp{enable} and @samp{disable} options forcibly enable or disable
1469 the use of long section names in the output object; when @samp{disable}
1470 is in effect, any long section names in the input object will be truncated.
1471 The @samp{enable} option will only emit long section names if any are
1472 present in the inputs; this is mostly the same as @samp{keep}, but it
1473 is left undefined whether the @samp{enable} option might force the
1474 creation of an empty string table in the output file.
1476 @item --change-leading-char
1477 Some object file formats use special characters at the start of
1478 symbols. The most common such character is underscore, which compilers
1479 often add before every symbol. This option tells @command{objcopy} to
1480 change the leading character of every symbol when it converts between
1481 object file formats. If the object file formats use the same leading
1482 character, this option has no effect. Otherwise, it will add a
1483 character, or remove a character, or change a character, as
1486 @item --remove-leading-char
1487 If the first character of a global symbol is a special symbol leading
1488 character used by the object file format, remove the character. The
1489 most common symbol leading character is underscore. This option will
1490 remove a leading underscore from all global symbols. This can be useful
1491 if you want to link together objects of different file formats with
1492 different conventions for symbol names. This is different from
1493 @option{--change-leading-char} because it always changes the symbol name
1494 when appropriate, regardless of the object file format of the output
1497 @item --reverse-bytes=@var{num}
1498 Reverse the bytes in a section with output contents. A section length must
1499 be evenly divisible by the value given in order for the swap to be able to
1500 take place. Reversing takes place before the interleaving is performed.
1502 This option is used typically in generating ROM images for problematic
1503 target systems. For example, on some target boards, the 32-bit words
1504 fetched from 8-bit ROMs are re-assembled in little-endian byte order
1505 regardless of the CPU byte order. Depending on the programming model, the
1506 endianness of the ROM may need to be modified.
1508 Consider a simple file with a section containing the following eight
1509 bytes: @code{12345678}.
1511 Using @samp{--reverse-bytes=2} for the above example, the bytes in the
1512 output file would be ordered @code{21436587}.
1514 Using @samp{--reverse-bytes=4} for the above example, the bytes in the
1515 output file would be ordered @code{43218765}.
1517 By using @samp{--reverse-bytes=2} for the above example, followed by
1518 @samp{--reverse-bytes=4} on the output file, the bytes in the second
1519 output file would be ordered @code{34127856}.
1521 @item --srec-len=@var{ival}
1522 Meaningful only for srec output. Set the maximum length of the Srecords
1523 being produced to @var{ival}. This length covers both address, data and
1526 @item --srec-forceS3
1527 Meaningful only for srec output. Avoid generation of S1/S2 records,
1528 creating S3-only record format.
1530 @item --redefine-sym @var{old}=@var{new}
1531 Change the name of a symbol @var{old}, to @var{new}. This can be useful
1532 when one is trying link two things together for which you have no
1533 source, and there are name collisions.
1535 @item --redefine-syms=@var{filename}
1536 Apply @option{--redefine-sym} to each symbol pair "@var{old} @var{new}"
1537 listed in the file @var{filename}. @var{filename} is simply a flat file,
1538 with one symbol pair per line. Line comments may be introduced by the hash
1539 character. This option may be given more than once.
1542 Change all global symbols in the file to be weak. This can be useful
1543 when building an object which will be linked against other objects using
1544 the @option{-R} option to the linker. This option is only effective when
1545 using an object file format which supports weak symbols.
1547 @item --keep-symbols=@var{filename}
1548 Apply @option{--keep-symbol} option to each symbol listed in the file
1549 @var{filename}. @var{filename} is simply a flat file, with one symbol
1550 name per line. Line comments may be introduced by the hash character.
1551 This option may be given more than once.
1553 @item --strip-symbols=@var{filename}
1554 Apply @option{--strip-symbol} option to each symbol listed in the file
1555 @var{filename}. @var{filename} is simply a flat file, with one symbol
1556 name per line. Line comments may be introduced by the hash character.
1557 This option may be given more than once.
1559 @item --strip-unneeded-symbols=@var{filename}
1560 Apply @option{--strip-unneeded-symbol} option to each symbol listed in
1561 the file @var{filename}. @var{filename} is simply a flat file, with one
1562 symbol name per line. Line comments may be introduced by the hash
1563 character. This option may be given more than once.
1565 @item --keep-global-symbols=@var{filename}
1566 Apply @option{--keep-global-symbol} option to each symbol listed in the
1567 file @var{filename}. @var{filename} is simply a flat file, with one
1568 symbol name per line. Line comments may be introduced by the hash
1569 character. This option may be given more than once.
1571 @item --localize-symbols=@var{filename}
1572 Apply @option{--localize-symbol} option to each symbol listed in the file
1573 @var{filename}. @var{filename} is simply a flat file, with one symbol
1574 name per line. Line comments may be introduced by the hash character.
1575 This option may be given more than once.
1577 @item --globalize-symbols=@var{filename}
1578 Apply @option{--globalize-symbol} option to each symbol listed in the file
1579 @var{filename}. @var{filename} is simply a flat file, with one symbol
1580 name per line. Line comments may be introduced by the hash character.
1581 This option may be given more than once.
1583 @item --weaken-symbols=@var{filename}
1584 Apply @option{--weaken-symbol} option to each symbol listed in the file
1585 @var{filename}. @var{filename} is simply a flat file, with one symbol
1586 name per line. Line comments may be introduced by the hash character.
1587 This option may be given more than once.
1589 @item --alt-machine-code=@var{index}
1590 If the output architecture has alternate machine codes, use the
1591 @var{index}th code instead of the default one. This is useful in case
1592 a machine is assigned an official code and the tool-chain adopts the
1593 new code, but other applications still depend on the original code
1594 being used. For ELF based architectures if the @var{index}
1595 alternative does not exist then the value is treated as an absolute
1596 number to be stored in the e_machine field of the ELF header.
1598 @item --writable-text
1599 Mark the output text as writable. This option isn't meaningful for all
1600 object file formats.
1602 @item --readonly-text
1603 Make the output text write protected. This option isn't meaningful for all
1604 object file formats.
1607 Mark the output file as demand paged. This option isn't meaningful for all
1608 object file formats.
1611 Mark the output file as impure. This option isn't meaningful for all
1612 object file formats.
1614 @item --prefix-symbols=@var{string}
1615 Prefix all symbols in the output file with @var{string}.
1617 @item --prefix-sections=@var{string}
1618 Prefix all section names in the output file with @var{string}.
1620 @item --prefix-alloc-sections=@var{string}
1621 Prefix all the names of all allocated sections in the output file with
1624 @item --add-gnu-debuglink=@var{path-to-file}
1625 Creates a .gnu_debuglink section which contains a reference to @var{path-to-file}
1626 and adds it to the output file.
1628 @item --keep-file-symbols
1629 When stripping a file, perhaps with @option{--strip-debug} or
1630 @option{--strip-unneeded}, retain any symbols specifying source file names,
1631 which would otherwise get stripped.
1633 @item --only-keep-debug
1634 Strip a file, removing contents of any sections that would not be
1635 stripped by @option{--strip-debug} and leaving the debugging sections
1636 intact. In ELF files, this preserves all note sections in the output.
1638 The intention is that this option will be used in conjunction with
1639 @option{--add-gnu-debuglink} to create a two part executable. One a
1640 stripped binary which will occupy less space in RAM and in a
1641 distribution and the second a debugging information file which is only
1642 needed if debugging abilities are required. The suggested procedure
1643 to create these files is as follows:
1646 @item Link the executable as normal. Assuming that is is called
1648 @item Run @code{objcopy --only-keep-debug foo foo.dbg} to
1649 create a file containing the debugging info.
1650 @item Run @code{objcopy --strip-debug foo} to create a
1651 stripped executable.
1652 @item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
1653 to add a link to the debugging info into the stripped executable.
1656 Note---the choice of @code{.dbg} as an extension for the debug info
1657 file is arbitrary. Also the @code{--only-keep-debug} step is
1658 optional. You could instead do this:
1661 @item Link the executable as normal.
1662 @item Copy @code{foo} to @code{foo.full}
1663 @item Run @code{objcopy --strip-debug foo}
1664 @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
1667 i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
1668 full executable. It does not have to be a file created by the
1669 @option{--only-keep-debug} switch.
1671 Note---this switch is only intended for use on fully linked files. It
1672 does not make sense to use it on object files where the debugging
1673 information may be incomplete. Besides the gnu_debuglink feature
1674 currently only supports the presence of one filename containing
1675 debugging information, not multiple filenames on a one-per-object-file
1679 Remove the contents of all DWARF .dwo sections, leaving the
1680 remaining debugging sections and all symbols intact.
1681 This option is intended for use by the compiler as part of
1682 the @option{-gsplit-dwarf} option, which splits debug information
1683 between the .o file and a separate .dwo file. The compiler
1684 generates all debug information in the same file, then uses
1685 the @option{--extract-dwo} option to copy the .dwo sections to
1686 the .dwo file, then the @option{--strip-dwo} option to remove
1687 those sections from the original .o file.
1690 Extract the contents of all DWARF .dwo sections. See the
1691 @option{--strip-dwo} option for more information.
1693 @item --file-alignment @var{num}
1694 Specify the file alignment. Sections in the file will always begin at
1695 file offsets which are multiples of this number. This defaults to
1697 [This option is specific to PE targets.]
1699 @item --heap @var{reserve}
1700 @itemx --heap @var{reserve},@var{commit}
1701 Specify the number of bytes of memory to reserve (and optionally commit)
1702 to be used as heap for this program.
1703 [This option is specific to PE targets.]
1705 @item --image-base @var{value}
1706 Use @var{value} as the base address of your program or dll. This is
1707 the lowest memory location that will be used when your program or dll
1708 is loaded. To reduce the need to relocate and improve performance of
1709 your dlls, each should have a unique base address and not overlap any
1710 other dlls. The default is 0x400000 for executables, and 0x10000000
1712 [This option is specific to PE targets.]
1714 @item --section-alignment @var{num}
1715 Sets the section alignment. Sections in memory will always begin at
1716 addresses which are a multiple of this number. Defaults to 0x1000.
1717 [This option is specific to PE targets.]
1719 @item --stack @var{reserve}
1720 @itemx --stack @var{reserve},@var{commit}
1721 Specify the number of bytes of memory to reserve (and optionally commit)
1722 to be used as stack for this program.
1723 [This option is specific to PE targets.]
1725 @item --subsystem @var{which}
1726 @itemx --subsystem @var{which}:@var{major}
1727 @itemx --subsystem @var{which}:@var{major}.@var{minor}
1728 Specifies the subsystem under which your program will execute. The
1729 legal values for @var{which} are @code{native}, @code{windows},
1730 @code{console}, @code{posix}, @code{efi-app}, @code{efi-bsd},
1731 @code{efi-rtd}, @code{sal-rtd}, and @code{xbox}. You may optionally set
1732 the subsystem version also. Numeric values are also accepted for
1734 [This option is specific to PE targets.]
1736 @item --extract-symbol
1737 Keep the file's section flags and symbols but remove all section data.
1738 Specifically, the option:
1741 @item removes the contents of all sections;
1742 @item sets the size of every section to zero; and
1743 @item sets the file's start address to zero.
1746 This option is used to build a @file{.sym} file for a VxWorks kernel.
1747 It can also be a useful way of reducing the size of a @option{--just-symbols}
1750 @item --compress-debug-sections
1751 Compress DWARF debug sections using zlib.
1753 @item --decompress-debug-sections
1754 Decompress DWARF debug sections using zlib.
1758 Show the version number of @command{objcopy}.
1762 Verbose output: list all object files modified. In the case of
1763 archives, @samp{objcopy -V} lists all members of the archive.
1766 Show a summary of the options to @command{objcopy}.
1769 Display a list showing all architectures and object formats available.
1775 @c man begin SEEALSO objcopy
1776 ld(1), objdump(1), and the Info entries for @file{binutils}.
1783 @cindex object file information
1786 @c man title objdump display information from object files.
1789 @c man begin SYNOPSIS objdump
1790 objdump [@option{-a}|@option{--archive-headers}]
1791 [@option{-b} @var{bfdname}|@option{--target=@var{bfdname}}]
1792 [@option{-C}|@option{--demangle}[=@var{style}] ]
1793 [@option{-d}|@option{--disassemble}]
1794 [@option{-D}|@option{--disassemble-all}]
1795 [@option{-z}|@option{--disassemble-zeroes}]
1796 [@option{-EB}|@option{-EL}|@option{--endian=}@{big | little @}]
1797 [@option{-f}|@option{--file-headers}]
1798 [@option{-F}|@option{--file-offsets}]
1799 [@option{--file-start-context}]
1800 [@option{-g}|@option{--debugging}]
1801 [@option{-e}|@option{--debugging-tags}]
1802 [@option{-h}|@option{--section-headers}|@option{--headers}]
1803 [@option{-i}|@option{--info}]
1804 [@option{-j} @var{section}|@option{--section=}@var{section}]
1805 [@option{-l}|@option{--line-numbers}]
1806 [@option{-S}|@option{--source}]
1807 [@option{-m} @var{machine}|@option{--architecture=}@var{machine}]
1808 [@option{-M} @var{options}|@option{--disassembler-options=}@var{options}]
1809 [@option{-p}|@option{--private-headers}]
1810 [@option{-P} @var{options}|@option{--private=}@var{options}]
1811 [@option{-r}|@option{--reloc}]
1812 [@option{-R}|@option{--dynamic-reloc}]
1813 [@option{-s}|@option{--full-contents}]
1814 [@option{-W[lLiaprmfFsoRt]}|
1815 @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
1816 [@option{-G}|@option{--stabs}]
1817 [@option{-t}|@option{--syms}]
1818 [@option{-T}|@option{--dynamic-syms}]
1819 [@option{-x}|@option{--all-headers}]
1820 [@option{-w}|@option{--wide}]
1821 [@option{--start-address=}@var{address}]
1822 [@option{--stop-address=}@var{address}]
1823 [@option{--prefix-addresses}]
1824 [@option{--[no-]show-raw-insn}]
1825 [@option{--adjust-vma=}@var{offset}]
1826 [@option{--special-syms}]
1827 [@option{--prefix=}@var{prefix}]
1828 [@option{--prefix-strip=}@var{level}]
1829 [@option{--insn-width=}@var{width}]
1830 [@option{-V}|@option{--version}]
1831 [@option{-H}|@option{--help}]
1832 @var{objfile}@dots{}
1836 @c man begin DESCRIPTION objdump
1838 @command{objdump} displays information about one or more object files.
1839 The options control what particular information to display. This
1840 information is mostly useful to programmers who are working on the
1841 compilation tools, as opposed to programmers who just want their
1842 program to compile and work.
1844 @var{objfile}@dots{} are the object files to be examined. When you
1845 specify archives, @command{objdump} shows information on each of the member
1850 @c man begin OPTIONS objdump
1852 The long and short forms of options, shown here as alternatives, are
1853 equivalent. At least one option from the list
1854 @option{-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-P,-r,-R,-s,-S,-t,-T,-V,-x} must be given.
1858 @itemx --archive-header
1859 @cindex archive headers
1860 If any of the @var{objfile} files are archives, display the archive
1861 header information (in a format similar to @samp{ls -l}). Besides the
1862 information you could list with @samp{ar tv}, @samp{objdump -a} shows
1863 the object file format of each archive member.
1865 @item --adjust-vma=@var{offset}
1866 @cindex section addresses in objdump
1867 @cindex VMA in objdump
1868 When dumping information, first add @var{offset} to all the section
1869 addresses. This is useful if the section addresses do not correspond to
1870 the symbol table, which can happen when putting sections at particular
1871 addresses when using a format which can not represent section addresses,
1874 @item -b @var{bfdname}
1875 @itemx --target=@var{bfdname}
1876 @cindex object code format
1877 Specify that the object-code format for the object files is
1878 @var{bfdname}. This option may not be necessary; @var{objdump} can
1879 automatically recognize many formats.
1883 objdump -b oasys -m vax -h fu.o
1886 displays summary information from the section headers (@option{-h}) of
1887 @file{fu.o}, which is explicitly identified (@option{-m}) as a VAX object
1888 file in the format produced by Oasys compilers. You can list the
1889 formats available with the @option{-i} option.
1890 @xref{Target Selection}, for more information.
1893 @itemx --demangle[=@var{style}]
1894 @cindex demangling in objdump
1895 Decode (@dfn{demangle}) low-level symbol names into user-level names.
1896 Besides removing any initial underscore prepended by the system, this
1897 makes C++ function names readable. Different compilers have different
1898 mangling styles. The optional demangling style argument can be used to
1899 choose an appropriate demangling style for your compiler. @xref{c++filt},
1900 for more information on demangling.
1904 Display debugging information. This attempts to parse STABS and IEEE
1905 debugging format information stored in the file and print it out using
1906 a C like syntax. If neither of these formats are found this option
1907 falls back on the @option{-W} option to print any DWARF information in
1911 @itemx --debugging-tags
1912 Like @option{-g}, but the information is generated in a format compatible
1916 @itemx --disassemble
1917 @cindex disassembling object code
1918 @cindex machine instructions
1919 Display the assembler mnemonics for the machine instructions from
1920 @var{objfile}. This option only disassembles those sections which are
1921 expected to contain instructions.
1924 @itemx --disassemble-all
1925 Like @option{-d}, but disassemble the contents of all sections, not just
1926 those expected to contain instructions.
1928 If the target is an ARM architecture this switch also has the effect
1929 of forcing the disassembler to decode pieces of data found in code
1930 sections as if they were instructions.
1932 @item --prefix-addresses
1933 When disassembling, print the complete address on each line. This is
1934 the older disassembly format.
1938 @itemx --endian=@{big|little@}
1940 @cindex disassembly endianness
1941 Specify the endianness of the object files. This only affects
1942 disassembly. This can be useful when disassembling a file format which
1943 does not describe endianness information, such as S-records.
1946 @itemx --file-headers
1947 @cindex object file header
1948 Display summary information from the overall header of
1949 each of the @var{objfile} files.
1952 @itemx --file-offsets
1953 @cindex object file offsets
1954 When disassembling sections, whenever a symbol is displayed, also
1955 display the file offset of the region of data that is about to be
1956 dumped. If zeroes are being skipped, then when disassembly resumes,
1957 tell the user how many zeroes were skipped and the file offset of the
1958 location from where the disassembly resumes. When dumping sections,
1959 display the file offset of the location from where the dump starts.
1961 @item --file-start-context
1962 @cindex source code context
1963 Specify that when displaying interlisted source code/disassembly
1964 (assumes @option{-S}) from a file that has not yet been displayed, extend the
1965 context to the start of the file.
1968 @itemx --section-headers
1970 @cindex section headers
1971 Display summary information from the section headers of the
1974 File segments may be relocated to nonstandard addresses, for example by
1975 using the @option{-Ttext}, @option{-Tdata}, or @option{-Tbss} options to
1976 @command{ld}. However, some object file formats, such as a.out, do not
1977 store the starting address of the file segments. In those situations,
1978 although @command{ld} relocates the sections correctly, using @samp{objdump
1979 -h} to list the file section headers cannot show the correct addresses.
1980 Instead, it shows the usual addresses, which are implicit for the
1985 Print a summary of the options to @command{objdump} and exit.
1989 @cindex architectures available
1990 @cindex object formats available
1991 Display a list showing all architectures and object formats available
1992 for specification with @option{-b} or @option{-m}.
1995 @itemx --section=@var{name}
1996 @cindex section information
1997 Display information only for section @var{name}.
2000 @itemx --line-numbers
2001 @cindex source filenames for object files
2002 Label the display (using debugging information) with the filename and
2003 source line numbers corresponding to the object code or relocs shown.
2004 Only useful with @option{-d}, @option{-D}, or @option{-r}.
2006 @item -m @var{machine}
2007 @itemx --architecture=@var{machine}
2008 @cindex architecture
2009 @cindex disassembly architecture
2010 Specify the architecture to use when disassembling object files. This
2011 can be useful when disassembling object files which do not describe
2012 architecture information, such as S-records. You can list the available
2013 architectures with the @option{-i} option.
2015 If the target is an ARM architecture then this switch has an
2016 additional effect. It restricts the disassembly to only those
2017 instructions supported by the architecture specified by @var{machine}.
2018 If it is necessary to use this switch because the input file does not
2019 contain any architecture information, but it is also desired to
2020 disassemble all the instructions use @option{-marm}.
2022 @item -M @var{options}
2023 @itemx --disassembler-options=@var{options}
2024 Pass target specific information to the disassembler. Only supported on
2025 some targets. If it is necessary to specify more than one
2026 disassembler option then multiple @option{-M} options can be used or
2027 can be placed together into a comma separated list.
2029 If the target is an ARM architecture then this switch can be used to
2030 select which register name set is used during disassembler. Specifying
2031 @option{-M reg-names-std} (the default) will select the register names as
2032 used in ARM's instruction set documentation, but with register 13 called
2033 'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying
2034 @option{-M reg-names-apcs} will select the name set used by the ARM
2035 Procedure Call Standard, whilst specifying @option{-M reg-names-raw} will
2036 just use @samp{r} followed by the register number.
2038 There are also two variants on the APCS register naming scheme enabled
2039 by @option{-M reg-names-atpcs} and @option{-M reg-names-special-atpcs} which
2040 use the ARM/Thumb Procedure Call Standard naming conventions. (Either
2041 with the normal register names or the special register names).
2043 This option can also be used for ARM architectures to force the
2044 disassembler to interpret all instructions as Thumb instructions by
2045 using the switch @option{--disassembler-options=force-thumb}. This can be
2046 useful when attempting to disassemble thumb code produced by other
2049 For the x86, some of the options duplicate functions of the @option{-m}
2050 switch, but allow finer grained control. Multiple selections from the
2051 following may be specified as a comma separated string.
2052 @option{x86-64}, @option{i386} and @option{i8086} select disassembly for
2053 the given architecture. @option{intel} and @option{att} select between
2054 intel syntax mode and AT&T syntax mode.
2055 @option{intel-mnemonic} and @option{att-mnemonic} select between
2056 intel mnemonic mode and AT&T mnemonic mode. @option{intel-mnemonic}
2057 implies @option{intel} and @option{att-mnemonic} implies @option{att}.
2058 @option{addr64}, @option{addr32},
2059 @option{addr16}, @option{data32} and @option{data16} specify the default
2060 address size and operand size. These four options will be overridden if
2061 @option{x86-64}, @option{i386} or @option{i8086} appear later in the
2062 option string. Lastly, @option{suffix}, when in AT&T mode,
2063 instructs the disassembler to print a mnemonic suffix even when the
2064 suffix could be inferred by the operands.
2066 For PowerPC, @option{booke} controls the disassembly of BookE
2067 instructions. @option{32} and @option{64} select PowerPC and
2068 PowerPC64 disassembly, respectively. @option{e300} selects
2069 disassembly for the e300 family. @option{440} selects disassembly for
2070 the PowerPC 440. @option{ppcps} selects disassembly for the paired
2071 single instructions of the PPC750CL.
2073 For MIPS, this option controls the printing of instruction mnemonic
2074 names and register names in disassembled instructions. Multiple
2075 selections from the following may be specified as a comma separated
2076 string, and invalid options are ignored:
2080 Print the 'raw' instruction mnemonic instead of some pseudo
2081 instruction mnemonic. I.e., print 'daddu' or 'or' instead of 'move',
2082 'sll' instead of 'nop', etc.
2084 @item gpr-names=@var{ABI}
2085 Print GPR (general-purpose register) names as appropriate
2086 for the specified ABI. By default, GPR names are selected according to
2087 the ABI of the binary being disassembled.
2089 @item fpr-names=@var{ABI}
2090 Print FPR (floating-point register) names as
2091 appropriate for the specified ABI. By default, FPR numbers are printed
2094 @item cp0-names=@var{ARCH}
2095 Print CP0 (system control coprocessor; coprocessor 0) register names
2096 as appropriate for the CPU or architecture specified by
2097 @var{ARCH}. By default, CP0 register names are selected according to
2098 the architecture and CPU of the binary being disassembled.
2100 @item hwr-names=@var{ARCH}
2101 Print HWR (hardware register, used by the @code{rdhwr} instruction) names
2102 as appropriate for the CPU or architecture specified by
2103 @var{ARCH}. By default, HWR names are selected according to
2104 the architecture and CPU of the binary being disassembled.
2106 @item reg-names=@var{ABI}
2107 Print GPR and FPR names as appropriate for the selected ABI.
2109 @item reg-names=@var{ARCH}
2110 Print CPU-specific register names (CP0 register and HWR names)
2111 as appropriate for the selected CPU or architecture.
2114 For any of the options listed above, @var{ABI} or
2115 @var{ARCH} may be specified as @samp{numeric} to have numbers printed
2116 rather than names, for the selected types of registers.
2117 You can list the available values of @var{ABI} and @var{ARCH} using
2118 the @option{--help} option.
2120 For VAX, you can specify function entry addresses with @option{-M
2121 entry:0xf00ba}. You can use this multiple times to properly
2122 disassemble VAX binary files that don't contain symbol tables (like
2123 ROM dumps). In these cases, the function entry mask would otherwise
2124 be decoded as VAX instructions, which would probably lead the rest
2125 of the function being wrongly disassembled.
2128 @itemx --private-headers
2129 Print information that is specific to the object file format. The exact
2130 information printed depends upon the object file format. For some
2131 object file formats, no additional information is printed.
2133 @item -P @var{options}
2134 @itemx --private=@var{options}
2135 Print information that is specific to the object file format. The
2136 argument @var{options} is a comma separated list that depends on the
2137 format (the lists of options is displayed with the help).
2139 For XCOFF, the available options are: @option{header}, @option{aout},
2140 @option{sections}, @option{syms}, @option{relocs}, @option{lineno},
2141 @option{loader}, @option{except}, @option{typchk}, @option{traceback}
2146 @cindex relocation entries, in object file
2147 Print the relocation entries of the file. If used with @option{-d} or
2148 @option{-D}, the relocations are printed interspersed with the
2152 @itemx --dynamic-reloc
2153 @cindex dynamic relocation entries, in object file
2154 Print the dynamic relocation entries of the file. This is only
2155 meaningful for dynamic objects, such as certain types of shared
2156 libraries. As for @option{-r}, if used with @option{-d} or
2157 @option{-D}, the relocations are printed interspersed with the
2161 @itemx --full-contents
2162 @cindex sections, full contents
2163 @cindex object file sections
2164 Display the full contents of any sections requested. By default all
2165 non-empty sections are displayed.
2169 @cindex source disassembly
2170 @cindex disassembly, with source
2171 Display source code intermixed with disassembly, if possible. Implies
2174 @item --prefix=@var{prefix}
2175 @cindex Add prefix to absolute paths
2176 Specify @var{prefix} to add to the absolute paths when used with
2179 @item --prefix-strip=@var{level}
2180 @cindex Strip absolute paths
2181 Indicate how many initial directory names to strip off the hardwired
2182 absolute paths. It has no effect without @option{--prefix=}@var{prefix}.
2184 @item --show-raw-insn
2185 When disassembling instructions, print the instruction in hex as well as
2186 in symbolic form. This is the default except when
2187 @option{--prefix-addresses} is used.
2189 @item --no-show-raw-insn
2190 When disassembling instructions, do not print the instruction bytes.
2191 This is the default when @option{--prefix-addresses} is used.
2193 @item --insn-width=@var{width}
2194 @cindex Instruction width
2195 Display @var{width} bytes on a single line when disassembling
2198 @item -W[lLiaprmfFsoRt]
2199 @itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]
2201 @cindex debug symbols
2202 Displays the contents of the debug sections in the file, if any are
2203 present. If one of the optional letters or words follows the switch
2204 then only data found in those specific sections will be dumped.
2206 Note that there is no single letter option to display the content of
2207 trace sections or .gdb_index.
2209 Note: the output from the @option{=info} option can also be affected
2210 by the options @option{--dwarf-depth}, the @option{--dwarf-start} and
2211 the @option{--dwarf-check}.
2213 @item --dwarf-depth=@var{n}
2214 Limit the dump of the @code{.debug_info} section to @var{n} children.
2215 This is only useful with @option{--dwarf=info}. The default is
2216 to print all DIEs; the special value 0 for @var{n} will also have this
2219 With a non-zero value for @var{n}, DIEs at or deeper than @var{n}
2220 levels will not be printed. The range for @var{n} is zero-based.
2222 @item --dwarf-start=@var{n}
2223 Print only DIEs beginning with the DIE numbered @var{n}. This is only
2224 useful with @option{--dwarf=info}.
2226 If specified, this option will suppress printing of any header
2227 information and all DIEs before the DIE numbered @var{n}. Only
2228 siblings and children of the specified DIE will be printed.
2230 This can be used in conjunction with @option{--dwarf-depth}.
2233 Enable additional checks for consistency of Dwarf information.
2239 @cindex debug symbols
2240 @cindex ELF object file format
2241 Display the full contents of any sections requested. Display the
2242 contents of the .stab and .stab.index and .stab.excl sections from an
2243 ELF file. This is only useful on systems (such as Solaris 2.0) in which
2244 @code{.stab} debugging symbol-table entries are carried in an ELF
2245 section. In most other file formats, debugging symbol-table entries are
2246 interleaved with linkage symbols, and are visible in the @option{--syms}
2249 For more information on stabs symbols, see @ref{Top,Stabs,Stabs
2250 Overview,stabs.info, The ``stabs'' debug format}.
2253 @item --start-address=@var{address}
2254 @cindex start-address
2255 Start displaying data at the specified address. This affects the output
2256 of the @option{-d}, @option{-r} and @option{-s} options.
2258 @item --stop-address=@var{address}
2259 @cindex stop-address
2260 Stop displaying data at the specified address. This affects the output
2261 of the @option{-d}, @option{-r} and @option{-s} options.
2265 @cindex symbol table entries, printing
2266 Print the symbol table entries of the file.
2267 This is similar to the information provided by the @samp{nm} program,
2268 although the display format is different. The format of the output
2269 depends upon the format of the file being dumped, but there are two main
2270 types. One looks like this:
2273 [ 4](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
2274 [ 6](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 fred
2277 where the number inside the square brackets is the number of the entry
2278 in the symbol table, the @var{sec} number is the section number, the
2279 @var{fl} value are the symbol's flag bits, the @var{ty} number is the
2280 symbol's type, the @var{scl} number is the symbol's storage class and
2281 the @var{nx} value is the number of auxilary entries associated with
2282 the symbol. The last two fields are the symbol's value and its name.
2284 The other common output format, usually seen with ELF based files,
2288 00000000 l d .bss 00000000 .bss
2289 00000000 g .text 00000000 fred
2292 Here the first number is the symbol's value (sometimes refered to as
2293 its address). The next field is actually a set of characters and
2294 spaces indicating the flag bits that are set on the symbol. These
2295 characters are described below. Next is the section with which the
2296 symbol is associated or @emph{*ABS*} if the section is absolute (ie
2297 not connected with any section), or @emph{*UND*} if the section is
2298 referenced in the file being dumped, but not defined there.
2300 After the section name comes another field, a number, which for common
2301 symbols is the alignment and for other symbol is the size. Finally
2302 the symbol's name is displayed.
2304 The flag characters are divided into 7 groups as follows:
2310 The symbol is a local (l), global (g), unique global (u), neither
2311 global nor local (a space) or both global and local (!). A
2312 symbol can be neither local or global for a variety of reasons, e.g.,
2313 because it is used for debugging, but it is probably an indication of
2314 a bug if it is ever both local and global. Unique global symbols are
2315 a GNU extension to the standard set of ELF symbol bindings. For such
2316 a symbol the dynamic linker will make sure that in the entire process
2317 there is just one symbol with this name and type in use.
2320 The symbol is weak (w) or strong (a space).
2323 The symbol denotes a constructor (C) or an ordinary symbol (a space).
2326 The symbol is a warning (W) or a normal symbol (a space). A warning
2327 symbol's name is a message to be displayed if the symbol following the
2328 warning symbol is ever referenced.
2332 The symbol is an indirect reference to another symbol (I), a function
2333 to be evaluated during reloc processing (i) or a normal symbol (a
2338 The symbol is a debugging symbol (d) or a dynamic symbol (D) or a
2339 normal symbol (a space).
2344 The symbol is the name of a function (F) or a file (f) or an object
2345 (O) or just a normal symbol (a space).
2349 @itemx --dynamic-syms
2350 @cindex dynamic symbol table entries, printing
2351 Print the dynamic symbol table entries of the file. This is only
2352 meaningful for dynamic objects, such as certain types of shared
2353 libraries. This is similar to the information provided by the @samp{nm}
2354 program when given the @option{-D} (@option{--dynamic}) option.
2356 @item --special-syms
2357 When displaying symbols include those which the target considers to be
2358 special in some way and which would not normally be of interest to the
2363 Print the version number of @command{objdump} and exit.
2366 @itemx --all-headers
2367 @cindex all header information, object file
2368 @cindex header information, all
2369 Display all available header information, including the symbol table and
2370 relocation entries. Using @option{-x} is equivalent to specifying all of
2371 @option{-a -f -h -p -r -t}.
2375 @cindex wide output, printing
2376 Format some lines for output devices that have more than 80 columns.
2377 Also do not truncate symbol names when they are displayed.
2380 @itemx --disassemble-zeroes
2381 Normally the disassembly output will skip blocks of zeroes. This
2382 option directs the disassembler to disassemble those blocks, just like
2389 @c man begin SEEALSO objdump
2390 nm(1), readelf(1), and the Info entries for @file{binutils}.
2398 @cindex archive contents
2399 @cindex symbol index
2401 @c man title ranlib generate index to archive.
2404 @c man begin SYNOPSIS ranlib
2405 ranlib [@option{--plugin} @var{name}] [@option{-DhHvVt}] @var{archive}
2409 @c man begin DESCRIPTION ranlib
2411 @command{ranlib} generates an index to the contents of an archive and
2412 stores it in the archive. The index lists each symbol defined by a
2413 member of an archive that is a relocatable object file.
2415 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
2417 An archive with such an index speeds up linking to the library and
2418 allows routines in the library to call each other without regard to
2419 their placement in the archive.
2421 The @sc{gnu} @command{ranlib} program is another form of @sc{gnu} @command{ar}; running
2422 @command{ranlib} is completely equivalent to executing @samp{ar -s}.
2427 @c man begin OPTIONS ranlib
2433 Show usage information for @command{ranlib}.
2438 Show the version number of @command{ranlib}.
2441 @cindex deterministic archives
2442 @kindex --enable-deterministic-archives
2443 Operate in @emph{deterministic} mode. The symbol map archive member's
2444 header will show zero for the UID, GID, and timestamp. When this
2445 option is used, multiple runs will produce identical output files.
2447 This is the default unless @file{binutils} was configured with
2448 @option{--enable-deterministic-archives}.
2451 Update the timestamp of the symbol map of an archive.
2454 @cindex deterministic archives
2455 @kindex --enable-deterministic-archives
2456 Do @emph{not} operate in @emph{deterministic} mode. This is the
2457 inverse of the @samp{-D} option, above: the archive index will get
2458 actual UID, GID, timestamp, and file mode values.
2460 This is the default unless @file{binutils} was configured with
2461 @option{--enable-deterministic-archives}.
2467 @c man begin SEEALSO ranlib
2468 ar(1), nm(1), and the Info entries for @file{binutils}.
2476 @cindex section sizes
2478 @c man title size list section sizes and total size.
2481 @c man begin SYNOPSIS size
2482 size [@option{-A}|@option{-B}|@option{--format=}@var{compatibility}]
2484 [@option{-d}|@option{-o}|@option{-x}|@option{--radix=}@var{number}]
2486 [@option{-t}|@option{--totals}]
2487 [@option{--target=}@var{bfdname}] [@option{-V}|@option{--version}]
2488 [@var{objfile}@dots{}]
2492 @c man begin DESCRIPTION size
2494 The @sc{gnu} @command{size} utility lists the section sizes---and the total
2495 size---for each of the object or archive files @var{objfile} in its
2496 argument list. By default, one line of output is generated for each
2497 object file or each module in an archive.
2499 @var{objfile}@dots{} are the object files to be examined.
2500 If none are specified, the file @code{a.out} will be used.
2504 @c man begin OPTIONS size
2506 The command line options have the following meanings:
2511 @itemx --format=@var{compatibility}
2512 @cindex @command{size} display format
2513 Using one of these options, you can choose whether the output from @sc{gnu}
2514 @command{size} resembles output from System V @command{size} (using @option{-A},
2515 or @option{--format=sysv}), or Berkeley @command{size} (using @option{-B}, or
2516 @option{--format=berkeley}). The default is the one-line format similar to
2518 @c Bonus for doc-source readers: you can also say --format=strange (or
2519 @c anything else that starts with 's') for sysv, and --format=boring (or
2520 @c anything else that starts with 'b') for Berkeley.
2522 Here is an example of the Berkeley (default) format of output from
2525 $ size --format=Berkeley ranlib size
2526 text data bss dec hex filename
2527 294880 81920 11592 388392 5ed28 ranlib
2528 294880 81920 11888 388688 5ee50 size
2532 This is the same data, but displayed closer to System V conventions:
2535 $ size --format=SysV ranlib size
2553 Show a summary of acceptable arguments and options.
2558 @itemx --radix=@var{number}
2559 @cindex @command{size} number format
2560 @cindex radix for section sizes
2561 Using one of these options, you can control whether the size of each
2562 section is given in decimal (@option{-d}, or @option{--radix=10}); octal
2563 (@option{-o}, or @option{--radix=8}); or hexadecimal (@option{-x}, or
2564 @option{--radix=16}). In @option{--radix=@var{number}}, only the three
2565 values (8, 10, 16) are supported. The total size is always given in two
2566 radices; decimal and hexadecimal for @option{-d} or @option{-x} output, or
2567 octal and hexadecimal if you're using @option{-o}.
2570 Print total size of common symbols in each file. When using Berkeley
2571 format these are included in the bss size.
2575 Show totals of all objects listed (Berkeley format listing mode only).
2577 @item --target=@var{bfdname}
2578 @cindex object code format
2579 Specify that the object-code format for @var{objfile} is
2580 @var{bfdname}. This option may not be necessary; @command{size} can
2581 automatically recognize many formats.
2582 @xref{Target Selection}, for more information.
2586 Display the version number of @command{size}.
2592 @c man begin SEEALSO size
2593 ar(1), objdump(1), readelf(1), and the Info entries for @file{binutils}.
2600 @cindex listings strings
2601 @cindex printing strings
2602 @cindex strings, printing
2604 @c man title strings print the strings of printable characters in files.
2607 @c man begin SYNOPSIS strings
2608 strings [@option{-afovV}] [@option{-}@var{min-len}]
2609 [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}]
2610 [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
2611 [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
2612 [@option{-}] [@option{--all}] [@option{--print-file-name}]
2613 [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
2614 [@option{--help}] [@option{--version}] @var{file}@dots{}
2618 @c man begin DESCRIPTION strings
2620 For each @var{file} given, @sc{gnu} @command{strings} prints the printable
2621 character sequences that are at least 4 characters long (or the number
2622 given with the options below) and are followed by an unprintable
2623 character. By default, it only prints the strings from the initialized
2624 and loaded sections of object files; for other types of files, it prints
2625 the strings from the whole file.
2627 @command{strings} is mainly useful for determining the contents of non-text
2632 @c man begin OPTIONS strings
2638 Do not scan only the initialized and loaded sections of object files;
2639 scan the whole files.
2642 @itemx --print-file-name
2643 Print the name of the file before each string.
2646 Print a summary of the program usage on the standard output and exit.
2648 @item -@var{min-len}
2649 @itemx -n @var{min-len}
2650 @itemx --bytes=@var{min-len}
2651 Print sequences of characters that are at least @var{min-len} characters
2652 long, instead of the default 4.
2655 Like @samp{-t o}. Some other versions of @command{strings} have @option{-o}
2656 act like @samp{-t d} instead. Since we can not be compatible with both
2657 ways, we simply chose one.
2659 @item -t @var{radix}
2660 @itemx --radix=@var{radix}
2661 Print the offset within the file before each string. The single
2662 character argument specifies the radix of the offset---@samp{o} for
2663 octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
2665 @item -e @var{encoding}
2666 @itemx --encoding=@var{encoding}
2667 Select the character encoding of the strings that are to be found.
2668 Possible values for @var{encoding} are: @samp{s} = single-7-bit-byte
2669 characters (ASCII, ISO 8859, etc., default), @samp{S} =
2670 single-8-bit-byte characters, @samp{b} = 16-bit bigendian, @samp{l} =
2671 16-bit littleendian, @samp{B} = 32-bit bigendian, @samp{L} = 32-bit
2672 littleendian. Useful for finding wide character strings. (@samp{l}
2673 and @samp{b} apply to, for example, Unicode UTF-16/UCS-2 encodings).
2675 @item -T @var{bfdname}
2676 @itemx --target=@var{bfdname}
2677 @cindex object code format
2678 Specify an object code format other than your system's default format.
2679 @xref{Target Selection}, for more information.
2684 Print the program version number on the standard output and exit.
2690 @c man begin SEEALSO strings
2691 ar(1), nm(1), objdump(1), ranlib(1), readelf(1)
2692 and the Info entries for @file{binutils}.
2700 @cindex removing symbols
2701 @cindex discarding symbols
2702 @cindex symbols, discarding
2704 @c man title strip Discard symbols from object files.
2707 @c man begin SYNOPSIS strip
2708 strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
2709 [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname}]
2710 [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname}]
2711 [@option{-s}|@option{--strip-all}]
2712 [@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}]
2713 [@option{--strip-dwo}]
2714 [@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname}]
2715 [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname}]
2716 [@option{-w}|@option{--wildcard}]
2717 [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
2718 [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
2719 [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
2720 [@option{-D}|@option{--enable-deterministic-archives}]
2721 [@option{--keep-file-symbols}]
2722 [@option{--only-keep-debug}]
2723 [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
2724 [@option{--help}] [@option{--info}]
2725 @var{objfile}@dots{}
2729 @c man begin DESCRIPTION strip
2731 @sc{gnu} @command{strip} discards all symbols from object files
2732 @var{objfile}. The list of object files may include archives.
2733 At least one object file must be given.
2735 @command{strip} modifies the files named in its argument,
2736 rather than writing modified copies under different names.
2740 @c man begin OPTIONS strip
2743 @item -F @var{bfdname}
2744 @itemx --target=@var{bfdname}
2745 Treat the original @var{objfile} as a file with the object
2746 code format @var{bfdname}, and rewrite it in the same format.
2747 @xref{Target Selection}, for more information.
2750 Show a summary of the options to @command{strip} and exit.
2753 Display a list showing all architectures and object formats available.
2755 @item -I @var{bfdname}
2756 @itemx --input-target=@var{bfdname}
2757 Treat the original @var{objfile} as a file with the object
2758 code format @var{bfdname}.
2759 @xref{Target Selection}, for more information.
2761 @item -O @var{bfdname}
2762 @itemx --output-target=@var{bfdname}
2763 Replace @var{objfile} with a file in the output format @var{bfdname}.
2764 @xref{Target Selection}, for more information.
2766 @item -R @var{sectionname}
2767 @itemx --remove-section=@var{sectionname}
2768 Remove any section named @var{sectionname} from the output file. This
2769 option may be given more than once. Note that using this option
2770 inappropriately may make the output file unusable.
2779 @itemx --strip-debug
2780 Remove debugging symbols only.
2783 Remove the contents of all DWARF .dwo sections, leaving the
2784 remaining debugging sections and all symbols intact.
2785 See the description of this option in the @command{objcopy} section
2786 for more information.
2788 @item --strip-unneeded
2789 Remove all symbols that are not needed for relocation processing.
2791 @item -K @var{symbolname}
2792 @itemx --keep-symbol=@var{symbolname}
2793 When stripping symbols, keep symbol @var{symbolname} even if it would
2794 normally be stripped. This option may be given more than once.
2796 @item -N @var{symbolname}
2797 @itemx --strip-symbol=@var{symbolname}
2798 Remove symbol @var{symbolname} from the source file. This option may be
2799 given more than once, and may be combined with strip options other than
2803 Put the stripped output in @var{file}, rather than replacing the
2804 existing file. When this argument is used, only one @var{objfile}
2805 argument may be specified.
2808 @itemx --preserve-dates
2809 Preserve the access and modification dates of the file.
2812 @itemx --enable-deterministic-archives
2813 Operate in @emph{deterministic} mode. When copying archive members
2814 and writing the archive index, use zero for UIDs, GIDs, timestamps,
2815 and use consistent file modes for all files.
2819 Permit regular expressions in @var{symbolname}s used in other command
2820 line options. The question mark (?), asterisk (*), backslash (\) and
2821 square brackets ([]) operators can be used anywhere in the symbol
2822 name. If the first character of the symbol name is the exclamation
2823 point (!) then the sense of the switch is reversed for that symbol.
2830 would cause strip to only keep symbols that start with the letters
2831 ``fo'', but to discard the symbol ``foo''.
2834 @itemx --discard-all
2835 Remove non-global symbols.
2838 @itemx --discard-locals
2839 Remove compiler-generated local symbols.
2840 (These usually start with @samp{L} or @samp{.}.)
2842 @item --keep-file-symbols
2843 When stripping a file, perhaps with @option{--strip-debug} or
2844 @option{--strip-unneeded}, retain any symbols specifying source file names,
2845 which would otherwise get stripped.
2847 @item --only-keep-debug
2848 Strip a file, removing contents of any sections that would not be
2849 stripped by @option{--strip-debug} and leaving the debugging sections
2850 intact. In ELF files, this preserves all note sections in the output.
2852 The intention is that this option will be used in conjunction with
2853 @option{--add-gnu-debuglink} to create a two part executable. One a
2854 stripped binary which will occupy less space in RAM and in a
2855 distribution and the second a debugging information file which is only
2856 needed if debugging abilities are required. The suggested procedure
2857 to create these files is as follows:
2860 @item Link the executable as normal. Assuming that is is called
2862 @item Run @code{objcopy --only-keep-debug foo foo.dbg} to
2863 create a file containing the debugging info.
2864 @item Run @code{objcopy --strip-debug foo} to create a
2865 stripped executable.
2866 @item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
2867 to add a link to the debugging info into the stripped executable.
2870 Note---the choice of @code{.dbg} as an extension for the debug info
2871 file is arbitrary. Also the @code{--only-keep-debug} step is
2872 optional. You could instead do this:
2875 @item Link the executable as normal.
2876 @item Copy @code{foo} to @code{foo.full}
2877 @item Run @code{strip --strip-debug foo}
2878 @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
2881 i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
2882 full executable. It does not have to be a file created by the
2883 @option{--only-keep-debug} switch.
2885 Note---this switch is only intended for use on fully linked files. It
2886 does not make sense to use it on object files where the debugging
2887 information may be incomplete. Besides the gnu_debuglink feature
2888 currently only supports the presence of one filename containing
2889 debugging information, not multiple filenames on a one-per-object-file
2894 Show the version number for @command{strip}.
2898 Verbose output: list all object files modified. In the case of
2899 archives, @samp{strip -v} lists all members of the archive.
2905 @c man begin SEEALSO strip
2906 the Info entries for @file{binutils}.
2910 @node c++filt, addr2line, strip, Top
2914 @cindex demangling C++ symbols
2916 @c man title cxxfilt Demangle C++ and Java symbols.
2919 @c man begin SYNOPSIS cxxfilt
2920 c++filt [@option{-_}|@option{--strip-underscore}]
2921 [@option{-n}|@option{--no-strip-underscore}]
2922 [@option{-p}|@option{--no-params}]
2923 [@option{-t}|@option{--types}]
2924 [@option{-i}|@option{--no-verbose}]
2925 [@option{-s} @var{format}|@option{--format=}@var{format}]
2926 [@option{--help}] [@option{--version}] [@var{symbol}@dots{}]
2930 @c man begin DESCRIPTION cxxfilt
2933 The C++ and Java languages provide function overloading, which means
2934 that you can write many functions with the same name, providing that
2935 each function takes parameters of different types. In order to be
2936 able to distinguish these similarly named functions C++ and Java
2937 encode them into a low-level assembler name which uniquely identifies
2938 each different version. This process is known as @dfn{mangling}. The
2940 @footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
2941 MS-DOS this program is named @command{CXXFILT}.}
2942 program does the inverse mapping: it decodes (@dfn{demangles}) low-level
2943 names into user-level names so that they can be read.
2945 Every alphanumeric word (consisting of letters, digits, underscores,
2946 dollars, or periods) seen in the input is a potential mangled name.
2947 If the name decodes into a C++ name, the C++ name replaces the
2948 low-level name in the output, otherwise the original word is output.
2949 In this way you can pass an entire assembler source file, containing
2950 mangled names, through @command{c++filt} and see the same source file
2951 containing demangled names.
2953 You can also use @command{c++filt} to decipher individual symbols by
2954 passing them on the command line:
2957 c++filt @var{symbol}
2960 If no @var{symbol} arguments are given, @command{c++filt} reads symbol
2961 names from the standard input instead. All the results are printed on
2962 the standard output. The difference between reading names from the
2963 command line versus reading names from the standard input is that
2964 command line arguments are expected to be just mangled names and no
2965 checking is performed to separate them from surrounding text. Thus
2972 will work and demangle the name to ``f()'' whereas:
2978 will not work. (Note the extra comma at the end of the mangled
2979 name which makes it invalid). This command however will work:
2982 echo _Z1fv, | c++filt -n
2985 and will display ``f(),'', i.e., the demangled name followed by a
2986 trailing comma. This behaviour is because when the names are read
2987 from the standard input it is expected that they might be part of an
2988 assembler source file where there might be extra, extraneous
2989 characters trailing after a mangled name. For example:
2992 .type _Z1fv, @@function
2997 @c man begin OPTIONS cxxfilt
3001 @itemx --strip-underscore
3002 On some systems, both the C and C++ compilers put an underscore in front
3003 of every name. For example, the C name @code{foo} gets the low-level
3004 name @code{_foo}. This option removes the initial underscore. Whether
3005 @command{c++filt} removes the underscore by default is target dependent.
3008 @itemx --no-strip-underscore
3009 Do not remove the initial underscore.
3013 When demangling the name of a function, do not display the types of
3014 the function's parameters.
3018 Attempt to demangle types as well as function names. This is disabled
3019 by default since mangled types are normally only used internally in
3020 the compiler, and they can be confused with non-mangled names. For example,
3021 a function called ``a'' treated as a mangled type name would be
3022 demangled to ``signed char''.
3026 Do not include implementation details (if any) in the demangled
3029 @item -s @var{format}
3030 @itemx --format=@var{format}
3031 @command{c++filt} can decode various methods of mangling, used by
3032 different compilers. The argument to this option selects which
3037 Automatic selection based on executable (the default method)
3039 the one used by the @sc{gnu} C++ compiler (g++)
3041 the one used by the Lucid compiler (lcc)
3043 the one specified by the C++ Annotated Reference Manual
3045 the one used by the HP compiler (aCC)
3047 the one used by the EDG compiler
3049 the one used by the @sc{gnu} C++ compiler (g++) with the V3 ABI.
3051 the one used by the @sc{gnu} Java compiler (gcj)
3053 the one used by the @sc{gnu} Ada compiler (GNAT).
3057 Print a summary of the options to @command{c++filt} and exit.
3060 Print the version number of @command{c++filt} and exit.
3066 @c man begin SEEALSO cxxfilt
3067 the Info entries for @file{binutils}.
3072 @emph{Warning:} @command{c++filt} is a new utility, and the details of its
3073 user interface are subject to change in future releases. In particular,
3074 a command-line option may be required in the future to decode a name
3075 passed as an argument on the command line; in other words,
3078 c++filt @var{symbol}
3082 may in a future release become
3085 c++filt @var{option} @var{symbol}
3093 @cindex address to file name and line number
3095 @c man title addr2line convert addresses into file names and line numbers.
3098 @c man begin SYNOPSIS addr2line
3099 addr2line [@option{-a}|@option{--addresses}]
3100 [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
3101 [@option{-C}|@option{--demangle}[=@var{style}]]
3102 [@option{-e} @var{filename}|@option{--exe=}@var{filename}]
3103 [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
3104 [@option{-i}|@option{--inlines}]
3105 [@option{-p}|@option{--pretty-print}]
3106 [@option{-j}|@option{--section=}@var{name}]
3107 [@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
3112 @c man begin DESCRIPTION addr2line
3114 @command{addr2line} translates addresses into file names and line numbers.
3115 Given an address in an executable or an offset in a section of a relocatable
3116 object, it uses the debugging information to figure out which file name and
3117 line number are associated with it.
3119 The executable or relocatable object to use is specified with the @option{-e}
3120 option. The default is the file @file{a.out}. The section in the relocatable
3121 object to use is specified with the @option{-j} option.
3123 @command{addr2line} has two modes of operation.
3125 In the first, hexadecimal addresses are specified on the command line,
3126 and @command{addr2line} displays the file name and line number for each
3129 In the second, @command{addr2line} reads hexadecimal addresses from
3130 standard input, and prints the file name and line number for each
3131 address on standard output. In this mode, @command{addr2line} may be used
3132 in a pipe to convert dynamically chosen addresses.
3134 The format of the output is @samp{FILENAME:LINENO}. The file name and
3135 line number for each input address is printed on separate lines.
3137 If the @option{-f} option is used, then each @samp{FILENAME:LINENO}
3138 line is preceded by @samp{FUNCTIONNAME} which is the name of the
3139 function containing the address.
3141 If the @option{-i} option is used and the code at the given address is
3142 present there because of inlining by the compiler then the
3143 @samp{@{FUNCTIONNAME@} FILENAME:LINENO} information for the inlining
3144 function will be displayed afterwards. This continues recursively
3145 until there is no more inlining to report.
3147 If the @option{-a} option is used then the output is prefixed by the
3150 If the @option{-p} option is used then the output for each input
3151 address is displayed on one, possibly quite long, line. If
3152 @option{-p} is not used then the output is broken up into multiple
3153 lines, based on the paragraphs above.
3155 If the file name or function name can not be determined,
3156 @command{addr2line} will print two question marks in their place. If the
3157 line number can not be determined, @command{addr2line} will print 0.
3161 @c man begin OPTIONS addr2line
3163 The long and short forms of options, shown here as alternatives, are
3169 Display the address before the function name, file and line number
3170 information. The address is printed with a @samp{0x} prefix to easily
3173 @item -b @var{bfdname}
3174 @itemx --target=@var{bfdname}
3175 @cindex object code format
3176 Specify that the object-code format for the object files is
3180 @itemx --demangle[=@var{style}]
3181 @cindex demangling in objdump
3182 Decode (@dfn{demangle}) low-level symbol names into user-level names.
3183 Besides removing any initial underscore prepended by the system, this
3184 makes C++ function names readable. Different compilers have different
3185 mangling styles. The optional demangling style argument can be used to
3186 choose an appropriate demangling style for your compiler. @xref{c++filt},
3187 for more information on demangling.
3189 @item -e @var{filename}
3190 @itemx --exe=@var{filename}
3191 Specify the name of the executable for which addresses should be
3192 translated. The default file is @file{a.out}.
3196 Display function names as well as file and line number information.
3200 Display only the base of each file name.
3204 If the address belongs to a function that was inlined, the source
3205 information for all enclosing scopes back to the first non-inlined
3206 function will also be printed. For example, if @code{main} inlines
3207 @code{callee1} which inlines @code{callee2}, and address is from
3208 @code{callee2}, the source information for @code{callee1} and @code{main}
3209 will also be printed.
3213 Read offsets relative to the specified section instead of absolute addresses.
3216 @itemx --pretty-print
3217 Make the output more human friendly: each location are printed on one line.
3218 If option @option{-i} is specified, lines for all enclosing scopes are
3219 prefixed with @samp{(inlined by)}.
3225 @c man begin SEEALSO addr2line
3226 Info entries for @file{binutils}.
3233 @command{nlmconv} converts a relocatable object file into a NetWare
3237 @command{nlmconv} currently works with @samp{i386} object
3238 files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
3239 object files in @sc{elf}, or @code{a.out} format@footnote{
3240 @command{nlmconv} should work with any @samp{i386} or @sc{sparc} object
3241 format in the Binary File Descriptor library. It has only been tested
3242 with the above formats.}.
3246 @emph{Warning:} @command{nlmconv} is not always built as part of the binary
3247 utilities, since it is only useful for NLM targets.
3250 @c man title nlmconv converts object code into an NLM.
3253 @c man begin SYNOPSIS nlmconv
3254 nlmconv [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
3255 [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
3256 [@option{-T} @var{headerfile}|@option{--header-file=}@var{headerfile}]
3257 [@option{-d}|@option{--debug}] [@option{-l} @var{linker}|@option{--linker=}@var{linker}]
3258 [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
3259 @var{infile} @var{outfile}
3263 @c man begin DESCRIPTION nlmconv
3265 @command{nlmconv} converts the relocatable @samp{i386} object file
3266 @var{infile} into the NetWare Loadable Module @var{outfile}, optionally
3267 reading @var{headerfile} for NLM header information. For instructions
3268 on writing the NLM command file language used in header files, see the
3269 @samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
3270 Development and Tools Overview}, which is part of the NLM Software
3271 Developer's Kit (``NLM SDK''), available from Novell, Inc.
3272 @command{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
3275 see @ref{BFD,,BFD,ld.info,Using LD}, for more information.
3278 @command{nlmconv} can perform a link step. In other words, you can list
3279 more than one object file for input if you list them in the definitions
3280 file (rather than simply specifying one input file on the command line).
3281 In this case, @command{nlmconv} calls the linker for you.
3285 @c man begin OPTIONS nlmconv
3288 @item -I @var{bfdname}
3289 @itemx --input-target=@var{bfdname}
3290 Object format of the input file. @command{nlmconv} can usually determine
3291 the format of a given file (so no default is necessary).
3292 @xref{Target Selection}, for more information.
3294 @item -O @var{bfdname}
3295 @itemx --output-target=@var{bfdname}
3296 Object format of the output file. @command{nlmconv} infers the output
3297 format based on the input format, e.g. for a @samp{i386} input file the
3298 output format is @samp{nlm32-i386}.
3299 @xref{Target Selection}, for more information.
3301 @item -T @var{headerfile}
3302 @itemx --header-file=@var{headerfile}
3303 Reads @var{headerfile} for NLM header information. For instructions on
3304 writing the NLM command file language used in header files, see@ see the
3305 @samp{linkers} section, of the @cite{NLM Development and Tools
3306 Overview}, which is part of the NLM Software Developer's Kit, available
3311 Displays (on standard error) the linker command line used by @command{nlmconv}.
3313 @item -l @var{linker}
3314 @itemx --linker=@var{linker}
3315 Use @var{linker} for any linking. @var{linker} can be an absolute or a
3320 Prints a usage summary.
3324 Prints the version number for @command{nlmconv}.
3330 @c man begin SEEALSO nlmconv
3331 the Info entries for @file{binutils}.
3338 @command{windmc} may be used to generator Windows message resources.
3341 @emph{Warning:} @command{windmc} is not always built as part of the binary
3342 utilities, since it is only useful for Windows targets.
3345 @c man title windmc generates Windows message resources.
3348 @c man begin SYNOPSIS windmc
3349 windmc [options] input-file
3353 @c man begin DESCRIPTION windmc
3355 @command{windmc} reads message definitions from an input file (.mc) and
3356 translate them into a set of output files. The output files may be of
3361 A C header file containing the message definitions.
3364 A resource file compilable by the @command{windres} tool.
3367 One or more binary files containing the resource data for a specific
3371 A C include file that maps message id's to their symbolic name.
3374 The exact description of these different formats is available in
3375 documentation from Microsoft.
3377 When @command{windmc} converts from the @code{mc} format to the @code{bin}
3378 format, @code{rc}, @code{h}, and optional @code{dbg} it is acting like the
3379 Windows Message Compiler.
3383 @c man begin OPTIONS windmc
3388 Specifies that the input file specified is ASCII. This is the default
3393 Specifies that messages in the output @code{bin} files should be in ASCII
3398 Specifies that @code{bin} filenames should have to be prefixed by the
3399 basename of the source file.
3403 Sets the customer bit in all message id's.
3405 @item -C @var{codepage}
3406 @itemx --codepage_in @var{codepage}
3407 Sets the default codepage to be used to convert input file to UTF16. The
3408 default is ocdepage 1252.
3411 @itemx --decimal_values
3412 Outputs the constants in the header file in decimal. Default is using
3416 @itemx --extension @var{ext}
3417 The extension for the header file. The default is .h extension.
3419 @item -F @var{target}
3420 @itemx --target @var{target}
3421 Specify the BFD format to use for a bin file as output. This
3422 is a BFD target name; you can use the @option{--help} option to see a list
3423 of supported targets. Normally @command{windmc} will use the default
3424 format, which is the first one listed by the @option{--help} option.
3426 @ref{Target Selection}.
3430 @itemx --headerdir @var{path}
3431 The target directory of the generated header file. The default is the
3436 Displays a list of command line options and then exits.
3438 @item -m @var{characters}
3439 @itemx --maxlength @var{characters}
3440 Instructs @command{windmc} to generate a warning if the length
3441 of any message exceeds the number specified.
3444 @itemx --nullterminate
3445 Terminate message text in @code{bin} files by zero. By default they are
3446 terminated by CR/LF.
3449 @itemx --hresult_use
3450 Not yet implemented. Instructs @code{windmc} to generate an OLE2 header
3451 file, using HRESULT definitions. Status codes are used if the flag is not
3454 @item -O @var{codepage}
3455 @itemx --codepage_out @var{codepage}
3456 Sets the default codepage to be used to output text files. The default
3460 @itemx --rcdir @var{path}
3461 The target directory for the generated @code{rc} script and the generated
3462 @code{bin} files that the resource compiler script includes. The default
3463 is the current directory.
3467 Specifies that the input file is UTF16.
3470 @itemx --unicode_out
3471 Specifies that messages in the output @code{bin} file should be in UTF16
3472 format. This is the default behaviour.
3476 Enable verbose mode.
3480 Prints the version number for @command{windmc}.
3483 @itemx --xdgb @var{path}
3484 The path of the @code{dbg} C include file that maps message id's to the
3485 symbolic name. No such file is generated without specifying the switch.
3491 @c man begin SEEALSO windmc
3492 the Info entries for @file{binutils}.
3499 @command{windres} may be used to manipulate Windows resources.
3502 @emph{Warning:} @command{windres} is not always built as part of the binary
3503 utilities, since it is only useful for Windows targets.
3506 @c man title windres manipulate Windows resources.
3509 @c man begin SYNOPSIS windres
3510 windres [options] [input-file] [output-file]
3514 @c man begin DESCRIPTION windres
3516 @command{windres} reads resources from an input file and copies them into
3517 an output file. Either file may be in one of three formats:
3521 A text format read by the Resource Compiler.
3524 A binary format generated by the Resource Compiler.
3527 A COFF object or executable.
3530 The exact description of these different formats is available in
3531 documentation from Microsoft.
3533 When @command{windres} converts from the @code{rc} format to the @code{res}
3534 format, it is acting like the Windows Resource Compiler. When
3535 @command{windres} converts from the @code{res} format to the @code{coff}
3536 format, it is acting like the Windows @code{CVTRES} program.
3538 When @command{windres} generates an @code{rc} file, the output is similar
3539 but not identical to the format expected for the input. When an input
3540 @code{rc} file refers to an external filename, an output @code{rc} file
3541 will instead include the file contents.
3543 If the input or output format is not specified, @command{windres} will
3544 guess based on the file name, or, for the input file, the file contents.
3545 A file with an extension of @file{.rc} will be treated as an @code{rc}
3546 file, a file with an extension of @file{.res} will be treated as a
3547 @code{res} file, and a file with an extension of @file{.o} or
3548 @file{.exe} will be treated as a @code{coff} file.
3550 If no output file is specified, @command{windres} will print the resources
3551 in @code{rc} format to standard output.
3553 The normal use is for you to write an @code{rc} file, use @command{windres}
3554 to convert it to a COFF object file, and then link the COFF file into
3555 your application. This will make the resources described in the
3556 @code{rc} file available to Windows.
3560 @c man begin OPTIONS windres
3563 @item -i @var{filename}
3564 @itemx --input @var{filename}
3565 The name of the input file. If this option is not used, then
3566 @command{windres} will use the first non-option argument as the input file
3567 name. If there are no non-option arguments, then @command{windres} will
3568 read from standard input. @command{windres} can not read a COFF file from
3571 @item -o @var{filename}
3572 @itemx --output @var{filename}
3573 The name of the output file. If this option is not used, then
3574 @command{windres} will use the first non-option argument, after any used
3575 for the input file name, as the output file name. If there is no
3576 non-option argument, then @command{windres} will write to standard output.
3577 @command{windres} can not write a COFF file to standard output. Note,
3578 for compatibility with @command{rc} the option @option{-fo} is also
3579 accepted, but its use is not recommended.
3581 @item -J @var{format}
3582 @itemx --input-format @var{format}
3583 The input format to read. @var{format} may be @samp{res}, @samp{rc}, or
3584 @samp{coff}. If no input format is specified, @command{windres} will
3585 guess, as described above.
3587 @item -O @var{format}
3588 @itemx --output-format @var{format}
3589 The output format to generate. @var{format} may be @samp{res},
3590 @samp{rc}, or @samp{coff}. If no output format is specified,
3591 @command{windres} will guess, as described above.
3593 @item -F @var{target}
3594 @itemx --target @var{target}
3595 Specify the BFD format to use for a COFF file as input or output. This
3596 is a BFD target name; you can use the @option{--help} option to see a list
3597 of supported targets. Normally @command{windres} will use the default
3598 format, which is the first one listed by the @option{--help} option.
3600 @ref{Target Selection}.
3603 @item --preprocessor @var{program}
3604 When @command{windres} reads an @code{rc} file, it runs it through the C
3605 preprocessor first. This option may be used to specify the preprocessor
3606 to use, including any leading arguments. The default preprocessor
3607 argument is @code{gcc -E -xc-header -DRC_INVOKED}.
3609 @item --preprocessor-arg @var{option}
3610 When @command{windres} reads an @code{rc} file, it runs it through
3611 the C preprocessor first. This option may be used to specify additional
3612 text to be passed to preprocessor on its command line.
3613 This option can be used multiple times to add multiple options to the
3614 preprocessor command line.
3616 @item -I @var{directory}
3617 @itemx --include-dir @var{directory}
3618 Specify an include directory to use when reading an @code{rc} file.
3619 @command{windres} will pass this to the preprocessor as an @option{-I}
3620 option. @command{windres} will also search this directory when looking for
3621 files named in the @code{rc} file. If the argument passed to this command
3622 matches any of the supported @var{formats} (as described in the @option{-J}
3623 option), it will issue a deprecation warning, and behave just like the
3624 @option{-J} option. New programs should not use this behaviour. If a
3625 directory happens to match a @var{format}, simple prefix it with @samp{./}
3626 to disable the backward compatibility.
3628 @item -D @var{target}
3629 @itemx --define @var{sym}[=@var{val}]
3630 Specify a @option{-D} option to pass to the preprocessor when reading an
3633 @item -U @var{target}
3634 @itemx --undefine @var{sym}
3635 Specify a @option{-U} option to pass to the preprocessor when reading an
3639 Ignored for compatibility with rc.
3642 Enable verbose mode. This tells you what the preprocessor is if you
3646 @item --codepage @var{val}
3647 Specify the default codepage to use when reading an @code{rc} file.
3648 @var{val} should be a hexadecimal prefixed by @samp{0x} or decimal
3649 codepage code. The valid range is from zero up to 0xffff, but the
3650 validity of the codepage is host and configuration dependent.
3653 @item --language @var{val}
3654 Specify the default language to use when reading an @code{rc} file.
3655 @var{val} should be a hexadecimal language code. The low eight bits are
3656 the language, and the high eight bits are the sublanguage.
3658 @item --use-temp-file
3659 Use a temporary file to instead of using popen to read the output of
3660 the preprocessor. Use this option if the popen implementation is buggy
3661 on the host (eg., certain non-English language versions of Windows 95 and
3662 Windows 98 are known to have buggy popen where the output will instead
3665 @item --no-use-temp-file
3666 Use popen, not a temporary file, to read the output of the preprocessor.
3667 This is the default behaviour.
3671 Prints a usage summary.
3675 Prints the version number for @command{windres}.
3678 If @command{windres} is compiled with @code{YYDEBUG} defined as @code{1},
3679 this will turn on parser debugging.
3685 @c man begin SEEALSO windres
3686 the Info entries for @file{binutils}.
3695 @command{dlltool} is used to create the files needed to create dynamic
3696 link libraries (DLLs) on systems which understand PE format image
3697 files such as Windows. A DLL contains an export table which contains
3698 information that the runtime loader needs to resolve references from a
3699 referencing program.
3701 The export table is generated by this program by reading in a
3702 @file{.def} file or scanning the @file{.a} and @file{.o} files which
3703 will be in the DLL. A @file{.o} file can contain information in
3704 special @samp{.drectve} sections with export information.
3707 @emph{Note:} @command{dlltool} is not always built as part of the
3708 binary utilities, since it is only useful for those targets which
3712 @c man title dlltool Create files needed to build and use DLLs.
3715 @c man begin SYNOPSIS dlltool
3716 dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
3717 [@option{-b}|@option{--base-file} @var{base-file-name}]
3718 [@option{-e}|@option{--output-exp} @var{exports-file-name}]
3719 [@option{-z}|@option{--output-def} @var{def-file-name}]
3720 [@option{-l}|@option{--output-lib} @var{library-file-name}]
3721 [@option{-y}|@option{--output-delaylib} @var{library-file-name}]
3722 [@option{--export-all-symbols}] [@option{--no-export-all-symbols}]
3723 [@option{--exclude-symbols} @var{list}]
3724 [@option{--no-default-excludes}]
3725 [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}]
3726 [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
3727 [@option{-a}|@option{--add-indirect}]
3728 [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}]
3729 [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
3730 [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
3731 [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}]
3732 [@option{--use-nul-prefixed-import-tables}]
3733 [@option{-I}|@option{--identify} @var{library-file-name}] [@option{--identify-strict}]
3734 [@option{-i}|@option{--interwork}]
3735 [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
3736 [@option{-v}|@option{--verbose}]
3737 [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
3738 [@option{--no-leading-underscore}] [@option{--leading-underscore}]
3739 [object-file @dots{}]
3743 @c man begin DESCRIPTION dlltool
3745 @command{dlltool} reads its inputs, which can come from the @option{-d} and
3746 @option{-b} options as well as object files specified on the command
3747 line. It then processes these inputs and if the @option{-e} option has
3748 been specified it creates a exports file. If the @option{-l} option
3749 has been specified it creates a library file and if the @option{-z} option
3750 has been specified it creates a def file. Any or all of the @option{-e},
3751 @option{-l} and @option{-z} options can be present in one invocation of
3754 When creating a DLL, along with the source for the DLL, it is necessary
3755 to have three other files. @command{dlltool} can help with the creation of
3758 The first file is a @file{.def} file which specifies which functions are
3759 exported from the DLL, which functions the DLL imports, and so on. This
3760 is a text file and can be created by hand, or @command{dlltool} can be used
3761 to create it using the @option{-z} option. In this case @command{dlltool}
3762 will scan the object files specified on its command line looking for
3763 those functions which have been specially marked as being exported and
3764 put entries for them in the @file{.def} file it creates.
3766 In order to mark a function as being exported from a DLL, it needs to
3767 have an @option{-export:<name_of_function>} entry in the @samp{.drectve}
3768 section of the object file. This can be done in C by using the
3772 asm (".section .drectve");
3773 asm (".ascii \"-export:my_func\"");
3775 int my_func (void) @{ @dots{} @}
3778 The second file needed for DLL creation is an exports file. This file
3779 is linked with the object files that make up the body of the DLL and it
3780 handles the interface between the DLL and the outside world. This is a
3781 binary file and it can be created by giving the @option{-e} option to
3782 @command{dlltool} when it is creating or reading in a @file{.def} file.
3784 The third file needed for DLL creation is the library file that programs
3785 will link with in order to access the functions in the DLL (an `import
3786 library'). This file can be created by giving the @option{-l} option to
3787 dlltool when it is creating or reading in a @file{.def} file.
3789 If the @option{-y} option is specified, dlltool generates a delay-import
3790 library that can be used instead of the normal import library to allow
3791 a program to link to the dll only as soon as an imported function is
3792 called for the first time. The resulting executable will need to be
3793 linked to the static delayimp library containing __delayLoadHelper2(),
3794 which in turn will import LoadLibraryA and GetProcAddress from kernel32.
3796 @command{dlltool} builds the library file by hand, but it builds the
3797 exports file by creating temporary files containing assembler statements
3798 and then assembling these. The @option{-S} command line option can be
3799 used to specify the path to the assembler that dlltool will use,
3800 and the @option{-f} option can be used to pass specific flags to that
3801 assembler. The @option{-n} can be used to prevent dlltool from deleting
3802 these temporary assembler files when it is done, and if @option{-n} is
3803 specified twice then this will prevent dlltool from deleting the
3804 temporary object files it used to build the library.
3806 Here is an example of creating a DLL from a source file @samp{dll.c} and
3807 also creating a program (from an object file called @samp{program.o})
3812 dlltool -e exports.o -l dll.lib dll.o
3813 gcc dll.o exports.o -o dll.dll
3814 gcc program.o dll.lib -o program
3818 @command{dlltool} may also be used to query an existing import library
3819 to determine the name of the DLL to which it is associated. See the
3820 description of the @option{-I} or @option{--identify} option.
3824 @c man begin OPTIONS dlltool
3826 The command line options have the following meanings:
3830 @item -d @var{filename}
3831 @itemx --input-def @var{filename}
3832 @cindex input .def file
3833 Specifies the name of a @file{.def} file to be read in and processed.
3835 @item -b @var{filename}
3836 @itemx --base-file @var{filename}
3838 Specifies the name of a base file to be read in and processed. The
3839 contents of this file will be added to the relocation section in the
3840 exports file generated by dlltool.
3842 @item -e @var{filename}
3843 @itemx --output-exp @var{filename}
3844 Specifies the name of the export file to be created by dlltool.
3846 @item -z @var{filename}
3847 @itemx --output-def @var{filename}
3848 Specifies the name of the @file{.def} file to be created by dlltool.
3850 @item -l @var{filename}
3851 @itemx --output-lib @var{filename}
3852 Specifies the name of the library file to be created by dlltool.
3854 @item -y @var{filename}
3855 @itemx --output-delaylib @var{filename}
3856 Specifies the name of the delay-import library file to be created by dlltool.
3858 @item --export-all-symbols
3859 Treat all global and weak defined symbols found in the input object
3860 files as symbols to be exported. There is a small list of symbols which
3861 are not exported by default; see the @option{--no-default-excludes}
3862 option. You may add to the list of symbols to not export by using the
3863 @option{--exclude-symbols} option.
3865 @item --no-export-all-symbols
3866 Only export symbols explicitly listed in an input @file{.def} file or in
3867 @samp{.drectve} sections in the input object files. This is the default
3868 behaviour. The @samp{.drectve} sections are created by @samp{dllexport}
3869 attributes in the source code.
3871 @item --exclude-symbols @var{list}
3872 Do not export the symbols in @var{list}. This is a list of symbol names
3873 separated by comma or colon characters. The symbol names should not
3874 contain a leading underscore. This is only meaningful when
3875 @option{--export-all-symbols} is used.
3877 @item --no-default-excludes
3878 When @option{--export-all-symbols} is used, it will by default avoid
3879 exporting certain special symbols. The current list of symbols to avoid
3880 exporting is @samp{DllMain@@12}, @samp{DllEntryPoint@@0},
3881 @samp{impure_ptr}. You may use the @option{--no-default-excludes} option
3882 to go ahead and export these special symbols. This is only meaningful
3883 when @option{--export-all-symbols} is used.
3886 @itemx --as @var{path}
3887 Specifies the path, including the filename, of the assembler to be used
3888 to create the exports file.
3890 @item -f @var{options}
3891 @itemx --as-flags @var{options}
3892 Specifies any specific command line options to be passed to the
3893 assembler when building the exports file. This option will work even if
3894 the @option{-S} option is not used. This option only takes one argument,
3895 and if it occurs more than once on the command line, then later
3896 occurrences will override earlier occurrences. So if it is necessary to
3897 pass multiple options to the assembler they should be enclosed in
3901 @itemx --dll-name @var{name}
3902 Specifies the name to be stored in the @file{.def} file as the name of
3903 the DLL when the @option{-e} option is used. If this option is not
3904 present, then the filename given to the @option{-e} option will be
3905 used as the name of the DLL.
3907 @item -m @var{machine}
3908 @itemx -machine @var{machine}
3909 Specifies the type of machine for which the library file should be
3910 built. @command{dlltool} has a built in default type, depending upon how
3911 it was created, but this option can be used to override that. This is
3912 normally only useful when creating DLLs for an ARM processor, when the
3913 contents of the DLL are actually encode using Thumb instructions.
3916 @itemx --add-indirect
3917 Specifies that when @command{dlltool} is creating the exports file it
3918 should add a section which allows the exported functions to be
3919 referenced without using the import library. Whatever the hell that
3923 @itemx --add-underscore
3924 Specifies that when @command{dlltool} is creating the exports file it
3925 should prepend an underscore to the names of @emph{all} exported symbols.
3927 @item --no-leading-underscore
3928 @item --leading-underscore
3929 Specifies whether standard symbol should be forced to be prefixed, or
3932 @item --add-stdcall-underscore
3933 Specifies that when @command{dlltool} is creating the exports file it
3934 should prepend an underscore to the names of exported @emph{stdcall}
3935 functions. Variable names and non-stdcall function names are not modified.
3936 This option is useful when creating GNU-compatible import libs for third
3937 party DLLs that were built with MS-Windows tools.
3941 Specifies that when @command{dlltool} is creating the exports file it
3942 should not append the string @samp{@@ <number>}. These numbers are
3943 called ordinal numbers and they represent another way of accessing the
3944 function in a DLL, other than by name.
3947 @itemx --add-stdcall-alias
3948 Specifies that when @command{dlltool} is creating the exports file it
3949 should add aliases for stdcall symbols without @samp{@@ <number>}
3950 in addition to the symbols with @samp{@@ <number>}.
3953 @itemx --ext-prefix-alias @var{prefix}
3954 Causes @command{dlltool} to create external aliases for all DLL
3955 imports with the specified prefix. The aliases are created for both
3956 external and import symbols with no leading underscore.
3960 Specifies that when @command{dlltool} is creating the exports and library
3961 files it should omit the @code{.idata4} section. This is for compatibility
3962 with certain operating systems.
3964 @item --use-nul-prefixed-import-tables
3965 Specifies that when @command{dlltool} is creating the exports and library
3966 files it should prefix the @code{.idata4} and @code{.idata5} by zero an
3967 element. This emulates old gnu import library generation of
3968 @code{dlltool}. By default this option is turned off.
3972 Specifies that when @command{dlltool} is creating the exports and library
3973 files it should omit the @code{.idata5} section. This is for compatibility
3974 with certain operating systems.
3976 @item -I @var{filename}
3977 @itemx --identify @var{filename}
3978 Specifies that @command{dlltool} should inspect the import library
3979 indicated by @var{filename} and report, on @code{stdout}, the name(s)
3980 of the associated DLL(s). This can be performed in addition to any
3981 other operations indicated by the other options and arguments.
3982 @command{dlltool} fails if the import library does not exist or is not
3983 actually an import library. See also @option{--identify-strict}.
3985 @item --identify-strict
3986 Modifies the behavior of the @option{--identify} option, such
3987 that an error is reported if @var{filename} is associated with
3992 Specifies that @command{dlltool} should mark the objects in the library
3993 file and exports file that it produces as supporting interworking
3994 between ARM and Thumb code.
3998 Makes @command{dlltool} preserve the temporary assembler files it used to
3999 create the exports file. If this option is repeated then dlltool will
4000 also preserve the temporary object files it uses to create the library
4003 @item -t @var{prefix}
4004 @itemx --temp-prefix @var{prefix}
4005 Makes @command{dlltool} use @var{prefix} when constructing the names of
4006 temporary assembler and object files. By default, the temp file prefix
4007 is generated from the pid.
4011 Make dlltool describe what it is doing.
4015 Displays a list of command line options and then exits.
4019 Displays dlltool's version number and then exits.
4026 * def file format:: The format of the dlltool @file{.def} file
4029 @node def file format
4030 @section The format of the @command{dlltool} @file{.def} file
4032 A @file{.def} file contains any number of the following commands:
4036 @item @code{NAME} @var{name} @code{[ ,} @var{base} @code{]}
4037 The result is going to be named @var{name}@code{.exe}.
4039 @item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]}
4040 The result is going to be named @var{name}@code{.dll}.
4041 Note: If you want to use LIBRARY as name then you need to quote. Otherwise
4042 this will fail due a necessary hack for libtool (see PR binutils/13710 for more
4045 @item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2} @code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.} @var{external-name} @code{) ) [ == } @var{its_name} @code{]}
4046 @item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *}
4047 Declares @var{name1} as an exported symbol from the DLL, with optional
4048 ordinal number @var{integer}, or declares @var{name1} as an alias
4049 (forward) of the function @var{external-name} in the DLL.
4050 If @var{its_name} is specified, this name is used as string in export table.
4052 Note: The @code{EXPORTS} has to be the last command in .def file, as keywords
4053 are treated - beside @code{LIBRARY} - as simple name-identifiers.
4054 If you want to use LIBRARY as name then you need to quote it.
4056 @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{]} *}
4057 Declares that @var{external-name} or the exported function whose
4058 ordinal number is @var{integer} is to be imported from the file
4059 @var{module-name}. If @var{internal-name} is specified then this is
4060 the name that the imported function will be referred to in the body of
4062 If @var{its_name} is specified, this name is used as string in import table.
4063 Note: The @code{IMPORTS} has to be the last command in .def file, as keywords
4064 are treated - beside @code{LIBRARY} - as simple name-identifiers.
4065 If you want to use LIBRARY as name then you need to quote it.
4067 @item @code{DESCRIPTION} @var{string}
4068 Puts @var{string} into the output @file{.exp} file in the
4069 @code{.rdata} section.
4071 @item @code{STACKSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
4072 @item @code{HEAPSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
4073 Generates @code{--stack} or @code{--heap}
4074 @var{number-reserve},@var{number-commit} in the output @code{.drectve}
4075 section. The linker will see this and act upon it.
4077 @item @code{CODE} @var{attr} @code{+}
4078 @item @code{DATA} @var{attr} @code{+}
4079 @item @code{SECTIONS (} @var{section-name} @var{attr}@code{ + ) *}
4080 Generates @code{--attr} @var{section-name} @var{attr} in the output
4081 @code{.drectve} section, where @var{attr} is one of @code{READ},
4082 @code{WRITE}, @code{EXECUTE} or @code{SHARED}. The linker will see
4083 this and act upon it.
4088 @c man begin SEEALSO dlltool
4089 The Info pages for @file{binutils}.
4096 @cindex ELF file information
4099 @c man title readelf Displays information about ELF files.
4102 @c man begin SYNOPSIS readelf
4103 readelf [@option{-a}|@option{--all}]
4104 [@option{-h}|@option{--file-header}]
4105 [@option{-l}|@option{--program-headers}|@option{--segments}]
4106 [@option{-S}|@option{--section-headers}|@option{--sections}]
4107 [@option{-g}|@option{--section-groups}]
4108 [@option{-t}|@option{--section-details}]
4109 [@option{-e}|@option{--headers}]
4110 [@option{-s}|@option{--syms}|@option{--symbols}]
4111 [@option{--dyn-syms}]
4112 [@option{-n}|@option{--notes}]
4113 [@option{-r}|@option{--relocs}]
4114 [@option{-u}|@option{--unwind}]
4115 [@option{-d}|@option{--dynamic}]
4116 [@option{-V}|@option{--version-info}]
4117 [@option{-A}|@option{--arch-specific}]
4118 [@option{-D}|@option{--use-dynamic}]
4119 [@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
4120 [@option{-p} <number or name>|@option{--string-dump=}<number or name>]
4121 [@option{-R} <number or name>|@option{--relocated-dump=}<number or name>]
4122 [@option{-c}|@option{--archive-index}]
4123 [@option{-w[lLiaprmfFsoRt]}|
4124 @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]]
4125 [@option{--dwarf-depth=@var{n}}]
4126 [@option{--dwarf-start=@var{n}}]
4127 [@option{-I}|@option{--histogram}]
4128 [@option{-v}|@option{--version}]
4129 [@option{-W}|@option{--wide}]
4130 [@option{-H}|@option{--help}]
4131 @var{elffile}@dots{}
4135 @c man begin DESCRIPTION readelf
4137 @command{readelf} displays information about one or more ELF format object
4138 files. The options control what particular information to display.
4140 @var{elffile}@dots{} are the object files to be examined. 32-bit and
4141 64-bit ELF files are supported, as are archives containing ELF files.
4143 This program performs a similar function to @command{objdump} but it
4144 goes into more detail and it exists independently of the @sc{bfd}
4145 library, so if there is a bug in @sc{bfd} then readelf will not be
4150 @c man begin OPTIONS readelf
4152 The long and short forms of options, shown here as alternatives, are
4153 equivalent. At least one option besides @samp{-v} or @samp{-H} must be
4159 Equivalent to specifying @option{--file-header},
4160 @option{--program-headers}, @option{--sections}, @option{--symbols},
4161 @option{--relocs}, @option{--dynamic}, @option{--notes} and
4162 @option{--version-info}.
4165 @itemx --file-header
4166 @cindex ELF file header information
4167 Displays the information contained in the ELF header at the start of the
4171 @itemx --program-headers
4173 @cindex ELF program header information
4174 @cindex ELF segment information
4175 Displays the information contained in the file's segment headers, if it
4180 @itemx --section-headers
4181 @cindex ELF section information
4182 Displays the information contained in the file's section headers, if it
4186 @itemx --section-groups
4187 @cindex ELF section group information
4188 Displays the information contained in the file's section groups, if it
4192 @itemx --section-details
4193 @cindex ELF section information
4194 Displays the detailed section information. Implies @option{-S}.
4199 @cindex ELF symbol table information
4200 Displays the entries in symbol table section of the file, if it has one.
4203 @cindex ELF dynamic symbol table information
4204 Displays the entries in dynamic symbol table section of the file, if it
4209 Display all the headers in the file. Equivalent to @option{-h -l -S}.
4214 Displays the contents of the NOTE segments and/or sections, if any.
4218 @cindex ELF reloc information
4219 Displays the contents of the file's relocation section, if it has one.
4223 @cindex unwind information
4224 Displays the contents of the file's unwind section, if it has one. Only
4225 the unwind sections for IA64 ELF files, as well as ARM unwind tables
4226 (@code{.ARM.exidx} / @code{.ARM.extab}) are currently supported.
4230 @cindex ELF dynamic section information
4231 Displays the contents of the file's dynamic section, if it has one.
4234 @itemx --version-info
4235 @cindex ELF version sections information
4236 Displays the contents of the version sections in the file, it they
4240 @itemx --arch-specific
4241 Displays architecture-specific information in the file, if there
4245 @itemx --use-dynamic
4246 When displaying symbols, this option makes @command{readelf} use the
4247 symbol hash tables in the file's dynamic section, rather than the
4248 symbol table sections.
4250 @item -x <number or name>
4251 @itemx --hex-dump=<number or name>
4252 Displays the contents of the indicated section as a hexadecimal bytes.
4253 A number identifies a particular section by index in the section table;
4254 any other string identifies all sections with that name in the object file.
4256 @item -R <number or name>
4257 @itemx --relocated-dump=<number or name>
4258 Displays the contents of the indicated section as a hexadecimal
4259 bytes. A number identifies a particular section by index in the
4260 section table; any other string identifies all sections with that name
4261 in the object file. The contents of the section will be relocated
4262 before they are displayed.
4264 @item -p <number or name>
4265 @itemx --string-dump=<number or name>
4266 Displays the contents of the indicated section as printable strings.
4267 A number identifies a particular section by index in the section table;
4268 any other string identifies all sections with that name in the object file.
4271 @itemx --archive-index
4272 @cindex Archive file symbol index information
4273 Displays the file symbol index information contained in the header part
4274 of binary archives. Performs the same function as the @option{t}
4275 command to @command{ar}, but without using the BFD library. @xref{ar}.
4277 @item -w[lLiaprmfFsoRt]
4278 @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]
4279 Displays the contents of the debug sections in the file, if any are
4280 present. If one of the optional letters or words follows the switch
4281 then only data found in those specific sections will be dumped.
4283 Note that there is no single letter option to display the content of
4284 trace sections or .gdb_index.
4286 Note: the @option{=decodedline} option will display the interpreted
4287 contents of a .debug_line section whereas the @option{=rawline} option
4288 dumps the contents in a raw format.
4290 Note: the @option{=frames-interp} option will display the interpreted
4291 contents of a .debug_frame section whereas the @option{=frames} option
4292 dumps the contents in a raw format.
4294 Note: the output from the @option{=info} option can also be affected
4295 by the options @option{--dwarf-depth} and @option{--dwarf-start}.
4297 @item --dwarf-depth=@var{n}
4298 Limit the dump of the @code{.debug_info} section to @var{n} children.
4299 This is only useful with @option{--debug-dump=info}. The default is
4300 to print all DIEs; the special value 0 for @var{n} will also have this
4303 With a non-zero value for @var{n}, DIEs at or deeper than @var{n}
4304 levels will not be printed. The range for @var{n} is zero-based.
4306 @item --dwarf-start=@var{n}
4307 Print only DIEs beginning with the DIE numbered @var{n}. This is only
4308 useful with @option{--debug-dump=info}.
4310 If specified, this option will suppress printing of any header
4311 information and all DIEs before the DIE numbered @var{n}. Only
4312 siblings and children of the specified DIE will be printed.
4314 This can be used in conjunction with @option{--dwarf-depth}.
4318 Display a histogram of bucket list lengths when displaying the contents
4319 of the symbol tables.
4323 Display the version number of readelf.
4327 Don't break output lines to fit into 80 columns. By default
4328 @command{readelf} breaks section header and segment listing lines for
4329 64-bit ELF files, so that they fit into 80 columns. This option causes
4330 @command{readelf} to print each section header resp. each segment one a
4331 single line, which is far more readable on terminals wider than 80 columns.
4335 Display the command line options understood by @command{readelf}.
4342 @c man begin SEEALSO readelf
4343 objdump(1), and the Info entries for @file{binutils}.
4350 @cindex Update ELF header
4353 @c man title elfedit Update the ELF header of ELF files.
4356 @c man begin SYNOPSIS elfedit
4357 elfedit [@option{--input-mach=}@var{machine}]
4358 [@option{--input-type=}@var{type}]
4359 [@option{--input-osabi=}@var{osabi}]
4360 @option{--output-mach=}@var{machine}
4361 @option{--output-type=}@var{type}
4362 @option{--output-osabi=}@var{osabi}
4363 [@option{-v}|@option{--version}]
4364 [@option{-h}|@option{--help}]
4365 @var{elffile}@dots{}
4369 @c man begin DESCRIPTION elfedit
4371 @command{elfedit} updates the ELF header of ELF files which have
4372 the matching ELF machine and file types. The options control how and
4373 which fields in the ELF header should be updated.
4375 @var{elffile}@dots{} are the ELF files to be updated. 32-bit and
4376 64-bit ELF files are supported, as are archives containing ELF files.
4379 @c man begin OPTIONS elfedit
4381 The long and short forms of options, shown here as alternatives, are
4382 equivalent. At least one of the @option{--output-mach},
4383 @option{--output-type} and @option{--output-osabi} options must be given.
4387 @item --input-mach=@var{machine}
4388 Set the matching input ELF machine type to @var{machine}. If
4389 @option{--input-mach} isn't specified, it will match any ELF
4392 The supported ELF machine types are, @var{L1OM}, @var{K1OM} and
4395 @item --output-mach=@var{machine}
4396 Change the ELF machine type in the ELF header to @var{machine}. The
4397 supported ELF machine types are the same as @option{--input-mach}.
4399 @item --input-type=@var{type}
4400 Set the matching input ELF file type to @var{type}. If
4401 @option{--input-type} isn't specified, it will match any ELF file types.
4403 The supported ELF file types are, @var{rel}, @var{exec} and @var{dyn}.
4405 @item --output-type=@var{type}
4406 Change the ELF file type in the ELF header to @var{type}. The
4407 supported ELF types are the same as @option{--input-type}.
4409 @item --input-osabi=@var{osabi}
4410 Set the matching input ELF file OSABI to @var{osabi}. If
4411 @option{--input-osabi} isn't specified, it will match any ELF OSABIs.
4413 The supported ELF OSABIs are, @var{none}, @var{HPUX}, @var{NetBSD},
4414 @var{GNU}, @var{Linux} (alias for @var{GNU}),
4415 @var{Solaris}, @var{AIX}, @var{Irix},
4416 @var{FreeBSD}, @var{TRU64}, @var{Modesto}, @var{OpenBSD}, @var{OpenVMS},
4417 @var{NSK}, @var{AROS} and @var{FenixOS}.
4419 @item --output-osabi=@var{osabi}
4420 Change the ELF OSABI in the ELF header to @var{osabi}. The
4421 supported ELF OSABI are the same as @option{--input-osabi}.
4425 Display the version number of @command{elfedit}.
4429 Display the command line options understood by @command{elfedit}.
4436 @c man begin SEEALSO elfedit
4437 readelf(1), and the Info entries for @file{binutils}.
4441 @node Common Options
4442 @chapter Common Options
4444 The following command-line options are supported by all of the
4445 programs described in this manual.
4447 @c man begin OPTIONS
4449 @include at-file.texi
4453 Display the command-line options supported by the program.
4456 Display the version number of the program.
4458 @c man begin OPTIONS
4462 @node Selecting the Target System
4463 @chapter Selecting the Target System
4465 You can specify two aspects of the target system to the @sc{gnu}
4466 binary file utilities, each in several ways:
4476 In the following summaries, the lists of ways to specify values are in
4477 order of decreasing precedence. The ways listed first override those
4480 The commands to list valid values only list the values for which the
4481 programs you are running were configured. If they were configured with
4482 @option{--enable-targets=all}, the commands list most of the available
4483 values, but a few are left out; not all targets can be configured in at
4484 once because some of them can only be configured @dfn{native} (on hosts
4485 with the same type as the target system).
4488 * Target Selection::
4489 * Architecture Selection::
4492 @node Target Selection
4493 @section Target Selection
4495 A @dfn{target} is an object file format. A given target may be
4496 supported for multiple architectures (@pxref{Architecture Selection}).
4497 A target selection may also have variations for different operating
4498 systems or architectures.
4500 The command to list valid target values is @samp{objdump -i}
4501 (the first column of output contains the relevant information).
4503 Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
4504 @samp{a.out-sunos-big}.
4506 You can also specify a target using a configuration triplet. This is
4507 the same sort of name that is passed to @file{configure} to specify a
4508 target. When you use a configuration triplet as an argument, it must be
4509 fully canonicalized. You can see the canonical version of a triplet by
4510 running the shell script @file{config.sub} which is included with the
4513 Some sample configuration triplets are: @samp{m68k-hp-bsd},
4514 @samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}.
4516 @subheading @command{objdump} Target
4522 command line option: @option{-b} or @option{--target}
4525 environment variable @code{GNUTARGET}
4528 deduced from the input file
4531 @subheading @command{objcopy} and @command{strip} Input Target
4537 command line options: @option{-I} or @option{--input-target}, or @option{-F} or @option{--target}
4540 environment variable @code{GNUTARGET}
4543 deduced from the input file
4546 @subheading @command{objcopy} and @command{strip} Output Target
4552 command line options: @option{-O} or @option{--output-target}, or @option{-F} or @option{--target}
4555 the input target (see ``@command{objcopy} and @command{strip} Input Target'' above)
4558 environment variable @code{GNUTARGET}
4561 deduced from the input file
4564 @subheading @command{nm}, @command{size}, and @command{strings} Target
4570 command line option: @option{--target}
4573 environment variable @code{GNUTARGET}
4576 deduced from the input file
4579 @node Architecture Selection
4580 @section Architecture Selection
4582 An @dfn{architecture} is a type of @sc{cpu} on which an object file is
4583 to run. Its name may contain a colon, separating the name of the
4584 processor family from the name of the particular @sc{cpu}.
4586 The command to list valid architecture values is @samp{objdump -i} (the
4587 second column contains the relevant information).
4589 Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
4591 @subheading @command{objdump} Architecture
4597 command line option: @option{-m} or @option{--architecture}
4600 deduced from the input file
4603 @subheading @command{objcopy}, @command{nm}, @command{size}, @command{strings} Architecture
4609 deduced from the input file
4612 @node Reporting Bugs
4613 @chapter Reporting Bugs
4615 @cindex reporting bugs
4617 Your bug reports play an essential role in making the binary utilities
4620 Reporting a bug may help you by bringing a solution to your problem, or
4621 it may not. But in any case the principal function of a bug report is
4622 to help the entire community by making the next version of the binary
4623 utilities work better. Bug reports are your contribution to their
4626 In order for a bug report to serve its purpose, you must include the
4627 information that enables us to fix the bug.
4630 * Bug Criteria:: Have you found a bug?
4631 * Bug Reporting:: How to report bugs
4635 @section Have You Found a Bug?
4636 @cindex bug criteria
4638 If you are not sure whether you have found a bug, here are some guidelines:
4641 @cindex fatal signal
4644 If a binary utility gets a fatal signal, for any input whatever, that is
4645 a bug. Reliable utilities never crash.
4647 @cindex error on valid input
4649 If a binary utility produces an error message for valid input, that is a
4653 If you are an experienced user of binary utilities, your suggestions for
4654 improvement are welcome in any case.
4658 @section How to Report Bugs
4660 @cindex bugs, reporting
4662 A number of companies and individuals offer support for @sc{gnu}
4663 products. If you obtained the binary utilities from a support
4664 organization, we recommend you contact that organization first.
4666 You can find contact information for many support companies and
4667 individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
4671 In any event, we also recommend that you send bug reports for the binary
4672 utilities to @value{BUGURL}.
4675 The fundamental principle of reporting bugs usefully is this:
4676 @strong{report all the facts}. If you are not sure whether to state a
4677 fact or leave it out, state it!
4679 Often people omit facts because they think they know what causes the
4680 problem and assume that some details do not matter. Thus, you might
4681 assume that the name of a file you use in an example does not matter.
4682 Well, probably it does not, but one cannot be sure. Perhaps the bug is
4683 a stray memory reference which happens to fetch from the location where
4684 that pathname is stored in memory; perhaps, if the pathname were
4685 different, the contents of that location would fool the utility into
4686 doing the right thing despite the bug. Play it safe and give a
4687 specific, complete example. That is the easiest thing for you to do,
4688 and the most helpful.
4690 Keep in mind that the purpose of a bug report is to enable us to fix the bug if
4691 it is new to us. Therefore, always write your bug reports on the assumption
4692 that the bug has not been reported previously.
4694 Sometimes people give a few sketchy facts and ask, ``Does this ring a
4695 bell?'' This cannot help us fix a bug, so it is basically useless. We
4696 respond by asking for enough details to enable us to investigate.
4697 You might as well expedite matters by sending them to begin with.
4699 To enable us to fix the bug, you should include all these things:
4703 The version of the utility. Each utility announces it if you start it
4704 with the @option{--version} argument.
4706 Without this, we will not know whether there is any point in looking for
4707 the bug in the current version of the binary utilities.
4710 Any patches you may have applied to the source, including any patches
4711 made to the @code{BFD} library.
4714 The type of machine you are using, and the operating system name and
4718 What compiler (and its version) was used to compile the utilities---e.g.
4722 The command arguments you gave the utility to observe the bug. To
4723 guarantee you will not omit something important, list them all. A copy
4724 of the Makefile (or the output from make) is sufficient.
4726 If we were to try to guess the arguments, we would probably guess wrong
4727 and then we might not encounter the bug.
4730 A complete input file, or set of input files, that will reproduce the
4731 bug. If the utility is reading an object file or files, then it is
4732 generally most helpful to send the actual object files.
4734 If the source files were produced exclusively using @sc{gnu} programs
4735 (e.g., @command{gcc}, @command{gas}, and/or the @sc{gnu} @command{ld}), then it
4736 may be OK to send the source files rather than the object files. In
4737 this case, be sure to say exactly what version of @command{gcc}, or
4738 whatever, was used to produce the object files. Also say how
4739 @command{gcc}, or whatever, was configured.
4742 A description of what behavior you observe that you believe is
4743 incorrect. For example, ``It gets a fatal signal.''
4745 Of course, if the bug is that the utility gets a fatal signal, then we
4746 will certainly notice it. But if the bug is incorrect output, we might
4747 not notice unless it is glaringly wrong. You might as well not give us
4748 a chance to make a mistake.
4750 Even if the problem you experience is a fatal signal, you should still
4751 say so explicitly. Suppose something strange is going on, such as your
4752 copy of the utility is out of sync, or you have encountered a bug in
4753 the C library on your system. (This has happened!) Your copy might
4754 crash and ours would not. If you told us to expect a crash, then when
4755 ours fails to crash, we would know that the bug was not happening for
4756 us. If you had not told us to expect a crash, then we would not be able
4757 to draw any conclusion from our observations.
4760 If you wish to suggest changes to the source, send us context diffs, as
4761 generated by @command{diff} with the @option{-u}, @option{-c}, or @option{-p}
4762 option. Always send diffs from the old file to the new file. If you
4763 wish to discuss something in the @command{ld} source, refer to it by
4764 context, not by line number.
4766 The line numbers in our development sources will not match those in your
4767 sources. Your line numbers would convey no useful information to us.
4770 Here are some things that are not necessary:
4774 A description of the envelope of the bug.
4776 Often people who encounter a bug spend a lot of time investigating
4777 which changes to the input file will make the bug go away and which
4778 changes will not affect it.
4780 This is often time consuming and not very useful, because the way we
4781 will find the bug is by running a single example under the debugger
4782 with breakpoints, not by pure deduction from a series of examples.
4783 We recommend that you save your time for something else.
4785 Of course, if you can find a simpler example to report @emph{instead}
4786 of the original one, that is a convenience for us. Errors in the
4787 output will be easier to spot, running under the debugger will take
4788 less time, and so on.
4790 However, simplification is not vital; if you do not want to do this,
4791 report the bug anyway and send us the entire test case you used.
4794 A patch for the bug.
4796 A patch for the bug does help us if it is a good one. But do not omit
4797 the necessary information, such as the test case, on the assumption that
4798 a patch is all we need. We might see problems with your patch and decide
4799 to fix the problem another way, or we might not understand it at all.
4801 Sometimes with programs as complicated as the binary utilities it is
4802 very hard to construct an example that will make the program follow a
4803 certain path through the code. If you do not send us the example, we
4804 will not be able to construct one, so we will not be able to verify that
4807 And if we cannot understand what bug you are trying to fix, or why your
4808 patch should be an improvement, we will not install it. A test case will
4809 help us to understand.
4812 A guess about what the bug is or what it depends on.
4814 Such guesses are usually wrong. Even we cannot guess right about such
4815 things without first using the debugger to find the facts.
4818 @node GNU Free Documentation License
4819 @appendix GNU Free Documentation License
4823 @node Binutils Index
4824 @unnumbered Binutils Index