1 This is binutils.info, produced by makeinfo version 4.0 from
5 * Binutils: (binutils). The GNU binary utilities.
6 * ar: (binutils)ar. Create, modify, and extract from archives
7 * nm: (binutils)nm. List symbols from object files
8 * objcopy: (binutils)objcopy. Copy and translate object files
9 * objdump: (binutils)objdump. Display information from object files
10 * ranlib: (binutils)ranlib. Generate index to archive contents
11 * readelf: (binutils)readelf. Display the contents of ELF format files.
12 * size: (binutils)size. List section sizes and total size
13 * strings: (binutils)strings. List printable strings from files
14 * strip: (binutils)strip. Discard symbols
15 * c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols
16 * cxxfilt: (binutils)c++filt. MS-DOS name for c++filt
17 * addr2line: (binutils)addr2line. Convert addresses to file and line
18 * nlmconv: (binutils)nlmconv. Converts object code into an NLM
19 * windres: (binutils)windres. Manipulate Windows resources
20 * dlltool: (binutils)dlltool. Create files needed to build and use DLLs
23 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free
24 Software Foundation, Inc.
26 Permission is granted to copy, distribute and/or modify this document
27 under the terms of the GNU Free Documentation License, Version 1.1
28 or any later version published by the Free Software Foundation;
29 with no Invariant Sections, with no Front-Cover Texts, and with no
30 Back-Cover Texts. A copy of the license is included in the
31 section entitled "GNU Free Documentation License".
34 File: binutils.info, Node: Top, Next: ar, Up: (dir)
39 This brief manual contains preliminary documentation for the GNU
40 binary utilities (collectively version 2.10.91):
42 This document is distributed under the terms of the GNU Free
43 Documentation License. A copy of the license is included in the
44 section entitled "GNU Free Documentation License".
48 * ar:: Create, modify, and extract from archives
49 * nm:: List symbols from object files
50 * objcopy:: Copy and translate object files
51 * objdump:: Display information from object files
52 * ranlib:: Generate index to archive contents
53 * readelf:: Display the contents of ELF format files.
54 * size:: List section sizes and total size
55 * strings:: List printable strings from files
56 * strip:: Discard symbols
57 * c++filt:: Filter to demangle encoded C++ symbols
58 * cxxfilt: c++filt. MS-DOS name for c++filt
59 * addr2line:: Convert addresses to file and line
60 * nlmconv:: Converts object code into an NLM
61 * windres:: Manipulate Windows resources
62 * dlltool:: Create files needed to build and use DLLs
63 * Selecting The Target System:: How these utilities determine the target.
64 * Reporting Bugs:: Reporting Bugs
65 * GNU Free Documentation License:: GNU Free Documentation License
69 File: binutils.info, Node: ar, Next: nm, Prev: Top, Up: Top
74 ar [-]P[MOD [RELPOS] [COUNT]] ARCHIVE [MEMBER...]
77 The GNU `ar' program creates, modifies, and extracts from archives.
78 An "archive" is a single file holding a collection of other files in a
79 structure that makes it possible to retrieve the original individual
80 files (called "members" of the archive).
82 The original files' contents, mode (permissions), timestamp, owner,
83 and group are preserved in the archive, and can be restored on
86 GNU `ar' can maintain archives whose members have names of any
87 length; however, depending on how `ar' is configured on your system, a
88 limit on member-name length may be imposed for compatibility with
89 archive formats maintained with other tools. If it exists, the limit
90 is often 15 characters (typical of formats related to a.out) or 16
91 characters (typical of formats related to coff).
93 `ar' is considered a binary utility because archives of this sort
94 are most often used as "libraries" holding commonly needed subroutines.
96 `ar' creates an index to the symbols defined in relocatable object
97 modules in the archive when you specify the modifier `s'. Once
98 created, this index is updated in the archive whenever `ar' makes a
99 change to its contents (save for the `q' update operation). An archive
100 with such an index speeds up linking to the library, and allows
101 routines in the library to call each other without regard to their
102 placement in the archive.
104 You may use `nm -s' or `nm --print-armap' to list this index table.
105 If an archive lacks the table, another form of `ar' called `ranlib' can
106 be used to add just the table.
108 GNU `ar' is designed to be compatible with two different facilities.
109 You can control its activity using command-line options, like the
110 different varieties of `ar' on Unix systems; or, if you specify the
111 single command-line option `-M', you can control it with a script
112 supplied via standard input, like the MRI "librarian" program.
116 * ar cmdline:: Controlling `ar' on the command line
117 * ar scripts:: Controlling `ar' with a script
120 File: binutils.info, Node: ar cmdline, Next: ar scripts, Up: ar
122 Controlling `ar' on the command line
123 ====================================
125 ar [-X32_64] [-]P[MOD [RELPOS] [COUNT]] ARCHIVE [MEMBER...]
127 When you use `ar' in the Unix style, `ar' insists on at least two
128 arguments to execute: one keyletter specifying the _operation_
129 (optionally accompanied by other keyletters specifying _modifiers_),
130 and the archive name to act on.
132 Most operations can also accept further MEMBER arguments, specifying
133 particular files to operate on.
135 GNU `ar' allows you to mix the operation code P and modifier flags
136 MOD in any order, within the first command-line argument.
138 If you wish, you may begin the first command-line argument with a
141 The P keyletter specifies what operation to execute; it may be any
142 of the following, but you must specify only one of them:
145 _Delete_ modules from the archive. Specify the names of modules to
146 be deleted as MEMBER...; the archive is untouched if you specify
149 If you specify the `v' modifier, `ar' lists each module as it is
153 Use this operation to _move_ members in an archive.
155 The ordering of members in an archive can make a difference in how
156 programs are linked using the library, if a symbol is defined in
157 more than one member.
159 If no modifiers are used with `m', any members you name in the
160 MEMBER arguments are moved to the _end_ of the archive; you can
161 use the `a', `b', or `i' modifiers to move them to a specified
165 _Print_ the specified members of the archive, to the standard
166 output file. If the `v' modifier is specified, show the member
167 name before copying its contents to standard output.
169 If you specify no MEMBER arguments, all the files in the archive
173 _Quick append_; Historically, add the files MEMBER... to the end of
174 ARCHIVE, without checking for replacement.
176 The modifiers `a', `b', and `i' do _not_ affect this operation;
177 new members are always placed at the end of the archive.
179 The modifier `v' makes `ar' list each file as it is appended.
181 Since the point of this operation is speed, the archive's symbol
182 table index is not updated, even if it already existed; you can
183 use `ar s' or `ranlib' explicitly to update the symbol table index.
185 However, too many different systems assume quick append rebuilds
186 the index, so GNU ar implements `q' as a synonym for `r'.
189 Insert the files MEMBER... into ARCHIVE (with _replacement_). This
190 operation differs from `q' in that any previously existing members
191 are deleted if their names match those being added.
193 If one of the files named in MEMBER... does not exist, `ar'
194 displays an error message, and leaves undisturbed any existing
195 members of the archive matching that name.
197 By default, new members are added at the end of the file; but you
198 may use one of the modifiers `a', `b', or `i' to request placement
199 relative to some existing member.
201 The modifier `v' used with this operation elicits a line of output
202 for each file inserted, along with one of the letters `a' or `r'
203 to indicate whether the file was appended (no old member deleted)
207 Display a _table_ listing the contents of ARCHIVE, or those of the
208 files listed in MEMBER... that are present in the archive.
209 Normally only the member name is shown; if you also want to see
210 the modes (permissions), timestamp, owner, group, and size, you can
211 request that by also specifying the `v' modifier.
213 If you do not specify a MEMBER, all files in the archive are
216 If there is more than one file with the same name (say, `fie') in
217 an archive (say `b.a'), `ar t b.a fie' lists only the first
218 instance; to see them all, you must ask for a complete listing--in
219 our example, `ar t b.a'.
222 _Extract_ members (named MEMBER) from the archive. You can use
223 the `v' modifier with this operation, to request that `ar' list
224 each name as it extracts it.
226 If you do not specify a MEMBER, all files in the archive are
229 A number of modifiers (MOD) may immediately follow the P keyletter,
230 to specify variations on an operation's behavior:
233 Add new files _after_ an existing member of the archive. If you
234 use the modifier `a', the name of an existing archive member must
235 be present as the RELPOS argument, before the ARCHIVE
239 Add new files _before_ an existing member of the archive. If you
240 use the modifier `b', the name of an existing archive member must
241 be present as the RELPOS argument, before the ARCHIVE
242 specification. (same as `i').
245 _Create_ the archive. The specified ARCHIVE is always created if
246 it did not exist, when you request an update. But a warning is
247 issued unless you specify in advance that you expect to create it,
248 by using this modifier.
251 Truncate names in the archive. GNU `ar' will normally permit file
252 names of any length. This will cause it to create archives which
253 are not compatible with the native `ar' program on some systems.
254 If this is a concern, the `f' modifier may be used to truncate file
255 names when putting them in the archive.
258 Insert new files _before_ an existing member of the archive. If
259 you use the modifier `i', the name of an existing archive member
260 must be present as the RELPOS argument, before the ARCHIVE
261 specification. (same as `b').
264 This modifier is accepted but not used.
267 Uses the COUNT parameter. This is used if there are multiple
268 entries in the archive with the same name. Extract or delete
269 instance COUNT of the given name from the archive.
272 Preserve the _original_ dates of members when extracting them. If
273 you do not specify this modifier, files extracted from the archive
274 are stamped with the time of extraction.
277 Use the full path name when matching names in the archive. GNU
278 `ar' can not create an archive with a full path name (such archives
279 are not POSIX complaint), but other archive creators can. This
280 option will cause GNU `ar' to match file names using a complete
281 path name, which can be convenient when extracting a single file
282 from an archive created by another tool.
285 Write an object-file index into the archive, or update an existing
286 one, even if no other change is made to the archive. You may use
287 this modifier flag either with any operation, or alone. Running
288 `ar s' on an archive is equivalent to running `ranlib' on it.
291 Do not generate an archive symbol table. This can speed up
292 building a large library in several steps. The resulting archive
293 can not be used with the linker. In order to build a symbol
294 table, you must omit the `S' modifier on the last execution of
295 `ar', or you must run `ranlib' on the archive.
298 Normally, `ar r'... inserts all files listed into the archive. If
299 you would like to insert _only_ those of the files you list that
300 are newer than existing members of the same names, use this
301 modifier. The `u' modifier is allowed only for the operation `r'
302 (replace). In particular, the combination `qu' is not allowed,
303 since checking the timestamps would lose any speed advantage from
307 This modifier requests the _verbose_ version of an operation. Many
308 operations display additional information, such as filenames
309 processed, when the modifier `v' is appended.
312 This modifier shows the version number of `ar'.
314 `ar' ignores an initial option spelt `-X32_64', for compatibility
315 with AIX. The behaviour produced by this option is the default for GNU
316 `ar'. `ar' does not support any of the other `-X' options; in
317 particular, it does not support `-X32' which is the default for AIX
321 File: binutils.info, Node: ar scripts, Prev: ar cmdline, Up: ar
323 Controlling `ar' with a script
324 ==============================
328 If you use the single command-line option `-M' with `ar', you can
329 control its operation with a rudimentary command language. This form
330 of `ar' operates interactively if standard input is coming directly
331 from a terminal. During interactive use, `ar' prompts for input (the
332 prompt is `AR >'), and continues executing even after errors. If you
333 redirect standard input to a script file, no prompts are issued, and
334 `ar' abandons execution (with a nonzero exit code) on any error.
336 The `ar' command language is _not_ designed to be equivalent to the
337 command-line options; in fact, it provides somewhat less control over
338 archives. The only purpose of the command language is to ease the
339 transition to GNU `ar' for developers who already have scripts written
340 for the MRI "librarian" program.
342 The syntax for the `ar' command language is straightforward:
343 * commands are recognized in upper or lower case; for example, `LIST'
344 is the same as `list'. In the following descriptions, commands are
345 shown in upper case for clarity.
347 * a single command may appear on each line; it is the first word on
350 * empty lines are allowed, and have no effect.
352 * comments are allowed; text after either of the characters `*' or
355 * Whenever you use a list of names as part of the argument to an `ar'
356 command, you can separate the individual names with either commas
357 or blanks. Commas are shown in the explanations below, for
360 * `+' is used as a line continuation character; if `+' appears at
361 the end of a line, the text on the following line is considered
362 part of the current command.
364 Here are the commands you can use in `ar' scripts, or when using
365 `ar' interactively. Three of them have special significance:
367 `OPEN' or `CREATE' specify a "current archive", which is a temporary
368 file required for most of the other commands.
370 `SAVE' commits the changes so far specified by the script. Prior to
371 `SAVE', commands affect only the temporary copy of the current archive.
374 `ADDLIB ARCHIVE (MODULE, MODULE, ... MODULE)'
375 Add all the contents of ARCHIVE (or, if specified, each named
376 MODULE from ARCHIVE) to the current archive.
378 Requires prior use of `OPEN' or `CREATE'.
380 `ADDMOD MEMBER, MEMBER, ... MEMBER'
381 Add each named MEMBER as a module in the current archive.
383 Requires prior use of `OPEN' or `CREATE'.
386 Discard the contents of the current archive, canceling the effect
387 of any operations since the last `SAVE'. May be executed (with no
388 effect) even if no current archive is specified.
391 Creates an archive, and makes it the current archive (required for
392 many other commands). The new archive is created with a temporary
393 name; it is not actually saved as ARCHIVE until you use `SAVE'.
394 You can overwrite existing archives; similarly, the contents of any
395 existing file named ARCHIVE will not be destroyed until `SAVE'.
397 `DELETE MODULE, MODULE, ... MODULE'
398 Delete each listed MODULE from the current archive; equivalent to
399 `ar -d ARCHIVE MODULE ... MODULE'.
401 Requires prior use of `OPEN' or `CREATE'.
403 `DIRECTORY ARCHIVE (MODULE, ... MODULE)'
404 `DIRECTORY ARCHIVE (MODULE, ... MODULE) OUTPUTFILE'
405 List each named MODULE present in ARCHIVE. The separate command
406 `VERBOSE' specifies the form of the output: when verbose output is
407 off, output is like that of `ar -t ARCHIVE MODULE...'. When
408 verbose output is on, the listing is like `ar -tv ARCHIVE
411 Output normally goes to the standard output stream; however, if you
412 specify OUTPUTFILE as a final argument, `ar' directs the output to
416 Exit from `ar', with a `0' exit code to indicate successful
417 completion. This command does not save the output file; if you
418 have changed the current archive since the last `SAVE' command,
419 those changes are lost.
421 `EXTRACT MODULE, MODULE, ... MODULE'
422 Extract each named MODULE from the current archive, writing them
423 into the current directory as separate files. Equivalent to `ar -x
426 Requires prior use of `OPEN' or `CREATE'.
429 Display full contents of the current archive, in "verbose" style
430 regardless of the state of `VERBOSE'. The effect is like `ar tv
431 ARCHIVE'. (This single command is a GNU `ar' enhancement, rather
432 than present for MRI compatibility.)
434 Requires prior use of `OPEN' or `CREATE'.
437 Opens an existing archive for use as the current archive (required
438 for many other commands). Any changes as the result of subsequent
439 commands will not actually affect ARCHIVE until you next use
442 `REPLACE MODULE, MODULE, ... MODULE'
443 In the current archive, replace each existing MODULE (named in the
444 `REPLACE' arguments) from files in the current working directory.
445 To execute this command without errors, both the file, and the
446 module in the current archive, must exist.
448 Requires prior use of `OPEN' or `CREATE'.
451 Toggle an internal flag governing the output from `DIRECTORY'.
452 When the flag is on, `DIRECTORY' output matches output from `ar
456 Commit your changes to the current archive, and actually save it
457 as a file with the name specified in the last `CREATE' or `OPEN'
460 Requires prior use of `OPEN' or `CREATE'.
463 File: binutils.info, Node: nm, Next: objcopy, Prev: ar, Up: Top
468 nm [ -a | --debug-syms ] [ -g | --extern-only ]
469 [ -B ] [ -C | --demangle[=STYLE] ] [ -D | --dynamic ]
470 [ -s | --print-armap ] [ -A | -o | --print-file-name ]
471 [ -n | -v | --numeric-sort ] [ -p | --no-sort ]
472 [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ]
473 [ -t RADIX | --radix=RADIX ] [ -P | --portability ]
474 [ --target=BFDNAME ] [ -f FORMAT | --format=FORMAT ]
475 [ --defined-only ] [-l | --line-numbers ] [ --no-demangle ]
476 [ -V | --version ] [ -X 32_64 ] [ --help ] [ OBJFILE... ]
478 GNU `nm' lists the symbols from object files OBJFILE.... If no
479 object files are listed as arguments, `nm' assumes the file `a.out'.
481 For each symbol, `nm' shows:
483 * The symbol value, in the radix selected by options (see below), or
484 hexadecimal by default.
486 * The symbol type. At least the following types are used; others
487 are, as well, depending on the object file format. If lowercase,
488 the symbol is local; if uppercase, the symbol is global (external).
491 The symbol's value is absolute, and will not be changed by
495 The symbol is in the uninitialized data section (known as
499 The symbol is common. Common symbols are uninitialized data.
500 When linking, multiple common symbols may appear with the
501 same name. If the symbol is defined anywhere, the common
502 symbols are treated as undefined references. For more
503 details on common symbols, see the discussion of -warn-common
504 in *Note Linker options: (ld.info)Options.
507 The symbol is in the initialized data section.
510 The symbol is in an initialized data section for small
511 objects. Some object file formats permit more efficient
512 access to small data objects, such as a global int variable
513 as opposed to a large global array.
516 The symbol is an indirect reference to another symbol. This
517 is a GNU extension to the a.out object file format which is
521 The symbol is a debugging symbol.
524 The symbol is in a read only data section.
527 The symbol is in an uninitialized data section for small
531 The symbol is in the text (code) section.
534 The symbol is undefined.
537 The symbol is a weak object. When a weak defined symbol is
538 linked with a normal defined symbol, the normal defined
539 symbol is used with no error. When a weak undefined symbol
540 is linked and the symbol is not defined, the value of the
541 weak symbol becomes zero with no error.
544 The symbol is a weak symbol that has not been specifically
545 tagged as a weak object symbol. When a weak defined symbol
546 is linked with a normal defined symbol, the normal defined
547 symbol is used with no error. When a weak undefined symbol
548 is linked and the symbol is not defined, the value of the
549 weak symbol becomes zero with no error.
552 The symbol is a stabs symbol in an a.out object file. In
553 this case, the next values printed are the stabs other field,
554 the stabs desc field, and the stab type. Stabs symbols are
555 used to hold debugging information; for more information, see
556 *Note Stabs: (stabs.info)Top.
559 The symbol type is unknown, or object file format specific.
563 The long and short forms of options, shown here as alternatives, are
569 Precede each symbol by the name of the input file (or archive
570 member) in which it was found, rather than identifying the input
571 file once only, before all of its symbols.
575 Display all symbols, even debugger-only symbols; normally these
579 The same as `--format=bsd' (for compatibility with the MIPS `nm').
583 Decode ("demangle") low-level symbol names into user-level names.
584 Besides removing any initial underscore prepended by the system,
585 this makes C++ function names readable. Different compilers have
586 different mangling styles. The optional demangling style argument
587 can be used to choose an appropriate demangling style for your
588 compiler. *Note c++filt::, for more information on demangling.
591 Do not demangle low-level symbol names. This is the default.
595 Display the dynamic symbols rather than the normal symbols. This
596 is only meaningful for dynamic objects, such as certain types of
601 Use the output format FORMAT, which can be `bsd', `sysv', or
602 `posix'. The default is `bsd'. Only the first character of
603 FORMAT is significant; it can be either upper or lower case.
607 Display only external symbols.
611 For each symbol, use debugging information to try to find a
612 filename and line number. For a defined symbol, look for the line
613 number of the address of the symbol. For an undefined symbol,
614 look for the line number of a relocation entry which refers to the
615 symbol. If line number information can be found, print it after
616 the other symbol information.
621 Sort symbols numerically by their addresses, rather than
622 alphabetically by their names.
626 Do not bother to sort the symbols in any order; print them in the
631 Use the POSIX.2 standard output format instead of the default
632 format. Equivalent to `-f posix'.
636 When listing symbols from archive members, include the index: a
637 mapping (stored in the archive by `ar' or `ranlib') of which
638 modules contain definitions for which names.
642 Reverse the order of the sort (whether numeric or alphabetic); let
646 Sort symbols by size. The size is computed as the difference
647 between the value of the symbol and the value of the symbol with
648 the next higher value. The size of the symbol is printed, rather
653 Use RADIX as the radix for printing the symbol values. It must be
654 `d' for decimal, `o' for octal, or `x' for hexadecimal.
657 Specify an object code format other than your system's default
658 format. *Note Target Selection::, for more information.
662 Display only undefined symbols (those external to each object
666 Display only defined symbols for each object file.
670 Show the version number of `nm' and exit.
673 This option is ignored for compatibility with the AIX version of
674 `nm'. It takes one parameter which must be the string `32_64'.
675 The default mode of AIX `nm' corresponds to `-X 32', which is not
676 supported by GNU `nm'.
679 Show a summary of the options to `nm' and exit.
682 File: binutils.info, Node: objcopy, Next: objdump, Prev: nm, Up: Top
687 objcopy [ -F BFDNAME | --target=BFDNAME ]
688 [ -I BFDNAME | --input-target=BFDNAME ]
689 [ -O BFDNAME | --output-target=BFDNAME ]
690 [ -S | --strip-all ] [ -g | --strip-debug ]
691 [ -K SYMBOLNAME | --keep-symbol=SYMBOLNAME ]
692 [ -N SYMBOLNAME | --strip-symbol=SYMBOLNAME ]
693 [ -L SYMBOLNAME | --localize-symbol=SYMBOLNAME ]
694 [ -W SYMBOLNAME | --weaken-symbol=SYMBOLNAME ]
695 [ -x | --discard-all ] [ -X | --discard-locals ]
696 [ -b BYTE | --byte=BYTE ]
697 [ -i INTERLEAVE | --interleave=INTERLEAVE ]
698 [ -j SECTIONNAME | --only-section=SECTIONNAME ]
699 [ -R SECTIONNAME | --remove-section=SECTIONNAME ]
700 [ -p | --preserve-dates ] [ --debugging ]
701 [ --gap-fill=VAL ] [ --pad-to=ADDRESS ]
702 [ --set-start=VAL ] [ --adjust-start=INCR ]
703 [ --change-addresses=INCR ]
704 [ --change-section-address SECTION{=,+,-}VAL ]
705 [ --change-section-lma SECTION{=,+,-}VAL ]
706 [ --change-section-vma SECTION{=,+,-}VAL ]
707 [ --change-warnings ] [ --no-change-warnings ]
708 [ --set-section-flags SECTION=FLAGS ]
709 [ --add-section SECTIONNAME=FILENAME ]
710 [ --change-leading-char ] [ --remove-leading-char ]
711 [ --srec-len=IVAL ] [ --srec-forceS3 ]
712 [ --redefine-sym OLD=NEW ] [ --weaken ]
713 [ -v | --verbose ] [ -V | --version ] [ --help ]
716 The GNU `objcopy' utility copies the contents of an object file to
717 another. `objcopy' uses the GNU BFD Library to read and write the
718 object files. It can write the destination object file in a format
719 different from that of the source object file. The exact behavior of
720 `objcopy' is controlled by command-line options. Note that `objcopy'
721 should be able to copy a fully linked file between any two formats.
722 However, copying a relocatable object file between any two formats may
723 not work as expected.
725 `objcopy' creates temporary files to do its translations and deletes
726 them afterward. `objcopy' uses BFD to do all its translation work; it
727 has access to all the formats described in BFD and thus is able to
728 recognize most formats without being told explicitly. *Note BFD:
731 `objcopy' can be used to generate S-records by using an output
732 target of `srec' (e.g., use `-O srec').
734 `objcopy' can be used to generate a raw binary file by using an
735 output target of `binary' (e.g., use `-O binary'). When `objcopy'
736 generates a raw binary file, it will essentially produce a memory dump
737 of the contents of the input object file. All symbols and relocation
738 information will be discarded. The memory dump will start at the load
739 address of the lowest section copied into the output file.
741 When generating an S-record or a raw binary file, it may be helpful
742 to use `-S' to remove sections containing debugging information. In
743 some cases `-R' will be useful to remove sections which contain
744 information that is not needed by the binary file.
746 Note - `objcopy' is not able to change the endianness of its input
747 files. If the input format has an endianness, (some formats do not),
748 `objcopy' can only copy the inputs into file formats that have the same
749 endianness or which have no endianness (eg `srec').
753 The input and output files, respectively. If you do not specify
754 OUTFILE, `objcopy' creates a temporary file and destructively
755 renames the result with the name of INFILE.
758 `--input-target=BFDNAME'
759 Consider the source file's object format to be BFDNAME, rather than
760 attempting to deduce it. *Note Target Selection::, for more
764 `--output-target=BFDNAME'
765 Write the output file using the object format BFDNAME. *Note
766 Target Selection::, for more information.
770 Use BFDNAME as the object format for both the input and the output
771 file; i.e., simply transfer data from source to destination with no
772 translation. *Note Target Selection::, for more information.
775 `--only-section=SECTIONNAME'
776 Copy only the named section from the input file to the output file.
777 This option may be given more than once. Note that using this
778 option inappropriately may make the output file unusable.
781 `--remove-section=SECTIONNAME'
782 Remove any section named SECTIONNAME from the output file. This
783 option may be given more than once. Note that using this option
784 inappropriately may make the output file unusable.
788 Do not copy relocation and symbol information from the source file.
792 Do not copy debugging symbols from the source file.
795 Strip all symbols that are not needed for relocation processing.
798 `--keep-symbol=SYMBOLNAME'
799 Copy only symbol SYMBOLNAME from the source file. This option may
800 be given more than once.
803 `--strip-symbol=SYMBOLNAME'
804 Do not copy symbol SYMBOLNAME from the source file. This option
805 may be given more than once.
808 `--localize-symbol=SYMBOLNAME'
809 Make symbol SYMBOLNAME local to the file, so that it is not
810 visible externally. This option may be given more than once.
813 `--weaken-symbol=SYMBOLNAME'
814 Make symbol SYMBOLNAME weak. This option may be given more than
819 Do not copy non-global symbols from the source file.
823 Do not copy compiler-generated local symbols. (These usually
824 start with `L' or `.'.)
828 Keep only every BYTEth byte of the input file (header data is not
829 affected). BYTE can be in the range from 0 to INTERLEAVE-1, where
830 INTERLEAVE is given by the `-i' or `--interleave' option, or the
831 default of 4. This option is useful for creating files to program
832 ROM. It is typically used with an `srec' output target.
835 `--interleave=INTERLEAVE'
836 Only copy one out of every INTERLEAVE bytes. Select which byte to
837 copy with the -B or `--byte' option. The default is 4. `objcopy'
838 ignores this option if you do not specify either `-b' or `--byte'.
842 Set the access and modification dates of the output file to be the
843 same as those of the input file.
846 Convert debugging information, if possible. This is not the
847 default because only certain debugging formats are supported, and
848 the conversion process can be time consuming.
851 Fill gaps between sections with VAL. This operation applies to
852 the _load address_ (LMA) of the sections. It is done by increasing
853 the size of the section with the lower address, and filling in the
854 extra space created with VAL.
857 Pad the output file up to the load address ADDRESS. This is done
858 by increasing the size of the last section. The extra space is
859 filled in with the value specified by `--gap-fill' (default zero).
862 Set the start address of the new file to VAL. Not all object file
863 formats support setting the start address.
865 `--change-start INCR'
866 `--adjust-start INCR'
867 Change the start address by adding INCR. Not all object file
868 formats support setting the start address.
870 `--change-addresses INCR'
872 Change the VMA and LMA addresses of all sections, as well as the
873 start address, by adding INCR. Some object file formats do not
874 permit section addresses to be changed arbitrarily. Note that
875 this does not relocate the sections; if the program expects
876 sections to be loaded at a certain address, and this option is
877 used to change the sections such that they are loaded at a
878 different address, the program may fail.
880 `--change-section-address SECTION{=,+,-}VAL'
881 `--adjust-section-vma SECTION{=,+,-}VAL'
882 Set or change both the VMA address and the LMA address of the named
883 SECTION. If `=' is used, the section address is set to VAL.
884 Otherwise, VAL is added to or subtracted from the section address.
885 See the comments under `--change-addresses', above. If SECTION
886 does not exist in the input file, a warning will be issued, unless
887 `--no-change-warnings' is used.
889 `--change-section-lma SECTION{=,+,-}VAL'
890 Set or change the LMA address of the named SECTION. The LMA
891 address is the address where the section will be loaded into
892 memory at program load time. Normally this is the same as the VMA
893 address, which is the address of the section at program run time,
894 but on some systems, especially those where a program is held in
895 ROM, the two can be different. If `=' is used, the section
896 address is set to VAL. Otherwise, VAL is added to or subtracted
897 from the section address. See the comments under
898 `--change-addresses', above. If SECTION does not exist in the
899 input file, a warning will be issued, unless
900 `--no-change-warnings' is used.
902 `--change-section-vma SECTION{=,+,-}VAL'
903 Set or change the VMA address of the named SECTION. The VMA
904 address is the address where the section will be located once the
905 program has started executing. Normally this is the same as the
906 LMA address, which is the address where the section will be loaded
907 into memory, but on some systems, especially those where a program
908 is held in ROM, the two can be different. If `=' is used, the
909 section address is set to VAL. Otherwise, VAL is added to or
910 subtracted from the section address. See the comments under
911 `--change-addresses', above. If SECTION does not exist in the
912 input file, a warning will be issued, unless
913 `--no-change-warnings' is used.
917 If `--change-section-address' or `--change-section-lma' or
918 `--change-section-vma' is used, and the named section does not
919 exist, issue a warning. This is the default.
921 `--no-change-warnings'
922 `--no-adjust-warnings'
923 Do not issue a warning if `--change-section-address' or
924 `--adjust-section-lma' or `--adjust-section-vma' is used, even if
925 the named section does not exist.
927 `--set-section-flags SECTION=FLAGS'
928 Set the flags for the named section. The FLAGS argument is a
929 comma separated string of flag names. The recognized names are
930 `alloc', `contents', `load', `noload', `readonly', `code', `data',
931 `rom', `share', and `debug'. You can set the `contents' flag for
932 a section which does not have contents, but it is not meaningful
933 to clear the `contents' flag of a section which does have
934 contents-just remove the section instead. Not all flags are
935 meaningful for all object file formats.
937 `--add-section SECTIONNAME=FILENAME'
938 Add a new section named SECTIONNAME while copying the file. The
939 contents of the new section are taken from the file FILENAME. The
940 size of the section will be the size of the file. This option only
941 works on file formats which can support sections with arbitrary
944 `--change-leading-char'
945 Some object file formats use special characters at the start of
946 symbols. The most common such character is underscore, which
947 compilers often add before every symbol. This option tells
948 `objcopy' to change the leading character of every symbol when it
949 converts between object file formats. If the object file formats
950 use the same leading character, this option has no effect.
951 Otherwise, it will add a character, or remove a character, or
952 change a character, as appropriate.
954 `--remove-leading-char'
955 If the first character of a global symbol is a special symbol
956 leading character used by the object file format, remove the
957 character. The most common symbol leading character is
958 underscore. This option will remove a leading underscore from all
959 global symbols. This can be useful if you want to link together
960 objects of different file formats with different conventions for
961 symbol names. This is different from `--change-leading-char'
962 because it always changes the symbol name when appropriate,
963 regardless of the object file format of the output file.
966 Meaningful only for srec output. Set the maximum length of the
967 Srecords being produced to IVAL. This length covers both address,
971 Meaningful only for srec output. Avoid generation of S1/S2
972 records, creating S3-only record format.
974 `--redefine-sym OLD=NEW'
975 Change the name of a symbol OLD, to NEW. This can be useful when
976 one is trying link two things together for which you have no
977 source, and there are name collisions.
980 Change all global symbols in the file to be weak. This can be
981 useful when building an object which will be linked against other
982 objects using the `-R' option to the linker. This option is only
983 effective when using an object file format which supports weak
988 Show the version number of `objcopy'.
992 Verbose output: list all object files modified. In the case of
993 archives, `objcopy -V' lists all members of the archive.
996 Show a summary of the options to `objcopy'.
999 File: binutils.info, Node: objdump, Next: ranlib, Prev: objcopy, Up: Top
1004 objdump [ -a | --archive-headers ]
1005 [ -b BFDNAME | --target=BFDNAME ]
1006 [ -C | --demangle[=STYLE] ]
1007 [ -d | --disassemble ]
1008 [ -D | --disassemble-all ]
1009 [ -z | --disassemble-zeroes ]
1010 [ -EB | -EL | --endian={big | little } ]
1011 [ -f | --file-headers ]
1012 [ --file-start-context ]
1013 [ -g | --debugging ]
1014 [ -h | --section-headers | --headers ]
1016 [ -j SECTION | --section=SECTION ]
1017 [ -l | --line-numbers ]
1019 [ -m MACHINE | --architecture=MACHINE ]
1020 [ -M OPTIONS | --disassembler-options=OPTIONS]
1021 [ -p | --private-headers ]
1023 [ -R | --dynamic-reloc ]
1024 [ -s | --full-contents ]
1027 [ -T | --dynamic-syms ]
1028 [ -x | --all-headers ]
1030 [ --start-address=ADDRESS ]
1031 [ --stop-address=ADDRESS ]
1032 [ --prefix-addresses]
1033 [ --[no-]show-raw-insn ]
1034 [ --adjust-vma=OFFSET ]
1039 `objdump' displays information about one or more object files. The
1040 options control what particular information to display. This
1041 information is mostly useful to programmers who are working on the
1042 compilation tools, as opposed to programmers who just want their
1043 program to compile and work.
1045 OBJFILE... are the object files to be examined. When you specify
1046 archives, `objdump' shows information on each of the member object
1049 The long and short forms of options, shown here as alternatives, are
1050 equivalent. At least one option from the list
1051 `-a,-d,-D,-f,-g,-G,-h,-H,-p,-r,-R,-S,-t,-T,-V,-x' must be given.
1055 If any of the OBJFILE files are archives, display the archive
1056 header information (in a format similar to `ls -l'). Besides the
1057 information you could list with `ar tv', `objdump -a' shows the
1058 object file format of each archive member.
1060 `--adjust-vma=OFFSET'
1061 When dumping information, first add OFFSET to all the section
1062 addresses. This is useful if the section addresses do not
1063 correspond to the symbol table, which can happen when putting
1064 sections at particular addresses when using a format which can not
1065 represent section addresses, such as a.out.
1069 Specify that the object-code format for the object files is
1070 BFDNAME. This option may not be necessary; OBJDUMP can
1071 automatically recognize many formats.
1074 objdump -b oasys -m vax -h fu.o
1076 displays summary information from the section headers (`-h') of
1077 `fu.o', which is explicitly identified (`-m') as a VAX object file
1078 in the format produced by Oasys compilers. You can list the
1079 formats available with the `-i' option. *Note Target Selection::,
1080 for more information.
1083 `--demangle[=STYLE]'
1084 Decode ("demangle") low-level symbol names into user-level names.
1085 Besides removing any initial underscore prepended by the system,
1086 this makes C++ function names readable. Different compilers have
1087 different mangling styles. The optional demangling style argument
1088 can be used to choose an appropriate demangling style for your
1089 compiler. *Note c++filt::, for more information on demangling.
1094 Display debugging information. This attempts to parse debugging
1095 information stored in the file and print it out using a C like
1096 syntax. Only certain types of debugging information have been
1101 Display the assembler mnemonics for the machine instructions from
1102 OBJFILE. This option only disassembles those sections which are
1103 expected to contain instructions.
1107 Like `-d', but disassemble the contents of all sections, not just
1108 those expected to contain instructions.
1110 `--prefix-addresses'
1111 When disassembling, print the complete address on each line. This
1112 is the older disassembly format.
1114 `--disassemble-zeroes'
1115 Normally the disassembly output will skip blocks of zeroes. This
1116 option directs the disassembler to disassemble those blocks, just
1117 like any other data.
1121 `--endian={big|little}'
1122 Specify the endianness of the object files. This only affects
1123 disassembly. This can be useful when disassembling a file format
1124 which does not describe endianness information, such as S-records.
1128 Display summary information from the overall header of each of the
1131 `--file-start-context'
1132 Specify that when displaying interlisted source code/disassembly
1133 (assumes '-S') from a file that has not yet been displayed, extend
1134 the context to the start of the file.
1139 Display summary information from the section headers of the object
1142 File segments may be relocated to nonstandard addresses, for
1143 example by using the `-Ttext', `-Tdata', or `-Tbss' options to
1144 `ld'. However, some object file formats, such as a.out, do not
1145 store the starting address of the file segments. In those
1146 situations, although `ld' relocates the sections correctly, using
1147 `objdump -h' to list the file section headers cannot show the
1148 correct addresses. Instead, it shows the usual addresses, which
1149 are implicit for the target.
1152 Print a summary of the options to `objdump' and exit.
1156 Display a list showing all architectures and object formats
1157 available for specification with `-b' or `-m'.
1161 Display information only for section NAME.
1165 Label the display (using debugging information) with the filename
1166 and source line numbers corresponding to the object code or relocs
1167 shown. Only useful with `-d', `-D', or `-r'.
1170 `--architecture=MACHINE'
1171 Specify the architecture to use when disassembling object files.
1172 This can be useful when disassembling object files which do not
1173 describe architecture information, such as S-records. You can
1174 list the available architectures with the `-i' option.
1177 `--disassembler-options=OPTIONS'
1178 Pass target specific information to the disassembler. Only
1179 supported on some targets.
1181 If the target is an ARM architecture then this switch can be used
1182 to select which register name set is used during disassembler.
1183 Specifying `-M reg-name-std' (the default) will select the
1184 register names as used in ARM's instruction set documentation, but
1185 with register 13 called 'sp', register 14 called 'lr' and register
1186 15 called 'pc'. Specifying `-M reg-names-apcs' will select the
1187 name set used by the ARM Procedure Call Standard, whilst
1188 specifying `-M reg-names-raw' will just use `r' followed by the
1191 There are also two variants on the APCS register naming scheme
1192 enabled by `-M reg-names-atpcs' and `-M reg-names-special-atpcs'
1193 which use the ARM/Thumb Procedure Call Standard naming
1194 conventions. (Eiuther with the normal register name sor the
1195 special register names).
1197 This option can also be used for ARM architectures to force the
1198 disassembler to interpret all instructions as THUMB instructions by
1199 using the switch `--disassembler-options=force-thumb'. This can be
1200 useful when attempting to disassemble thumb code produced by other
1205 Print information that is specific to the object file format. The
1206 exact information printed depends upon the object file format.
1207 For some object file formats, no additional information is printed.
1211 Print the relocation entries of the file. If used with `-d' or
1212 `-D', the relocations are printed interspersed with the
1217 Print the dynamic relocation entries of the file. This is only
1218 meaningful for dynamic objects, such as certain types of shared
1223 Display the full contents of any sections requested.
1227 Display source code intermixed with disassembly, if possible.
1231 When disassembling instructions, print the instruction in hex as
1232 well as in symbolic form. This is the default except when
1233 `--prefix-addresses' is used.
1235 `--no-show-raw-insn'
1236 When disassembling instructions, do not print the instruction
1237 bytes. This is the default when `--prefix-addresses' is used.
1242 Display the full contents of any sections requested. Display the
1243 contents of the .stab and .stab.index and .stab.excl sections from
1244 an ELF file. This is only useful on systems (such as Solaris 2.0)
1245 in which `.stab' debugging symbol-table entries are carried in an
1246 ELF section. In most other file formats, debugging symbol-table
1247 entries are interleaved with linkage symbols, and are visible in
1248 the `--syms' output. For more information on stabs symbols, see
1249 *Note Stabs: (stabs.info)Top.
1251 `--start-address=ADDRESS'
1252 Start displaying data at the specified address. This affects the
1253 output of the `-d', `-r' and `-s' options.
1255 `--stop-address=ADDRESS'
1256 Stop displaying data at the specified address. This affects the
1257 output of the `-d', `-r' and `-s' options.
1261 Print the symbol table entries of the file. This is similar to
1262 the information provided by the `nm' program.
1266 Print the dynamic symbol table entries of the file. This is only
1267 meaningful for dynamic objects, such as certain types of shared
1268 libraries. This is similar to the information provided by the `nm'
1269 program when given the `-D' (`--dynamic') option.
1272 Print the version number of `objdump' and exit.
1276 Display all available header information, including the symbol
1277 table and relocation entries. Using `-x' is equivalent to
1278 specifying all of `-a -f -h -r -t'.
1282 Format some lines for output devices that have more than 80
1286 File: binutils.info, Node: ranlib, Next: readelf, Prev: objdump, Up: Top
1291 ranlib [-vV] ARCHIVE
1293 `ranlib' generates an index to the contents of an archive and stores
1294 it in the archive. The index lists each symbol defined by a member of
1295 an archive that is a relocatable object file.
1297 You may use `nm -s' or `nm --print-armap' to list this index.
1299 An archive with such an index speeds up linking to the library and
1300 allows routines in the library to call each other without regard to
1301 their placement in the archive.
1303 The GNU `ranlib' program is another form of GNU `ar'; running
1304 `ranlib' is completely equivalent to executing `ar -s'. *Note ar::.
1309 Show the version number of `ranlib'.