2006-07-06 Mohammed Adnène Trojette <adn@diwi.org>
[deliverable/binutils-gdb.git] / binutils / doc / binutils.texi
index fe7eb60c1058af3b7f05913674b6b4a5f63b73b2..de7aaf377ff4814c14a9855095ee6988789ae984 100644 (file)
@@ -1,8 +1,10 @@
 \input texinfo       @c                    -*- Texinfo -*-
 @setfilename binutils.info
-@c Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+@c Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
+@c man begin INCLUDE
 @include config.texi
+@c man end
 
 @ifinfo
 @format
@@ -30,7 +32,7 @@ END-INFO-DIR-ENTRY
 @ifinfo
 @c man begin COPYRIGHT
 Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1
@@ -55,7 +57,7 @@ notice identical to this one except for the removal of this paragraph
 @c  "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib".
 @c
 @c Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-@c 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 @c 
 @c This text may be freely distributed under the terms of the GNU
 @c Free Documentation License.
@@ -81,7 +83,7 @@ notice identical to this one except for the removal of this paragraph
 
 @vskip 0pt plus 1filll
 Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.1
@@ -170,7 +172,7 @@ section entitled "GNU Free Documentation License".
 * Selecting The Target System:: How these utilities determine the target.
 * Reporting Bugs::              Reporting Bugs
 * GNU Free Documentation License::  GNU Free Documentation License
-* Index::                       Index
+* Binutils Index::                       Binutils Index
 @end menu
 
 @node ar
@@ -950,6 +952,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
         [@option{-N} @var{symbolname}|@option{--strip-symbol=}@var{symbolname}]
         [@option{--strip-unneeded-symbol=}@var{symbolname}]
         [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}]
+        [@option{--localize-hidden}]
         [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}]
         [@option{--globalize-symbol=}@var{symbolname}]
         [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}]
@@ -991,6 +994,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
         [@option{--prefix-sections=}@var{string}]
         [@option{--prefix-alloc-sections=}@var{string}]
         [@option{--add-gnu-debuglink=}@var{path-to-file}]
+        [@option{--keep-file-symbols}]
         [@option{--only-keep-debug}]
         [@option{--writable-text}]
         [@option{--readonly-text}]
@@ -1121,6 +1125,11 @@ Keep only symbol @var{symbolname} global.  Make all other symbols local
 to the file, so that they are not visible externally.  This option may
 be given more than once.
 
+@item --localize-hidden
+In an ELF object, mark all symbols that have hidden or internal visibility
+as local.  This option applies on top of symbol-specific localization options
+such as @option{-L}.
+
 @item -L @var{symbolname}
 @itemx --localize-symbol=@var{symbolname}
 Make symbol @var{symbolname} local to the file, so that it is not
@@ -1396,7 +1405,9 @@ If the output architecture has alternate machine codes, use the
 @var{index}th code instead of the default one.  This is useful in case
 a machine is assigned an official code and the tool-chain adopts the 
 new code, but other applications still depend on the original code
-being used.
+being used.  For ELF based architectures if the @var{index}
+alternative does not exist then the value is treated as an absolute
+number to be stored in the e_machine field of the ELF header.
 
 @item --writable-text
 Mark the output text as writable.  This option isn't meaningful for all
@@ -1428,6 +1439,11 @@ Prefix all the names of all allocated sections in the output file with
 Creates a .gnu_debuglink section which contains a reference to @var{path-to-file}
 and adds it to the output file.
 
+@item --keep-file-symbols
+When stripping a file, perhaps with @option{--strip-debug} or
+@option{--strip-unneeded}, retain any symbols specifying source file names,
+which would otherwise get stripped.
+
 @item --only-keep-debug
 Strip a file, removing contents of any sections that would not be
 stripped by @option{--strip-debug} and leaving the debugging sections
@@ -1714,7 +1730,7 @@ can be placed together into a comma separated list.
 
 If the target is an ARM architecture then this switch can be used to
 select which register name set is used during disassembler.  Specifying
-@option{-M reg-name-std} (the default) will select the register names as
+@option{-M reg-names-std} (the default) will select the register names as
 used in ARM's instruction set documentation, but with register 13 called
 'sp', register 14 called 'lr' and register 15 called 'pc'.  Specifying
 @option{-M reg-names-apcs} will select the name set used by the ARM
