xref: /openbsd-src/gnu/usr.bin/binutils-2.17/binutils/doc/binutils.texi (revision ca868f0e5e76020f13bb5f0bca6ddd21f2bdf7ab)
13d8817e4Smiod\input texinfo       @c                    -*- Texinfo -*-
23d8817e4Smiod@setfilename binutils.info
33d8817e4Smiod@c Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
43d8817e4Smiod
53d8817e4Smiod@c man begin INCLUDE
63d8817e4Smiod@include config.texi
73d8817e4Smiod@c man end
83d8817e4Smiod
93d8817e4Smiod@ifinfo
103d8817e4Smiod@format
113d8817e4SmiodSTART-INFO-DIR-ENTRY
123d8817e4Smiod* Binutils: (binutils).         The GNU binary utilities.
133d8817e4Smiod* ar: (binutils)ar.               Create, modify, and extract from archives
143d8817e4Smiod* nm: (binutils)nm.               List symbols from object files
153d8817e4Smiod* objcopy: (binutils)objcopy.	  Copy and translate object files
163d8817e4Smiod* objdump: (binutils)objdump.     Display information from object files
173d8817e4Smiod* ranlib: (binutils)ranlib.       Generate index to archive contents
183d8817e4Smiod* readelf: (binutils)readelf.	  Display the contents of ELF format files.
193d8817e4Smiod* size: (binutils)size.           List section sizes and total size
203d8817e4Smiod* strings: (binutils)strings.     List printable strings from files
213d8817e4Smiod* strip: (binutils)strip.         Discard symbols
223d8817e4Smiod* c++filt: (binutils)c++filt.	  Filter to demangle encoded C++ symbols
233d8817e4Smiod* cxxfilt: (binutils)c++filt.     MS-DOS name for c++filt
243d8817e4Smiod* addr2line: (binutils)addr2line. Convert addresses to file and line
253d8817e4Smiod* nlmconv: (binutils)nlmconv.     Converts object code into an NLM
263d8817e4Smiod* windres: (binutils)windres.	  Manipulate Windows resources
273d8817e4Smiod* dlltool: (binutils)dlltool.	  Create files needed to build and use DLLs
283d8817e4SmiodEND-INFO-DIR-ENTRY
293d8817e4Smiod@end format
303d8817e4Smiod@end ifinfo
313d8817e4Smiod
323d8817e4Smiod@ifinfo
333d8817e4Smiod@c man begin COPYRIGHT
343d8817e4SmiodCopyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
353d8817e4Smiod2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
363d8817e4Smiod
373d8817e4SmiodPermission is granted to copy, distribute and/or modify this document
383d8817e4Smiodunder the terms of the GNU Free Documentation License, Version 1.1
393d8817e4Smiodor any later version published by the Free Software Foundation;
403d8817e4Smiodwith no Invariant Sections, with no Front-Cover Texts, and with no
413d8817e4SmiodBack-Cover Texts.  A copy of the license is included in the
423d8817e4Smiodsection entitled ``GNU Free Documentation License''.
433d8817e4Smiod
443d8817e4Smiod@c man end
453d8817e4Smiod@ignore
463d8817e4SmiodPermission is granted to process this file through TeX and print the
473d8817e4Smiodresults, provided the printed document carries a copying permission
483d8817e4Smiodnotice identical to this one except for the removal of this paragraph
493d8817e4Smiod(this paragraph not being relevant to the printed manual).
503d8817e4Smiod
513d8817e4Smiod@end ignore
523d8817e4Smiod@end ifinfo
533d8817e4Smiod
543d8817e4Smiod@synindex ky cp
553d8817e4Smiod@c
563d8817e4Smiod@c This file documents the GNU binary utilities "ar", "ld", "objcopy",
573d8817e4Smiod@c  "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib".
583d8817e4Smiod@c
593d8817e4Smiod@c Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
603d8817e4Smiod@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
613d8817e4Smiod@c
623d8817e4Smiod@c This text may be freely distributed under the terms of the GNU
633d8817e4Smiod@c Free Documentation License.
643d8817e4Smiod@c
653d8817e4Smiod
663d8817e4Smiod@setchapternewpage odd
673d8817e4Smiod@settitle @sc{gnu} Binary Utilities
683d8817e4Smiod@titlepage
693d8817e4Smiod@finalout
703d8817e4Smiod@title The @sc{gnu} Binary Utilities
713d8817e4Smiod@subtitle Version @value{VERSION}
723d8817e4Smiod@sp 1
733d8817e4Smiod@subtitle @value{UPDATED}
743d8817e4Smiod@author Roland H. Pesch
753d8817e4Smiod@author Jeffrey M. Osier
763d8817e4Smiod@author Cygnus Support
773d8817e4Smiod@page
783d8817e4Smiod
793d8817e4Smiod@tex
803d8817e4Smiod{\parskip=0pt \hfill Cygnus Support\par \hfill
813d8817e4Smiod\TeX{}info \texinfoversion\par }
823d8817e4Smiod@end tex
833d8817e4Smiod
843d8817e4Smiod@vskip 0pt plus 1filll
853d8817e4SmiodCopyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
863d8817e4Smiod2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
873d8817e4Smiod
883d8817e4Smiod      Permission is granted to copy, distribute and/or modify this document
893d8817e4Smiod      under the terms of the GNU Free Documentation License, Version 1.1
903d8817e4Smiod      or any later version published by the Free Software Foundation;
913d8817e4Smiod      with no Invariant Sections, with no Front-Cover Texts, and with no
923d8817e4Smiod      Back-Cover Texts.  A copy of the license is included in the
933d8817e4Smiod      section entitled ``GNU Free Documentation License''.
943d8817e4Smiod
953d8817e4Smiod@end titlepage
963d8817e4Smiod
973d8817e4Smiod@node Top
983d8817e4Smiod@top Introduction
993d8817e4Smiod
1003d8817e4Smiod@cindex version
1013d8817e4SmiodThis brief manual contains documentation for the @sc{gnu} binary
1023d8817e4Smiodutilities (collectively version @value{VERSION}):
1033d8817e4Smiod
1043d8817e4Smiod@iftex
1053d8817e4Smiod@table @code
1063d8817e4Smiod@item ar
1073d8817e4SmiodCreate, modify, and extract from archives
1083d8817e4Smiod
1093d8817e4Smiod@item nm
1103d8817e4SmiodList symbols from object files
1113d8817e4Smiod
1123d8817e4Smiod@item objcopy
1133d8817e4SmiodCopy and translate object files
1143d8817e4Smiod
1153d8817e4Smiod@item objdump
1163d8817e4SmiodDisplay information from object files
1173d8817e4Smiod
1183d8817e4Smiod@item ranlib
1193d8817e4SmiodGenerate index to archive contents
1203d8817e4Smiod
1213d8817e4Smiod@item readelf
1223d8817e4SmiodDisplay the contents of ELF format files.
1233d8817e4Smiod
1243d8817e4Smiod@item size
1253d8817e4SmiodList file section sizes and total size
1263d8817e4Smiod
1273d8817e4Smiod@item strings
1283d8817e4SmiodList printable strings from files
1293d8817e4Smiod
1303d8817e4Smiod@item strip
1313d8817e4SmiodDiscard symbols
1323d8817e4Smiod
1333d8817e4Smiod@item c++filt
1343d8817e4SmiodDemangle encoded C++ symbols (on MS-DOS, this program is named
1353d8817e4Smiod@code{cxxfilt})
1363d8817e4Smiod
1373d8817e4Smiod@item addr2line
1383d8817e4SmiodConvert addresses into file names and line numbers
1393d8817e4Smiod
1403d8817e4Smiod@item nlmconv
1413d8817e4SmiodConvert object code into a Netware Loadable Module
1423d8817e4Smiod
1433d8817e4Smiod@item windres
1443d8817e4SmiodManipulate Windows resources
1453d8817e4Smiod
1463d8817e4Smiod@item dlltool
1473d8817e4SmiodCreate the files needed to build and use Dynamic Link Libraries
1483d8817e4Smiod@end table
1493d8817e4Smiod@end iftex
1503d8817e4Smiod
1513d8817e4SmiodThis document is distributed under the terms of the GNU Free
1523d8817e4SmiodDocumentation License.  A copy of the license is included in the
1533d8817e4Smiodsection entitled "GNU Free Documentation License".
1543d8817e4Smiod
1553d8817e4Smiod@menu
1563d8817e4Smiod* ar::                          Create, modify, and extract from archives
1573d8817e4Smiod* nm::                          List symbols from object files
1583d8817e4Smiod* objcopy::			Copy and translate object files
1593d8817e4Smiod* objdump::                     Display information from object files
1603d8817e4Smiod* ranlib::                      Generate index to archive contents
1613d8817e4Smiod* readelf::			Display the contents of ELF format files.
1623d8817e4Smiod* size::                        List section sizes and total size
1633d8817e4Smiod* strings::                     List printable strings from files
1643d8817e4Smiod* strip::                       Discard symbols
1653d8817e4Smiod* c++filt::			Filter to demangle encoded C++ symbols
1663d8817e4Smiod* cxxfilt: c++filt.             MS-DOS name for c++filt
1673d8817e4Smiod* addr2line::			Convert addresses to file and line
1683d8817e4Smiod* nlmconv::                     Converts object code into an NLM
1693d8817e4Smiod* windres::			Manipulate Windows resources
1703d8817e4Smiod* dlltool::			Create files needed to build and use DLLs
1713d8817e4Smiod* Common Options::              Command-line options for all utilities
1723d8817e4Smiod* Selecting The Target System:: How these utilities determine the target.
1733d8817e4Smiod* Reporting Bugs::              Reporting Bugs
1743d8817e4Smiod* GNU Free Documentation License::  GNU Free Documentation License
1753d8817e4Smiod* Index::                       Index
1763d8817e4Smiod@end menu
1773d8817e4Smiod
1783d8817e4Smiod@node ar
1793d8817e4Smiod@chapter ar
1803d8817e4Smiod
1813d8817e4Smiod@kindex ar
1823d8817e4Smiod@cindex archives
1833d8817e4Smiod@cindex collections of files
1843d8817e4Smiod
1853d8817e4Smiod@c man title ar create, modify, and extract from archives
1863d8817e4Smiod
1873d8817e4Smiod@smallexample
1883d8817e4Smiodar [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}]
1893d8817e4Smiodar -M [ <mri-script ]
1903d8817e4Smiod@end smallexample
1913d8817e4Smiod
1923d8817e4Smiod@c man begin DESCRIPTION ar
1933d8817e4Smiod
1943d8817e4SmiodThe @sc{gnu} @command{ar} program creates, modifies, and extracts from
1953d8817e4Smiodarchives.  An @dfn{archive} is a single file holding a collection of
1963d8817e4Smiodother files in a structure that makes it possible to retrieve
1973d8817e4Smiodthe original individual files (called @dfn{members} of the archive).
1983d8817e4Smiod
1993d8817e4SmiodThe original files' contents, mode (permissions), timestamp, owner, and
2003d8817e4Smiodgroup are preserved in the archive, and can be restored on
2013d8817e4Smiodextraction.
2023d8817e4Smiod
2033d8817e4Smiod@cindex name length
2043d8817e4Smiod@sc{gnu} @command{ar} can maintain archives whose members have names of any
2053d8817e4Smiodlength; however, depending on how @command{ar} is configured on your
2063d8817e4Smiodsystem, a limit on member-name length may be imposed for compatibility
2073d8817e4Smiodwith archive formats maintained with other tools.  If it exists, the
2083d8817e4Smiodlimit is often 15 characters (typical of formats related to a.out) or 16
2093d8817e4Smiodcharacters (typical of formats related to coff).
2103d8817e4Smiod
2113d8817e4Smiod@cindex libraries
2123d8817e4Smiod@command{ar} is considered a binary utility because archives of this sort
2133d8817e4Smiodare most often used as @dfn{libraries} holding commonly needed
2143d8817e4Smiodsubroutines.
2153d8817e4Smiod
2163d8817e4Smiod@cindex symbol index
2173d8817e4Smiod@command{ar} creates an index to the symbols defined in relocatable
2183d8817e4Smiodobject modules in the archive when you specify the modifier @samp{s}.
2193d8817e4SmiodOnce created, this index is updated in the archive whenever @command{ar}
2203d8817e4Smiodmakes a change to its contents (save for the @samp{q} update operation).
2213d8817e4SmiodAn archive with such an index speeds up linking to the library, and
2223d8817e4Smiodallows routines in the library to call each other without regard to
2233d8817e4Smiodtheir placement in the archive.
2243d8817e4Smiod
2253d8817e4SmiodYou may use @samp{nm -s} or @samp{nm --print-armap} to list this index
2263d8817e4Smiodtable.  If an archive lacks the table, another form of @command{ar} called
2273d8817e4Smiod@command{ranlib} can be used to add just the table.
2283d8817e4Smiod
2293d8817e4Smiod@cindex compatibility, @command{ar}
2303d8817e4Smiod@cindex @command{ar} compatibility
2313d8817e4Smiod@sc{gnu} @command{ar} is designed to be compatible with two different
2323d8817e4Smiodfacilities.  You can control its activity using command-line options,
2333d8817e4Smiodlike the different varieties of @command{ar} on Unix systems; or, if you
2343d8817e4Smiodspecify the single command-line option @option{-M}, you can control it
2353d8817e4Smiodwith a script supplied via standard input, like the MRI ``librarian''
2363d8817e4Smiodprogram.
2373d8817e4Smiod
2383d8817e4Smiod@c man end
2393d8817e4Smiod
2403d8817e4Smiod@menu
2413d8817e4Smiod* ar cmdline::                  Controlling @command{ar} on the command line
2423d8817e4Smiod* ar scripts::                  Controlling @command{ar} with a script
2433d8817e4Smiod@end menu
2443d8817e4Smiod
2453d8817e4Smiod@page
2463d8817e4Smiod@node ar cmdline
2473d8817e4Smiod@section Controlling @command{ar} on the Command Line
2483d8817e4Smiod
2493d8817e4Smiod@smallexample
2503d8817e4Smiod@c man begin SYNOPSIS ar
2513d8817e4Smiodar [@option{-X32_64}] [@option{-}]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}]
2523d8817e4Smiod@c man end
2533d8817e4Smiod@end smallexample
2543d8817e4Smiod
2553d8817e4Smiod@cindex Unix compatibility, @command{ar}
2563d8817e4SmiodWhen you use @command{ar} in the Unix style, @command{ar} insists on at least two
2573d8817e4Smiodarguments to execute: one keyletter specifying the @emph{operation}
2583d8817e4Smiod(optionally accompanied by other keyletters specifying
2593d8817e4Smiod@emph{modifiers}), and the archive name to act on.
2603d8817e4Smiod
2613d8817e4SmiodMost operations can also accept further @var{member} arguments,
2623d8817e4Smiodspecifying particular files to operate on.
2633d8817e4Smiod
2643d8817e4Smiod@c man begin OPTIONS ar
2653d8817e4Smiod
2663d8817e4Smiod@sc{gnu} @command{ar} allows you to mix the operation code @var{p} and modifier
2673d8817e4Smiodflags @var{mod} in any order, within the first command-line argument.
2683d8817e4Smiod
2693d8817e4SmiodIf you wish, you may begin the first command-line argument with a
2703d8817e4Smioddash.
2713d8817e4Smiod
2723d8817e4Smiod@cindex operations on archive
2733d8817e4SmiodThe @var{p} keyletter specifies what operation to execute; it may be
2743d8817e4Smiodany of the following, but you must specify only one of them:
2753d8817e4Smiod
2763d8817e4Smiod@table @samp
2773d8817e4Smiod@item d
2783d8817e4Smiod@cindex deleting from archive
2793d8817e4Smiod@emph{Delete} modules from the archive.  Specify the names of modules to
2803d8817e4Smiodbe deleted as @var{member}@dots{}; the archive is untouched if you
2813d8817e4Smiodspecify no files to delete.
2823d8817e4Smiod
2833d8817e4SmiodIf you specify the @samp{v} modifier, @command{ar} lists each module
2843d8817e4Smiodas it is deleted.
2853d8817e4Smiod
2863d8817e4Smiod@item m
2873d8817e4Smiod@cindex moving in archive
2883d8817e4SmiodUse this operation to @emph{move} members in an archive.
2893d8817e4Smiod
2903d8817e4SmiodThe ordering of members in an archive can make a difference in how
2913d8817e4Smiodprograms are linked using the library, if a symbol is defined in more
2923d8817e4Smiodthan one member.
2933d8817e4Smiod
2943d8817e4SmiodIf no modifiers are used with @code{m}, any members you name in the
2953d8817e4Smiod@var{member} arguments are moved to the @emph{end} of the archive;
2963d8817e4Smiodyou can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
2973d8817e4Smiodspecified place instead.
2983d8817e4Smiod
2993d8817e4Smiod@item p
3003d8817e4Smiod@cindex printing from archive
3013d8817e4Smiod@emph{Print} the specified members of the archive, to the standard
3023d8817e4Smiodoutput file.  If the @samp{v} modifier is specified, show the member
3033d8817e4Smiodname before copying its contents to standard output.
3043d8817e4Smiod
3053d8817e4SmiodIf you specify no @var{member} arguments, all the files in the archive are
3063d8817e4Smiodprinted.
3073d8817e4Smiod
3083d8817e4Smiod@item q
3093d8817e4Smiod@cindex quick append to archive
3103d8817e4Smiod@emph{Quick append}; Historically, add the files @var{member}@dots{} to the end of
3113d8817e4Smiod@var{archive}, without checking for replacement.
3123d8817e4Smiod
3133d8817e4SmiodThe modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
3143d8817e4Smiodoperation; new members are always placed at the end of the archive.
3153d8817e4Smiod
3163d8817e4SmiodThe modifier @samp{v} makes @command{ar} list each file as it is appended.
3173d8817e4Smiod
3183d8817e4SmiodSince the point of this operation is speed, the archive's symbol table
3193d8817e4Smiodindex is not updated, even if it already existed; you can use @samp{ar s} or
3203d8817e4Smiod@command{ranlib} explicitly to update the symbol table index.
3213d8817e4Smiod
3223d8817e4SmiodHowever, too many different systems assume quick append rebuilds the
3233d8817e4Smiodindex, so @sc{gnu} @command{ar} implements @samp{q} as a synonym for @samp{r}.
3243d8817e4Smiod
3253d8817e4Smiod@item r
3263d8817e4Smiod@cindex replacement in archive
3273d8817e4SmiodInsert the files @var{member}@dots{} into @var{archive} (with
3283d8817e4Smiod@emph{replacement}). This operation differs from @samp{q} in that any
3293d8817e4Smiodpreviously existing members are deleted if their names match those being
3303d8817e4Smiodadded.
3313d8817e4Smiod
3323d8817e4SmiodIf one of the files named in @var{member}@dots{} does not exist, @command{ar}
3333d8817e4Smioddisplays an error message, and leaves undisturbed any existing members
3343d8817e4Smiodof the archive matching that name.
3353d8817e4Smiod
3363d8817e4SmiodBy default, new members are added at the end of the file; but you may
3373d8817e4Smioduse one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
3383d8817e4Smiodplacement relative to some existing member.
3393d8817e4Smiod
3403d8817e4SmiodThe modifier @samp{v} used with this operation elicits a line of
3413d8817e4Smiodoutput for each file inserted, along with one of the letters @samp{a} or
3423d8817e4Smiod@samp{r} to indicate whether the file was appended (no old member
3433d8817e4Smioddeleted) or replaced.
3443d8817e4Smiod
3453d8817e4Smiod@item t
3463d8817e4Smiod@cindex contents of archive
3473d8817e4SmiodDisplay a @emph{table} listing the contents of @var{archive}, or those
3483d8817e4Smiodof the files listed in @var{member}@dots{} that are present in the
3493d8817e4Smiodarchive.  Normally only the member name is shown; if you also want to
3503d8817e4Smiodsee the modes (permissions), timestamp, owner, group, and size, you can
3513d8817e4Smiodrequest that by also specifying the @samp{v} modifier.
3523d8817e4Smiod
3533d8817e4SmiodIf you do not specify a @var{member}, all files in the archive
3543d8817e4Smiodare listed.
3553d8817e4Smiod
3563d8817e4Smiod@cindex repeated names in archive
3573d8817e4Smiod@cindex name duplication in archive
3583d8817e4SmiodIf there is more than one file with the same name (say, @samp{fie}) in
3593d8817e4Smiodan archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
3603d8817e4Smiodfirst instance; to see them all, you must ask for a complete
3613d8817e4Smiodlisting---in our example, @samp{ar t b.a}.
3623d8817e4Smiod@c WRS only; per Gumby, this is implementation-dependent, and in a more
3633d8817e4Smiod@c recent case in fact works the other way.
3643d8817e4Smiod
3653d8817e4Smiod@item x
3663d8817e4Smiod@cindex extract from archive
3673d8817e4Smiod@emph{Extract} members (named @var{member}) from the archive.  You can
3683d8817e4Smioduse the @samp{v} modifier with this operation, to request that
3693d8817e4Smiod@command{ar} list each name as it extracts it.
3703d8817e4Smiod
3713d8817e4SmiodIf you do not specify a @var{member}, all files in the archive
3723d8817e4Smiodare extracted.
3733d8817e4Smiod
3743d8817e4Smiod@end table
3753d8817e4Smiod
3763d8817e4SmiodA number of modifiers (@var{mod}) may immediately follow the @var{p}
3773d8817e4Smiodkeyletter, to specify variations on an operation's behavior:
3783d8817e4Smiod
3793d8817e4Smiod@table @samp
3803d8817e4Smiod@item a
3813d8817e4Smiod@cindex relative placement in archive
3823d8817e4SmiodAdd new files @emph{after} an existing member of the
3833d8817e4Smiodarchive.  If you use the modifier @samp{a}, the name of an existing archive
3843d8817e4Smiodmember must be present as the @var{relpos} argument, before the
3853d8817e4Smiod@var{archive} specification.
3863d8817e4Smiod
3873d8817e4Smiod@item b
3883d8817e4SmiodAdd new files @emph{before} an existing member of the
3893d8817e4Smiodarchive.  If you use the modifier @samp{b}, the name of an existing archive
3903d8817e4Smiodmember must be present as the @var{relpos} argument, before the
3913d8817e4Smiod@var{archive} specification.  (same as @samp{i}).
3923d8817e4Smiod
3933d8817e4Smiod@item c
3943d8817e4Smiod@cindex creating archives
3953d8817e4Smiod@emph{Create} the archive.  The specified @var{archive} is always
3963d8817e4Smiodcreated if it did not exist, when you request an update.  But a warning is
3973d8817e4Smiodissued unless you specify in advance that you expect to create it, by
3983d8817e4Smiodusing this modifier.
3993d8817e4Smiod
4003d8817e4Smiod@item f
4013d8817e4SmiodTruncate names in the archive.  @sc{gnu} @command{ar} will normally permit file
4023d8817e4Smiodnames of any length.  This will cause it to create archives which are
4033d8817e4Smiodnot compatible with the native @command{ar} program on some systems.  If
4043d8817e4Smiodthis is a concern, the @samp{f} modifier may be used to truncate file
4053d8817e4Smiodnames when putting them in the archive.
4063d8817e4Smiod
4073d8817e4Smiod@item i
4083d8817e4SmiodInsert new files @emph{before} an existing member of the
4093d8817e4Smiodarchive.  If you use the modifier @samp{i}, the name of an existing archive
4103d8817e4Smiodmember must be present as the @var{relpos} argument, before the
4113d8817e4Smiod@var{archive} specification.  (same as @samp{b}).
4123d8817e4Smiod
4133d8817e4Smiod@item l
4143d8817e4SmiodThis modifier is accepted but not used.
4153d8817e4Smiod@c whaffor ar l modifier??? presumably compat; with
4163d8817e4Smiod@c what???---doc@@cygnus.com, 25jan91
4173d8817e4Smiod
4183d8817e4Smiod@item N
4193d8817e4SmiodUses the @var{count} parameter.  This is used if there are multiple
4203d8817e4Smiodentries in the archive with the same name.  Extract or delete instance
4213d8817e4Smiod@var{count} of the given name from the archive.
4223d8817e4Smiod
4233d8817e4Smiod@item o
4243d8817e4Smiod@cindex dates in archive
4253d8817e4SmiodPreserve the @emph{original} dates of members when extracting them.  If
4263d8817e4Smiodyou do not specify this modifier, files extracted from the archive
4273d8817e4Smiodare stamped with the time of extraction.
4283d8817e4Smiod
4293d8817e4Smiod@item P
4303d8817e4SmiodUse the full path name when matching names in the archive.  @sc{gnu}
4313d8817e4Smiod@command{ar} can not create an archive with a full path name (such archives
4323d8817e4Smiodare not POSIX complaint), but other archive creators can.  This option
4333d8817e4Smiodwill cause @sc{gnu} @command{ar} to match file names using a complete path
4343d8817e4Smiodname, which can be convenient when extracting a single file from an
4353d8817e4Smiodarchive created by another tool.
4363d8817e4Smiod
4373d8817e4Smiod@item s
4383d8817e4Smiod@cindex writing archive index
4393d8817e4SmiodWrite an object-file index into the archive, or update an existing one,
4403d8817e4Smiodeven if no other change is made to the archive.  You may use this modifier
4413d8817e4Smiodflag either with any operation, or alone.  Running @samp{ar s} on an
4423d8817e4Smiodarchive is equivalent to running @samp{ranlib} on it.
4433d8817e4Smiod
4443d8817e4Smiod@item S
4453d8817e4Smiod@cindex not writing archive index
4463d8817e4SmiodDo not generate an archive symbol table.  This can speed up building a
4473d8817e4Smiodlarge library in several steps.  The resulting archive can not be used
4483d8817e4Smiodwith the linker.  In order to build a symbol table, you must omit the
4493d8817e4Smiod@samp{S} modifier on the last execution of @samp{ar}, or you must run
4503d8817e4Smiod@samp{ranlib} on the archive.
4513d8817e4Smiod
4523d8817e4Smiod@item u
4533d8817e4Smiod@cindex updating an archive
4543d8817e4SmiodNormally, @samp{ar r}@dots{} inserts all files
4553d8817e4Smiodlisted into the archive.  If you would like to insert @emph{only} those
4563d8817e4Smiodof the files you list that are newer than existing members of the same
4573d8817e4Smiodnames, use this modifier.  The @samp{u} modifier is allowed only for the
4583d8817e4Smiodoperation @samp{r} (replace).  In particular, the combination @samp{qu} is
4593d8817e4Smiodnot allowed, since checking the timestamps would lose any speed
4603d8817e4Smiodadvantage from the operation @samp{q}.
4613d8817e4Smiod
4623d8817e4Smiod@item v
4633d8817e4SmiodThis modifier requests the @emph{verbose} version of an operation.  Many
4643d8817e4Smiodoperations display additional information, such as filenames processed,
4653d8817e4Smiodwhen the modifier @samp{v} is appended.
4663d8817e4Smiod
4673d8817e4Smiod@item V
4683d8817e4SmiodThis modifier shows the version number of @command{ar}.
4693d8817e4Smiod@end table
4703d8817e4Smiod
4713d8817e4Smiod@command{ar} ignores an initial option spelt @samp{-X32_64}, for
4723d8817e4Smiodcompatibility with AIX.  The behaviour produced by this option is the
4733d8817e4Smioddefault for @sc{gnu} @command{ar}.  @command{ar} does not support any of the other
4743d8817e4Smiod@samp{-X} options; in particular, it does not support @option{-X32}
4753d8817e4Smiodwhich is the default for AIX @command{ar}.
4763d8817e4Smiod
4773d8817e4Smiod@c man end
4783d8817e4Smiod
4793d8817e4Smiod@ignore
4803d8817e4Smiod@c man begin SEEALSO ar
4813d8817e4Smiodnm(1), ranlib(1), and the Info entries for @file{binutils}.
4823d8817e4Smiod@c man end
4833d8817e4Smiod@end ignore
4843d8817e4Smiod
4853d8817e4Smiod@node ar scripts
4863d8817e4Smiod@section Controlling @command{ar} with a Script
4873d8817e4Smiod
4883d8817e4Smiod@smallexample
4893d8817e4Smiodar -M [ <@var{script} ]
4903d8817e4Smiod@end smallexample
4913d8817e4Smiod
4923d8817e4Smiod@cindex MRI compatibility, @command{ar}
4933d8817e4Smiod@cindex scripts, @command{ar}
4943d8817e4SmiodIf you use the single command-line option @samp{-M} with @command{ar}, you
4953d8817e4Smiodcan control its operation with a rudimentary command language.  This
4963d8817e4Smiodform of @command{ar} operates interactively if standard input is coming
4973d8817e4Smioddirectly from a terminal.  During interactive use, @command{ar} prompts for
4983d8817e4Smiodinput (the prompt is @samp{AR >}), and continues executing even after
4993d8817e4Smioderrors.  If you redirect standard input to a script file, no prompts are
5003d8817e4Smiodissued, and @command{ar} abandons execution (with a nonzero exit code)
5013d8817e4Smiodon any error.
5023d8817e4Smiod
5033d8817e4SmiodThe @command{ar} command language is @emph{not} designed to be equivalent
5043d8817e4Smiodto the command-line options; in fact, it provides somewhat less control
5053d8817e4Smiodover archives.  The only purpose of the command language is to ease the
5063d8817e4Smiodtransition to @sc{gnu} @command{ar} for developers who already have scripts
5073d8817e4Smiodwritten for the MRI ``librarian'' program.
5083d8817e4Smiod
5093d8817e4SmiodThe syntax for the @command{ar} command language is straightforward:
5103d8817e4Smiod@itemize @bullet
5113d8817e4Smiod@item
5123d8817e4Smiodcommands are recognized in upper or lower case; for example, @code{LIST}
5133d8817e4Smiodis the same as @code{list}.  In the following descriptions, commands are
5143d8817e4Smiodshown in upper case for clarity.
5153d8817e4Smiod
5163d8817e4Smiod@item
5173d8817e4Smioda single command may appear on each line; it is the first word on the
5183d8817e4Smiodline.
5193d8817e4Smiod
5203d8817e4Smiod@item
5213d8817e4Smiodempty lines are allowed, and have no effect.
5223d8817e4Smiod
5233d8817e4Smiod@item
5243d8817e4Smiodcomments are allowed; text after either of the characters @samp{*}
5253d8817e4Smiodor @samp{;} is ignored.
5263d8817e4Smiod
5273d8817e4Smiod@item
5283d8817e4SmiodWhenever you use a list of names as part of the argument to an @command{ar}
5293d8817e4Smiodcommand, you can separate the individual names with either commas or
5303d8817e4Smiodblanks.  Commas are shown in the explanations below, for clarity.
5313d8817e4Smiod
5323d8817e4Smiod@item
5333d8817e4Smiod@samp{+} is used as a line continuation character; if @samp{+} appears
5343d8817e4Smiodat the end of a line, the text on the following line is considered part
5353d8817e4Smiodof the current command.
5363d8817e4Smiod@end itemize
5373d8817e4Smiod
5383d8817e4SmiodHere are the commands you can use in @command{ar} scripts, or when using
5393d8817e4Smiod@command{ar} interactively.  Three of them have special significance:
5403d8817e4Smiod
5413d8817e4Smiod@code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
5423d8817e4Smioda temporary file required for most of the other commands.
5433d8817e4Smiod
5443d8817e4Smiod@code{SAVE} commits the changes so far specified by the script.  Prior
5453d8817e4Smiodto @code{SAVE}, commands affect only the temporary copy of the current
5463d8817e4Smiodarchive.
5473d8817e4Smiod
5483d8817e4Smiod@table @code
5493d8817e4Smiod@item ADDLIB @var{archive}
5503d8817e4Smiod@itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
5513d8817e4SmiodAdd all the contents of @var{archive} (or, if specified, each named
5523d8817e4Smiod@var{module} from @var{archive}) to the current archive.
5533d8817e4Smiod
5543d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
5553d8817e4Smiod
5563d8817e4Smiod@item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
5573d8817e4Smiod@c FIXME! w/Replacement??  If so, like "ar r @var{archive} @var{names}"
5583d8817e4Smiod@c        else like "ar q..."
5593d8817e4SmiodAdd each named @var{member} as a module in the current archive.
5603d8817e4Smiod
5613d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
5623d8817e4Smiod
5633d8817e4Smiod@item CLEAR
5643d8817e4SmiodDiscard the contents of the current archive, canceling the effect of
5653d8817e4Smiodany operations since the last @code{SAVE}.  May be executed (with no
5663d8817e4Smiodeffect) even if  no current archive is specified.
5673d8817e4Smiod
5683d8817e4Smiod@item CREATE @var{archive}
5693d8817e4SmiodCreates an archive, and makes it the current archive (required for many
5703d8817e4Smiodother commands).  The new archive is created with a temporary name; it
5713d8817e4Smiodis not actually saved as @var{archive} until you use @code{SAVE}.
5723d8817e4SmiodYou can overwrite existing archives; similarly, the contents of any
5733d8817e4Smiodexisting file named @var{archive} will not be destroyed until @code{SAVE}.
5743d8817e4Smiod
5753d8817e4Smiod@item DELETE @var{module}, @var{module}, @dots{} @var{module}
5763d8817e4SmiodDelete each listed @var{module} from the current archive; equivalent to
5773d8817e4Smiod@samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
5783d8817e4Smiod
5793d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
5803d8817e4Smiod
5813d8817e4Smiod@item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
5823d8817e4Smiod@itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
5833d8817e4SmiodList each named @var{module} present in @var{archive}.  The separate
5843d8817e4Smiodcommand @code{VERBOSE} specifies the form of the output: when verbose
5853d8817e4Smiodoutput is off, output is like that of @samp{ar -t @var{archive}
5863d8817e4Smiod@var{module}@dots{}}.  When verbose output is on, the listing is like
5873d8817e4Smiod@samp{ar -tv @var{archive} @var{module}@dots{}}.
5883d8817e4Smiod
5893d8817e4SmiodOutput normally goes to the standard output stream; however, if you
5903d8817e4Smiodspecify @var{outputfile} as a final argument, @command{ar} directs the
5913d8817e4Smiodoutput to that file.
5923d8817e4Smiod
5933d8817e4Smiod@item END
5943d8817e4SmiodExit from @command{ar}, with a @code{0} exit code to indicate successful
5953d8817e4Smiodcompletion.  This command does not save the output file; if you have
5963d8817e4Smiodchanged the current archive since the last @code{SAVE} command, those
5973d8817e4Smiodchanges are lost.
5983d8817e4Smiod
5993d8817e4Smiod@item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
6003d8817e4SmiodExtract each named @var{module} from the current archive, writing them
6013d8817e4Smiodinto the current directory as separate files.  Equivalent to @samp{ar -x
6023d8817e4Smiod@var{archive} @var{module}@dots{}}.
6033d8817e4Smiod
6043d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
6053d8817e4Smiod
6063d8817e4Smiod@ignore
6073d8817e4Smiod@c FIXME Tokens but no commands???
6083d8817e4Smiod@item FULLDIR
6093d8817e4Smiod
6103d8817e4Smiod@item HELP
6113d8817e4Smiod@end ignore
6123d8817e4Smiod
6133d8817e4Smiod@item LIST
6143d8817e4SmiodDisplay full contents of the current archive, in ``verbose'' style
6153d8817e4Smiodregardless of the state of @code{VERBOSE}.  The effect is like @samp{ar
6163d8817e4Smiodtv @var{archive}}.  (This single command is a @sc{gnu} @command{ar}
6173d8817e4Smiodenhancement, rather than present for MRI compatibility.)
6183d8817e4Smiod
6193d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
6203d8817e4Smiod
6213d8817e4Smiod@item OPEN @var{archive}
6223d8817e4SmiodOpens an existing archive for use as the current archive (required for
6233d8817e4Smiodmany other commands).  Any changes as the result of subsequent commands
6243d8817e4Smiodwill not actually affect @var{archive} until you next use @code{SAVE}.
6253d8817e4Smiod
6263d8817e4Smiod@item REPLACE @var{module}, @var{module}, @dots{} @var{module}
6273d8817e4SmiodIn the current archive, replace each existing @var{module} (named in
6283d8817e4Smiodthe @code{REPLACE} arguments) from files in the current working directory.
6293d8817e4SmiodTo execute this command without errors, both the file, and the module in
6303d8817e4Smiodthe current archive, must exist.
6313d8817e4Smiod
6323d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
6333d8817e4Smiod
6343d8817e4Smiod@item VERBOSE
6353d8817e4SmiodToggle an internal flag governing the output from @code{DIRECTORY}.
6363d8817e4SmiodWhen the flag is on, @code{DIRECTORY} output matches output from
6373d8817e4Smiod@samp{ar -tv }@dots{}.
6383d8817e4Smiod
6393d8817e4Smiod@item SAVE
6403d8817e4SmiodCommit your changes to the current archive, and actually save it as a
6413d8817e4Smiodfile with the name specified in the last @code{CREATE} or @code{OPEN}
6423d8817e4Smiodcommand.
6433d8817e4Smiod
6443d8817e4SmiodRequires prior use of @code{OPEN} or @code{CREATE}.
6453d8817e4Smiod
6463d8817e4Smiod@end table
6473d8817e4Smiod
6483d8817e4Smiod@iftex
6493d8817e4Smiod@node ld
6503d8817e4Smiod@chapter ld
6513d8817e4Smiod@cindex linker
6523d8817e4Smiod@kindex ld
6533d8817e4SmiodThe @sc{gnu} linker @command{ld} is now described in a separate manual.
6543d8817e4Smiod@xref{Top,, Overview,, Using LD: the @sc{gnu} linker}.
6553d8817e4Smiod@end iftex
6563d8817e4Smiod
6573d8817e4Smiod@node nm
6583d8817e4Smiod@chapter nm
6593d8817e4Smiod@cindex symbols
6603d8817e4Smiod@kindex nm
6613d8817e4Smiod
6623d8817e4Smiod@c man title nm list symbols from object files
6633d8817e4Smiod
6643d8817e4Smiod@smallexample
6653d8817e4Smiod@c man begin SYNOPSIS nm
6663d8817e4Smiodnm [@option{-a}|@option{--debug-syms}] [@option{-g}|@option{--extern-only}]
6673d8817e4Smiod   [@option{-B}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-D}|@option{--dynamic}]
6683d8817e4Smiod   [@option{-S}|@option{--print-size}] [@option{-s}|@option{--print-armap}]
6693d8817e4Smiod   [@option{-A}|@option{-o}|@option{--print-file-name}][@option{--special-syms}]
6703d8817e4Smiod   [@option{-n}|@option{-v}|@option{--numeric-sort}] [@option{-p}|@option{--no-sort}]
6713d8817e4Smiod   [@option{-r}|@option{--reverse-sort}] [@option{--size-sort}] [@option{-u}|@option{--undefined-only}]
6723d8817e4Smiod   [@option{-t} @var{radix}|@option{--radix=}@var{radix}] [@option{-P}|@option{--portability}]
6733d8817e4Smiod   [@option{--target=}@var{bfdname}] [@option{-f}@var{format}|@option{--format=}@var{format}]
6743d8817e4Smiod   [@option{--defined-only}] [@option{-l}|@option{--line-numbers}] [@option{--no-demangle}]
6753d8817e4Smiod   [@option{-V}|@option{--version}] [@option{-X 32_64}] [@option{--help}]  [@var{objfile}@dots{}]
6763d8817e4Smiod@c man end
6773d8817e4Smiod@end smallexample
6783d8817e4Smiod
6793d8817e4Smiod@c man begin DESCRIPTION nm
6803d8817e4Smiod@sc{gnu} @command{nm} lists the symbols from object files @var{objfile}@dots{}.
6813d8817e4SmiodIf no object files are listed as arguments, @command{nm} assumes the file
6823d8817e4Smiod@file{a.out}.
6833d8817e4Smiod
6843d8817e4SmiodFor each symbol, @command{nm} shows:
6853d8817e4Smiod
6863d8817e4Smiod@itemize @bullet
6873d8817e4Smiod@item
6883d8817e4SmiodThe symbol value, in the radix selected by options (see below), or
6893d8817e4Smiodhexadecimal by default.
6903d8817e4Smiod
6913d8817e4Smiod@item
6923d8817e4SmiodThe symbol type.  At least the following types are used; others are, as
6933d8817e4Smiodwell, depending on the object file format.  If lowercase, the symbol is
6943d8817e4Smiodlocal; if uppercase, the symbol is global (external).
6953d8817e4Smiod
6963d8817e4Smiod@c Some more detail on exactly what these symbol types are used for
6973d8817e4Smiod@c would be nice.
6983d8817e4Smiod@table @code
6993d8817e4Smiod@item A
7003d8817e4SmiodThe symbol's value is absolute, and will not be changed by further
7013d8817e4Smiodlinking.
7023d8817e4Smiod
7033d8817e4Smiod@item B
7043d8817e4SmiodThe symbol is in the uninitialized data section (known as BSS).
7053d8817e4Smiod
7063d8817e4Smiod@item C
7073d8817e4SmiodThe symbol is common.  Common symbols are uninitialized data.  When
7083d8817e4Smiodlinking, multiple common symbols may appear with the same name.  If the
7093d8817e4Smiodsymbol is defined anywhere, the common symbols are treated as undefined
7103d8817e4Smiodreferences.
7113d8817e4Smiod@ifclear man
7123d8817e4SmiodFor more details on common symbols, see the discussion of
7133d8817e4Smiod--warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}.
7143d8817e4Smiod@end ifclear
7153d8817e4Smiod
7163d8817e4Smiod@item D
7173d8817e4SmiodThe symbol is in the initialized data section.
7183d8817e4Smiod
7193d8817e4Smiod@item G
7203d8817e4SmiodThe symbol is in an initialized data section for small objects.  Some
7213d8817e4Smiodobject file formats permit more efficient access to small data objects,
7223d8817e4Smiodsuch as a global int variable as opposed to a large global array.
7233d8817e4Smiod
7243d8817e4Smiod@item I
7253d8817e4SmiodThe symbol is an indirect reference to another symbol.  This is a @sc{gnu}
7263d8817e4Smiodextension to the a.out object file format which is rarely used.
7273d8817e4Smiod
7283d8817e4Smiod@item N
7293d8817e4SmiodThe symbol is a debugging symbol.
7303d8817e4Smiod
7313d8817e4Smiod@item R
7323d8817e4SmiodThe symbol is in a read only data section.
7333d8817e4Smiod
7343d8817e4Smiod@item S
7353d8817e4SmiodThe symbol is in an uninitialized data section for small objects.
7363d8817e4Smiod
7373d8817e4Smiod@item T
7383d8817e4SmiodThe symbol is in the text (code) section.
7393d8817e4Smiod
7403d8817e4Smiod@item U
7413d8817e4SmiodThe symbol is undefined.
7423d8817e4Smiod
7433d8817e4Smiod@item V
7443d8817e4SmiodThe symbol is a weak object.  When a weak defined symbol is linked with
7453d8817e4Smioda normal defined symbol, the normal defined symbol is used with no error.
7463d8817e4SmiodWhen a weak undefined symbol is linked and the symbol is not defined,
7473d8817e4Smiodthe value of the weak symbol becomes zero with no error.
7483d8817e4Smiod
7493d8817e4Smiod@item W
7503d8817e4SmiodThe symbol is a weak symbol that has not been specifically tagged as a
7513d8817e4Smiodweak object symbol.  When a weak defined symbol is linked with a normal
7523d8817e4Smioddefined symbol, the normal defined symbol is used with no error.
7533d8817e4SmiodWhen a weak undefined symbol is linked and the symbol is not defined,
7543d8817e4Smiodthe value of the symbol is determined in a system-specific manner without
7553d8817e4Smioderror.  On some systems, uppercase indicates that a default value has been
7563d8817e4Smiodspecified.
7573d8817e4Smiod
7583d8817e4Smiod
7593d8817e4Smiod@item -
7603d8817e4SmiodThe symbol is a stabs symbol in an a.out object file.  In this case, the
7613d8817e4Smiodnext values printed are the stabs other field, the stabs desc field, and
7623d8817e4Smiodthe stab type.  Stabs symbols are used to hold debugging information.
7633d8817e4Smiod@ifclear man
7643d8817e4SmiodFor more information, see @ref{Top,Stabs,Stabs Overview,stabs.info, The
7653d8817e4Smiod``stabs'' debug format}.
7663d8817e4Smiod@end ifclear
7673d8817e4Smiod
7683d8817e4Smiod@item ?
7693d8817e4SmiodThe symbol type is unknown, or object file format specific.
7703d8817e4Smiod@end table
7713d8817e4Smiod
7723d8817e4Smiod@item
7733d8817e4SmiodThe symbol name.
7743d8817e4Smiod@end itemize
7753d8817e4Smiod
7763d8817e4Smiod@c man end
7773d8817e4Smiod
7783d8817e4Smiod@c man begin OPTIONS nm
7793d8817e4SmiodThe long and short forms of options, shown here as alternatives, are
7803d8817e4Smiodequivalent.
7813d8817e4Smiod
7823d8817e4Smiod@table @env
7833d8817e4Smiod@item -A
7843d8817e4Smiod@itemx -o
7853d8817e4Smiod@itemx --print-file-name
7863d8817e4Smiod@cindex input file name
7873d8817e4Smiod@cindex file name
7883d8817e4Smiod@cindex source file name
7893d8817e4SmiodPrecede each symbol by the name of the input file (or archive member)
7903d8817e4Smiodin which it was found, rather than identifying the input file once only,
7913d8817e4Smiodbefore all of its symbols.
7923d8817e4Smiod
7933d8817e4Smiod@item -a
7943d8817e4Smiod@itemx --debug-syms
7953d8817e4Smiod@cindex debugging symbols
7963d8817e4SmiodDisplay all symbols, even debugger-only symbols; normally these are not
7973d8817e4Smiodlisted.
7983d8817e4Smiod
7993d8817e4Smiod@item -B
8003d8817e4Smiod@cindex @command{nm} format
8013d8817e4Smiod@cindex @command{nm} compatibility
8023d8817e4SmiodThe same as @option{--format=bsd} (for compatibility with the MIPS @command{nm}).
8033d8817e4Smiod
8043d8817e4Smiod@item -C
8053d8817e4Smiod@itemx --demangle[=@var{style}]
8063d8817e4Smiod@cindex demangling in nm
8073d8817e4SmiodDecode (@dfn{demangle}) low-level symbol names into user-level names.
8083d8817e4SmiodBesides removing any initial underscore prepended by the system, this
8093d8817e4Smiodmakes C++ function names readable. Different compilers have different
8103d8817e4Smiodmangling styles. The optional demangling style argument can be used to
8113d8817e4Smiodchoose an appropriate demangling style for your compiler. @xref{c++filt},
8123d8817e4Smiodfor more information on demangling.
8133d8817e4Smiod
8143d8817e4Smiod@item --no-demangle
8153d8817e4SmiodDo not demangle low-level symbol names.  This is the default.
8163d8817e4Smiod
8173d8817e4Smiod@item -D
8183d8817e4Smiod@itemx --dynamic
8193d8817e4Smiod@cindex dynamic symbols
8203d8817e4SmiodDisplay the dynamic symbols rather than the normal symbols.  This is
8213d8817e4Smiodonly meaningful for dynamic objects, such as certain types of shared
8223d8817e4Smiodlibraries.
8233d8817e4Smiod
8243d8817e4Smiod@item -f @var{format}
8253d8817e4Smiod@itemx --format=@var{format}
8263d8817e4Smiod@cindex @command{nm} format
8273d8817e4Smiod@cindex @command{nm} compatibility
8283d8817e4SmiodUse the output format @var{format}, which can be @code{bsd},
8293d8817e4Smiod@code{sysv}, or @code{posix}.  The default is @code{bsd}.
8303d8817e4SmiodOnly the first character of @var{format} is significant; it can be
8313d8817e4Smiodeither upper or lower case.
8323d8817e4Smiod
8333d8817e4Smiod@item -g
8343d8817e4Smiod@itemx --extern-only
8353d8817e4Smiod@cindex external symbols
8363d8817e4SmiodDisplay only external symbols.
8373d8817e4Smiod
8383d8817e4Smiod@item -l
8393d8817e4Smiod@itemx --line-numbers
8403d8817e4Smiod@cindex symbol line numbers
8413d8817e4SmiodFor each symbol, use debugging information to try to find a filename and
8423d8817e4Smiodline number.  For a defined symbol, look for the line number of the
8433d8817e4Smiodaddress of the symbol.  For an undefined symbol, look for the line
8443d8817e4Smiodnumber of a relocation entry which refers to the symbol.  If line number
8453d8817e4Smiodinformation can be found, print it after the other symbol information.
8463d8817e4Smiod
8473d8817e4Smiod@item -n
8483d8817e4Smiod@itemx -v
8493d8817e4Smiod@itemx --numeric-sort
8503d8817e4SmiodSort symbols numerically by their addresses, rather than alphabetically
8513d8817e4Smiodby their names.
8523d8817e4Smiod
8533d8817e4Smiod@item -p
8543d8817e4Smiod@itemx --no-sort
8553d8817e4Smiod@cindex sorting symbols
8563d8817e4SmiodDo not bother to sort the symbols in any order; print them in the order
8573d8817e4Smiodencountered.
8583d8817e4Smiod
8593d8817e4Smiod@item -P
8603d8817e4Smiod@itemx --portability
8613d8817e4SmiodUse the POSIX.2 standard output format instead of the default format.
8623d8817e4SmiodEquivalent to @samp{-f posix}.
8633d8817e4Smiod
8643d8817e4Smiod@item -S
8653d8817e4Smiod@itemx --print-size
8663d8817e4SmiodPrint size, not the value, of defined symbols for the @code{bsd} output format.
8673d8817e4Smiod
8683d8817e4Smiod@item -s
8693d8817e4Smiod@itemx --print-armap
8703d8817e4Smiod@cindex symbol index, listing
8713d8817e4SmiodWhen listing symbols from archive members, include the index: a mapping
8723d8817e4Smiod(stored in the archive by @command{ar} or @command{ranlib}) of which modules
8733d8817e4Smiodcontain definitions for which names.
8743d8817e4Smiod
8753d8817e4Smiod@item -r
8763d8817e4Smiod@itemx --reverse-sort
8773d8817e4SmiodReverse the order of the sort (whether numeric or alphabetic); let the
8783d8817e4Smiodlast come first.
8793d8817e4Smiod
8803d8817e4Smiod@item --size-sort
8813d8817e4SmiodSort symbols by size.  The size is computed as the difference between
8823d8817e4Smiodthe value of the symbol and the value of the symbol with the next higher
8833d8817e4Smiodvalue.  If the @code{bsd} output format is used the size of the symbol
8843d8817e4Smiodis printed, rather than the value, and @samp{-S} must be used in order
8853d8817e4Smiodboth size and value to be printed.
8863d8817e4Smiod
8873d8817e4Smiod@item --special-syms
8883d8817e4SmiodDisplay symbols which have a target-specific special meaning.  These
8893d8817e4Smiodsymbols are usually used by the target for some special processing and
8903d8817e4Smiodare not normally helpful when included included in the normal symbol
8913d8817e4Smiodlists.  For example for ARM targets this option would skip the mapping
8923d8817e4Smiodsymbols used to mark transistions between ARM code, THUMB code and
8933d8817e4Smioddata.
8943d8817e4Smiod
8953d8817e4Smiod@item -t @var{radix}
8963d8817e4Smiod@itemx --radix=@var{radix}
8973d8817e4SmiodUse @var{radix} as the radix for printing the symbol values.  It must be
8983d8817e4Smiod@samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
8993d8817e4Smiod
9003d8817e4Smiod@item --target=@var{bfdname}
9013d8817e4Smiod@cindex object code format
9023d8817e4SmiodSpecify an object code format other than your system's default format.
9033d8817e4Smiod@xref{Target Selection}, for more information.
9043d8817e4Smiod
9053d8817e4Smiod@item -u
9063d8817e4Smiod@itemx --undefined-only
9073d8817e4Smiod@cindex external symbols
9083d8817e4Smiod@cindex undefined symbols
9093d8817e4SmiodDisplay only undefined symbols (those external to each object file).
9103d8817e4Smiod
9113d8817e4Smiod@item --defined-only
9123d8817e4Smiod@cindex external symbols
9133d8817e4Smiod@cindex undefined symbols
9143d8817e4SmiodDisplay only defined symbols for each object file.
9153d8817e4Smiod
9163d8817e4Smiod@item -V
9173d8817e4Smiod@itemx --version
9183d8817e4SmiodShow the version number of @command{nm} and exit.
9193d8817e4Smiod
9203d8817e4Smiod@item -X
9213d8817e4SmiodThis option is ignored for compatibility with the AIX version of
9223d8817e4Smiod@command{nm}.  It takes one parameter which must be the string
9233d8817e4Smiod@option{32_64}.  The default mode of AIX @command{nm} corresponds
9243d8817e4Smiodto @option{-X 32}, which is not supported by @sc{gnu} @command{nm}.
9253d8817e4Smiod
9263d8817e4Smiod@item --help
9273d8817e4SmiodShow a summary of the options to @command{nm} and exit.
9283d8817e4Smiod@end table
9293d8817e4Smiod
9303d8817e4Smiod@c man end
9313d8817e4Smiod
9323d8817e4Smiod@ignore
9333d8817e4Smiod@c man begin SEEALSO nm
9343d8817e4Smiodar(1), objdump(1), ranlib(1), and the Info entries for @file{binutils}.
9353d8817e4Smiod@c man end
9363d8817e4Smiod@end ignore
9373d8817e4Smiod
9383d8817e4Smiod@node objcopy
9393d8817e4Smiod@chapter objcopy
9403d8817e4Smiod
9413d8817e4Smiod@c man title objcopy copy and translate object files
9423d8817e4Smiod
9433d8817e4Smiod@smallexample
9443d8817e4Smiod@c man begin SYNOPSIS objcopy
9453d8817e4Smiodobjcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
9463d8817e4Smiod        [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
9473d8817e4Smiod        [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
9483d8817e4Smiod        [@option{-B} @var{bfdarch}|@option{--binary-architecture=}@var{bfdarch}]
9493d8817e4Smiod        [@option{-S}|@option{--strip-all}]
9503d8817e4Smiod        [@option{-g}|@option{--strip-debug}]
9513d8817e4Smiod        [@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}]
9523d8817e4Smiod        [@option{-N} @var{symbolname}|@option{--strip-symbol=}@var{symbolname}]
9533d8817e4Smiod        [@option{--strip-unneeded-symbol=}@var{symbolname}]
9543d8817e4Smiod        [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}]
955c065f989Skettenis        [@option{--localize-hidden}]
9563d8817e4Smiod        [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}]
9573d8817e4Smiod        [@option{--globalize-symbol=}@var{symbolname}]
9583d8817e4Smiod        [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}]
9593d8817e4Smiod        [@option{-w}|@option{--wildcard}]
9603d8817e4Smiod        [@option{-x}|@option{--discard-all}]
9613d8817e4Smiod        [@option{-X}|@option{--discard-locals}]
9623d8817e4Smiod        [@option{-b} @var{byte}|@option{--byte=}@var{byte}]
9633d8817e4Smiod        [@option{-i} @var{interleave}|@option{--interleave=}@var{interleave}]
9643d8817e4Smiod        [@option{-j} @var{sectionname}|@option{--only-section=}@var{sectionname}]
9653d8817e4Smiod        [@option{-R} @var{sectionname}|@option{--remove-section=}@var{sectionname}]
9663d8817e4Smiod        [@option{-p}|@option{--preserve-dates}]
9673d8817e4Smiod        [@option{--debugging}]
9683d8817e4Smiod        [@option{--gap-fill=}@var{val}]
9693d8817e4Smiod        [@option{--pad-to=}@var{address}]
9703d8817e4Smiod        [@option{--set-start=}@var{val}]
9713d8817e4Smiod        [@option{--adjust-start=}@var{incr}]
9723d8817e4Smiod        [@option{--change-addresses=}@var{incr}]
9733d8817e4Smiod        [@option{--change-section-address} @var{section}@{=,+,-@}@var{val}]
9743d8817e4Smiod        [@option{--change-section-lma} @var{section}@{=,+,-@}@var{val}]
9753d8817e4Smiod        [@option{--change-section-vma} @var{section}@{=,+,-@}@var{val}]
9763d8817e4Smiod        [@option{--change-warnings}] [@option{--no-change-warnings}]
9773d8817e4Smiod        [@option{--set-section-flags} @var{section}=@var{flags}]
9783d8817e4Smiod        [@option{--add-section} @var{sectionname}=@var{filename}]
9793d8817e4Smiod        [@option{--rename-section} @var{oldname}=@var{newname}[,@var{flags}]]
9803d8817e4Smiod        [@option{--change-leading-char}] [@option{--remove-leading-char}]
9813d8817e4Smiod        [@option{--srec-len=}@var{ival}] [@option{--srec-forceS3}]
9823d8817e4Smiod        [@option{--redefine-sym} @var{old}=@var{new}]
9833d8817e4Smiod        [@option{--redefine-syms=}@var{filename}]
9843d8817e4Smiod        [@option{--weaken}]
9853d8817e4Smiod        [@option{--keep-symbols=}@var{filename}]
9863d8817e4Smiod        [@option{--strip-symbols=}@var{filename}]
9873d8817e4Smiod        [@option{--strip-unneeded-symbols=}@var{filename}]
9883d8817e4Smiod        [@option{--keep-global-symbols=}@var{filename}]
9893d8817e4Smiod        [@option{--localize-symbols=}@var{filename}]
9903d8817e4Smiod        [@option{--globalize-symbols=}@var{filename}]
9913d8817e4Smiod        [@option{--weaken-symbols=}@var{filename}]
9923d8817e4Smiod        [@option{--alt-machine-code=}@var{index}]
9933d8817e4Smiod        [@option{--prefix-symbols=}@var{string}]
9943d8817e4Smiod        [@option{--prefix-sections=}@var{string}]
9953d8817e4Smiod        [@option{--prefix-alloc-sections=}@var{string}]
9963d8817e4Smiod        [@option{--add-gnu-debuglink=}@var{path-to-file}]
9973d8817e4Smiod        [@option{--keep-file-symbols}]
9983d8817e4Smiod        [@option{--only-keep-debug}]
9993d8817e4Smiod        [@option{--writable-text}]
10003d8817e4Smiod        [@option{--readonly-text}]
10013d8817e4Smiod        [@option{--pure}]
10023d8817e4Smiod        [@option{--impure}]
10033d8817e4Smiod        [@option{-v}|@option{--verbose}]
10043d8817e4Smiod        [@option{-V}|@option{--version}]
10053d8817e4Smiod        [@option{--help}] [@option{--info}]
10063d8817e4Smiod        @var{infile} [@var{outfile}]
10073d8817e4Smiod@c man end
10083d8817e4Smiod@end smallexample
10093d8817e4Smiod
10103d8817e4Smiod@c man begin DESCRIPTION objcopy
10113d8817e4SmiodThe @sc{gnu} @command{objcopy} utility copies the contents of an object
10123d8817e4Smiodfile to another.  @command{objcopy} uses the @sc{gnu} @sc{bfd} Library to
10133d8817e4Smiodread and write the object files.  It can write the destination object
10143d8817e4Smiodfile in a format different from that of the source object file.  The
10153d8817e4Smiodexact behavior of @command{objcopy} is controlled by command-line options.
10163d8817e4SmiodNote that @command{objcopy} should be able to copy a fully linked file
10173d8817e4Smiodbetween any two formats. However, copying a relocatable object file
10183d8817e4Smiodbetween any two formats may not work as expected.
10193d8817e4Smiod
10203d8817e4Smiod@command{objcopy} creates temporary files to do its translations and
10213d8817e4Smioddeletes them afterward.  @command{objcopy} uses @sc{bfd} to do all its
10223d8817e4Smiodtranslation work; it has access to all the formats described in @sc{bfd}
10233d8817e4Smiodand thus is able to recognize most formats without being told
10243d8817e4Smiodexplicitly.  @xref{BFD,,BFD,ld.info,Using LD}.
10253d8817e4Smiod
10263d8817e4Smiod@command{objcopy} can be used to generate S-records by using an output
10273d8817e4Smiodtarget of @samp{srec} (e.g., use @samp{-O srec}).
10283d8817e4Smiod
10293d8817e4Smiod@command{objcopy} can be used to generate a raw binary file by using an
10303d8817e4Smiodoutput target of @samp{binary} (e.g., use @option{-O binary}).  When
10313d8817e4Smiod@command{objcopy} generates a raw binary file, it will essentially produce
10323d8817e4Smioda memory dump of the contents of the input object file.  All symbols and
10333d8817e4Smiodrelocation information will be discarded.  The memory dump will start at
10343d8817e4Smiodthe load address of the lowest section copied into the output file.
10353d8817e4Smiod
10363d8817e4SmiodWhen generating an S-record or a raw binary file, it may be helpful to
10373d8817e4Smioduse @option{-S} to remove sections containing debugging information.  In
10383d8817e4Smiodsome cases @option{-R} will be useful to remove sections which contain
10393d8817e4Smiodinformation that is not needed by the binary file.
10403d8817e4Smiod
10413d8817e4SmiodNote---@command{objcopy} is not able to change the endianness of its input
10423d8817e4Smiodfiles.  If the input format has an endianness (some formats do not),
10433d8817e4Smiod@command{objcopy} can only copy the inputs into file formats that have the
10443d8817e4Smiodsame endianness or which have no endianness (e.g., @samp{srec}).
10453d8817e4Smiod
10463d8817e4Smiod@c man end
10473d8817e4Smiod
10483d8817e4Smiod@c man begin OPTIONS objcopy
10493d8817e4Smiod
10503d8817e4Smiod@table @env
10513d8817e4Smiod@item @var{infile}
10523d8817e4Smiod@itemx @var{outfile}
10533d8817e4SmiodThe input and output files, respectively.
10543d8817e4SmiodIf you do not specify @var{outfile}, @command{objcopy} creates a
10553d8817e4Smiodtemporary file and destructively renames the result with
10563d8817e4Smiodthe name of @var{infile}.
10573d8817e4Smiod
10583d8817e4Smiod@item -I @var{bfdname}
10593d8817e4Smiod@itemx --input-target=@var{bfdname}
10603d8817e4SmiodConsider the source file's object format to be @var{bfdname}, rather than
10613d8817e4Smiodattempting to deduce it.  @xref{Target Selection}, for more information.
10623d8817e4Smiod
10633d8817e4Smiod@item -O @var{bfdname}
10643d8817e4Smiod@itemx --output-target=@var{bfdname}
10653d8817e4SmiodWrite the output file using the object format @var{bfdname}.
10663d8817e4Smiod@xref{Target Selection}, for more information.
10673d8817e4Smiod
10683d8817e4Smiod@item -F @var{bfdname}
10693d8817e4Smiod@itemx --target=@var{bfdname}
10703d8817e4SmiodUse @var{bfdname} as the object format for both the input and the output
10713d8817e4Smiodfile; i.e., simply transfer data from source to destination with no
10723d8817e4Smiodtranslation.  @xref{Target Selection}, for more information.
10733d8817e4Smiod
10743d8817e4Smiod@item -B @var{bfdarch}
10753d8817e4Smiod@itemx --binary-architecture=@var{bfdarch}
10763d8817e4SmiodUseful when transforming a raw binary input file into an object file.
10773d8817e4SmiodIn this case the output architecture can be set to @var{bfdarch}. This
10783d8817e4Smiodoption will be ignored if the input file has a known @var{bfdarch}. You
10793d8817e4Smiodcan access this binary data inside a program by referencing the special
10803d8817e4Smiodsymbols that are created by the conversion process.  These symbols are
10813d8817e4Smiodcalled _binary_@var{objfile}_start, _binary_@var{objfile}_end and
10823d8817e4Smiod_binary_@var{objfile}_size.  e.g. you can transform a picture file into
10833d8817e4Smiodan object file and then access it in your code using these symbols.
10843d8817e4Smiod
10853d8817e4Smiod@item -j @var{sectionname}
10863d8817e4Smiod@itemx --only-section=@var{sectionname}
10873d8817e4SmiodCopy only the named section from the input file to the output file.
10883d8817e4SmiodThis option may be given more than once.  Note that using this option
10893d8817e4Smiodinappropriately may make the output file unusable.
10903d8817e4Smiod
10913d8817e4Smiod@item -R @var{sectionname}
10923d8817e4Smiod@itemx --remove-section=@var{sectionname}
10933d8817e4SmiodRemove any section named @var{sectionname} from the output file.  This
10943d8817e4Smiodoption may be given more than once.  Note that using this option
10953d8817e4Smiodinappropriately may make the output file unusable.
10963d8817e4Smiod
10973d8817e4Smiod@item -S
10983d8817e4Smiod@itemx --strip-all
10993d8817e4SmiodDo not copy relocation and symbol information from the source file.
11003d8817e4Smiod
11013d8817e4Smiod@item -g
11023d8817e4Smiod@itemx --strip-debug
11033d8817e4SmiodDo not copy debugging symbols or sections from the source file.
11043d8817e4Smiod
11053d8817e4Smiod@item --strip-unneeded
11063d8817e4SmiodStrip all symbols that are not needed for relocation processing.
11073d8817e4Smiod
11083d8817e4Smiod@item -K @var{symbolname}
11093d8817e4Smiod@itemx --keep-symbol=@var{symbolname}
11103d8817e4SmiodWhen stripping symbols, keep symbol @var{symbolname} even if it would
11113d8817e4Smiodnormally be stripped.  This option may be given more than once.
11123d8817e4Smiod
11133d8817e4Smiod@item -N @var{symbolname}
11143d8817e4Smiod@itemx --strip-symbol=@var{symbolname}
11153d8817e4SmiodDo not copy symbol @var{symbolname} from the source file.  This option
11163d8817e4Smiodmay be given more than once.
11173d8817e4Smiod
11183d8817e4Smiod@item --strip-unneeded-symbol=@var{symbolname}
11193d8817e4SmiodDo not copy symbol @var{symbolname} from the source file unless it is needed
11203d8817e4Smiodby a relocation.  This option may be given more than once.
11213d8817e4Smiod
11223d8817e4Smiod@item -G @var{symbolname}
11233d8817e4Smiod@itemx --keep-global-symbol=@var{symbolname}
11243d8817e4SmiodKeep only symbol @var{symbolname} global.  Make all other symbols local
11253d8817e4Smiodto the file, so that they are not visible externally.  This option may
11263d8817e4Smiodbe given more than once.
11273d8817e4Smiod
1128c065f989Skettenis@item --localize-hidden
1129c065f989SkettenisIn an ELF object, mark all symbols that have hidden or internal visibility
1130c065f989Skettenisas local.  This option applies on top of symbol-specific localization options
1131c065f989Skettenissuch as @option{-L}.
1132c065f989Skettenis
11333d8817e4Smiod@item -L @var{symbolname}
11343d8817e4Smiod@itemx --localize-symbol=@var{symbolname}
11353d8817e4SmiodMake symbol @var{symbolname} local to the file, so that it is not
11363d8817e4Smiodvisible externally.  This option may be given more than once.
11373d8817e4Smiod
11383d8817e4Smiod@item -W @var{symbolname}
11393d8817e4Smiod@itemx --weaken-symbol=@var{symbolname}
11403d8817e4SmiodMake symbol @var{symbolname} weak. This option may be given more than once.
11413d8817e4Smiod
11423d8817e4Smiod@item --globalize-symbol=@var{symbolname}
11433d8817e4SmiodGive symbol @var{symbolname} global scoping so that it is visible
11443d8817e4Smiodoutside of the file in which it is defined.  This option may be given
11453d8817e4Smiodmore than once.
11463d8817e4Smiod
11473d8817e4Smiod@item -w
11483d8817e4Smiod@itemx --wildcard
11493d8817e4SmiodPermit regular expressions in @var{symbolname}s used in other command
11503d8817e4Smiodline options.  The question mark (?), asterisk (*), backslash (\) and
11513d8817e4Smiodsquare brackets ([]) operators can be used anywhere in the symbol
11523d8817e4Smiodname.  If the first character of the symbol name is the exclamation
11533d8817e4Smiodpoint (!) then the sense of the switch is reversed for that symbol.
11543d8817e4SmiodFor example:
11553d8817e4Smiod
11563d8817e4Smiod@smallexample
11573d8817e4Smiod  -w -W !foo -W fo*
11583d8817e4Smiod@end smallexample
11593d8817e4Smiod
11603d8817e4Smiodwould cause objcopy to weaken all symbols that start with ``fo''
11613d8817e4Smiodexcept for the symbol ``foo''.
11623d8817e4Smiod
11633d8817e4Smiod@item -x
11643d8817e4Smiod@itemx --discard-all
11653d8817e4SmiodDo not copy non-global symbols from the source file.
11663d8817e4Smiod@c FIXME any reason to prefer "non-global" to "local" here?
11673d8817e4Smiod
11683d8817e4Smiod@item -X
11693d8817e4Smiod@itemx --discard-locals
11703d8817e4SmiodDo not copy compiler-generated local symbols.
11713d8817e4Smiod(These usually start with @samp{L} or @samp{.}.)
11723d8817e4Smiod
11733d8817e4Smiod@item -b @var{byte}
11743d8817e4Smiod@itemx --byte=@var{byte}
11753d8817e4SmiodKeep only every @var{byte}th byte of the input file (header data is not
11763d8817e4Smiodaffected).  @var{byte} can be in the range from 0 to @var{interleave}-1,
11773d8817e4Smiodwhere @var{interleave} is given by the @option{-i} or @option{--interleave}
11783d8817e4Smiodoption, or the default of 4.  This option is useful for creating files
11793d8817e4Smiodto program @sc{rom}.  It is typically used with an @code{srec} output
11803d8817e4Smiodtarget.
11813d8817e4Smiod
11823d8817e4Smiod@item -i @var{interleave}
11833d8817e4Smiod@itemx --interleave=@var{interleave}
11843d8817e4SmiodOnly copy one out of every @var{interleave} bytes.  Select which byte to
11853d8817e4Smiodcopy with the @option{-b} or @option{--byte} option.  The default is 4.
11863d8817e4Smiod@command{objcopy} ignores this option if you do not specify either @option{-b} or
11873d8817e4Smiod@option{--byte}.
11883d8817e4Smiod
11893d8817e4Smiod@item -p
11903d8817e4Smiod@itemx --preserve-dates
11913d8817e4SmiodSet the access and modification dates of the output file to be the same
11923d8817e4Smiodas those of the input file.
11933d8817e4Smiod
11943d8817e4Smiod@item --debugging
11953d8817e4SmiodConvert debugging information, if possible.  This is not the default
11963d8817e4Smiodbecause only certain debugging formats are supported, and the
11973d8817e4Smiodconversion process can be time consuming.
11983d8817e4Smiod
11993d8817e4Smiod@item --gap-fill @var{val}
12003d8817e4SmiodFill gaps between sections with @var{val}.  This operation applies to
12013d8817e4Smiodthe @emph{load address} (LMA) of the sections.  It is done by increasing
12023d8817e4Smiodthe size of the section with the lower address, and filling in the extra
12033d8817e4Smiodspace created with @var{val}.
12043d8817e4Smiod
12053d8817e4Smiod@item --pad-to @var{address}
12063d8817e4SmiodPad the output file up to the load address @var{address}.  This is
12073d8817e4Smioddone by increasing the size of the last section.  The extra space is
12083d8817e4Smiodfilled in with the value specified by @option{--gap-fill} (default zero).
12093d8817e4Smiod
12103d8817e4Smiod@item --set-start @var{val}
12113d8817e4SmiodSet the start address of the new file to @var{val}.  Not all object file
12123d8817e4Smiodformats support setting the start address.
12133d8817e4Smiod
12143d8817e4Smiod@item --change-start @var{incr}
12153d8817e4Smiod@itemx --adjust-start @var{incr}
12163d8817e4Smiod@cindex changing start address
12173d8817e4SmiodChange the start address by adding @var{incr}.  Not all object file
12183d8817e4Smiodformats support setting the start address.
12193d8817e4Smiod
12203d8817e4Smiod@item --change-addresses @var{incr}
12213d8817e4Smiod@itemx --adjust-vma @var{incr}
12223d8817e4Smiod@cindex changing object addresses
12233d8817e4SmiodChange the VMA and LMA addresses of all sections, as well as the start
12243d8817e4Smiodaddress, by adding @var{incr}.  Some object file formats do not permit
12253d8817e4Smiodsection addresses to be changed arbitrarily.  Note that this does not
12263d8817e4Smiodrelocate the sections; if the program expects sections to be loaded at a
12273d8817e4Smiodcertain address, and this option is used to change the sections such
12283d8817e4Smiodthat they are loaded at a different address, the program may fail.
12293d8817e4Smiod
12303d8817e4Smiod@item --change-section-address @var{section}@{=,+,-@}@var{val}
12313d8817e4Smiod@itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val}
12323d8817e4Smiod@cindex changing section address
12333d8817e4SmiodSet or change both the VMA address and the LMA address of the named
12343d8817e4Smiod@var{section}.  If @samp{=} is used, the section address is set to
12353d8817e4Smiod@var{val}.  Otherwise, @var{val} is added to or subtracted from the
12363d8817e4Smiodsection address.  See the comments under @option{--change-addresses},
12373d8817e4Smiodabove. If @var{section} does not exist in the input file, a warning will
12383d8817e4Smiodbe issued, unless @option{--no-change-warnings} is used.
12393d8817e4Smiod
12403d8817e4Smiod@item --change-section-lma @var{section}@{=,+,-@}@var{val}
12413d8817e4Smiod@cindex changing section LMA
12423d8817e4SmiodSet or change the LMA address of the named @var{section}.  The LMA
12433d8817e4Smiodaddress is the address where the section will be loaded into memory at
12443d8817e4Smiodprogram load time.  Normally this is the same as the VMA address, which
12453d8817e4Smiodis the address of the section at program run time, but on some systems,
12463d8817e4Smiodespecially those where a program is held in ROM, the two can be
12473d8817e4Smioddifferent.  If @samp{=} is used, the section address is set to
12483d8817e4Smiod@var{val}.  Otherwise, @var{val} is added to or subtracted from the
12493d8817e4Smiodsection address.  See the comments under @option{--change-addresses},
12503d8817e4Smiodabove.  If @var{section} does not exist in the input file, a warning
12513d8817e4Smiodwill be issued, unless @option{--no-change-warnings} is used.
12523d8817e4Smiod
12533d8817e4Smiod@item --change-section-vma @var{section}@{=,+,-@}@var{val}
12543d8817e4Smiod@cindex changing section VMA
12553d8817e4SmiodSet or change the VMA address of the named @var{section}.  The VMA
12563d8817e4Smiodaddress is the address where the section will be located once the
12573d8817e4Smiodprogram has started executing.  Normally this is the same as the LMA
12583d8817e4Smiodaddress, which is the address where the section will be loaded into
12593d8817e4Smiodmemory, but on some systems, especially those where a program is held in
12603d8817e4SmiodROM, the two can be different.  If @samp{=} is used, the section address
12613d8817e4Smiodis set to @var{val}.  Otherwise, @var{val} is added to or subtracted
12623d8817e4Smiodfrom the section address.  See the comments under
12633d8817e4Smiod@option{--change-addresses}, above.  If @var{section} does not exist in
12643d8817e4Smiodthe input file, a warning will be issued, unless
12653d8817e4Smiod@option{--no-change-warnings} is used.
12663d8817e4Smiod
12673d8817e4Smiod@item --change-warnings
12683d8817e4Smiod@itemx --adjust-warnings
12693d8817e4SmiodIf @option{--change-section-address} or @option{--change-section-lma} or
12703d8817e4Smiod@option{--change-section-vma} is used, and the named section does not
12713d8817e4Smiodexist, issue a warning.  This is the default.
12723d8817e4Smiod
12733d8817e4Smiod@item --no-change-warnings
12743d8817e4Smiod@itemx --no-adjust-warnings
12753d8817e4SmiodDo not issue a warning if @option{--change-section-address} or
12763d8817e4Smiod@option{--adjust-section-lma} or @option{--adjust-section-vma} is used, even
12773d8817e4Smiodif the named section does not exist.
12783d8817e4Smiod
12793d8817e4Smiod@item --set-section-flags @var{section}=@var{flags}
12803d8817e4SmiodSet the flags for the named section.  The @var{flags} argument is a
12813d8817e4Smiodcomma separated string of flag names.  The recognized names are
12823d8817e4Smiod@samp{alloc}, @samp{contents}, @samp{load}, @samp{noload},
12833d8817e4Smiod@samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, @samp{share}, and
12843d8817e4Smiod@samp{debug}.  You can set the @samp{contents} flag for a section which
12853d8817e4Smioddoes not have contents, but it is not meaningful to clear the
12863d8817e4Smiod@samp{contents} flag of a section which does have contents--just remove
12873d8817e4Smiodthe section instead.  Not all flags are meaningful for all object file
12883d8817e4Smiodformats.
12893d8817e4Smiod
12903d8817e4Smiod@item --add-section @var{sectionname}=@var{filename}
12913d8817e4SmiodAdd a new section named @var{sectionname} while copying the file.  The
12923d8817e4Smiodcontents of the new section are taken from the file @var{filename}.  The
12933d8817e4Smiodsize of the section will be the size of the file.  This option only
12943d8817e4Smiodworks on file formats which can support sections with arbitrary names.
12953d8817e4Smiod
12963d8817e4Smiod@item --rename-section @var{oldname}=@var{newname}[,@var{flags}]
12973d8817e4SmiodRename a section from @var{oldname} to @var{newname}, optionally
12983d8817e4Smiodchanging the section's flags to @var{flags} in the process.  This has
12993d8817e4Smiodthe advantage over usng a linker script to perform the rename in that
13003d8817e4Smiodthe output stays as an object file and does not become a linked
13013d8817e4Smiodexecutable.
13023d8817e4Smiod
13033d8817e4SmiodThis option is particularly helpful when the input format is binary,
13043d8817e4Smiodsince this will always create a section called .data.  If for example,
13053d8817e4Smiodyou wanted instead to create a section called .rodata containing binary
13063d8817e4Smioddata you could use the following command line to achieve it:
13073d8817e4Smiod
13083d8817e4Smiod@smallexample
13093d8817e4Smiod  objcopy -I binary -O <output_format> -B <architecture> \
13103d8817e4Smiod   --rename-section .data=.rodata,alloc,load,readonly,data,contents \
13113d8817e4Smiod   <input_binary_file> <output_object_file>
13123d8817e4Smiod@end smallexample
13133d8817e4Smiod
13143d8817e4Smiod@item --change-leading-char
13153d8817e4SmiodSome object file formats use special characters at the start of
13163d8817e4Smiodsymbols.  The most common such character is underscore, which compilers
13173d8817e4Smiodoften add before every symbol.  This option tells @command{objcopy} to
13183d8817e4Smiodchange the leading character of every symbol when it converts between
13193d8817e4Smiodobject file formats.  If the object file formats use the same leading
13203d8817e4Smiodcharacter, this option has no effect.  Otherwise, it will add a
13213d8817e4Smiodcharacter, or remove a character, or change a character, as
13223d8817e4Smiodappropriate.
13233d8817e4Smiod
13243d8817e4Smiod@item --remove-leading-char
13253d8817e4SmiodIf the first character of a global symbol is a special symbol leading
13263d8817e4Smiodcharacter used by the object file format, remove the character.  The
13273d8817e4Smiodmost common symbol leading character is underscore.  This option will
13283d8817e4Smiodremove a leading underscore from all global symbols.  This can be useful
13293d8817e4Smiodif you want to link together objects of different file formats with
13303d8817e4Smioddifferent conventions for symbol names.  This is different from
13313d8817e4Smiod@option{--change-leading-char} because it always changes the symbol name
13323d8817e4Smiodwhen appropriate, regardless of the object file format of the output
13333d8817e4Smiodfile.
13343d8817e4Smiod
13353d8817e4Smiod@item --srec-len=@var{ival}
13363d8817e4SmiodMeaningful only for srec output.  Set the maximum length of the Srecords
13373d8817e4Smiodbeing produced to @var{ival}.  This length covers both address, data and
13383d8817e4Smiodcrc fields.
13393d8817e4Smiod
13403d8817e4Smiod@item --srec-forceS3
13413d8817e4SmiodMeaningful only for srec output.  Avoid generation of S1/S2 records,
13423d8817e4Smiodcreating S3-only record format.
13433d8817e4Smiod
13443d8817e4Smiod@item --redefine-sym @var{old}=@var{new}
13453d8817e4SmiodChange the name of a symbol @var{old}, to @var{new}.  This can be useful
13463d8817e4Smiodwhen one is trying link two things together for which you have no
13473d8817e4Smiodsource, and there are name collisions.
13483d8817e4Smiod
13493d8817e4Smiod@item --redefine-syms=@var{filename}
13503d8817e4SmiodApply @option{--redefine-sym} to each symbol pair "@var{old} @var{new}"
13513d8817e4Smiodlisted in the file @var{filename}.  @var{filename} is simply a flat file,
13523d8817e4Smiodwith one symbol pair per line.  Line comments may be introduced by the hash
13533d8817e4Smiodcharacter.  This option may be given more than once.
13543d8817e4Smiod
13553d8817e4Smiod@item --weaken
13563d8817e4SmiodChange all global symbols in the file to be weak.  This can be useful
13573d8817e4Smiodwhen building an object which will be linked against other objects using
13583d8817e4Smiodthe @option{-R} option to the linker.  This option is only effective when
13593d8817e4Smiodusing an object file format which supports weak symbols.
13603d8817e4Smiod
13613d8817e4Smiod@item --keep-symbols=@var{filename}
13623d8817e4SmiodApply @option{--keep-symbol} option to each symbol listed in the file
13633d8817e4Smiod@var{filename}.  @var{filename} is simply a flat file, with one symbol
13643d8817e4Smiodname per line.  Line comments may be introduced by the hash character.
13653d8817e4SmiodThis option may be given more than once.
13663d8817e4Smiod
13673d8817e4Smiod@item --strip-symbols=@var{filename}
13683d8817e4SmiodApply @option{--strip-symbol} option to each symbol listed in the file
13693d8817e4Smiod@var{filename}.  @var{filename} is simply a flat file, with one symbol
13703d8817e4Smiodname per line.  Line comments may be introduced by the hash character.
13713d8817e4SmiodThis option may be given more than once.
13723d8817e4Smiod
13733d8817e4Smiod@item --strip-unneeded-symbols=@var{filename}
13743d8817e4SmiodApply @option{--strip-unneeded-symbol} option to each symbol listed in
13753d8817e4Smiodthe file @var{filename}.  @var{filename} is simply a flat file, with one
13763d8817e4Smiodsymbol name per line.  Line comments may be introduced by the hash
13773d8817e4Smiodcharacter.  This option may be given more than once.
13783d8817e4Smiod
13793d8817e4Smiod@item --keep-global-symbols=@var{filename}
13803d8817e4SmiodApply @option{--keep-global-symbol} option to each symbol listed in the
13813d8817e4Smiodfile @var{filename}.  @var{filename} is simply a flat file, with one
13823d8817e4Smiodsymbol name per line.  Line comments may be introduced by the hash
13833d8817e4Smiodcharacter.  This option may be given more than once.
13843d8817e4Smiod
13853d8817e4Smiod@item --localize-symbols=@var{filename}
13863d8817e4SmiodApply @option{--localize-symbol} option to each symbol listed in the file
13873d8817e4Smiod@var{filename}.  @var{filename} is simply a flat file, with one symbol
13883d8817e4Smiodname per line.  Line comments may be introduced by the hash character.
13893d8817e4SmiodThis option may be given more than once.
13903d8817e4Smiod
13913d8817e4Smiod@item --globalize-symbols=@var{filename}
13923d8817e4SmiodApply @option{--globalize-symbol} option to each symbol listed in the file
13933d8817e4Smiod@var{filename}.  @var{filename} is simply a flat file, with one symbol
13943d8817e4Smiodname per line.  Line comments may be introduced by the hash character.
13953d8817e4SmiodThis option may be given more than once.
13963d8817e4Smiod
13973d8817e4Smiod@item --weaken-symbols=@var{filename}
13983d8817e4SmiodApply @option{--weaken-symbol} option to each symbol listed in the file
13993d8817e4Smiod@var{filename}.  @var{filename} is simply a flat file, with one symbol
14003d8817e4Smiodname per line.  Line comments may be introduced by the hash character.
14013d8817e4SmiodThis option may be given more than once.
14023d8817e4Smiod
14033d8817e4Smiod@item --alt-machine-code=@var{index}
14043d8817e4SmiodIf the output architecture has alternate machine codes, use the
14053d8817e4Smiod@var{index}th code instead of the default one.  This is useful in case
14063d8817e4Smioda machine is assigned an official code and the tool-chain adopts the
14073d8817e4Smiodnew code, but other applications still depend on the original code
14083d8817e4Smiodbeing used.  For ELF based architectures if the @var{index}
14093d8817e4Smiodalternative does not exist then the value is treated as an absolute
14103d8817e4Smiodnumber to be stored in the e_machine field of the ELF header.
14113d8817e4Smiod
14123d8817e4Smiod@item --writable-text
14133d8817e4SmiodMark the output text as writable.  This option isn't meaningful for all
14143d8817e4Smiodobject file formats.
14153d8817e4Smiod
14163d8817e4Smiod@item --readonly-text
14173d8817e4SmiodMake the output text write protected.  This option isn't meaningful for all
14183d8817e4Smiodobject file formats.
14193d8817e4Smiod
14203d8817e4Smiod@item --pure
14213d8817e4SmiodMark the output file as demand paged.  This option isn't meaningful for all
14223d8817e4Smiodobject file formats.
14233d8817e4Smiod
14243d8817e4Smiod@item --impure
14253d8817e4SmiodMark the output file as impure.  This option isn't meaningful for all
14263d8817e4Smiodobject file formats.
14273d8817e4Smiod
14283d8817e4Smiod@item --prefix-symbols=@var{string}
14293d8817e4SmiodPrefix all symbols in the output file with @var{string}.
14303d8817e4Smiod
14313d8817e4Smiod@item --prefix-sections=@var{string}
14323d8817e4SmiodPrefix all section names in the output file with @var{string}.
14333d8817e4Smiod
14343d8817e4Smiod@item --prefix-alloc-sections=@var{string}
14353d8817e4SmiodPrefix all the names of all allocated sections in the output file with
14363d8817e4Smiod@var{string}.
14373d8817e4Smiod
14383d8817e4Smiod@item --add-gnu-debuglink=@var{path-to-file}
14393d8817e4SmiodCreates a .gnu_debuglink section which contains a reference to @var{path-to-file}
14403d8817e4Smiodand adds it to the output file.
14413d8817e4Smiod
14423d8817e4Smiod@item --keep-file-symbols
14433d8817e4SmiodWhen stripping a file, perhaps with @option{--strip-debug} or
14443d8817e4Smiod@option{--strip-unneeded}, retain any symbols specifying source file names,
14453d8817e4Smiodwhich would otherwise get stripped.
14463d8817e4Smiod
14473d8817e4Smiod@item --only-keep-debug
14483d8817e4SmiodStrip a file, removing contents of any sections that would not be
14493d8817e4Smiodstripped by @option{--strip-debug} and leaving the debugging sections
14503d8817e4Smiodintact.
14513d8817e4Smiod
14523d8817e4SmiodThe intention is that this option will be used in conjunction with
14533d8817e4Smiod@option{--add-gnu-debuglink} to create a two part executable.  One a
14543d8817e4Smiodstripped binary which will occupy less space in RAM and in a
14553d8817e4Smioddistribution and the second a debugging information file which is only
14563d8817e4Smiodneeded if debugging abilities are required.  The suggested procedure
14573d8817e4Smiodto create these files is as follows:
14583d8817e4Smiod
14593d8817e4Smiod@enumerate
14603d8817e4Smiod@item Link the executable as normal.  Assuming that is is called
14613d8817e4Smiod@code{foo} then...
14623d8817e4Smiod@item Run @code{objcopy --only-keep-debug foo foo.dbg} to
14633d8817e4Smiodcreate a file containing the debugging info.
14643d8817e4Smiod@item Run @code{objcopy --strip-debug foo} to create a
14653d8817e4Smiodstripped executable.
14663d8817e4Smiod@item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
14673d8817e4Smiodto add a link to the debugging info into the stripped executable.
14683d8817e4Smiod@end enumerate
14693d8817e4Smiod
14703d8817e4SmiodNote - the choice of @code{.dbg} as an extension for the debug info
14713d8817e4Smiodfile is arbitrary.  Also the @code{--only-keep-debug} step is
14723d8817e4Smiodoptional.  You could instead do this:
14733d8817e4Smiod
14743d8817e4Smiod@enumerate
14753d8817e4Smiod@item Link the executable as normal.
14763d8817e4Smiod@item Copy @code{foo} to  @code{foo.full}
14773d8817e4Smiod@item Run @code{objcopy --strip-debug foo}
14783d8817e4Smiod@item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
14793d8817e4Smiod@end enumerate
14803d8817e4Smiod
14813d8817e4Smiodi.e. the file pointed to by the @option{--add-gnu-debuglink} can be the
14823d8817e4Smiodfull executable.  It does not have to be a file created by the
14833d8817e4Smiod@option{--only-keep-debug} switch.
14843d8817e4Smiod
14853d8817e4Smiod@item -V
14863d8817e4Smiod@itemx --version
14873d8817e4SmiodShow the version number of @command{objcopy}.
14883d8817e4Smiod
14893d8817e4Smiod@item -v
14903d8817e4Smiod@itemx --verbose
14913d8817e4SmiodVerbose output: list all object files modified.  In the case of
14923d8817e4Smiodarchives, @samp{objcopy -V} lists all members of the archive.
14933d8817e4Smiod
14943d8817e4Smiod@item --help
14953d8817e4SmiodShow a summary of the options to @command{objcopy}.
14963d8817e4Smiod
14973d8817e4Smiod@item --info
14983d8817e4SmiodDisplay a list showing all architectures and object formats available.
14993d8817e4Smiod@end table
15003d8817e4Smiod
15013d8817e4Smiod@c man end
15023d8817e4Smiod
15033d8817e4Smiod@ignore
15043d8817e4Smiod@c man begin SEEALSO objcopy
15053d8817e4Smiodld(1), objdump(1), and the Info entries for @file{binutils}.
15063d8817e4Smiod@c man end
15073d8817e4Smiod@end ignore
15083d8817e4Smiod
15093d8817e4Smiod@node objdump
15103d8817e4Smiod@chapter objdump
15113d8817e4Smiod
15123d8817e4Smiod@cindex object file information
15133d8817e4Smiod@kindex objdump
15143d8817e4Smiod
15153d8817e4Smiod@c man title objdump display information from object files.
15163d8817e4Smiod
15173d8817e4Smiod@smallexample
15183d8817e4Smiod@c man begin SYNOPSIS objdump
15193d8817e4Smiodobjdump [@option{-a}|@option{--archive-headers}]
15203d8817e4Smiod        [@option{-b} @var{bfdname}|@option{--target=@var{bfdname}}]
15213d8817e4Smiod        [@option{-C}|@option{--demangle}[=@var{style}] ]
15223d8817e4Smiod        [@option{-d}|@option{--disassemble}]
15233d8817e4Smiod        [@option{-D}|@option{--disassemble-all}]
15243d8817e4Smiod        [@option{-z}|@option{--disassemble-zeroes}]
15253d8817e4Smiod        [@option{-EB}|@option{-EL}|@option{--endian=}@{big | little @}]
15263d8817e4Smiod        [@option{-f}|@option{--file-headers}]
15273d8817e4Smiod        [@option{--file-start-context}]
15283d8817e4Smiod        [@option{-g}|@option{--debugging}]
15293d8817e4Smiod        [@option{-e}|@option{--debugging-tags}]
15303d8817e4Smiod        [@option{-h}|@option{--section-headers}|@option{--headers}]
15313d8817e4Smiod        [@option{-i}|@option{--info}]
15323d8817e4Smiod        [@option{-j} @var{section}|@option{--section=}@var{section}]
15333d8817e4Smiod        [@option{-l}|@option{--line-numbers}]
15343d8817e4Smiod        [@option{-S}|@option{--source}]
15353d8817e4Smiod        [@option{-m} @var{machine}|@option{--architecture=}@var{machine}]
15363d8817e4Smiod        [@option{-M} @var{options}|@option{--disassembler-options=}@var{options}]
15373d8817e4Smiod        [@option{-p}|@option{--private-headers}]
15383d8817e4Smiod        [@option{-r}|@option{--reloc}]
15393d8817e4Smiod        [@option{-R}|@option{--dynamic-reloc}]
15403d8817e4Smiod        [@option{-s}|@option{--full-contents}]
15413d8817e4Smiod        [@option{-W}|@option{--dwarf}]
15423d8817e4Smiod        [@option{-G}|@option{--stabs}]
15433d8817e4Smiod        [@option{-t}|@option{--syms}]
15443d8817e4Smiod        [@option{-T}|@option{--dynamic-syms}]
15453d8817e4Smiod        [@option{-x}|@option{--all-headers}]
15463d8817e4Smiod        [@option{-w}|@option{--wide}]
15473d8817e4Smiod        [@option{--start-address=}@var{address}]
15483d8817e4Smiod        [@option{--stop-address=}@var{address}]
15493d8817e4Smiod        [@option{--prefix-addresses}]
15503d8817e4Smiod        [@option{--[no-]show-raw-insn}]
15513d8817e4Smiod        [@option{--adjust-vma=}@var{offset}]
15523d8817e4Smiod        [@option{--special-syms}]
15533d8817e4Smiod        [@option{-V}|@option{--version}]
15543d8817e4Smiod        [@option{-H}|@option{--help}]
15553d8817e4Smiod        @var{objfile}@dots{}
15563d8817e4Smiod@c man end
15573d8817e4Smiod@end smallexample
15583d8817e4Smiod
15593d8817e4Smiod@c man begin DESCRIPTION objdump
15603d8817e4Smiod
15613d8817e4Smiod@command{objdump} displays information about one or more object files.
15623d8817e4SmiodThe options control what particular information to display.  This
15633d8817e4Smiodinformation is mostly useful to programmers who are working on the
15643d8817e4Smiodcompilation tools, as opposed to programmers who just want their
15653d8817e4Smiodprogram to compile and work.
15663d8817e4Smiod
15673d8817e4Smiod@var{objfile}@dots{} are the object files to be examined.  When you
15683d8817e4Smiodspecify archives, @command{objdump} shows information on each of the member
15693d8817e4Smiodobject files.
15703d8817e4Smiod
15713d8817e4Smiod@c man end
15723d8817e4Smiod
15733d8817e4Smiod@c man begin OPTIONS objdump
15743d8817e4Smiod
15753d8817e4SmiodThe long and short forms of options, shown here as alternatives, are
15763d8817e4Smiodequivalent.  At least one option from the list
15773d8817e4Smiod@option{-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-r,-R,-s,-S,-t,-T,-V,-x} must be given.
15783d8817e4Smiod
15793d8817e4Smiod@table @env
15803d8817e4Smiod@item -a
15813d8817e4Smiod@itemx --archive-header
15823d8817e4Smiod@cindex archive headers
15833d8817e4SmiodIf any of the @var{objfile} files are archives, display the archive
15843d8817e4Smiodheader information (in a format similar to @samp{ls -l}).  Besides the
15853d8817e4Smiodinformation you could list with @samp{ar tv}, @samp{objdump -a} shows
15863d8817e4Smiodthe object file format of each archive member.
15873d8817e4Smiod
15883d8817e4Smiod@item --adjust-vma=@var{offset}
15893d8817e4Smiod@cindex section addresses in objdump
15903d8817e4Smiod@cindex VMA in objdump
15913d8817e4SmiodWhen dumping information, first add @var{offset} to all the section
15923d8817e4Smiodaddresses.  This is useful if the section addresses do not correspond to
15933d8817e4Smiodthe symbol table, which can happen when putting sections at particular
15943d8817e4Smiodaddresses when using a format which can not represent section addresses,
15953d8817e4Smiodsuch as a.out.
15963d8817e4Smiod
15973d8817e4Smiod@item -b @var{bfdname}
15983d8817e4Smiod@itemx --target=@var{bfdname}
15993d8817e4Smiod@cindex object code format
16003d8817e4SmiodSpecify that the object-code format for the object files is
16013d8817e4Smiod@var{bfdname}.  This option may not be necessary; @var{objdump} can
16023d8817e4Smiodautomatically recognize many formats.
16033d8817e4Smiod
16043d8817e4SmiodFor example,
16053d8817e4Smiod@example
16063d8817e4Smiodobjdump -b oasys -m vax -h fu.o
16073d8817e4Smiod@end example
16083d8817e4Smiod@noindent
16093d8817e4Smioddisplays summary information from the section headers (@option{-h}) of
16103d8817e4Smiod@file{fu.o}, which is explicitly identified (@option{-m}) as a VAX object
16113d8817e4Smiodfile in the format produced by Oasys compilers.  You can list the
16123d8817e4Smiodformats available with the @option{-i} option.
16133d8817e4Smiod@xref{Target Selection}, for more information.
16143d8817e4Smiod
16153d8817e4Smiod@item -C
16163d8817e4Smiod@itemx --demangle[=@var{style}]
16173d8817e4Smiod@cindex demangling in objdump
16183d8817e4SmiodDecode (@dfn{demangle}) low-level symbol names into user-level names.
16193d8817e4SmiodBesides removing any initial underscore prepended by the system, this
16203d8817e4Smiodmakes C++ function names readable.  Different compilers have different
16213d8817e4Smiodmangling styles. The optional demangling style argument can be used to
16223d8817e4Smiodchoose an appropriate demangling style for your compiler. @xref{c++filt},
16233d8817e4Smiodfor more information on demangling.
16243d8817e4Smiod
16253d8817e4Smiod@item -g
16263d8817e4Smiod@itemx --debugging
16273d8817e4SmiodDisplay debugging information.  This attempts to parse debugging
16283d8817e4Smiodinformation stored in the file and print it out using a C like syntax.
16293d8817e4SmiodOnly certain types of debugging information have been implemented.
16303d8817e4SmiodSome other types are supported by @command{readelf -w}.
16313d8817e4Smiod@xref{readelf}.
16323d8817e4Smiod
16333d8817e4Smiod@item -e
16343d8817e4Smiod@itemx --debugging-tags
16353d8817e4SmiodLike @option{-g}, but the information is generated in a format compatible
16363d8817e4Smiodwith ctags tool.
16373d8817e4Smiod
16383d8817e4Smiod@item -d
16393d8817e4Smiod@itemx --disassemble
16403d8817e4Smiod@cindex disassembling object code
16413d8817e4Smiod@cindex machine instructions
16423d8817e4SmiodDisplay the assembler mnemonics for the machine instructions from
16433d8817e4Smiod@var{objfile}.  This option only disassembles those sections which are
16443d8817e4Smiodexpected to contain instructions.
16453d8817e4Smiod
16463d8817e4Smiod@item -D
16473d8817e4Smiod@itemx --disassemble-all
16483d8817e4SmiodLike @option{-d}, but disassemble the contents of all sections, not just
16493d8817e4Smiodthose expected to contain instructions.
16503d8817e4Smiod
16513d8817e4Smiod@item --prefix-addresses
16523d8817e4SmiodWhen disassembling, print the complete address on each line.  This is
16533d8817e4Smiodthe older disassembly format.
16543d8817e4Smiod
16553d8817e4Smiod@item -EB
16563d8817e4Smiod@itemx -EL
16573d8817e4Smiod@itemx --endian=@{big|little@}
16583d8817e4Smiod@cindex endianness
16593d8817e4Smiod@cindex disassembly endianness
16603d8817e4SmiodSpecify the endianness of the object files.  This only affects
16613d8817e4Smioddisassembly.  This can be useful when disassembling a file format which
16623d8817e4Smioddoes not describe endianness information, such as S-records.
16633d8817e4Smiod
16643d8817e4Smiod@item -f
16653d8817e4Smiod@itemx --file-headers
16663d8817e4Smiod@cindex object file header
16673d8817e4SmiodDisplay summary information from the overall header of
16683d8817e4Smiodeach of the @var{objfile} files.
16693d8817e4Smiod
16703d8817e4Smiod@item --file-start-context
16713d8817e4Smiod@cindex source code context
16723d8817e4SmiodSpecify that when displaying interlisted source code/disassembly
16733d8817e4Smiod(assumes @option{-S}) from a file that has not yet been displayed, extend the
16743d8817e4Smiodcontext to the start of the file.
16753d8817e4Smiod
16763d8817e4Smiod@item -h
16773d8817e4Smiod@itemx --section-headers
16783d8817e4Smiod@itemx --headers
16793d8817e4Smiod@cindex section headers
16803d8817e4SmiodDisplay summary information from the section headers of the
16813d8817e4Smiodobject file.
16823d8817e4Smiod
16833d8817e4SmiodFile segments may be relocated to nonstandard addresses, for example by
16843d8817e4Smiodusing the @option{-Ttext}, @option{-Tdata}, or @option{-Tbss} options to
16853d8817e4Smiod@command{ld}.  However, some object file formats, such as a.out, do not
16863d8817e4Smiodstore the starting address of the file segments.  In those situations,
16873d8817e4Smiodalthough @command{ld} relocates the sections correctly, using @samp{objdump
16883d8817e4Smiod-h} to list the file section headers cannot show the correct addresses.
16893d8817e4SmiodInstead, it shows the usual addresses, which are implicit for the
16903d8817e4Smiodtarget.
16913d8817e4Smiod
16923d8817e4Smiod@item -H
16933d8817e4Smiod@itemx --help
16943d8817e4SmiodPrint a summary of the options to @command{objdump} and exit.
16953d8817e4Smiod
16963d8817e4Smiod@item -i
16973d8817e4Smiod@itemx --info
16983d8817e4Smiod@cindex architectures available
16993d8817e4Smiod@cindex object formats available
17003d8817e4SmiodDisplay a list showing all architectures and object formats available
17013d8817e4Smiodfor specification with @option{-b} or @option{-m}.
17023d8817e4Smiod
17033d8817e4Smiod@item -j @var{name}
17043d8817e4Smiod@itemx --section=@var{name}
17053d8817e4Smiod@cindex section information
17063d8817e4SmiodDisplay information only for section @var{name}.
17073d8817e4Smiod
17083d8817e4Smiod@item -l
17093d8817e4Smiod@itemx --line-numbers
17103d8817e4Smiod@cindex source filenames for object files
17113d8817e4SmiodLabel the display (using debugging information) with the filename and
17123d8817e4Smiodsource line numbers corresponding to the object code or relocs shown.
17133d8817e4SmiodOnly useful with @option{-d}, @option{-D}, or @option{-r}.
17143d8817e4Smiod
17153d8817e4Smiod@item -m @var{machine}
17163d8817e4Smiod@itemx --architecture=@var{machine}
17173d8817e4Smiod@cindex architecture
17183d8817e4Smiod@cindex disassembly architecture
17193d8817e4SmiodSpecify the architecture to use when disassembling object files.  This
17203d8817e4Smiodcan be useful when disassembling object files which do not describe
17213d8817e4Smiodarchitecture information, such as S-records.  You can list the available
17223d8817e4Smiodarchitectures with the @option{-i} option.
17233d8817e4Smiod
17243d8817e4Smiod@item -M @var{options}
17253d8817e4Smiod@itemx --disassembler-options=@var{options}
17263d8817e4SmiodPass target specific information to the disassembler.  Only supported on
17273d8817e4Smiodsome targets.  If it is necessary to specify more than one
17283d8817e4Smioddisassembler option then multiple @option{-M} options can be used or
17293d8817e4Smiodcan be placed together into a comma separated list.
17303d8817e4Smiod
17313d8817e4SmiodIf the target is an ARM architecture then this switch can be used to
17323d8817e4Smiodselect which register name set is used during disassembler.  Specifying
17333d8817e4Smiod@option{-M reg-names-std} (the default) will select the register names as
17343d8817e4Smiodused in ARM's instruction set documentation, but with register 13 called
17353d8817e4Smiod'sp', register 14 called 'lr' and register 15 called 'pc'.  Specifying
17363d8817e4Smiod@option{-M reg-names-apcs} will select the name set used by the ARM
17373d8817e4SmiodProcedure Call Standard, whilst specifying @option{-M reg-names-raw} will
17383d8817e4Smiodjust use @samp{r} followed by the register number.
17393d8817e4Smiod
17403d8817e4SmiodThere are also two variants on the APCS register naming scheme enabled
17413d8817e4Smiodby @option{-M reg-names-atpcs} and @option{-M reg-names-special-atpcs} which
17423d8817e4Smioduse the ARM/Thumb Procedure Call Standard naming conventions.  (Either
17433d8817e4Smiodwith the normal register names or the special register names).
17443d8817e4Smiod
17453d8817e4SmiodThis option can also be used for ARM architectures to force the
17463d8817e4Smioddisassembler to interpret all instructions as Thumb instructions by
17473d8817e4Smiodusing the switch @option{--disassembler-options=force-thumb}.  This can be
17483d8817e4Smioduseful when attempting to disassemble thumb code produced by other
17493d8817e4Smiodcompilers.
17503d8817e4Smiod
17513d8817e4SmiodFor the x86, some of the options duplicate functions of the @option{-m}
17523d8817e4Smiodswitch, but allow finer grained control.  Multiple selections from the
17533d8817e4Smiodfollowing may be specified as a comma separated string.
17543d8817e4Smiod@option{x86-64}, @option{i386} and @option{i8086} select disassembly for
17553d8817e4Smiodthe given architecture.  @option{intel} and @option{att} select between
17563d8817e4Smiodintel syntax mode and AT&T syntax mode.  @option{addr32},
17573d8817e4Smiod@option{addr16}, @option{data32} and @option{data16} specify the default
17583d8817e4Smiodaddress size and operand size.  These four options will be overridden if
17593d8817e4Smiod@option{x86-64}, @option{i386} or @option{i8086} appear later in the
17603d8817e4Smiodoption string.  Lastly, @option{suffix}, when in AT&T mode,
17613d8817e4Smiodinstructs the disassembler to print a mnemonic suffix even when the
17623d8817e4Smiodsuffix could be inferred by the operands.
17633d8817e4Smiod
17643d8817e4SmiodFor PPC, @option{booke}, @option{booke32} and @option{booke64} select
17653d8817e4Smioddisassembly of BookE instructions.  @option{32} and @option{64} select
17663d8817e4SmiodPowerPC and PowerPC64 disassembly, respectively.  @option{e300} selects
17673d8817e4Smioddisassembly for the e300 family.
17683d8817e4Smiod
17693d8817e4SmiodFor MIPS, this option controls the printing of instruction mneumonic
17703d8817e4Smiodnames and register names in disassembled instructions.  Multiple
17713d8817e4Smiodselections from the following may be specified as a comma separated
17723d8817e4Smiodstring, and invalid options are ignored:
17733d8817e4Smiod
17743d8817e4Smiod@table @code
17753d8817e4Smiod@item no-aliases
17763d8817e4SmiodPrint the 'raw' instruction mneumonic instead of some pseudo
17773d8817e4Smiodinstruction mneumonic.  I.E. print 'daddu' or 'or' instead of 'move',
17783d8817e4Smiod'sll' instead of 'nop', etc.
17793d8817e4Smiod
17803d8817e4Smiod@item gpr-names=@var{ABI}
17813d8817e4SmiodPrint GPR (general-purpose register) names as appropriate
17823d8817e4Smiodfor the specified ABI.  By default, GPR names are selected according to
17833d8817e4Smiodthe ABI of the binary being disassembled.
17843d8817e4Smiod
17853d8817e4Smiod@item fpr-names=@var{ABI}
17863d8817e4SmiodPrint FPR (floating-point register) names as
17873d8817e4Smiodappropriate for the specified ABI.  By default, FPR numbers are printed
17883d8817e4Smiodrather than names.
17893d8817e4Smiod
17903d8817e4Smiod@item cp0-names=@var{ARCH}
17913d8817e4SmiodPrint CP0 (system control coprocessor; coprocessor 0) register names
17923d8817e4Smiodas appropriate for the CPU or architecture specified by
17933d8817e4Smiod@var{ARCH}.  By default, CP0 register names are selected according to
17943d8817e4Smiodthe architecture and CPU of the binary being disassembled.
17953d8817e4Smiod
17963d8817e4Smiod@item hwr-names=@var{ARCH}
17973d8817e4SmiodPrint HWR (hardware register, used by the @code{rdhwr} instruction) names
17983d8817e4Smiodas appropriate for the CPU or architecture specified by
17993d8817e4Smiod@var{ARCH}.  By default, HWR names are selected according to
18003d8817e4Smiodthe architecture and CPU of the binary being disassembled.
18013d8817e4Smiod
18023d8817e4Smiod@item reg-names=@var{ABI}
18033d8817e4SmiodPrint GPR and FPR names as appropriate for the selected ABI.
18043d8817e4Smiod
18053d8817e4Smiod@item reg-names=@var{ARCH}
18063d8817e4SmiodPrint CPU-specific register names (CP0 register and HWR names)
18073d8817e4Smiodas appropriate for the selected CPU or architecture.
18083d8817e4Smiod@end table
18093d8817e4Smiod
18103d8817e4SmiodFor any of the options listed above, @var{ABI} or
18113d8817e4Smiod@var{ARCH} may be specified as @samp{numeric} to have numbers printed
18123d8817e4Smiodrather than names, for the selected types of registers.
18133d8817e4SmiodYou can list the available values of @var{ABI} and @var{ARCH} using
18143d8817e4Smiodthe @option{--help} option.
18153d8817e4Smiod
18163d8817e4SmiodFor VAX, you can specify function entry addresses with @option{-M
18173d8817e4Smiodentry:0xf00ba}.  You can use this multiple times to properly
18183d8817e4Smioddisassemble VAX binary files that don't contain symbol tables (like
18193d8817e4SmiodROM dumps).  In these cases, the function entry mask would otherwise
18203d8817e4Smiodbe decoded as VAX instructions, which would probably lead the the rest
18213d8817e4Smiodof the function being wrongly disassembled.
18223d8817e4Smiod
18233d8817e4Smiod@item -p
18243d8817e4Smiod@itemx --private-headers
18253d8817e4SmiodPrint information that is specific to the object file format.  The exact
18263d8817e4Smiodinformation printed depends upon the object file format.  For some
18273d8817e4Smiodobject file formats, no additional information is printed.
18283d8817e4Smiod
18293d8817e4Smiod@item -r
18303d8817e4Smiod@itemx --reloc
18313d8817e4Smiod@cindex relocation entries, in object file
18323d8817e4SmiodPrint the relocation entries of the file.  If used with @option{-d} or
18333d8817e4Smiod@option{-D}, the relocations are printed interspersed with the
18343d8817e4Smioddisassembly.
18353d8817e4Smiod
18363d8817e4Smiod@item -R
18373d8817e4Smiod@itemx --dynamic-reloc
18383d8817e4Smiod@cindex dynamic relocation entries, in object file
18393d8817e4SmiodPrint the dynamic relocation entries of the file.  This is only
18403d8817e4Smiodmeaningful for dynamic objects, such as certain types of shared
18413d8817e4Smiodlibraries.
18423d8817e4Smiod
18433d8817e4Smiod@item -s
18443d8817e4Smiod@itemx --full-contents
18453d8817e4Smiod@cindex sections, full contents
18463d8817e4Smiod@cindex object file sections
18473d8817e4SmiodDisplay the full contents of any sections requested.  By default all
18483d8817e4Smiodnon-empty sections are displayed.
18493d8817e4Smiod
18503d8817e4Smiod@item -S
18513d8817e4Smiod@itemx --source
18523d8817e4Smiod@cindex source disassembly
18533d8817e4Smiod@cindex disassembly, with source
18543d8817e4SmiodDisplay source code intermixed with disassembly, if possible.  Implies
18553d8817e4Smiod@option{-d}.
18563d8817e4Smiod
18573d8817e4Smiod@item --show-raw-insn
18583d8817e4SmiodWhen disassembling instructions, print the instruction in hex as well as
18593d8817e4Smiodin symbolic form.  This is the default except when
18603d8817e4Smiod@option{--prefix-addresses} is used.
18613d8817e4Smiod
18623d8817e4Smiod@item --no-show-raw-insn
18633d8817e4SmiodWhen disassembling instructions, do not print the instruction bytes.
18643d8817e4SmiodThis is the default when @option{--prefix-addresses} is used.
18653d8817e4Smiod
18663d8817e4Smiod@item -W
18673d8817e4Smiod@itemx --dwarf
18683d8817e4Smiod@cindex DWARF
18693d8817e4Smiod@cindex debug symbols
18703d8817e4SmiodDisplays the contents of the DWARF debug sections in the file, if any
18713d8817e4Smiodare present.
18723d8817e4Smiod
18733d8817e4Smiod@item -G
18743d8817e4Smiod@itemx --stabs
18753d8817e4Smiod@cindex stab
18763d8817e4Smiod@cindex .stab
18773d8817e4Smiod@cindex debug symbols
18783d8817e4Smiod@cindex ELF object file format
18793d8817e4SmiodDisplay the full contents of any sections requested.  Display the
18803d8817e4Smiodcontents of the .stab and .stab.index and .stab.excl sections from an
18813d8817e4SmiodELF file.  This is only useful on systems (such as Solaris 2.0) in which
18823d8817e4Smiod@code{.stab} debugging symbol-table entries are carried in an ELF
18833d8817e4Smiodsection.  In most other file formats, debugging symbol-table entries are
18843d8817e4Smiodinterleaved with linkage symbols, and are visible in the @option{--syms}
18853d8817e4Smiodoutput.
18863d8817e4Smiod@ifclear man
18873d8817e4SmiodFor more information on stabs symbols, see @ref{Top,Stabs,Stabs
18883d8817e4SmiodOverview,stabs.info, The ``stabs'' debug format}.
18893d8817e4Smiod@end ifclear
18903d8817e4Smiod
18913d8817e4Smiod@item --start-address=@var{address}
18923d8817e4Smiod@cindex start-address
18933d8817e4SmiodStart displaying data at the specified address.  This affects the output
18943d8817e4Smiodof the @option{-d}, @option{-r} and @option{-s} options.
18953d8817e4Smiod
18963d8817e4Smiod@item --stop-address=@var{address}
18973d8817e4Smiod@cindex stop-address
18983d8817e4SmiodStop displaying data at the specified address.  This affects the output
18993d8817e4Smiodof the @option{-d}, @option{-r} and @option{-s} options.
19003d8817e4Smiod
19013d8817e4Smiod@item -t
19023d8817e4Smiod@itemx --syms
19033d8817e4Smiod@cindex symbol table entries, printing
19043d8817e4SmiodPrint the symbol table entries of the file.
19053d8817e4SmiodThis is similar to the information provided by the @samp{nm} program.
19063d8817e4Smiod
19073d8817e4Smiod@item -T
19083d8817e4Smiod@itemx --dynamic-syms
19093d8817e4Smiod@cindex dynamic symbol table entries, printing
19103d8817e4SmiodPrint the dynamic symbol table entries of the file.  This is only
19113d8817e4Smiodmeaningful for dynamic objects, such as certain types of shared
19123d8817e4Smiodlibraries.  This is similar to the information provided by the @samp{nm}
19133d8817e4Smiodprogram when given the @option{-D} (@option{--dynamic}) option.
19143d8817e4Smiod
19153d8817e4Smiod@item --special-syms
19163d8817e4SmiodWhen displaying symbols include those which the target considers to be
19173d8817e4Smiodspecial in some way and which would not normally be of interest to the
19183d8817e4Smioduser.
19193d8817e4Smiod
19203d8817e4Smiod@item -V
19213d8817e4Smiod@itemx --version
19223d8817e4SmiodPrint the version number of @command{objdump} and exit.
19233d8817e4Smiod
19243d8817e4Smiod@item -x
19253d8817e4Smiod@itemx --all-headers
19263d8817e4Smiod@cindex all header information, object file
19273d8817e4Smiod@cindex header information, all
19283d8817e4SmiodDisplay all available header information, including the symbol table and
19293d8817e4Smiodrelocation entries.  Using @option{-x} is equivalent to specifying all of
19303d8817e4Smiod@option{-a -f -h -p -r -t}.
19313d8817e4Smiod
19323d8817e4Smiod@item -w
19333d8817e4Smiod@itemx --wide
19343d8817e4Smiod@cindex wide output, printing
19353d8817e4SmiodFormat some lines for output devices that have more than 80 columns.
19363d8817e4SmiodAlso do not truncate symbol names when they are displayed.
19373d8817e4Smiod
19383d8817e4Smiod@item -z
19393d8817e4Smiod@itemx --disassemble-zeroes
19403d8817e4SmiodNormally the disassembly output will skip blocks of zeroes.  This
19413d8817e4Smiodoption directs the disassembler to disassemble those blocks, just like
19423d8817e4Smiodany other data.
19433d8817e4Smiod@end table
19443d8817e4Smiod
19453d8817e4Smiod@c man end
19463d8817e4Smiod
19473d8817e4Smiod@ignore
19483d8817e4Smiod@c man begin SEEALSO objdump
19493d8817e4Smiodnm(1), readelf(1), and the Info entries for @file{binutils}.
19503d8817e4Smiod@c man end
19513d8817e4Smiod@end ignore
19523d8817e4Smiod
19533d8817e4Smiod@node ranlib
19543d8817e4Smiod@chapter ranlib
19553d8817e4Smiod
19563d8817e4Smiod@kindex ranlib
19573d8817e4Smiod@cindex archive contents
19583d8817e4Smiod@cindex symbol index
19593d8817e4Smiod
19603d8817e4Smiod@c man title ranlib generate index to archive.
19613d8817e4Smiod
19623d8817e4Smiod@smallexample
19633d8817e4Smiod@c man begin SYNOPSIS ranlib
19643d8817e4Smiodranlib [@option{-vV}] @var{archive}
19653d8817e4Smiod@c man end
19663d8817e4Smiod@end smallexample
19673d8817e4Smiod
19683d8817e4Smiod@c man begin DESCRIPTION ranlib
19693d8817e4Smiod
19703d8817e4Smiod@command{ranlib} generates an index to the contents of an archive and
19713d8817e4Smiodstores it in the archive.  The index lists each symbol defined by a
19723d8817e4Smiodmember of an archive that is a relocatable object file.
19733d8817e4Smiod
19743d8817e4SmiodYou may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
19753d8817e4Smiod
19763d8817e4SmiodAn archive with such an index speeds up linking to the library and
19773d8817e4Smiodallows routines in the library to call each other without regard to
19783d8817e4Smiodtheir placement in the archive.
19793d8817e4Smiod
19803d8817e4SmiodThe @sc{gnu} @command{ranlib} program is another form of @sc{gnu} @command{ar}; running
19813d8817e4Smiod@command{ranlib} is completely equivalent to executing @samp{ar -s}.
19823d8817e4Smiod@xref{ar}.
19833d8817e4Smiod
19843d8817e4Smiod@c man end
19853d8817e4Smiod
19863d8817e4Smiod@c man begin OPTIONS ranlib
19873d8817e4Smiod
19883d8817e4Smiod@table @env
19893d8817e4Smiod@item -v
19903d8817e4Smiod@itemx -V
19913d8817e4Smiod@itemx --version
19923d8817e4SmiodShow the version number of @command{ranlib}.
19933d8817e4Smiod@end table
19943d8817e4Smiod
19953d8817e4Smiod@c man end
19963d8817e4Smiod
19973d8817e4Smiod@ignore
19983d8817e4Smiod@c man begin SEEALSO ranlib
19993d8817e4Smiodar(1), nm(1), and the Info entries for @file{binutils}.
20003d8817e4Smiod@c man end
20013d8817e4Smiod@end ignore
20023d8817e4Smiod
20033d8817e4Smiod@node size
20043d8817e4Smiod@chapter size
20053d8817e4Smiod
20063d8817e4Smiod@kindex size
20073d8817e4Smiod@cindex section sizes
20083d8817e4Smiod
20093d8817e4Smiod@c man title size list section sizes and total size.
20103d8817e4Smiod
20113d8817e4Smiod@smallexample
20123d8817e4Smiod@c man begin SYNOPSIS size
20133d8817e4Smiodsize [@option{-A}|@option{-B}|@option{--format=}@var{compatibility}]
20143d8817e4Smiod     [@option{--help}]
20153d8817e4Smiod     [@option{-d}|@option{-o}|@option{-x}|@option{--radix=}@var{number}]
20163d8817e4Smiod     [@option{-t}|@option{--totals}]
20173d8817e4Smiod     [@option{--target=}@var{bfdname}] [@option{-V}|@option{--version}]
20183d8817e4Smiod     [@var{objfile}@dots{}]
20193d8817e4Smiod@c man end
20203d8817e4Smiod@end smallexample
20213d8817e4Smiod
20223d8817e4Smiod@c man begin DESCRIPTION size
20233d8817e4Smiod
20243d8817e4SmiodThe @sc{gnu} @command{size} utility lists the section sizes---and the total
20253d8817e4Smiodsize---for each of the object or archive files @var{objfile} in its
20263d8817e4Smiodargument list.  By default, one line of output is generated for each
20273d8817e4Smiodobject file or each module in an archive.
20283d8817e4Smiod
20293d8817e4Smiod@var{objfile}@dots{} are the object files to be examined.
20303d8817e4SmiodIf none are specified, the file @code{a.out} will be used.
20313d8817e4Smiod
20323d8817e4Smiod@c man end
20333d8817e4Smiod
20343d8817e4Smiod@c man begin OPTIONS size
20353d8817e4Smiod
20363d8817e4SmiodThe command line options have the following meanings:
20373d8817e4Smiod
20383d8817e4Smiod@table @env
20393d8817e4Smiod@item -A
20403d8817e4Smiod@itemx -B
20413d8817e4Smiod@itemx --format=@var{compatibility}
20423d8817e4Smiod@cindex @command{size} display format
20433d8817e4SmiodUsing one of these options, you can choose whether the output from @sc{gnu}
20443d8817e4Smiod@command{size} resembles output from System V @command{size} (using @option{-A},
20453d8817e4Smiodor @option{--format=sysv}), or Berkeley @command{size} (using @option{-B}, or
20463d8817e4Smiod@option{--format=berkeley}).  The default is the one-line format similar to
20473d8817e4SmiodBerkeley's.
20483d8817e4Smiod@c Bonus for doc-source readers: you can also say --format=strange (or
20493d8817e4Smiod@c anything else that starts with 's') for sysv, and --format=boring (or
20503d8817e4Smiod@c anything else that starts with 'b') for Berkeley.
20513d8817e4Smiod
20523d8817e4SmiodHere is an example of the Berkeley (default) format of output from
20533d8817e4Smiod@command{size}:
20543d8817e4Smiod@smallexample
20553d8817e4Smiod$ size --format=Berkeley ranlib size
20563d8817e4Smiodtext    data    bss     dec     hex     filename
20573d8817e4Smiod294880  81920   11592   388392  5ed28   ranlib
20583d8817e4Smiod294880  81920   11888   388688  5ee50   size
20593d8817e4Smiod@end smallexample
20603d8817e4Smiod
20613d8817e4Smiod@noindent
20623d8817e4SmiodThis is the same data, but displayed closer to System V conventions:
20633d8817e4Smiod
20643d8817e4Smiod@smallexample
20653d8817e4Smiod$ size --format=SysV ranlib size
20663d8817e4Smiodranlib  :
20673d8817e4Smiodsection         size         addr
20683d8817e4Smiod.text         294880         8192
20693d8817e4Smiod.data          81920       303104
20703d8817e4Smiod.bss           11592       385024
20713d8817e4SmiodTotal         388392
20723d8817e4Smiod
20733d8817e4Smiod
20743d8817e4Smiodsize  :
20753d8817e4Smiodsection         size         addr
20763d8817e4Smiod.text         294880         8192
20773d8817e4Smiod.data          81920       303104
20783d8817e4Smiod.bss           11888       385024
20793d8817e4SmiodTotal         388688
20803d8817e4Smiod@end smallexample
20813d8817e4Smiod
20823d8817e4Smiod@item --help
20833d8817e4SmiodShow a summary of acceptable arguments and options.
20843d8817e4Smiod
20853d8817e4Smiod@item -d
20863d8817e4Smiod@itemx -o
20873d8817e4Smiod@itemx -x
20883d8817e4Smiod@itemx --radix=@var{number}
20893d8817e4Smiod@cindex @command{size} number format
20903d8817e4Smiod@cindex radix for section sizes
20913d8817e4SmiodUsing one of these options, you can control whether the size of each
20923d8817e4Smiodsection is given in decimal (@option{-d}, or @option{--radix=10}); octal
20933d8817e4Smiod(@option{-o}, or @option{--radix=8}); or hexadecimal (@option{-x}, or
20943d8817e4Smiod@option{--radix=16}).  In @option{--radix=@var{number}}, only the three
20953d8817e4Smiodvalues (8, 10, 16) are supported.  The total size is always given in two
20963d8817e4Smiodradices; decimal and hexadecimal for @option{-d} or @option{-x} output, or
20973d8817e4Smiodoctal and hexadecimal if you're using @option{-o}.
20983d8817e4Smiod
20993d8817e4Smiod@item -t
21003d8817e4Smiod@itemx --totals
21013d8817e4SmiodShow totals of all objects listed (Berkeley format listing mode only).
21023d8817e4Smiod
21033d8817e4Smiod@item --target=@var{bfdname}
21043d8817e4Smiod@cindex object code format
21053d8817e4SmiodSpecify that the object-code format for @var{objfile} is
21063d8817e4Smiod@var{bfdname}.  This option may not be necessary; @command{size} can
21073d8817e4Smiodautomatically recognize many formats.
21083d8817e4Smiod@xref{Target Selection}, for more information.
21093d8817e4Smiod
21103d8817e4Smiod@item -V
21113d8817e4Smiod@itemx --version
21123d8817e4SmiodDisplay the version number of @command{size}.
21133d8817e4Smiod@end table
21143d8817e4Smiod
21153d8817e4Smiod@c man end
21163d8817e4Smiod
21173d8817e4Smiod@ignore
21183d8817e4Smiod@c man begin SEEALSO size
21193d8817e4Smiodar(1), objdump(1), readelf(1), and the Info entries for @file{binutils}.
21203d8817e4Smiod@c man end
21213d8817e4Smiod@end ignore
21223d8817e4Smiod
21233d8817e4Smiod@node strings
21243d8817e4Smiod@chapter strings
21253d8817e4Smiod@kindex strings
21263d8817e4Smiod@cindex listings strings
21273d8817e4Smiod@cindex printing strings
21283d8817e4Smiod@cindex strings, printing
21293d8817e4Smiod
21303d8817e4Smiod@c man title strings print the strings of printable characters in files.
21313d8817e4Smiod
21323d8817e4Smiod@smallexample
21333d8817e4Smiod@c man begin SYNOPSIS strings
21343d8817e4Smiodstrings [@option{-afov}] [@option{-}@var{min-len}]
21353d8817e4Smiod        [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}]
21363d8817e4Smiod        [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
21373d8817e4Smiod        [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
21383d8817e4Smiod        [@option{-}] [@option{--all}] [@option{--print-file-name}]
21393d8817e4Smiod        [@option{--target=}@var{bfdname}]
21403d8817e4Smiod        [@option{--help}] [@option{--version}] @var{file}@dots{}
21413d8817e4Smiod@c man end
21423d8817e4Smiod@end smallexample
21433d8817e4Smiod
21443d8817e4Smiod@c man begin DESCRIPTION strings
21453d8817e4Smiod
21463d8817e4SmiodFor each @var{file} given, @sc{gnu} @command{strings} prints the printable
21473d8817e4Smiodcharacter sequences that are at least 4 characters long (or the number
21483d8817e4Smiodgiven with the options below) and are followed by an unprintable
21493d8817e4Smiodcharacter.  By default, it only prints the strings from the initialized
21503d8817e4Smiodand loaded sections of object files; for other types of files, it prints
21513d8817e4Smiodthe strings from the whole file.
21523d8817e4Smiod
21533d8817e4Smiod@command{strings} is mainly useful for determining the contents of non-text
21543d8817e4Smiodfiles.
21553d8817e4Smiod
21563d8817e4Smiod@c man end
21573d8817e4Smiod
21583d8817e4Smiod@c man begin OPTIONS strings
21593d8817e4Smiod
21603d8817e4Smiod@table @env
21613d8817e4Smiod@item -a
21623d8817e4Smiod@itemx --all
21633d8817e4Smiod@itemx -
21643d8817e4SmiodDo not scan only the initialized and loaded sections of object files;
21653d8817e4Smiodscan the whole files.
21663d8817e4Smiod
21673d8817e4Smiod@item -f
21683d8817e4Smiod@itemx --print-file-name
21693d8817e4SmiodPrint the name of the file before each string.
21703d8817e4Smiod
21713d8817e4Smiod@item --help
21723d8817e4SmiodPrint a summary of the program usage on the standard output and exit.
21733d8817e4Smiod
21743d8817e4Smiod@item -@var{min-len}
21753d8817e4Smiod@itemx -n @var{min-len}
21763d8817e4Smiod@itemx --bytes=@var{min-len}
21773d8817e4SmiodPrint sequences of characters that are at least @var{min-len} characters
21783d8817e4Smiodlong, instead of the default 4.
21793d8817e4Smiod
21803d8817e4Smiod@item -o
21813d8817e4SmiodLike @samp{-t o}.  Some other versions of @command{strings} have @option{-o}
21823d8817e4Smiodact like @samp{-t d} instead.  Since we can not be compatible with both
21833d8817e4Smiodways, we simply chose one.
21843d8817e4Smiod
21853d8817e4Smiod@item -t @var{radix}
21863d8817e4Smiod@itemx --radix=@var{radix}
21873d8817e4SmiodPrint the offset within the file before each string.  The single
21883d8817e4Smiodcharacter argument specifies the radix of the offset---@samp{o} for
21893d8817e4Smiodoctal, @samp{x} for hexadecimal, or @samp{d} for decimal.
21903d8817e4Smiod
21913d8817e4Smiod@item -e @var{encoding}
21923d8817e4Smiod@itemx --encoding=@var{encoding}
21933d8817e4SmiodSelect the character encoding of the strings that are to be found.
21943d8817e4SmiodPossible values for @var{encoding} are: @samp{s} = single-7-bit-byte
21953d8817e4Smiodcharacters (ASCII, ISO 8859, etc., default), @samp{S} =
21963d8817e4Smiodsingle-8-bit-byte characters, @samp{b} = 16-bit bigendian, @samp{l} =
21973d8817e4Smiod16-bit littleendian, @samp{B} = 32-bit bigendian, @samp{L} = 32-bit
21983d8817e4Smiodlittleendian. Useful for finding wide character strings.
21993d8817e4Smiod
22003d8817e4Smiod@item --target=@var{bfdname}
22013d8817e4Smiod@cindex object code format
22023d8817e4SmiodSpecify an object code format other than your system's default format.
22033d8817e4Smiod@xref{Target Selection}, for more information.
22043d8817e4Smiod
22053d8817e4Smiod@item -v
22063d8817e4Smiod@itemx --version
22073d8817e4SmiodPrint the program version number on the standard output and exit.
22083d8817e4Smiod@end table
22093d8817e4Smiod
22103d8817e4Smiod@c man end
22113d8817e4Smiod
22123d8817e4Smiod@ignore
22133d8817e4Smiod@c man begin SEEALSO strings
22143d8817e4Smiodar(1), nm(1), objdump(1), ranlib(1), readelf(1)
22153d8817e4Smiodand the Info entries for @file{binutils}.
22163d8817e4Smiod@c man end
22173d8817e4Smiod@end ignore
22183d8817e4Smiod
22193d8817e4Smiod@node strip
22203d8817e4Smiod@chapter strip
22213d8817e4Smiod
22223d8817e4Smiod@kindex strip
22233d8817e4Smiod@cindex removing symbols
22243d8817e4Smiod@cindex discarding symbols
22253d8817e4Smiod@cindex symbols, discarding
22263d8817e4Smiod
22273d8817e4Smiod@c man title strip Discard symbols from object files.
22283d8817e4Smiod
22293d8817e4Smiod@smallexample
22303d8817e4Smiod@c man begin SYNOPSIS strip
22313d8817e4Smiodstrip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
22323d8817e4Smiod      [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname}]
22333d8817e4Smiod      [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname}]
22343d8817e4Smiod      [@option{-s}|@option{--strip-all}]
22353d8817e4Smiod      [@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}]
22363d8817e4Smiod      [@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname}]
22373d8817e4Smiod      [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname}]
22383d8817e4Smiod      [@option{-w}|@option{--wildcard}]
22393d8817e4Smiod      [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
22403d8817e4Smiod      [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
22413d8817e4Smiod      [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
22423d8817e4Smiod      [@option{--keep-file-symbols}]
22433d8817e4Smiod      [@option{--only-keep-debug}]
22443d8817e4Smiod      [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
22453d8817e4Smiod      [@option{--help}] [@option{--info}]
22463d8817e4Smiod      @var{objfile}@dots{}
22473d8817e4Smiod@c man end
22483d8817e4Smiod@end smallexample
22493d8817e4Smiod
22503d8817e4Smiod@c man begin DESCRIPTION strip
22513d8817e4Smiod
22523d8817e4Smiod@sc{gnu} @command{strip} discards all symbols from object files
22533d8817e4Smiod@var{objfile}.  The list of object files may include archives.
22543d8817e4SmiodAt least one object file must be given.
22553d8817e4Smiod
22563d8817e4Smiod@command{strip} modifies the files named in its argument,
22573d8817e4Smiodrather than writing modified copies under different names.
22583d8817e4Smiod
22593d8817e4Smiod@c man end
22603d8817e4Smiod
22613d8817e4Smiod@c man begin OPTIONS strip
22623d8817e4Smiod
22633d8817e4Smiod@table @env
22643d8817e4Smiod@item -F @var{bfdname}
22653d8817e4Smiod@itemx --target=@var{bfdname}
22663d8817e4SmiodTreat the original @var{objfile} as a file with the object
22673d8817e4Smiodcode format @var{bfdname}, and rewrite it in the same format.
22683d8817e4Smiod@xref{Target Selection}, for more information.
22693d8817e4Smiod
22703d8817e4Smiod@item --help
22713d8817e4SmiodShow a summary of the options to @command{strip} and exit.
22723d8817e4Smiod
22733d8817e4Smiod@item --info
22743d8817e4SmiodDisplay a list showing all architectures and object formats available.
22753d8817e4Smiod
22763d8817e4Smiod@item -I @var{bfdname}
22773d8817e4Smiod@itemx --input-target=@var{bfdname}
22783d8817e4SmiodTreat the original @var{objfile} as a file with the object
22793d8817e4Smiodcode format @var{bfdname}.
22803d8817e4Smiod@xref{Target Selection}, for more information.
22813d8817e4Smiod
22823d8817e4Smiod@item -O @var{bfdname}
22833d8817e4Smiod@itemx --output-target=@var{bfdname}
22843d8817e4SmiodReplace @var{objfile} with a file in the output format @var{bfdname}.
22853d8817e4Smiod@xref{Target Selection}, for more information.
22863d8817e4Smiod
22873d8817e4Smiod@item -R @var{sectionname}
22883d8817e4Smiod@itemx --remove-section=@var{sectionname}
22893d8817e4SmiodRemove any section named @var{sectionname} from the output file.  This
22903d8817e4Smiodoption may be given more than once.  Note that using this option
22913d8817e4Smiodinappropriately may make the output file unusable.
22923d8817e4Smiod
22933d8817e4Smiod@item -s
22943d8817e4Smiod@itemx --strip-all
22953d8817e4SmiodRemove all symbols.
22963d8817e4Smiod
22973d8817e4Smiod@item -g
22983d8817e4Smiod@itemx -S
22993d8817e4Smiod@itemx -d
23003d8817e4Smiod@itemx --strip-debug
23013d8817e4SmiodRemove debugging symbols only.
23023d8817e4Smiod
23033d8817e4Smiod@item --strip-unneeded
23043d8817e4SmiodRemove all symbols that are not needed for relocation processing.
23053d8817e4Smiod
23063d8817e4Smiod@item -K @var{symbolname}
23073d8817e4Smiod@itemx --keep-symbol=@var{symbolname}
23083d8817e4SmiodWhen stripping symbols, keep symbol @var{symbolname} even if it would
23093d8817e4Smiodnormally be stripped.  This option may be given more than once.
23103d8817e4Smiod
23113d8817e4Smiod@item -N @var{symbolname}
23123d8817e4Smiod@itemx --strip-symbol=@var{symbolname}
23133d8817e4SmiodRemove symbol @var{symbolname} from the source file. This option may be
23143d8817e4Smiodgiven more than once, and may be combined with strip options other than
23153d8817e4Smiod@option{-K}.
23163d8817e4Smiod
23173d8817e4Smiod@item -o @var{file}
23183d8817e4SmiodPut the stripped output in @var{file}, rather than replacing the
23193d8817e4Smiodexisting file.  When this argument is used, only one @var{objfile}
23203d8817e4Smiodargument may be specified.
23213d8817e4Smiod
23223d8817e4Smiod@item -p
23233d8817e4Smiod@itemx --preserve-dates
23243d8817e4SmiodPreserve the access and modification dates of the file.
23253d8817e4Smiod
23263d8817e4Smiod@item -w
23273d8817e4Smiod@itemx --wildcard
23283d8817e4SmiodPermit regular expressions in @var{symbolname}s used in other command
23293d8817e4Smiodline options.  The question mark (?), asterisk (*), backslash (\) and
23303d8817e4Smiodsquare brackets ([]) operators can be used anywhere in the symbol
23313d8817e4Smiodname.  If the first character of the symbol name is the exclamation
23323d8817e4Smiodpoint (!) then the sense of the switch is reversed for that symbol.
23333d8817e4SmiodFor example:
23343d8817e4Smiod
23353d8817e4Smiod@smallexample
23363d8817e4Smiod  -w -K !foo -K fo*
23373d8817e4Smiod@end smallexample
23383d8817e4Smiod
23393d8817e4Smiodwould cause strip to only keep symbols that start with the letters
23403d8817e4Smiod``fo'', but to discard the symbol ``foo''.
23413d8817e4Smiod
23423d8817e4Smiod@item -x
23433d8817e4Smiod@itemx --discard-all
23443d8817e4SmiodRemove non-global symbols.
23453d8817e4Smiod
23463d8817e4Smiod@item -X
23473d8817e4Smiod@itemx --discard-locals
23483d8817e4SmiodRemove compiler-generated local symbols.
23493d8817e4Smiod(These usually start with @samp{L} or @samp{.}.)
23503d8817e4Smiod
23513d8817e4Smiod@item --keep-file-symbols
23523d8817e4SmiodWhen stripping a file, perhaps with @option{--strip-debug} or
23533d8817e4Smiod@option{--strip-unneeded}, retain any symbols specifying source file names,
23543d8817e4Smiodwhich would otherwise get stripped.
23553d8817e4Smiod
23563d8817e4Smiod@item --only-keep-debug
23573d8817e4SmiodStrip a file, removing any sections that would be stripped by
23583d8817e4Smiod@option{--strip-debug} and leaving the debugging sections.
23593d8817e4Smiod
23603d8817e4SmiodThe intention is that this option will be used in conjunction with
23613d8817e4Smiod@option{--add-gnu-debuglink} to create a two part executable.  One a
23623d8817e4Smiodstripped binary which will occupy less space in RAM and in a
23633d8817e4Smioddistribution and the second a debugging information file which is only
23643d8817e4Smiodneeded if debugging abilities are required.  The suggested procedure
23653d8817e4Smiodto create these files is as follows:
23663d8817e4Smiod
23673d8817e4Smiod@enumerate
23683d8817e4Smiod@item Link the executable as normal.  Assuming that is is called
23693d8817e4Smiod@code{foo} then...
23703d8817e4Smiod@item Run @code{objcopy --only-keep-debug foo foo.dbg} to
23713d8817e4Smiodcreate a file containing the debugging info.
23723d8817e4Smiod@item Run @code{objcopy --strip-debug foo} to create a
23733d8817e4Smiodstripped executable.
23743d8817e4Smiod@item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
23753d8817e4Smiodto add a link to the debugging info into the stripped executable.
23763d8817e4Smiod@end enumerate
23773d8817e4Smiod
23783d8817e4SmiodNote - the choice of @code{.dbg} as an extension for the debug info
23793d8817e4Smiodfile is arbitrary.  Also the @code{--only-keep-debug} step is
23803d8817e4Smiodoptional.  You could instead do this:
23813d8817e4Smiod
23823d8817e4Smiod@enumerate
23833d8817e4Smiod@item Link the executable as normal.
23843d8817e4Smiod@item Copy @code{foo} to  @code{foo.full}
23853d8817e4Smiod@item Run @code{strip --strip-debug foo}
23863d8817e4Smiod@item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
23873d8817e4Smiod@end enumerate
23883d8817e4Smiod
23893d8817e4Smiodie the file pointed to by the @option{--add-gnu-debuglink} can be the
23903d8817e4Smiodfull executable.  It does not have to be a file created by the
23913d8817e4Smiod@option{--only-keep-debug} switch.
23923d8817e4Smiod
23933d8817e4Smiod@item -V
23943d8817e4Smiod@itemx --version
23953d8817e4SmiodShow the version number for @command{strip}.
23963d8817e4Smiod
23973d8817e4Smiod@item -v
23983d8817e4Smiod@itemx --verbose
23993d8817e4SmiodVerbose output: list all object files modified.  In the case of
24003d8817e4Smiodarchives, @samp{strip -v} lists all members of the archive.
24013d8817e4Smiod@end table
24023d8817e4Smiod
24033d8817e4Smiod@c man end
24043d8817e4Smiod
24053d8817e4Smiod@ignore
24063d8817e4Smiod@c man begin SEEALSO strip
24073d8817e4Smiodthe Info entries for @file{binutils}.
24083d8817e4Smiod@c man end
24093d8817e4Smiod@end ignore
24103d8817e4Smiod
24113d8817e4Smiod@node c++filt, addr2line, strip, Top
24123d8817e4Smiod@chapter c++filt
24133d8817e4Smiod
24143d8817e4Smiod@kindex c++filt
24153d8817e4Smiod@cindex demangling C++ symbols
24163d8817e4Smiod
24173d8817e4Smiod@c man title cxxfilt Demangle C++ and Java symbols.
24183d8817e4Smiod
24193d8817e4Smiod@smallexample
24203d8817e4Smiod@c man begin SYNOPSIS cxxfilt
24213d8817e4Smiodc++filt [@option{-_}|@option{--strip-underscores}]
24223d8817e4Smiod        [@option{-n}|@option{--no-strip-underscores}]
24233d8817e4Smiod        [@option{-p}|@option{--no-params}]
24243d8817e4Smiod        [@option{-t}|@option{--types}]
24253d8817e4Smiod        [@option{-i}|@option{--no-verbose}]
24263d8817e4Smiod        [@option{-s} @var{format}|@option{--format=}@var{format}]
24273d8817e4Smiod        [@option{--help}]  [@option{--version}]  [@var{symbol}@dots{}]
24283d8817e4Smiod@c man end
24293d8817e4Smiod@end smallexample
24303d8817e4Smiod
24313d8817e4Smiod@c man begin DESCRIPTION cxxfilt
24323d8817e4Smiod
24333d8817e4Smiod@kindex cxxfilt
24343d8817e4SmiodThe C++ and Java languages provide function overloading, which means
24353d8817e4Smiodthat you can write many functions with the same name, providing that
24363d8817e4Smiodeach function takes parameters of different types.  In order to be
24373d8817e4Smiodable to distinguish these similarly named functions C++ and Java
24383d8817e4Smiodencode them into a low-level assembler name which uniquely identifies
24393d8817e4Smiodeach different version.  This process is known as @dfn{mangling}. The
24403d8817e4Smiod@command{c++filt}
24413d8817e4Smiod@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
24423d8817e4SmiodMS-DOS this program is named @command{CXXFILT}.}
24433d8817e4Smiodprogram does the inverse mapping: it decodes (@dfn{demangles}) low-level
24443d8817e4Smiodnames into user-level names so that they can be read.
24453d8817e4Smiod
24463d8817e4SmiodEvery alphanumeric word (consisting of letters, digits, underscores,
24473d8817e4Smioddollars, or periods) seen in the input is a potential mangled name.
24483d8817e4SmiodIf the name decodes into a C++ name, the C++ name replaces the
24493d8817e4Smiodlow-level name in the output, otherwise the original word is output.
24503d8817e4SmiodIn this way you can pass an entire assembler source file, containing
24513d8817e4Smiodmangled names, through @command{c++filt} and see the same source file
24523d8817e4Smiodcontaining demangled names.
24533d8817e4Smiod
24543d8817e4SmiodYou can also use @command{c++filt} to decipher individual symbols by
24553d8817e4Smiodpassing them on the command line:
24563d8817e4Smiod
24573d8817e4Smiod@example
24583d8817e4Smiodc++filt @var{symbol}
24593d8817e4Smiod@end example
24603d8817e4Smiod
24613d8817e4SmiodIf no @var{symbol} arguments are given, @command{c++filt} reads symbol
24623d8817e4Smiodnames from the standard input instead.  All the results are printed on
24633d8817e4Smiodthe standard output.  The difference between reading names from the
24643d8817e4Smiodcommand line versus reading names from the standard input is that
24653d8817e4Smiodcommand line arguments are expected to be just mangled names and no
24663d8817e4Smiodchecking is performed to seperate them from surrounding text.  Thus
24673d8817e4Smiodfor example:
24683d8817e4Smiod
24693d8817e4Smiod@smallexample
24703d8817e4Smiodc++filt -n _Z1fv
24713d8817e4Smiod@end smallexample
24723d8817e4Smiod
24733d8817e4Smiodwill work and demangle the name to ``f()'' whereas:
24743d8817e4Smiod
24753d8817e4Smiod@smallexample
24763d8817e4Smiodc++filt -n _Z1fv,
24773d8817e4Smiod@end smallexample
24783d8817e4Smiod
24793d8817e4Smiodwill not work.  (Note the extra comma at the end of the mangled
24803d8817e4Smiodname which makes it invalid).  This command however will work:
24813d8817e4Smiod
24823d8817e4Smiod@smallexample
24833d8817e4Smiodecho _Z1fv, | c++filt -n
24843d8817e4Smiod@end smallexample
24853d8817e4Smiod
24863d8817e4Smiodand will display ``f(),'' ie the demangled name followed by a
24873d8817e4Smiodtrailing comma.  This behaviour is because when the names are read
24883d8817e4Smiodfrom the standard input it is expected that they might be part of an
24893d8817e4Smiodassembler source file where there might be extra, extraneous
24903d8817e4Smiodcharacters trailing after a mangled name.  eg:
24913d8817e4Smiod
24923d8817e4Smiod@smallexample
24933d8817e4Smiod    .type   _Z1fv, @@function
24943d8817e4Smiod@end smallexample
24953d8817e4Smiod
24963d8817e4Smiod@c man end
24973d8817e4Smiod
24983d8817e4Smiod@c man begin OPTIONS cxxfilt
24993d8817e4Smiod
25003d8817e4Smiod@table @env
25013d8817e4Smiod@item -_
25023d8817e4Smiod@itemx --strip-underscores
25033d8817e4SmiodOn some systems, both the C and C++ compilers put an underscore in front
25043d8817e4Smiodof every name.  For example, the C name @code{foo} gets the low-level
25053d8817e4Smiodname @code{_foo}.  This option removes the initial underscore.  Whether
25063d8817e4Smiod@command{c++filt} removes the underscore by default is target dependent.
25073d8817e4Smiod
25083d8817e4Smiod@item -j
25093d8817e4Smiod@itemx --java
25103d8817e4SmiodPrints demangled names using Java syntax.  The default is to use C++
25113d8817e4Smiodsyntax.
25123d8817e4Smiod
25133d8817e4Smiod@item -n
25143d8817e4Smiod@itemx --no-strip-underscores
25153d8817e4SmiodDo not remove the initial underscore.
25163d8817e4Smiod
25173d8817e4Smiod@item -p
25183d8817e4Smiod@itemx --no-params
25193d8817e4SmiodWhen demangling the name of a function, do not display the types of
25203d8817e4Smiodthe function's parameters.
25213d8817e4Smiod
25223d8817e4Smiod@item -t
25233d8817e4Smiod@itemx --types
25243d8817e4SmiodAttempt to demangle types as well as function names.  This is disabled
25253d8817e4Smiodby default since mangled types are normally only used internally in
25263d8817e4Smiodthe compiler, and they can be confused with non-mangled names.  eg
25273d8817e4Smioda function called ``a'' treated as a mangled type name would be
25283d8817e4Smioddemangled to ``signed char''.
25293d8817e4Smiod
25303d8817e4Smiod@item -i
25313d8817e4Smiod@itemx --no-verbose
25323d8817e4SmiodDo not include implementation details (if any) in the demangled
25333d8817e4Smiodoutput.
25343d8817e4Smiod
25353d8817e4Smiod@item -s @var{format}
25363d8817e4Smiod@itemx --format=@var{format}
25373d8817e4Smiod@command{c++filt} can decode various methods of mangling, used by
25383d8817e4Smioddifferent compilers.  The argument to this option selects which
25393d8817e4Smiodmethod it uses:
25403d8817e4Smiod
25413d8817e4Smiod@table @code
25423d8817e4Smiod@item auto
25433d8817e4SmiodAutomatic selection based on executable (the default method)
25443d8817e4Smiod@item gnu
25453d8817e4Smiodthe one used by the @sc{gnu} C++ compiler (g++)
25463d8817e4Smiod@item lucid
25473d8817e4Smiodthe one used by the Lucid compiler (lcc)
25483d8817e4Smiod@item arm
25493d8817e4Smiodthe one specified by the C++ Annotated Reference Manual
25503d8817e4Smiod@item hp
25513d8817e4Smiodthe one used by the HP compiler (aCC)
25523d8817e4Smiod@item edg
25533d8817e4Smiodthe one used by the EDG compiler
25543d8817e4Smiod@item gnu-v3
25553d8817e4Smiodthe one used by the @sc{gnu} C++ compiler (g++) with the V3 ABI.
25563d8817e4Smiod@item java
25573d8817e4Smiodthe one used by the @sc{gnu} Java compiler (gcj)
25583d8817e4Smiod@item gnat
25593d8817e4Smiodthe one used by the @sc{gnu} Ada compiler (GNAT).
25603d8817e4Smiod@end table
25613d8817e4Smiod
25623d8817e4Smiod@item --help
25633d8817e4SmiodPrint a summary of the options to @command{c++filt} and exit.
25643d8817e4Smiod
25653d8817e4Smiod@item --version
25663d8817e4SmiodPrint the version number of @command{c++filt} and exit.
25673d8817e4Smiod@end table
25683d8817e4Smiod
25693d8817e4Smiod@c man end
25703d8817e4Smiod
25713d8817e4Smiod@ignore
25723d8817e4Smiod@c man begin SEEALSO cxxfilt
25733d8817e4Smiodthe Info entries for @file{binutils}.
25743d8817e4Smiod@c man end
25753d8817e4Smiod@end ignore
25763d8817e4Smiod
25773d8817e4Smiod@quotation
25783d8817e4Smiod@emph{Warning:} @command{c++filt} is a new utility, and the details of its
25793d8817e4Smioduser interface are subject to change in future releases.  In particular,
25803d8817e4Smioda command-line option may be required in the the future to decode a name
25813d8817e4Smiodpassed as an argument on the command line; in other words,
25823d8817e4Smiod
25833d8817e4Smiod@example
25843d8817e4Smiodc++filt @var{symbol}
25853d8817e4Smiod@end example
25863d8817e4Smiod
25873d8817e4Smiod@noindent
25883d8817e4Smiodmay in a future release become
25893d8817e4Smiod
25903d8817e4Smiod@example
25913d8817e4Smiodc++filt @var{option} @var{symbol}
25923d8817e4Smiod@end example
25933d8817e4Smiod@end quotation
25943d8817e4Smiod
25953d8817e4Smiod@node addr2line
25963d8817e4Smiod@chapter addr2line
25973d8817e4Smiod
25983d8817e4Smiod@kindex addr2line
25993d8817e4Smiod@cindex address to file name and line number
26003d8817e4Smiod
26013d8817e4Smiod@c man title addr2line convert addresses into file names and line numbers.
26023d8817e4Smiod
26033d8817e4Smiod@smallexample
26043d8817e4Smiod@c man begin SYNOPSIS addr2line
2605*ca868f0eSantonaddr2line [@option{-a}|@option{--addresses}]
2606*ca868f0eSanton          [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
26073d8817e4Smiod          [@option{-C}|@option{--demangle}[=@var{style}]]
26083d8817e4Smiod          [@option{-e} @var{filename}|@option{--exe=}@var{filename}]
26093d8817e4Smiod          [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
26103d8817e4Smiod          [@option{-i}|@option{--inlines}]
26113d8817e4Smiod          [@option{-j}|@option{--section=}@var{name}]
26123d8817e4Smiod          [@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
26133d8817e4Smiod          [addr addr @dots{}]
26143d8817e4Smiod@c man end
26153d8817e4Smiod@end smallexample
26163d8817e4Smiod
26173d8817e4Smiod@c man begin DESCRIPTION addr2line
26183d8817e4Smiod
26193d8817e4Smiod@command{addr2line} translates addresses into file names and line numbers.
26203d8817e4SmiodGiven an address in an executable or an offset in a section of a relocatable
26213d8817e4Smiodobject, it uses the debugging information to figure out which file name and
26223d8817e4Smiodline number are associated with it.
26233d8817e4Smiod
26243d8817e4SmiodThe executable or relocatable object to use is specified with the @option{-e}
26253d8817e4Smiodoption.  The default is the file @file{a.out}.  The section in the relocatable
26263d8817e4Smiodobject to use is specified with the @option{-j} option.
26273d8817e4Smiod
26283d8817e4Smiod@command{addr2line} has two modes of operation.
26293d8817e4Smiod
26303d8817e4SmiodIn the first, hexadecimal addresses are specified on the command line,
26313d8817e4Smiodand @command{addr2line} displays the file name and line number for each
26323d8817e4Smiodaddress.
26333d8817e4Smiod
26343d8817e4SmiodIn the second, @command{addr2line} reads hexadecimal addresses from
26353d8817e4Smiodstandard input, and prints the file name and line number for each
26363d8817e4Smiodaddress on standard output.  In this mode, @command{addr2line} may be used
26373d8817e4Smiodin a pipe to convert dynamically chosen addresses.
26383d8817e4Smiod
26393d8817e4SmiodThe format of the output is @samp{FILENAME:LINENO}.  The file name and
26403d8817e4Smiodline number for each address is printed on a separate line.  If the
26413d8817e4Smiod@command{-f} option is used, then each @samp{FILENAME:LINENO} line is
26423d8817e4Smiodpreceded by a @samp{FUNCTIONNAME} line which is the name of the function
26433d8817e4Smiodcontaining the address.
26443d8817e4Smiod
26453d8817e4SmiodIf the file name or function name can not be determined,
26463d8817e4Smiod@command{addr2line} will print two question marks in their place.  If the
26473d8817e4Smiodline number can not be determined, @command{addr2line} will print 0.
26483d8817e4Smiod
26493d8817e4Smiod@c man end
26503d8817e4Smiod
26513d8817e4Smiod@c man begin OPTIONS addr2line
26523d8817e4Smiod
26533d8817e4SmiodThe long and short forms of options, shown here as alternatives, are
26543d8817e4Smiodequivalent.
26553d8817e4Smiod
26563d8817e4Smiod@table @env
2657*ca868f0eSanton@item -a
2658*ca868f0eSanton@itemx --addresses
2659*ca868f0eSantonDisplay the address before the function name, file and line number information.
2660*ca868f0eSantonThe address is printed with a @samp{0x} prefix to easily identify it.
2661*ca868f0eSanton
26623d8817e4Smiod@item -b @var{bfdname}
26633d8817e4Smiod@itemx --target=@var{bfdname}
26643d8817e4Smiod@cindex object code format
26653d8817e4SmiodSpecify that the object-code format for the object files is
26663d8817e4Smiod@var{bfdname}.
26673d8817e4Smiod
26683d8817e4Smiod@item -C
26693d8817e4Smiod@itemx --demangle[=@var{style}]
26703d8817e4Smiod@cindex demangling in objdump
26713d8817e4SmiodDecode (@dfn{demangle}) low-level symbol names into user-level names.
26723d8817e4SmiodBesides removing any initial underscore prepended by the system, this
26733d8817e4Smiodmakes C++ function names readable.  Different compilers have different
26743d8817e4Smiodmangling styles. The optional demangling style argument can be used to
26753d8817e4Smiodchoose an appropriate demangling style for your compiler. @xref{c++filt},
26763d8817e4Smiodfor more information on demangling.
26773d8817e4Smiod
26783d8817e4Smiod@item -e @var{filename}
26793d8817e4Smiod@itemx --exe=@var{filename}
26803d8817e4SmiodSpecify the name of the executable for which addresses should be
26813d8817e4Smiodtranslated.  The default file is @file{a.out}.
26823d8817e4Smiod
26833d8817e4Smiod@item -f
26843d8817e4Smiod@itemx --functions
26853d8817e4SmiodDisplay function names as well as file and line number information.
26863d8817e4Smiod
26873d8817e4Smiod@item -s
26883d8817e4Smiod@itemx --basenames
26893d8817e4SmiodDisplay only the base of each file name.
26903d8817e4Smiod
26913d8817e4Smiod@item -i
26923d8817e4Smiod@itemx --inlines
26933d8817e4SmiodIf the address belongs to a function that was inlined, the source
26943d8817e4Smiodinformation for all enclosing scopes back to the first non-inlined
26953d8817e4Smiodfunction will also be printed.  For example, if @code{main} inlines
26963d8817e4Smiod@code{callee1} which inlines @code{callee2}, and address is from
26973d8817e4Smiod@code{callee2}, the source information for @code{callee1} and @code{main}
26983d8817e4Smiodwill also be printed.
26993d8817e4Smiod
27003d8817e4Smiod@item -j
27013d8817e4Smiod@itemx --section
27023d8817e4SmiodRead offsets relative to the specified section instead of absolute addresses.
27033d8817e4Smiod@end table
27043d8817e4Smiod
27053d8817e4Smiod@c man end
27063d8817e4Smiod
27073d8817e4Smiod@ignore
27083d8817e4Smiod@c man begin SEEALSO addr2line
27093d8817e4SmiodInfo entries for @file{binutils}.
27103d8817e4Smiod@c man end
27113d8817e4Smiod@end ignore
27123d8817e4Smiod
27133d8817e4Smiod@node nlmconv
27143d8817e4Smiod@chapter nlmconv
27153d8817e4Smiod
27163d8817e4Smiod@command{nlmconv} converts a relocatable object file into a NetWare
27173d8817e4SmiodLoadable Module.
27183d8817e4Smiod
27193d8817e4Smiod@ignore
27203d8817e4Smiod@command{nlmconv} currently works with @samp{i386} object
27213d8817e4Smiodfiles in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
27223d8817e4Smiodobject files in @sc{elf}, or @code{a.out} format@footnote{
27233d8817e4Smiod@command{nlmconv} should work with any @samp{i386} or @sc{sparc} object
27243d8817e4Smiodformat in the Binary File Descriptor library.  It has only been tested
27253d8817e4Smiodwith the above formats.}.
27263d8817e4Smiod@end ignore
27273d8817e4Smiod
27283d8817e4Smiod@quotation
27293d8817e4Smiod@emph{Warning:} @command{nlmconv} is not always built as part of the binary
27303d8817e4Smiodutilities, since it is only useful for NLM targets.
27313d8817e4Smiod@end quotation
27323d8817e4Smiod
27333d8817e4Smiod@c man title nlmconv converts object code into an NLM.
27343d8817e4Smiod
27353d8817e4Smiod@smallexample
27363d8817e4Smiod@c man begin SYNOPSIS nlmconv
27373d8817e4Smiodnlmconv [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
27383d8817e4Smiod        [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
27393d8817e4Smiod        [@option{-T} @var{headerfile}|@option{--header-file=}@var{headerfile}]
27403d8817e4Smiod        [@option{-d}|@option{--debug}] [@option{-l} @var{linker}|@option{--linker=}@var{linker}]
27413d8817e4Smiod        [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
27423d8817e4Smiod        @var{infile} @var{outfile}
27433d8817e4Smiod@c man end
27443d8817e4Smiod@end smallexample
27453d8817e4Smiod
27463d8817e4Smiod@c man begin DESCRIPTION nlmconv
27473d8817e4Smiod
27483d8817e4Smiod@command{nlmconv} converts the relocatable @samp{i386} object file
27493d8817e4Smiod@var{infile} into the NetWare Loadable Module @var{outfile}, optionally
27503d8817e4Smiodreading @var{headerfile} for NLM header information.  For instructions
27513d8817e4Smiodon writing the NLM command file language used in header files, see the
27523d8817e4Smiod@samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
27533d8817e4SmiodDevelopment and Tools Overview}, which is part of the NLM Software
27543d8817e4SmiodDeveloper's Kit (``NLM SDK''), available from Novell, Inc.
27553d8817e4Smiod@command{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
27563d8817e4Smiod@var{infile};
27573d8817e4Smiod@ifclear man
27583d8817e4Smiodsee @ref{BFD,,BFD,ld.info,Using LD}, for more information.
27593d8817e4Smiod@end ifclear
27603d8817e4Smiod
27613d8817e4Smiod@command{nlmconv} can perform a link step.  In other words, you can list
27623d8817e4Smiodmore than one object file for input if you list them in the definitions
27633d8817e4Smiodfile (rather than simply specifying one input file on the command line).
27643d8817e4SmiodIn this case, @command{nlmconv} calls the linker for you.
27653d8817e4Smiod
27663d8817e4Smiod@c man end
27673d8817e4Smiod
27683d8817e4Smiod@c man begin OPTIONS nlmconv
27693d8817e4Smiod
27703d8817e4Smiod@table @env
27713d8817e4Smiod@item -I @var{bfdname}
27723d8817e4Smiod@itemx --input-target=@var{bfdname}
27733d8817e4SmiodObject format of the input file.  @command{nlmconv} can usually determine
27743d8817e4Smiodthe format of a given file (so no default is necessary).
27753d8817e4Smiod@xref{Target Selection}, for more information.
27763d8817e4Smiod
27773d8817e4Smiod@item -O @var{bfdname}
27783d8817e4Smiod@itemx --output-target=@var{bfdname}
27793d8817e4SmiodObject format of the output file.  @command{nlmconv} infers the output
27803d8817e4Smiodformat based on the input format, e.g. for a @samp{i386} input file the
27813d8817e4Smiodoutput format is @samp{nlm32-i386}.
27823d8817e4Smiod@xref{Target Selection}, for more information.
27833d8817e4Smiod
27843d8817e4Smiod@item -T @var{headerfile}
27853d8817e4Smiod@itemx --header-file=@var{headerfile}
27863d8817e4SmiodReads @var{headerfile} for NLM header information.  For instructions on
27873d8817e4Smiodwriting the NLM command file language used in header files, see@ see the
27883d8817e4Smiod@samp{linkers} section, of the @cite{NLM Development and Tools
27893d8817e4SmiodOverview}, which is part of the NLM Software Developer's Kit, available
27903d8817e4Smiodfrom Novell, Inc.
27913d8817e4Smiod
27923d8817e4Smiod@item -d
27933d8817e4Smiod@itemx --debug
27943d8817e4SmiodDisplays (on standard error) the linker command line used by @command{nlmconv}.
27953d8817e4Smiod
27963d8817e4Smiod@item -l @var{linker}
27973d8817e4Smiod@itemx --linker=@var{linker}
27983d8817e4SmiodUse @var{linker} for any linking.  @var{linker} can be an absolute or a
27993d8817e4Smiodrelative pathname.
28003d8817e4Smiod
28013d8817e4Smiod@item -h
28023d8817e4Smiod@itemx --help
28033d8817e4SmiodPrints a usage summary.
28043d8817e4Smiod
28053d8817e4Smiod@item -V
28063d8817e4Smiod@itemx --version
28073d8817e4SmiodPrints the version number for @command{nlmconv}.
28083d8817e4Smiod@end table
28093d8817e4Smiod
28103d8817e4Smiod@c man end
28113d8817e4Smiod
28123d8817e4Smiod@ignore
28133d8817e4Smiod@c man begin SEEALSO nlmconv
28143d8817e4Smiodthe Info entries for @file{binutils}.
28153d8817e4Smiod@c man end
28163d8817e4Smiod@end ignore
28173d8817e4Smiod
28183d8817e4Smiod@node windres
28193d8817e4Smiod@chapter windres
28203d8817e4Smiod
28213d8817e4Smiod@command{windres} may be used to manipulate Windows resources.
28223d8817e4Smiod
28233d8817e4Smiod@quotation
28243d8817e4Smiod@emph{Warning:} @command{windres} is not always built as part of the binary
28253d8817e4Smiodutilities, since it is only useful for Windows targets.
28263d8817e4Smiod@end quotation
28273d8817e4Smiod
28283d8817e4Smiod@c man title windres manipulate Windows resources.
28293d8817e4Smiod
28303d8817e4Smiod@smallexample
28313d8817e4Smiod@c man begin SYNOPSIS windres
28323d8817e4Smiodwindres [options] [input-file] [output-file]
28333d8817e4Smiod@c man end
28343d8817e4Smiod@end smallexample
28353d8817e4Smiod
28363d8817e4Smiod@c man begin DESCRIPTION windres
28373d8817e4Smiod
28383d8817e4Smiod@command{windres} reads resources from an input file and copies them into
28393d8817e4Smiodan output file.  Either file may be in one of three formats:
28403d8817e4Smiod
28413d8817e4Smiod@table @code
28423d8817e4Smiod@item rc
28433d8817e4SmiodA text format read by the Resource Compiler.
28443d8817e4Smiod
28453d8817e4Smiod@item res
28463d8817e4SmiodA binary format generated by the Resource Compiler.
28473d8817e4Smiod
28483d8817e4Smiod@item coff
28493d8817e4SmiodA COFF object or executable.
28503d8817e4Smiod@end table
28513d8817e4Smiod
28523d8817e4SmiodThe exact description of these different formats is available in
28533d8817e4Smioddocumentation from Microsoft.
28543d8817e4Smiod
28553d8817e4SmiodWhen @command{windres} converts from the @code{rc} format to the @code{res}
28563d8817e4Smiodformat, it is acting like the Windows Resource Compiler.  When
28573d8817e4Smiod@command{windres} converts from the @code{res} format to the @code{coff}
28583d8817e4Smiodformat, it is acting like the Windows @code{CVTRES} program.
28593d8817e4Smiod
28603d8817e4SmiodWhen @command{windres} generates an @code{rc} file, the output is similar
28613d8817e4Smiodbut not identical to the format expected for the input.  When an input
28623d8817e4Smiod@code{rc} file refers to an external filename, an output @code{rc} file
28633d8817e4Smiodwill instead include the file contents.
28643d8817e4Smiod
28653d8817e4SmiodIf the input or output format is not specified, @command{windres} will
28663d8817e4Smiodguess based on the file name, or, for the input file, the file contents.
28673d8817e4SmiodA file with an extension of @file{.rc} will be treated as an @code{rc}
28683d8817e4Smiodfile, a file with an extension of @file{.res} will be treated as a
28693d8817e4Smiod@code{res} file, and a file with an extension of @file{.o} or
28703d8817e4Smiod@file{.exe} will be treated as a @code{coff} file.
28713d8817e4Smiod
28723d8817e4SmiodIf no output file is specified, @command{windres} will print the resources
28733d8817e4Smiodin @code{rc} format to standard output.
28743d8817e4Smiod
28753d8817e4SmiodThe normal use is for you to write an @code{rc} file, use @command{windres}
28763d8817e4Smiodto convert it to a COFF object file, and then link the COFF file into
28773d8817e4Smiodyour application.  This will make the resources described in the
28783d8817e4Smiod@code{rc} file available to Windows.
28793d8817e4Smiod
28803d8817e4Smiod@c man end
28813d8817e4Smiod
28823d8817e4Smiod@c man begin OPTIONS windres
28833d8817e4Smiod
28843d8817e4Smiod@table @env
28853d8817e4Smiod@item -i @var{filename}
28863d8817e4Smiod@itemx --input @var{filename}
28873d8817e4SmiodThe name of the input file.  If this option is not used, then
28883d8817e4Smiod@command{windres} will use the first non-option argument as the input file
28893d8817e4Smiodname.  If there are no non-option arguments, then @command{windres} will
28903d8817e4Smiodread from standard input.  @command{windres} can not read a COFF file from
28913d8817e4Smiodstandard input.
28923d8817e4Smiod
28933d8817e4Smiod@item -o @var{filename}
28943d8817e4Smiod@itemx --output @var{filename}
28953d8817e4SmiodThe name of the output file.  If this option is not used, then
28963d8817e4Smiod@command{windres} will use the first non-option argument, after any used
28973d8817e4Smiodfor the input file name, as the output file name.  If there is no
28983d8817e4Smiodnon-option argument, then @command{windres} will write to standard output.
28993d8817e4Smiod@command{windres} can not write a COFF file to standard output.  Note,
29003d8817e4Smiodfor compatability with @command{rc} the option @option{-fo} is also
29013d8817e4Smiodaccepted, but its use is not recommended.
29023d8817e4Smiod
29033d8817e4Smiod@item -J @var{format}
29043d8817e4Smiod@itemx --input-format @var{format}
29053d8817e4SmiodThe input format to read.  @var{format} may be @samp{res}, @samp{rc}, or
29063d8817e4Smiod@samp{coff}.  If no input format is specified, @command{windres} will
29073d8817e4Smiodguess, as described above.
29083d8817e4Smiod
29093d8817e4Smiod@item -O @var{format}
29103d8817e4Smiod@itemx --output-format @var{format}
29113d8817e4SmiodThe output format to generate.  @var{format} may be @samp{res},
29123d8817e4Smiod@samp{rc}, or @samp{coff}.  If no output format is specified,
29133d8817e4Smiod@command{windres} will guess, as described above.
29143d8817e4Smiod
29153d8817e4Smiod@item -F @var{target}
29163d8817e4Smiod@itemx --target @var{target}
29173d8817e4SmiodSpecify the BFD format to use for a COFF file as input or output.  This
29183d8817e4Smiodis a BFD target name; you can use the @option{--help} option to see a list
29193d8817e4Smiodof supported targets.  Normally @command{windres} will use the default
29203d8817e4Smiodformat, which is the first one listed by the @option{--help} option.
29213d8817e4Smiod@ifclear man
29223d8817e4Smiod@ref{Target Selection}.
29233d8817e4Smiod@end ifclear
29243d8817e4Smiod
29253d8817e4Smiod@item --preprocessor @var{program}
29263d8817e4SmiodWhen @command{windres} reads an @code{rc} file, it runs it through the C
29273d8817e4Smiodpreprocessor first.  This option may be used to specify the preprocessor
29283d8817e4Smiodto use, including any leading arguments.  The default preprocessor
29293d8817e4Smiodargument is @code{gcc -E -xc-header -DRC_INVOKED}.
29303d8817e4Smiod
29313d8817e4Smiod@item -I @var{directory}
29323d8817e4Smiod@itemx --include-dir @var{directory}
29333d8817e4SmiodSpecify an include directory to use when reading an @code{rc} file.
29343d8817e4Smiod@command{windres} will pass this to the preprocessor as an @option{-I}
29353d8817e4Smiodoption.  @command{windres} will also search this directory when looking for
29363d8817e4Smiodfiles named in the @code{rc} file.  If the argument passed to this command
29373d8817e4Smiodmatches any of the supported @var{formats} (as descrived in the @option{-J}
29383d8817e4Smiodoption), it will issue a deprecation warning, and behave just like the
29393d8817e4Smiod@option{-J} option.  New programs should not use this behaviour.  If a
29403d8817e4Smioddirectory happens to match a @var{format}, simple prefix it with @samp{./}
29413d8817e4Smiodto disable the backward compatibility.
29423d8817e4Smiod
29433d8817e4Smiod@item -D @var{target}
29443d8817e4Smiod@itemx --define @var{sym}[=@var{val}]
29453d8817e4SmiodSpecify a @option{-D} option to pass to the preprocessor when reading an
29463d8817e4Smiod@code{rc} file.
29473d8817e4Smiod
29483d8817e4Smiod@item -U @var{target}
29493d8817e4Smiod@itemx --undefine @var{sym}
29503d8817e4SmiodSpecify a @option{-U} option to pass to the preprocessor when reading an
29513d8817e4Smiod@code{rc} file.
29523d8817e4Smiod
29533d8817e4Smiod@item -r
29543d8817e4SmiodIgnored for compatibility with rc.
29553d8817e4Smiod
29563d8817e4Smiod@item -v
29573d8817e4SmiodEnable verbose mode.  This tells you what the preprocessor is if you
29583d8817e4Smioddidn't specify one.
29593d8817e4Smiod
29603d8817e4Smiod@item -l @var{val}
29613d8817e4Smiod@item --language @var{val}
29623d8817e4SmiodSpecify the default language to use when reading an @code{rc} file.
29633d8817e4Smiod@var{val} should be a hexadecimal language code.  The low eight bits are
29643d8817e4Smiodthe language, and the high eight bits are the sublanguage.
29653d8817e4Smiod
29663d8817e4Smiod@item --use-temp-file
29673d8817e4SmiodUse a temporary file to instead of using popen to read the output of
29683d8817e4Smiodthe preprocessor. Use this option if the popen implementation is buggy
29693d8817e4Smiodon the host (eg., certain non-English language versions of Windows 95 and
29703d8817e4SmiodWindows 98 are known to have buggy popen where the output will instead
29713d8817e4Smiodgo the console).
29723d8817e4Smiod
29733d8817e4Smiod@item --no-use-temp-file
29743d8817e4SmiodUse popen, not a temporary file, to read the output of the preprocessor.
29753d8817e4SmiodThis is the default behaviour.
29763d8817e4Smiod
29773d8817e4Smiod@item -h
29783d8817e4Smiod@item --help
29793d8817e4SmiodPrints a usage summary.
29803d8817e4Smiod
29813d8817e4Smiod@item -V
29823d8817e4Smiod@item --version
29833d8817e4SmiodPrints the version number for @command{windres}.
29843d8817e4Smiod
29853d8817e4Smiod@item --yydebug
29863d8817e4SmiodIf @command{windres} is compiled with @code{YYDEBUG} defined as @code{1},
29873d8817e4Smiodthis will turn on parser debugging.
29883d8817e4Smiod@end table
29893d8817e4Smiod
29903d8817e4Smiod@c man end
29913d8817e4Smiod
29923d8817e4Smiod@ignore
29933d8817e4Smiod@c man begin SEEALSO windres
29943d8817e4Smiodthe Info entries for @file{binutils}.
29953d8817e4Smiod@c man end
29963d8817e4Smiod@end ignore
29973d8817e4Smiod
29983d8817e4Smiod@node dlltool
29993d8817e4Smiod@chapter dlltool
30003d8817e4Smiod@cindex DLL
30013d8817e4Smiod@kindex dlltool
30023d8817e4Smiod
30033d8817e4Smiod@command{dlltool} is used to create the files needed to create dynamic
30043d8817e4Smiodlink libraries (DLLs) on systems which understand PE format image
30053d8817e4Smiodfiles such as Windows.  A DLL contains an export table which contains
30063d8817e4Smiodinformation that the runtime loader needs to resolve references from a
30073d8817e4Smiodreferencing program.
30083d8817e4Smiod
30093d8817e4SmiodThe export table is generated by this program by reading in a
30103d8817e4Smiod@file{.def} file or scanning the @file{.a} and @file{.o} files which
30113d8817e4Smiodwill be in the DLL.  A @file{.o} file can contain information in
30123d8817e4Smiodspecial @samp{.drectve} sections with export information.
30133d8817e4Smiod
30143d8817e4Smiod@quotation
30153d8817e4Smiod@emph{Note:} @command{dlltool} is not always built as part of the
30163d8817e4Smiodbinary utilities, since it is only useful for those targets which
30173d8817e4Smiodsupport DLLs.
30183d8817e4Smiod@end quotation
30193d8817e4Smiod
30203d8817e4Smiod@c man title dlltool Create files needed to build and use DLLs.
30213d8817e4Smiod
30223d8817e4Smiod@smallexample
30233d8817e4Smiod@c man begin SYNOPSIS dlltool
30243d8817e4Smioddlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
30253d8817e4Smiod        [@option{-b}|@option{--base-file} @var{base-file-name}]
30263d8817e4Smiod        [@option{-e}|@option{--output-exp} @var{exports-file-name}]
30273d8817e4Smiod        [@option{-z}|@option{--output-def} @var{def-file-name}]
30283d8817e4Smiod        [@option{-l}|@option{--output-lib} @var{library-file-name}]
30293d8817e4Smiod        [@option{--export-all-symbols}] [@option{--no-export-all-symbols}]
30303d8817e4Smiod        [@option{--exclude-symbols} @var{list}]
30313d8817e4Smiod        [@option{--no-default-excludes}]
30323d8817e4Smiod        [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}]
30333d8817e4Smiod        [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
30343d8817e4Smiod        [@option{-a}|@option{--add-indirect}]
30353d8817e4Smiod        [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}]
30363d8817e4Smiod        [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
30373d8817e4Smiod        [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
30383d8817e4Smiod        [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}] [@option{-i}|@option{--interwork}]
30393d8817e4Smiod        [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
30403d8817e4Smiod        [@option{-v}|@option{--verbose}]
30413d8817e4Smiod        [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
30423d8817e4Smiod        [object-file @dots{}]
30433d8817e4Smiod@c man end
30443d8817e4Smiod@end smallexample
30453d8817e4Smiod
30463d8817e4Smiod@c man begin DESCRIPTION dlltool
30473d8817e4Smiod
30483d8817e4Smiod@command{dlltool} reads its inputs, which can come from the @option{-d} and
30493d8817e4Smiod@option{-b} options as well as object files specified on the command
30503d8817e4Smiodline.  It then processes these inputs and if the @option{-e} option has
30513d8817e4Smiodbeen specified it creates a exports file.  If the @option{-l} option
30523d8817e4Smiodhas been specified it creates a library file and if the @option{-z} option
30533d8817e4Smiodhas been specified it creates a def file.  Any or all of the @option{-e},
30543d8817e4Smiod@option{-l} and @option{-z} options can be present in one invocation of
30553d8817e4Smioddlltool.
30563d8817e4Smiod
30573d8817e4SmiodWhen creating a DLL, along with the source for the DLL, it is necessary
30583d8817e4Smiodto have three other files.  @command{dlltool} can help with the creation of
30593d8817e4Smiodthese files.
30603d8817e4Smiod
30613d8817e4SmiodThe first file is a @file{.def} file which specifies which functions are
30623d8817e4Smiodexported from the DLL, which functions the DLL imports, and so on.  This
30633d8817e4Smiodis a text file and can be created by hand, or @command{dlltool} can be used
30643d8817e4Smiodto create it using the @option{-z} option.  In this case @command{dlltool}
30653d8817e4Smiodwill scan the object files specified on its command line looking for
30663d8817e4Smiodthose functions which have been specially marked as being exported and
30673d8817e4Smiodput entries for them in the @file{.def} file it creates.
30683d8817e4Smiod
30693d8817e4SmiodIn order to mark a function as being exported from a DLL, it needs to
30703d8817e4Smiodhave an @option{-export:<name_of_function>} entry in the @samp{.drectve}
30713d8817e4Smiodsection of the object file.  This can be done in C by using the
30723d8817e4Smiodasm() operator:
30733d8817e4Smiod
30743d8817e4Smiod@smallexample
30753d8817e4Smiod  asm (".section .drectve");
30763d8817e4Smiod  asm (".ascii \"-export:my_func\"");
30773d8817e4Smiod
30783d8817e4Smiod  int my_func (void) @{ @dots{} @}
30793d8817e4Smiod@end smallexample
30803d8817e4Smiod
30813d8817e4SmiodThe second file needed for DLL creation is an exports file.  This file
30823d8817e4Smiodis linked with the object files that make up the body of the DLL and it
30833d8817e4Smiodhandles the interface between the DLL and the outside world.  This is a
30843d8817e4Smiodbinary file and it can be created by giving the @option{-e} option to
30853d8817e4Smiod@command{dlltool} when it is creating or reading in a @file{.def} file.
30863d8817e4Smiod
30873d8817e4SmiodThe third file needed for DLL creation is the library file that programs
30883d8817e4Smiodwill link with in order to access the functions in the DLL.  This file
30893d8817e4Smiodcan be created by giving the @option{-l} option to dlltool when it
30903d8817e4Smiodis creating or reading in a @file{.def} file.
30913d8817e4Smiod
30923d8817e4Smiod@command{dlltool} builds the library file by hand, but it builds the
30933d8817e4Smiodexports file by creating temporary files containing assembler statements
30943d8817e4Smiodand then assembling these.  The @option{-S} command line option can be
30953d8817e4Smiodused to specify the path to the assembler that dlltool will use,
30963d8817e4Smiodand the @option{-f} option can be used to pass specific flags to that
30973d8817e4Smiodassembler.  The @option{-n} can be used to prevent dlltool from deleting
30983d8817e4Smiodthese temporary assembler files when it is done, and if @option{-n} is
30993d8817e4Smiodspecified twice then this will prevent dlltool from deleting the
31003d8817e4Smiodtemporary object files it used to build the library.
31013d8817e4Smiod
31023d8817e4SmiodHere is an example of creating a DLL from a source file @samp{dll.c} and
31033d8817e4Smiodalso creating a program (from an object file called @samp{program.o})
31043d8817e4Smiodthat uses that DLL:
31053d8817e4Smiod
31063d8817e4Smiod@smallexample
31073d8817e4Smiod  gcc -c dll.c
31083d8817e4Smiod  dlltool -e exports.o -l dll.lib dll.o
31093d8817e4Smiod  gcc dll.o exports.o -o dll.dll
31103d8817e4Smiod  gcc program.o dll.lib -o program
31113d8817e4Smiod@end smallexample
31123d8817e4Smiod
31133d8817e4Smiod@c man end
31143d8817e4Smiod
31153d8817e4Smiod@c man begin OPTIONS dlltool
31163d8817e4Smiod
31173d8817e4SmiodThe command line options have the following meanings:
31183d8817e4Smiod
31193d8817e4Smiod@table @env
31203d8817e4Smiod
31213d8817e4Smiod@item -d @var{filename}
31223d8817e4Smiod@itemx --input-def @var{filename}
31233d8817e4Smiod@cindex input .def file
31243d8817e4SmiodSpecifies the name of a @file{.def} file to be read in and processed.
31253d8817e4Smiod
31263d8817e4Smiod@item -b @var{filename}
31273d8817e4Smiod@itemx --base-file @var{filename}
31283d8817e4Smiod@cindex base files
31293d8817e4SmiodSpecifies the name of a base file to be read in and processed.  The
31303d8817e4Smiodcontents of this file will be added to the relocation section in the
31313d8817e4Smiodexports file generated by dlltool.
31323d8817e4Smiod
31333d8817e4Smiod@item -e @var{filename}
31343d8817e4Smiod@itemx --output-exp @var{filename}
31353d8817e4SmiodSpecifies the name of the export file to be created by dlltool.
31363d8817e4Smiod
31373d8817e4Smiod@item -z @var{filename}
31383d8817e4Smiod@itemx --output-def @var{filename}
31393d8817e4SmiodSpecifies the name of the @file{.def} file to be created by dlltool.
31403d8817e4Smiod
31413d8817e4Smiod@item -l @var{filename}
31423d8817e4Smiod@itemx --output-lib @var{filename}
31433d8817e4SmiodSpecifies the name of the library file to be created by dlltool.
31443d8817e4Smiod
31453d8817e4Smiod@item --export-all-symbols
31463d8817e4SmiodTreat all global and weak defined symbols found in the input object
31473d8817e4Smiodfiles as symbols to be exported.  There is a small list of symbols which
31483d8817e4Smiodare not exported by default; see the @option{--no-default-excludes}
31493d8817e4Smiodoption.  You may add to the list of symbols to not export by using the
31503d8817e4Smiod@option{--exclude-symbols} option.
31513d8817e4Smiod
31523d8817e4Smiod@item --no-export-all-symbols
31533d8817e4SmiodOnly export symbols explicitly listed in an input @file{.def} file or in
31543d8817e4Smiod@samp{.drectve} sections in the input object files.  This is the default
31553d8817e4Smiodbehaviour.  The @samp{.drectve} sections are created by @samp{dllexport}
31563d8817e4Smiodattributes in the source code.
31573d8817e4Smiod
31583d8817e4Smiod@item --exclude-symbols @var{list}
31593d8817e4SmiodDo not export the symbols in @var{list}.  This is a list of symbol names
31603d8817e4Smiodseparated by comma or colon characters.  The symbol names should not
31613d8817e4Smiodcontain a leading underscore.  This is only meaningful when
31623d8817e4Smiod@option{--export-all-symbols} is used.
31633d8817e4Smiod
31643d8817e4Smiod@item --no-default-excludes
31653d8817e4SmiodWhen @option{--export-all-symbols} is used, it will by default avoid
31663d8817e4Smiodexporting certain special symbols.  The current list of symbols to avoid
31673d8817e4Smiodexporting is @samp{DllMain@@12}, @samp{DllEntryPoint@@0},
31683d8817e4Smiod@samp{impure_ptr}.  You may use the @option{--no-default-excludes} option
31693d8817e4Smiodto go ahead and export these special symbols.  This is only meaningful
31703d8817e4Smiodwhen @option{--export-all-symbols} is used.
31713d8817e4Smiod
31723d8817e4Smiod@item -S @var{path}
31733d8817e4Smiod@itemx --as @var{path}
31743d8817e4SmiodSpecifies the path, including the filename, of the assembler to be used
31753d8817e4Smiodto create the exports file.
31763d8817e4Smiod
31773d8817e4Smiod@item -f @var{options}
31783d8817e4Smiod@itemx --as-flags @var{options}
31793d8817e4SmiodSpecifies any specific command line options to be passed to the
31803d8817e4Smiodassembler when building the exports file.  This option will work even if
31813d8817e4Smiodthe @option{-S} option is not used.  This option only takes one argument,
31823d8817e4Smiodand if it occurs more than once on the command line, then later
31833d8817e4Smiodoccurrences will override earlier occurrences.  So if it is necessary to
31843d8817e4Smiodpass multiple options to the assembler they should be enclosed in
31853d8817e4Smioddouble quotes.
31863d8817e4Smiod
31873d8817e4Smiod@item -D @var{name}
31883d8817e4Smiod@itemx --dll-name @var{name}
31893d8817e4SmiodSpecifies the name to be stored in the @file{.def} file as the name of
31903d8817e4Smiodthe DLL when the @option{-e} option is used.  If this option is not
31913d8817e4Smiodpresent, then the filename given to the @option{-e} option will be
31923d8817e4Smiodused as the name of the DLL.
31933d8817e4Smiod
31943d8817e4Smiod@item -m @var{machine}
31953d8817e4Smiod@itemx -machine @var{machine}
31963d8817e4SmiodSpecifies the type of machine for which the library file should be
31973d8817e4Smiodbuilt.  @command{dlltool} has a built in default type, depending upon how
31983d8817e4Smiodit was created, but this option can be used to override that.  This is
31993d8817e4Smiodnormally only useful when creating DLLs for an ARM processor, when the
32003d8817e4Smiodcontents of the DLL are actually encode using Thumb instructions.
32013d8817e4Smiod
32023d8817e4Smiod@item -a
32033d8817e4Smiod@itemx --add-indirect
32043d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports file it
32053d8817e4Smiodshould add a section which allows the exported functions to be
32063d8817e4Smiodreferenced without using the import library.  Whatever the hell that
32073d8817e4Smiodmeans!
32083d8817e4Smiod
32093d8817e4Smiod@item -U
32103d8817e4Smiod@itemx --add-underscore
32113d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports file it
32123d8817e4Smiodshould prepend an underscore to the names of @emph{all} exported symbols.
32133d8817e4Smiod
32143d8817e4Smiod@item --add-stdcall-underscore
32153d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports file it
32163d8817e4Smiodshould prepend an underscore to the names of exported @emph{stdcall}
32173d8817e4Smiodfunctions. Variable names and non-stdcall function names are not modified.
32183d8817e4SmiodThis option is useful when creating GNU-compatible import libs for third
32193d8817e4Smiodparty DLLs that were built with MS-Windows tools.
32203d8817e4Smiod
32213d8817e4Smiod@item -k
32223d8817e4Smiod@itemx --kill-at
32233d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports file it
32243d8817e4Smiodshould not append the string @samp{@@ <number>}.  These numbers are
32253d8817e4Smiodcalled ordinal numbers and they represent another way of accessing the
32263d8817e4Smiodfunction in a DLL, other than by name.
32273d8817e4Smiod
32283d8817e4Smiod@item -A
32293d8817e4Smiod@itemx --add-stdcall-alias
32303d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports file it
32313d8817e4Smiodshould add aliases for stdcall symbols without @samp{@@ <number>}
32323d8817e4Smiodin addition to the symbols with @samp{@@ <number>}.
32333d8817e4Smiod
32343d8817e4Smiod@item -p
32353d8817e4Smiod@itemx --ext-prefix-alias @var{prefix}
32363d8817e4SmiodCauses @command{dlltool} to create external aliases for all DLL
32373d8817e4Smiodimports with the specified prefix.  The aliases are created for both
32383d8817e4Smiodexternal and import symbols with no leading underscore.
32393d8817e4Smiod
32403d8817e4Smiod@item -x
32413d8817e4Smiod@itemx --no-idata4
32423d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports and library
32433d8817e4Smiodfiles it should omit the @code{.idata4} section.  This is for compatibility
32443d8817e4Smiodwith certain operating systems.
32453d8817e4Smiod
32463d8817e4Smiod@item -c
32473d8817e4Smiod@itemx --no-idata5
32483d8817e4SmiodSpecifies that when @command{dlltool} is creating the exports and library
32493d8817e4Smiodfiles it should omit the @code{.idata5} section.  This is for compatibility
32503d8817e4Smiodwith certain operating systems.
32513d8817e4Smiod
32523d8817e4Smiod@item -i
32533d8817e4Smiod@itemx --interwork
32543d8817e4SmiodSpecifies that @command{dlltool} should mark the objects in the library
32553d8817e4Smiodfile and exports file that it produces as supporting interworking
32563d8817e4Smiodbetween ARM and Thumb code.
32573d8817e4Smiod
32583d8817e4Smiod@item -n
32593d8817e4Smiod@itemx --nodelete
32603d8817e4SmiodMakes @command{dlltool} preserve the temporary assembler files it used to
32613d8817e4Smiodcreate the exports file.  If this option is repeated then dlltool will
32623d8817e4Smiodalso preserve the temporary object files it uses to create the library
32633d8817e4Smiodfile.
32643d8817e4Smiod
32653d8817e4Smiod@item -t @var{prefix}
32663d8817e4Smiod@itemx --temp-prefix @var{prefix}
32673d8817e4SmiodMakes @command{dlltool} use @var{prefix} when constructing the names of
32683d8817e4Smiodtemporary assembler and object files.  By default, the temp file prefix
32693d8817e4Smiodis generated from the pid.
32703d8817e4Smiod
32713d8817e4Smiod@item -v
32723d8817e4Smiod@itemx --verbose
32733d8817e4SmiodMake dlltool describe what it is doing.
32743d8817e4Smiod
32753d8817e4Smiod@item -h
32763d8817e4Smiod@itemx --help
32773d8817e4SmiodDisplays a list of command line options and then exits.
32783d8817e4Smiod
32793d8817e4Smiod@item -V
32803d8817e4Smiod@itemx --version
32813d8817e4SmiodDisplays dlltool's version number and then exits.
32823d8817e4Smiod
32833d8817e4Smiod@end table
32843d8817e4Smiod
32853d8817e4Smiod@c man end
32863d8817e4Smiod
32873d8817e4Smiod@menu
32883d8817e4Smiod* def file format::             The format of the dlltool @file{.def} file
32893d8817e4Smiod@end menu
32903d8817e4Smiod
32913d8817e4Smiod@node def file format
32923d8817e4Smiod@section The format of the @command{dlltool} @file{.def} file
32933d8817e4Smiod
32943d8817e4SmiodA @file{.def} file contains any number of the following commands:
32953d8817e4Smiod
32963d8817e4Smiod@table @asis
32973d8817e4Smiod
32983d8817e4Smiod@item @code{NAME} @var{name} @code{[ ,} @var{base} @code{]}
32993d8817e4SmiodThe result is going to be named @var{name}@code{.exe}.
33003d8817e4Smiod
33013d8817e4Smiod@item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]}
33023d8817e4SmiodThe result is going to be named @var{name}@code{.dll}.
33033d8817e4Smiod
33043d8817e4Smiod@item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2} @code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.} @var{external-name} @code{) )}
33053d8817e4Smiod@item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *}
33063d8817e4SmiodDeclares @var{name1} as an exported symbol from the DLL, with optional
33073d8817e4Smiodordinal number @var{integer}, or declares @var{name1} as an alias
33083d8817e4Smiod(forward) of the function @var{external-name} in the DLL
33093d8817e4Smiod@var{module-name}.
33103d8817e4Smiod
33113d8817e4Smiod@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{) ) *}
33123d8817e4SmiodDeclares that @var{external-name} or the exported function whose
33133d8817e4Smiodordinal number is @var{integer} is to be imported from the file
33143d8817e4Smiod@var{module-name}.  If @var{internal-name} is specified then this is
33153d8817e4Smiodthe name that the imported function will be referred to in the body of
33163d8817e4Smiodthe DLL.
33173d8817e4Smiod
33183d8817e4Smiod@item @code{DESCRIPTION} @var{string}
33193d8817e4SmiodPuts @var{string} into the output @file{.exp} file in the
33203d8817e4Smiod@code{.rdata} section.
33213d8817e4Smiod
33223d8817e4Smiod@item @code{STACKSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
33233d8817e4Smiod@item @code{HEAPSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
33243d8817e4SmiodGenerates @code{--stack} or @code{--heap}
33253d8817e4Smiod@var{number-reserve},@var{number-commit} in the output @code{.drectve}
33263d8817e4Smiodsection.  The linker will see this and act upon it.
33273d8817e4Smiod
33283d8817e4Smiod@item @code{CODE} @var{attr} @code{+}
33293d8817e4Smiod@item @code{DATA} @var{attr} @code{+}
33303d8817e4Smiod@item @code{SECTIONS (} @var{section-name} @var{attr}@code{ + ) *}
33313d8817e4SmiodGenerates @code{--attr} @var{section-name} @var{attr} in the output
33323d8817e4Smiod@code{.drectve} section, where @var{attr} is one of @code{READ},
33333d8817e4Smiod@code{WRITE}, @code{EXECUTE} or @code{SHARED}.  The linker will see
33343d8817e4Smiodthis and act upon it.
33353d8817e4Smiod
33363d8817e4Smiod@end table
33373d8817e4Smiod
33383d8817e4Smiod@ignore
33393d8817e4Smiod@c man begin SEEALSO dlltool
33403d8817e4SmiodThe Info pages for @file{binutils}.
33413d8817e4Smiod@c man end
33423d8817e4Smiod@end ignore
33433d8817e4Smiod
33443d8817e4Smiod@node readelf
33453d8817e4Smiod@chapter readelf
33463d8817e4Smiod
33473d8817e4Smiod@cindex ELF file information
33483d8817e4Smiod@kindex readelf
33493d8817e4Smiod
33503d8817e4Smiod@c man title readelf Displays information about ELF files.
33513d8817e4Smiod
33523d8817e4Smiod@smallexample
33533d8817e4Smiod@c man begin SYNOPSIS readelf
33543d8817e4Smiodreadelf [@option{-a}|@option{--all}]
33553d8817e4Smiod        [@option{-h}|@option{--file-header}]
33563d8817e4Smiod        [@option{-l}|@option{--program-headers}|@option{--segments}]
33573d8817e4Smiod        [@option{-S}|@option{--section-headers}|@option{--sections}]
33583d8817e4Smiod        [@option{-g}|@option{--section-groups}]
33593d8817e4Smiod        [@option{-t}|@option{--section-details}]
33603d8817e4Smiod        [@option{-e}|@option{--headers}]
33613d8817e4Smiod        [@option{-s}|@option{--syms}|@option{--symbols}]
33623d8817e4Smiod        [@option{-n}|@option{--notes}]
33633d8817e4Smiod        [@option{-r}|@option{--relocs}]
33643d8817e4Smiod        [@option{-u}|@option{--unwind}]
33653d8817e4Smiod        [@option{-d}|@option{--dynamic}]
33663d8817e4Smiod        [@option{-V}|@option{--version-info}]
33673d8817e4Smiod        [@option{-A}|@option{--arch-specific}]
33683d8817e4Smiod        [@option{-D}|@option{--use-dynamic}]
33693d8817e4Smiod        [@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
33703d8817e4Smiod        [@option{-w[liaprmfFsoR]}|
33713d8817e4Smiod         @option{--debug-dump}[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]]
33723d8817e4Smiod        [@option{-I}|@option{-histogram}]
33733d8817e4Smiod        [@option{-v}|@option{--version}]
33743d8817e4Smiod        [@option{-W}|@option{--wide}]
33753d8817e4Smiod        [@option{-H}|@option{--help}]
33763d8817e4Smiod        @var{elffile}@dots{}
33773d8817e4Smiod@c man end
33783d8817e4Smiod@end smallexample
33793d8817e4Smiod
33803d8817e4Smiod@c man begin DESCRIPTION readelf
33813d8817e4Smiod
33823d8817e4Smiod@command{readelf} displays information about one or more ELF format object
33833d8817e4Smiodfiles.  The options control what particular information to display.
33843d8817e4Smiod
33853d8817e4Smiod@var{elffile}@dots{} are the object files to be examined.  32-bit and
33863d8817e4Smiod64-bit ELF files are supported, as are archives containing ELF files.
33873d8817e4Smiod
33883d8817e4SmiodThis program performs a similar function to @command{objdump} but it
33893d8817e4Smiodgoes into more detail and it exists independently of the @sc{bfd}
33903d8817e4Smiodlibrary, so if there is a bug in @sc{bfd} then readelf will not be
33913d8817e4Smiodaffected.
33923d8817e4Smiod
33933d8817e4Smiod@c man end
33943d8817e4Smiod
33953d8817e4Smiod@c man begin OPTIONS readelf
33963d8817e4Smiod
33973d8817e4SmiodThe long and short forms of options, shown here as alternatives, are
33983d8817e4Smiodequivalent.  At least one option besides @samp{-v} or @samp{-H} must be
33993d8817e4Smiodgiven.
34003d8817e4Smiod
34013d8817e4Smiod@table @env
34023d8817e4Smiod@item -a
34033d8817e4Smiod@itemx --all
34043d8817e4SmiodEquivalent to specifiying @option{--file-header},
34053d8817e4Smiod@option{--program-headers}, @option{--sections}, @option{--symbols},
34063d8817e4Smiod@option{--relocs}, @option{--dynamic}, @option{--notes} and
34073d8817e4Smiod@option{--version-info}.
34083d8817e4Smiod
34093d8817e4Smiod@item -h
34103d8817e4Smiod@itemx --file-header
34113d8817e4Smiod@cindex ELF file header information
34123d8817e4SmiodDisplays the information contained in the ELF header at the start of the
34133d8817e4Smiodfile.
34143d8817e4Smiod
34153d8817e4Smiod@item -l
34163d8817e4Smiod@itemx --program-headers
34173d8817e4Smiod@itemx --segments
34183d8817e4Smiod@cindex ELF program header information
34193d8817e4Smiod@cindex ELF segment information
34203d8817e4SmiodDisplays the information contained in the file's segment headers, if it
34213d8817e4Smiodhas any.
34223d8817e4Smiod
34233d8817e4Smiod@item -S
34243d8817e4Smiod@itemx --sections
34253d8817e4Smiod@itemx --section-headers
34263d8817e4Smiod@cindex ELF section information
34273d8817e4SmiodDisplays the information contained in the file's section headers, if it
34283d8817e4Smiodhas any.
34293d8817e4Smiod
34303d8817e4Smiod@item -g
34313d8817e4Smiod@itemx --section-groups
34323d8817e4Smiod@cindex ELF section group information
34333d8817e4SmiodDisplays the information contained in the file's section groups, if it
34343d8817e4Smiodhas any.
34353d8817e4Smiod
34363d8817e4Smiod@item -t
34373d8817e4Smiod@itemx --section-details
34383d8817e4Smiod@cindex ELF section information
34393d8817e4SmiodDisplays the detailed section information. Implies @option{-S}.
34403d8817e4Smiod
34413d8817e4Smiod@item -s
34423d8817e4Smiod@itemx --symbols
34433d8817e4Smiod@itemx --syms
34443d8817e4Smiod@cindex ELF symbol table information
34453d8817e4SmiodDisplays the entries in symbol table section of the file, if it has one.
34463d8817e4Smiod
34473d8817e4Smiod@item -e
34483d8817e4Smiod@itemx --headers
34493d8817e4SmiodDisplay all the headers in the file.  Equivalent to @option{-h -l -S}.
34503d8817e4Smiod
34513d8817e4Smiod@item -n
34523d8817e4Smiod@itemx --notes
34533d8817e4Smiod@cindex ELF notes
34543d8817e4SmiodDisplays the contents of the NOTE segments and/or sections, if any.
34553d8817e4Smiod
34563d8817e4Smiod@item -r
34573d8817e4Smiod@itemx --relocs
34583d8817e4Smiod@cindex ELF reloc information
34593d8817e4SmiodDisplays the contents of the file's relocation section, if it has one.
34603d8817e4Smiod
34613d8817e4Smiod@item -u
34623d8817e4Smiod@itemx --unwind
34633d8817e4Smiod@cindex unwind information
34643d8817e4SmiodDisplays the contents of the file's unwind section, if it has one.  Only
34653d8817e4Smiodthe unwind sections for IA64 ELF files are currently supported.
34663d8817e4Smiod
34673d8817e4Smiod@item -d
34683d8817e4Smiod@itemx --dynamic
34693d8817e4Smiod@cindex ELF dynamic section information
34703d8817e4SmiodDisplays the contents of the file's dynamic section, if it has one.
34713d8817e4Smiod
34723d8817e4Smiod@item -V
34733d8817e4Smiod@itemx --version-info
34743d8817e4Smiod@cindex ELF version sections informations
34753d8817e4SmiodDisplays the contents of the version sections in the file, it they
34763d8817e4Smiodexist.
34773d8817e4Smiod
34783d8817e4Smiod@item -A
34793d8817e4Smiod@itemx --arch-specific
34803d8817e4SmiodDisplays architecture-specific information in the file, if there
34813d8817e4Smiodis any.
34823d8817e4Smiod
34833d8817e4Smiod@item -D
34843d8817e4Smiod@itemx --use-dynamic
34853d8817e4SmiodWhen displaying symbols, this option makes @command{readelf} use the
34863d8817e4Smiodsymbol table in the file's dynamic section, rather than the one in the
34873d8817e4Smiodsymbols section.
34883d8817e4Smiod
34893d8817e4Smiod@item -x <number or name>
34903d8817e4Smiod@itemx --hex-dump=<number or name>
34913d8817e4SmiodDisplays the contents of the indicated section as a hexadecimal dump.
34923d8817e4SmiodA number identifies a particular section by index in the section table;
34933d8817e4Smiodany other string identifies all sections with that name in the object file.
34943d8817e4Smiod
34953d8817e4Smiod@item -w[liaprmfFsoR]
34963d8817e4Smiod@itemx --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]
34973d8817e4SmiodDisplays the contents of the debug sections in the file, if any are
34983d8817e4Smiodpresent.  If one of the optional letters or words follows the switch
34993d8817e4Smiodthen only data found in those specific sections will be dumped.
35003d8817e4Smiod
35013d8817e4Smiod@item -I
35023d8817e4Smiod@itemx --histogram
35033d8817e4SmiodDisplay a histogram of bucket list lengths when displaying the contents
35043d8817e4Smiodof the symbol tables.
35053d8817e4Smiod
35063d8817e4Smiod@item -v
35073d8817e4Smiod@itemx --version
35083d8817e4SmiodDisplay the version number of readelf.
35093d8817e4Smiod
35103d8817e4Smiod@item -W
35113d8817e4Smiod@itemx --wide
35123d8817e4SmiodDon't break output lines to fit into 80 columns. By default
35133d8817e4Smiod@command{readelf} breaks section header and segment listing lines for
35143d8817e4Smiod64-bit ELF files, so that they fit into 80 columns. This option causes
35153d8817e4Smiod@command{readelf} to print each section header resp. each segment one a
35163d8817e4Smiodsingle line, which is far more readable on terminals wider than 80 columns.
35173d8817e4Smiod
35183d8817e4Smiod@item -H
35193d8817e4Smiod@itemx --help
35203d8817e4SmiodDisplay the command line options understood by @command{readelf}.
35213d8817e4Smiod
35223d8817e4Smiod@end table
35233d8817e4Smiod
35243d8817e4Smiod@c man end
35253d8817e4Smiod
35263d8817e4Smiod@ignore
35273d8817e4Smiod@c man begin SEEALSO readelf
35283d8817e4Smiodobjdump(1), and the Info entries for @file{binutils}.
35293d8817e4Smiod@c man end
35303d8817e4Smiod@end ignore
35313d8817e4Smiod
35323d8817e4Smiod@node Common Options
35333d8817e4Smiod@chapter Common Options
35343d8817e4Smiod
35353d8817e4SmiodThe following command-line options are supported by all of the
35363d8817e4Smiodprograms described in this manual.
35373d8817e4Smiod
35383d8817e4Smiod@c man begin OPTIONS
35393d8817e4Smiod@table @env
35403d8817e4Smiod@include at-file.texi
35413d8817e4Smiod@c man end
35423d8817e4Smiod
35433d8817e4Smiod@item --help
35443d8817e4SmiodDisplay the command-line options supported by the program.
35453d8817e4Smiod
35463d8817e4Smiod@item --version
35473d8817e4SmiodDisplay the version number of the program.
35483d8817e4Smiod
35493d8817e4Smiod@c man begin OPTIONS
35503d8817e4Smiod@end table
35513d8817e4Smiod@c man end
35523d8817e4Smiod
35533d8817e4Smiod@node Selecting The Target System
35543d8817e4Smiod@chapter Selecting the Target System
35553d8817e4Smiod
35563d8817e4SmiodYou can specify two aspects of the target system to the @sc{gnu}
35573d8817e4Smiodbinary file utilities, each in several ways:
35583d8817e4Smiod
35593d8817e4Smiod@itemize @bullet
35603d8817e4Smiod@item
35613d8817e4Smiodthe target
35623d8817e4Smiod
35633d8817e4Smiod@item
35643d8817e4Smiodthe architecture
35653d8817e4Smiod@end itemize
35663d8817e4Smiod
35673d8817e4SmiodIn the following summaries, the lists of ways to specify values are in
35683d8817e4Smiodorder of decreasing precedence.  The ways listed first override those
35693d8817e4Smiodlisted later.
35703d8817e4Smiod
35713d8817e4SmiodThe commands to list valid values only list the values for which the
35723d8817e4Smiodprograms you are running were configured.  If they were configured with
35733d8817e4Smiod@option{--enable-targets=all}, the commands list most of the available
35743d8817e4Smiodvalues, but a few are left out; not all targets can be configured in at
35753d8817e4Smiodonce because some of them can only be configured @dfn{native} (on hosts
35763d8817e4Smiodwith the same type as the target system).
35773d8817e4Smiod
35783d8817e4Smiod@menu
35793d8817e4Smiod* Target Selection::
35803d8817e4Smiod* Architecture Selection::
35813d8817e4Smiod@end menu
35823d8817e4Smiod
35833d8817e4Smiod@node Target Selection
35843d8817e4Smiod@section Target Selection
35853d8817e4Smiod
35863d8817e4SmiodA @dfn{target} is an object file format.  A given target may be
35873d8817e4Smiodsupported for multiple architectures (@pxref{Architecture Selection}).
35883d8817e4SmiodA target selection may also have variations for different operating
35893d8817e4Smiodsystems or architectures.
35903d8817e4Smiod
35913d8817e4SmiodThe command to list valid target values is @samp{objdump -i}
35923d8817e4Smiod(the first column of output contains the relevant information).
35933d8817e4Smiod
35943d8817e4SmiodSome sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
35953d8817e4Smiod@samp{a.out-sunos-big}.
35963d8817e4Smiod
35973d8817e4SmiodYou can also specify a target using a configuration triplet.  This is
35983d8817e4Smiodthe same sort of name that is passed to @file{configure} to specify a
35993d8817e4Smiodtarget.  When you use a configuration triplet as an argument, it must be
36003d8817e4Smiodfully canonicalized.  You can see the canonical version of a triplet by
36013d8817e4Smiodrunning the shell script @file{config.sub} which is included with the
36023d8817e4Smiodsources.
36033d8817e4Smiod
36043d8817e4SmiodSome sample configuration triplets are: @samp{m68k-hp-bsd},
36053d8817e4Smiod@samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}.
36063d8817e4Smiod
36073d8817e4Smiod@subheading @command{objdump} Target
36083d8817e4Smiod
36093d8817e4SmiodWays to specify:
36103d8817e4Smiod
36113d8817e4Smiod@enumerate
36123d8817e4Smiod@item
36133d8817e4Smiodcommand line option: @option{-b} or @option{--target}
36143d8817e4Smiod
36153d8817e4Smiod@item
36163d8817e4Smiodenvironment variable @code{GNUTARGET}
36173d8817e4Smiod
36183d8817e4Smiod@item
36193d8817e4Smioddeduced from the input file
36203d8817e4Smiod@end enumerate
36213d8817e4Smiod
36223d8817e4Smiod@subheading @command{objcopy} and @command{strip} Input Target
36233d8817e4Smiod
36243d8817e4SmiodWays to specify:
36253d8817e4Smiod
36263d8817e4Smiod@enumerate
36273d8817e4Smiod@item
36283d8817e4Smiodcommand line options: @option{-I} or @option{--input-target}, or @option{-F} or @option{--target}
36293d8817e4Smiod
36303d8817e4Smiod@item
36313d8817e4Smiodenvironment variable @code{GNUTARGET}
36323d8817e4Smiod
36333d8817e4Smiod@item
36343d8817e4Smioddeduced from the input file
36353d8817e4Smiod@end enumerate
36363d8817e4Smiod
36373d8817e4Smiod@subheading @command{objcopy} and @command{strip} Output Target
36383d8817e4Smiod
36393d8817e4SmiodWays to specify:
36403d8817e4Smiod
36413d8817e4Smiod@enumerate
36423d8817e4Smiod@item
36433d8817e4Smiodcommand line options: @option{-O} or @option{--output-target}, or @option{-F} or @option{--target}
36443d8817e4Smiod
36453d8817e4Smiod@item
36463d8817e4Smiodthe input target (see ``@command{objcopy} and @command{strip} Input Target'' above)
36473d8817e4Smiod
36483d8817e4Smiod@item
36493d8817e4Smiodenvironment variable @code{GNUTARGET}
36503d8817e4Smiod
36513d8817e4Smiod@item
36523d8817e4Smioddeduced from the input file
36533d8817e4Smiod@end enumerate
36543d8817e4Smiod
36553d8817e4Smiod@subheading @command{nm}, @command{size}, and @command{strings} Target
36563d8817e4Smiod
36573d8817e4SmiodWays to specify:
36583d8817e4Smiod
36593d8817e4Smiod@enumerate
36603d8817e4Smiod@item
36613d8817e4Smiodcommand line option: @option{--target}
36623d8817e4Smiod
36633d8817e4Smiod@item
36643d8817e4Smiodenvironment variable @code{GNUTARGET}
36653d8817e4Smiod
36663d8817e4Smiod@item
36673d8817e4Smioddeduced from the input file
36683d8817e4Smiod@end enumerate
36693d8817e4Smiod
36703d8817e4Smiod@node Architecture Selection
36713d8817e4Smiod@section Architecture Selection
36723d8817e4Smiod
36733d8817e4SmiodAn @dfn{architecture} is a type of @sc{cpu} on which an object file is
36743d8817e4Smiodto run.  Its name may contain a colon, separating the name of the
36753d8817e4Smiodprocessor family from the name of the particular @sc{cpu}.
36763d8817e4Smiod
36773d8817e4SmiodThe command to list valid architecture values is @samp{objdump -i} (the
36783d8817e4Smiodsecond column contains the relevant information).
36793d8817e4Smiod
36803d8817e4SmiodSample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
36813d8817e4Smiod
36823d8817e4Smiod@subheading @command{objdump} Architecture
36833d8817e4Smiod
36843d8817e4SmiodWays to specify:
36853d8817e4Smiod
36863d8817e4Smiod@enumerate
36873d8817e4Smiod@item
36883d8817e4Smiodcommand line option: @option{-m} or @option{--architecture}
36893d8817e4Smiod
36903d8817e4Smiod@item
36913d8817e4Smioddeduced from the input file
36923d8817e4Smiod@end enumerate
36933d8817e4Smiod
36943d8817e4Smiod@subheading @command{objcopy}, @command{nm}, @command{size}, @command{strings} Architecture
36953d8817e4Smiod
36963d8817e4SmiodWays to specify:
36973d8817e4Smiod
36983d8817e4Smiod@enumerate
36993d8817e4Smiod@item
37003d8817e4Smioddeduced from the input file
37013d8817e4Smiod@end enumerate
37023d8817e4Smiod
37033d8817e4Smiod@node Reporting Bugs
37043d8817e4Smiod@chapter Reporting Bugs
37053d8817e4Smiod@cindex bugs
37063d8817e4Smiod@cindex reporting bugs
37073d8817e4Smiod
37083d8817e4SmiodYour bug reports play an essential role in making the binary utilities
37093d8817e4Smiodreliable.
37103d8817e4Smiod
37113d8817e4SmiodReporting a bug may help you by bringing a solution to your problem, or
37123d8817e4Smiodit may not.  But in any case the principal function of a bug report is
37133d8817e4Smiodto help the entire community by making the next version of the binary
37143d8817e4Smiodutilities work better.  Bug reports are your contribution to their
37153d8817e4Smiodmaintenance.
37163d8817e4Smiod
37173d8817e4SmiodIn order for a bug report to serve its purpose, you must include the
37183d8817e4Smiodinformation that enables us to fix the bug.
37193d8817e4Smiod
37203d8817e4Smiod@menu
37213d8817e4Smiod* Bug Criteria::                Have you found a bug?
37223d8817e4Smiod* Bug Reporting::               How to report bugs
37233d8817e4Smiod@end menu
37243d8817e4Smiod
37253d8817e4Smiod@node Bug Criteria
37263d8817e4Smiod@section Have You Found a Bug?
37273d8817e4Smiod@cindex bug criteria
37283d8817e4Smiod
37293d8817e4SmiodIf you are not sure whether you have found a bug, here are some guidelines:
37303d8817e4Smiod
37313d8817e4Smiod@itemize @bullet
37323d8817e4Smiod@cindex fatal signal
37333d8817e4Smiod@cindex crash
37343d8817e4Smiod@item
37353d8817e4SmiodIf a binary utility gets a fatal signal, for any input whatever, that is
37363d8817e4Smioda bug.  Reliable utilities never crash.
37373d8817e4Smiod
37383d8817e4Smiod@cindex error on valid input
37393d8817e4Smiod@item
37403d8817e4SmiodIf a binary utility produces an error message for valid input, that is a
37413d8817e4Smiodbug.
37423d8817e4Smiod
37433d8817e4Smiod@item
37443d8817e4SmiodIf you are an experienced user of binary utilities, your suggestions for
37453d8817e4Smiodimprovement are welcome in any case.
37463d8817e4Smiod@end itemize
37473d8817e4Smiod
37483d8817e4Smiod@node Bug Reporting
37493d8817e4Smiod@section How to Report Bugs
37503d8817e4Smiod@cindex bug reports
37513d8817e4Smiod@cindex bugs, reporting
37523d8817e4Smiod
37533d8817e4SmiodA number of companies and individuals offer support for @sc{gnu}
37543d8817e4Smiodproducts.  If you obtained the binary utilities from a support
37553d8817e4Smiodorganization, we recommend you contact that organization first.
37563d8817e4Smiod
37573d8817e4SmiodYou can find contact information for many support companies and
37583d8817e4Smiodindividuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
37593d8817e4Smioddistribution.
37603d8817e4Smiod
37613d8817e4SmiodIn any event, we also recommend that you send bug reports for the binary
37623d8817e4Smiodutilities to @samp{bug-binutils@@gnu.org}.
37633d8817e4Smiod
37643d8817e4SmiodThe fundamental principle of reporting bugs usefully is this:
37653d8817e4Smiod@strong{report all the facts}.  If you are not sure whether to state a
37663d8817e4Smiodfact or leave it out, state it!
37673d8817e4Smiod
37683d8817e4SmiodOften people omit facts because they think they know what causes the
37693d8817e4Smiodproblem and assume that some details do not matter.  Thus, you might
37703d8817e4Smiodassume that the name of a file you use in an example does not matter.
37713d8817e4SmiodWell, probably it does not, but one cannot be sure.  Perhaps the bug is
37723d8817e4Smioda stray memory reference which happens to fetch from the location where
37733d8817e4Smiodthat pathname is stored in memory; perhaps, if the pathname were
37743d8817e4Smioddifferent, the contents of that location would fool the utility into
37753d8817e4Smioddoing the right thing despite the bug.  Play it safe and give a
37763d8817e4Smiodspecific, complete example.  That is the easiest thing for you to do,
37773d8817e4Smiodand the most helpful.
37783d8817e4Smiod
37793d8817e4SmiodKeep in mind that the purpose of a bug report is to enable us to fix the bug if
37803d8817e4Smiodit is new to us.  Therefore, always write your bug reports on the assumption
37813d8817e4Smiodthat the bug has not been reported previously.
37823d8817e4Smiod
37833d8817e4SmiodSometimes people give a few sketchy facts and ask, ``Does this ring a
37843d8817e4Smiodbell?''  This cannot help us fix a bug, so it is basically useless.  We
37853d8817e4Smiodrespond by asking for enough details to enable us to investigate.
37863d8817e4SmiodYou might as well expedite matters by sending them to begin with.
37873d8817e4Smiod
37883d8817e4SmiodTo enable us to fix the bug, you should include all these things:
37893d8817e4Smiod
37903d8817e4Smiod@itemize @bullet
37913d8817e4Smiod@item
37923d8817e4SmiodThe version of the utility.  Each utility announces it if you start it
37933d8817e4Smiodwith the @option{--version} argument.
37943d8817e4Smiod
37953d8817e4SmiodWithout this, we will not know whether there is any point in looking for
37963d8817e4Smiodthe bug in the current version of the binary utilities.
37973d8817e4Smiod
37983d8817e4Smiod@item
37993d8817e4SmiodAny patches you may have applied to the source, including any patches
38003d8817e4Smiodmade to the @code{BFD} library.
38013d8817e4Smiod
38023d8817e4Smiod@item
38033d8817e4SmiodThe type of machine you are using, and the operating system name and
38043d8817e4Smiodversion number.
38053d8817e4Smiod
38063d8817e4Smiod@item
38073d8817e4SmiodWhat compiler (and its version) was used to compile the utilities---e.g.
38083d8817e4Smiod``@code{gcc-2.7}''.
38093d8817e4Smiod
38103d8817e4Smiod@item
38113d8817e4SmiodThe command arguments you gave the utility to observe the bug.  To
38123d8817e4Smiodguarantee you will not omit something important, list them all.  A copy
38133d8817e4Smiodof the Makefile (or the output from make) is sufficient.
38143d8817e4Smiod
38153d8817e4SmiodIf we were to try to guess the arguments, we would probably guess wrong
38163d8817e4Smiodand then we might not encounter the bug.
38173d8817e4Smiod
38183d8817e4Smiod@item
38193d8817e4SmiodA complete input file, or set of input files, that will reproduce the
38203d8817e4Smiodbug.  If the utility is reading an object file or files, then it is
38213d8817e4Smiodgenerally most helpful to send the actual object files, uuencoded if
38223d8817e4Smiodnecessary to get them through the mail system.  Note that
38233d8817e4Smiod@samp{bug-binutils@@gnu.org} is a mailing list, so you should avoid
38243d8817e4Smiodsending very large files to it.  Making the files available for
38253d8817e4Smiodanonymous FTP is OK.
38263d8817e4Smiod
38273d8817e4SmiodIf the source files were produced exclusively using @sc{gnu} programs
38283d8817e4Smiod(e.g., @command{gcc}, @command{gas}, and/or the @sc{gnu} @command{ld}), then it
38293d8817e4Smiodmay be OK to send the source files rather than the object files.  In
38303d8817e4Smiodthis case, be sure to say exactly what version of @command{gcc}, or
38313d8817e4Smiodwhatever, was used to produce the object files.  Also say how
38323d8817e4Smiod@command{gcc}, or whatever, was configured.
38333d8817e4Smiod
38343d8817e4Smiod@item
38353d8817e4SmiodA description of what behavior you observe that you believe is
38363d8817e4Smiodincorrect.  For example, ``It gets a fatal signal.''
38373d8817e4Smiod
38383d8817e4SmiodOf course, if the bug is that the utility gets a fatal signal, then we
38393d8817e4Smiodwill certainly notice it.  But if the bug is incorrect output, we might
38403d8817e4Smiodnot notice unless it is glaringly wrong.  You might as well not give us
38413d8817e4Smioda chance to make a mistake.
38423d8817e4Smiod
38433d8817e4SmiodEven if the problem you experience is a fatal signal, you should still
38443d8817e4Smiodsay so explicitly.  Suppose something strange is going on, such as your
38453d8817e4Smiodcopy of the utility is out of synch, or you have encountered a bug in
38463d8817e4Smiodthe C library on your system.  (This has happened!)  Your copy might
38473d8817e4Smiodcrash and ours would not.  If you told us to expect a crash, then when
38483d8817e4Smiodours fails to crash, we would know that the bug was not happening for
38493d8817e4Smiodus.  If you had not told us to expect a crash, then we would not be able
38503d8817e4Smiodto draw any conclusion from our observations.
38513d8817e4Smiod
38523d8817e4Smiod@item
38533d8817e4SmiodIf you wish to suggest changes to the source, send us context diffs, as
38543d8817e4Smiodgenerated by @command{diff} with the @option{-u}, @option{-c}, or @option{-p}
38553d8817e4Smiodoption.  Always send diffs from the old file to the new file.  If you
38563d8817e4Smiodwish to discuss something in the @command{ld} source, refer to it by
38573d8817e4Smiodcontext, not by line number.
38583d8817e4Smiod
38593d8817e4SmiodThe line numbers in our development sources will not match those in your
38603d8817e4Smiodsources.  Your line numbers would convey no useful information to us.
38613d8817e4Smiod@end itemize
38623d8817e4Smiod
38633d8817e4SmiodHere are some things that are not necessary:
38643d8817e4Smiod
38653d8817e4Smiod@itemize @bullet
38663d8817e4Smiod@item
38673d8817e4SmiodA description of the envelope of the bug.
38683d8817e4Smiod
38693d8817e4SmiodOften people who encounter a bug spend a lot of time investigating
38703d8817e4Smiodwhich changes to the input file will make the bug go away and which
38713d8817e4Smiodchanges will not affect it.
38723d8817e4Smiod
38733d8817e4SmiodThis is often time consuming and not very useful, because the way we
38743d8817e4Smiodwill find the bug is by running a single example under the debugger
38753d8817e4Smiodwith breakpoints, not by pure deduction from a series of examples.
38763d8817e4SmiodWe recommend that you save your time for something else.
38773d8817e4Smiod
38783d8817e4SmiodOf course, if you can find a simpler example to report @emph{instead}
38793d8817e4Smiodof the original one, that is a convenience for us.  Errors in the
38803d8817e4Smiodoutput will be easier to spot, running under the debugger will take
38813d8817e4Smiodless time, and so on.
38823d8817e4Smiod
38833d8817e4SmiodHowever, simplification is not vital; if you do not want to do this,
38843d8817e4Smiodreport the bug anyway and send us the entire test case you used.
38853d8817e4Smiod
38863d8817e4Smiod@item
38873d8817e4SmiodA patch for the bug.
38883d8817e4Smiod
38893d8817e4SmiodA patch for the bug does help us if it is a good one.  But do not omit
38903d8817e4Smiodthe necessary information, such as the test case, on the assumption that
38913d8817e4Smioda patch is all we need.  We might see problems with your patch and decide
38923d8817e4Smiodto fix the problem another way, or we might not understand it at all.
38933d8817e4Smiod
38943d8817e4SmiodSometimes with programs as complicated as the binary utilities it is
38953d8817e4Smiodvery hard to construct an example that will make the program follow a
38963d8817e4Smiodcertain path through the code.  If you do not send us the example, we
38973d8817e4Smiodwill not be able to construct one, so we will not be able to verify that
38983d8817e4Smiodthe bug is fixed.
38993d8817e4Smiod
39003d8817e4SmiodAnd if we cannot understand what bug you are trying to fix, or why your
39013d8817e4Smiodpatch should be an improvement, we will not install it.  A test case will
39023d8817e4Smiodhelp us to understand.
39033d8817e4Smiod
39043d8817e4Smiod@item
39053d8817e4SmiodA guess about what the bug is or what it depends on.
39063d8817e4Smiod
39073d8817e4SmiodSuch guesses are usually wrong.  Even we cannot guess right about such
39083d8817e4Smiodthings without first using the debugger to find the facts.
39093d8817e4Smiod@end itemize
39103d8817e4Smiod
39113d8817e4Smiod@include fdl.texi
39123d8817e4Smiod
39133d8817e4Smiod@node Index
39143d8817e4Smiod@unnumbered Index
39153d8817e4Smiod
39163d8817e4Smiod@printindex cp
39173d8817e4Smiod
39183d8817e4Smiod@contents
39193d8817e4Smiod@bye
3920