@@ -2120,7 +2136,7 @@ strings [@option{-afov}] [@option{-}@var{min-len}]
         [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
         [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
         [@option{-}] [@option{--all}] [@option{--print-file-name}]
-        [@option{--target=}@var{bfdname}]
+        [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
         [@option{--help}] [@option{--version}] @var{file}@dots{}
 @c man end
 @end smallexample
@@ -2181,7 +2197,8 @@ single-8-bit-byte characters, @samp{b} = 16-bit bigendian, @samp{l} =
 16-bit littleendian, @samp{B} = 32-bit bigendian, @samp{L} = 32-bit
 littleendian. Useful for finding wide character strings.
 
-@item --target=@var{bfdname}
+@item -T @var{bfdname}
+@itemx --target=@var{bfdname}
 @cindex object code format
 Specify an object code format other than your system's default format.
 @xref{Target Selection}, for more information.
@@ -2223,6 +2240,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
       [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
       [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
       [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
+      [@option{--keep-file-symbols}]
       [@option{--only-keep-debug}]
       [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
       [@option{--help}] [@option{--info}]
@@ -2331,6 +2349,11 @@ Remove non-global symbols.
 Remove compiler-generated local symbols.
 (These usually start with @samp{L} or @samp{.}.)
 
+@item --keep-file-symbols
+When stripping a file, perhaps with @option{--strip-debug} or
+@option{--strip-unneeded}, retain any symbols specifying source file names,
+which would otherwise get stripped.
+
 @item --only-keep-debug
 Strip a file, removing any sections that would be stripped by
 @option{--strip-debug} and leaving the debugging sections.
@@ -2399,7 +2422,7 @@ the Info entries for @file{binutils}.
 c++filt [@option{-_}|@option{--strip-underscores}]
         [@option{-n}|@option{--no-strip-underscores}]
         [@option{-p}|@option{--no-params}]
-        [@option{-t}|@option{--no-types}]
+        [@option{-t}|@option{--types}]
         [@option{-i}|@option{--no-verbose}]
         [@option{-s} @var{format}|@option{--format=}@var{format}]
         [@option{--help}]  [@option{--version}]  [@var{symbol}@dots{}]
@@ -2409,31 +2432,67 @@ c++filt [@option{-_}|@option{--strip-underscores}]
 @c man begin DESCRIPTION cxxfilt
 
 @kindex cxxfilt
-The C++ and Java languages provides function overloading, which means
-that you can write many functions with the same name (providing each
-takes parameters of different types).  All C++ and Java function names
-are encoded into a low-level assembly label (this process is known as
-@dfn{mangling}). The @command{c++filt}
-@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
+The C++ and Java languages provide function overloading, which means
+that you can write many functions with the same name, providing that
+each function takes parameters of different types.  In order to be
+able to distinguish these similarly named functions C++ and Java
+encode them into a low-level assembler name which uniquely identifies
+each different version.  This process is known as @dfn{mangling}. The
+@command{c++filt}
+@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on 
 MS-DOS this program is named @command{CXXFILT}.}
 program does the inverse mapping: it decodes (@dfn{demangles}) low-level
-names into user-level names so that the linker can keep these overloaded
-functions from clashing.
+names into user-level names so that they can be read.
 
 Every alphanumeric word (consisting of letters, digits, underscores,
 dollars, or periods) seen in the input is a potential mangled name.
 If the name decodes into a C++ name, the C++ name replaces the
-low-level name in the output.
+low-level name in the output, otherwise the original word is output.
+In this way you can pass an entire assembler source file, containing
+mangled names, through @command{c++filt} and see the same source file
+containing demangled names.
 
-You can use @command{c++filt} to decipher individual symbols:
+You can also use @command{c++filt} to decipher individual symbols by
+passing them on the command line:
 
 @example
 c++filt @var{symbol}
 @end example
 
 If no @var{symbol} arguments are given, @command{c++filt} reads symbol
-names from the standard input and writes the demangled names to the
-standard output.  All results are printed on the standard output.
+names from the standard input instead.  All the results are printed on
+the standard output.  The difference between reading names from the
+command line versus reading names from the standard input is that
+command line arguments are expected to be just mangled names and no
+checking is performed to seperate them from surrounding text.  Thus
+for example:
+
+@smallexample
+c++filt -n _Z1fv
+@end smallexample
+
+will work and demangle the name to ``f()'' whereas:
+
+@smallexample
+c++filt -n _Z1fv,
+@end smallexample
+
+will not work.  (Note the extra comma at the end of the mangled
+name which makes it invalid).  This command however will work:
+
+@smallexample
+echo _Z1fv, | c++filt -n
+@end smallexample
+
+and will display ``f(),'' ie the demangled name followed by a
+trailing comma.  This behaviour is because when the names are read
+from the standard input it is expected that they might be part of an
+assembler source file where there might be extra, extraneous
+characters trailing after a mangled name.  eg:
+
+@smallexample
+    .type   _Z1fv, @@function
+@end smallexample
 
 @c man end
 
@@ -2462,9 +2521,12 @@ When demangling the name of a function, do not display the types of
 the function's parameters.
 
 @item -t
-@itemx --no-types
-Do not attempt to demangle types.  This is enabled by default, but it
-may not be desired if you are interested in mangled function names.
+@itemx --types
+Attempt to demangle types as well as function names.  This is disabled
+by default since mangled types are normally only used internally in
+the compiler, and they can be confused with non-mangled names.  eg
+a function called ``a'' treated as a mangled type name would be
+demangled to ``signed char''.
 
 @item -i
 @itemx --no-verbose
@@ -2546,6 +2608,7 @@ addr2line [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
           [@option{-e} @var{filename}|@option{--exe=}@var{filename}]
           [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
           [@option{-i}|@option{--inlines}]
+          [@option{-j}|@option{--section=}@var{name}]
           [@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
           [addr addr @dots{}]
 @c man end
@@ -2553,13 +2616,14 @@ addr2line [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
 
 @c man begin DESCRIPTION addr2line
 
-@command{addr2line} translates program addresses into file names and line
-numbers.  Given an address and an executable, it uses the debugging
-information in the executable to figure out which file name and line
-number are associated with a given address.
+@command{addr2line} translates addresses into file names and line numbers.
+Given an address in an executable or an offset in a section of a relocatable
+object, it uses the debugging information to figure out which file name and
+line number are associated with it.
 
-The executable to use is specified with the @option{-e} option.  The
-default is the file @file{a.out}.
+The executable or relocatable object to use is specified with the @option{-e}
+option.  The default is the file @file{a.out}.  The section in the relocatable
+object to use is specified with the @option{-j} option.
 
 @command{addr2line} has two modes of operation.
 
@@ -2627,6 +2691,10 @@ function will also be printed.  For example, if @code{main} inlines
 @code{callee1} which inlines @code{callee2}, and address is from
 @code{callee2}, the source information for @code{callee1} and @code{main}
 will also be printed.
+
+@item -j
+@itemx --section
+Read offsets relative to the specified section instead of absolute addresses.
 @end table
 
 @c man end
@@ -2958,8 +3026,9 @@ dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
         [@option{--no-default-excludes}]
         [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}]
         [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
-        [@option{-a}|@option{--add-indirect}] [@option{-U}|@option{--add-underscore}] [@option{-k}|@option{--kill-at}]
-        [@option{-A}|@option{--add-stdcall-alias}]
+        [@option{-a}|@option{--add-indirect}]
+        [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}]
+        [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
         [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
         [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}] [@option{-i}|@option{--interwork}]
         [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
@@ -3135,7 +3204,14 @@ means!
 @item -U
 @itemx --add-underscore
 Specifies that when @command{dlltool} is creating the exports file it
-should prepend an underscore to the names of the exported functions. 
+should prepend an underscore to the names of @emph{all} exported symbols. 
+
+@item --add-stdcall-underscore
+Specifies that when @command{dlltool} is creating the exports file it
+should prepend an underscore to the names of exported @emph{stdcall}
+functions. Variable names and non-stdcall function names are not modified.
+This option is useful when creating GNU-compatible import libs for third
+party DLLs that were built with MS-Windows tools.
 
 @item -k
 @itemx --kill-at
@@ -3285,7 +3361,7 @@ readelf [@option{-a}|@option{--all}]
         [@option{-V}|@option{--version-info}]
         [@option{-A}|@option{--arch-specific}]
         [@option{-D}|@option{--use-dynamic}]
-        [@option{-x} <number>|@option{--hex-dump=}<number>]
+        [@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
         [@option{-w[liaprmfFsoR]}|
          @option{--debug-dump}[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]]
         [@option{-I}|@option{-histogram}]
@@ -3320,7 +3396,7 @@ given.
 @table @env
 @item -a
 @itemx --all
-Equivalent to specifiying @option{--file-header},
+Equivalent to specifying @option{--file-header},
 @option{--program-headers}, @option{--sections}, @option{--symbols},
 @option{--relocs}, @option{--dynamic}, @option{--notes} and
 @option{--version-info}. 
@@ -3405,9 +3481,11 @@ When displaying symbols, this option makes @command{readelf} use the
 symbol table in the file's dynamic section, rather than the one in the
 symbols section.
 
-@item -x <number>
-@itemx --hex-dump=<number>
+@item -x <number or name>
+@itemx --hex-dump=<number or name>
 Displays the contents of the indicated section as a hexadecimal dump.
+A number identifies a particular section by index in the section table;
+any other string identifies all sections with that name in the object file.
 
 @item -w[liaprmfFsoR]
 @itemx --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]
@@ -3452,20 +3530,10 @@ objdump(1), and the Info entries for @file{binutils}.
 The following command-line options are supported by all of the
 programs described in this manual.
 
+@c man begin OPTIONS
 @table @env
-@item @@@var{file}
-Read command-line options from @var{file}.  The options read are
-inserted in place of the original @@@var{file} option.  If @var{file}
-does not exist, or cannot be read, then the option will be treated
-literally, and not removed.  
-
-Options in @var{file} are separated by whitespace.  A whitespace
-character may be included in an option by surrounding the entire
-option in either single or double quotes.  Any character (including a
-backslash) may be included by prefixing the character to be included
-character with a backslash.  The @var{file} may itself contain
-additional @@@var{file} options; any such options will be processed
-recursively.
+@include at-file.texi
+@c man end
 
 @item --help
 Display the command-line options supported by the program.
@@ -3473,7 +3541,9 @@ Display the command-line options supported by the program.
 @item --version
 Display the version number of the program.
 
+@c man begin OPTIONS
 @end table
+@c man end
 
 @node Selecting The Target System
 @chapter Selecting the Target System
@@ -3835,8 +3905,8 @@ things without first using the debugger to find the facts.
 
 @include fdl.texi
 
-@node Index
-@unnumbered Index
+@node Binutils Index
+@unnumbered Binutils Index
 
 @printindex cp
 
This page took 0.028924 seconds and 4 git commands to generate.