* emultempl/aix.em: Add missing prototype.
[platform/upstream/binutils.git] / ld / ld.texinfo
index b7a64e9..5bc0a30 100644 (file)
@@ -1,5 +1,7 @@
 \input texinfo
 @setfilename ld.info
+@c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+@c 2001 Free Software Foundation, Inc.
 @syncodeindex ky cp
 @include configdoc.texi
 @c (configdoc.texi is generated by the Makefile)
@@ -7,6 +9,38 @@
 
 @c @smallbook
 
+@c man begin NAME
+@ifset man
+@c Configure for the generation of man pages
+@set UsesEnvVars
+@set GENERIC
+@set A29K
+@set ARC
+@set ARM
+@set D10V
+@set D30V
+@set H8/300
+@set H8/500
+@set HPPA
+@set I370
+@set I80386
+@set I860
+@set I960
+@set M32R
+@set M68HC11
+@set M680X0
+@set MCORE
+@set MIPS
+@set PDP11
+@set PJ
+@set SH
+@set SPARC
+@set C54X
+@set V850
+@set VAX
+@end ifset
+@c man end
+
 @ifinfo
 @format
 START-INFO-DIR-ENTRY
@@ -18,7 +52,8 @@ END-INFO-DIR-ENTRY
 @ifinfo
 This file documents the @sc{gnu} linker LD version @value{VERSION}.
 
-Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
+2001 Free Software Foundation, Inc.
 
 @ignore
 
@@ -61,14 +96,16 @@ notice identical to this one except for the removal of this paragraph
 @end tex
 
 @vskip 0pt plus 1filll
+@c man begin COPYRIGHT
 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 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
-      or any later version published by the Free Software Foundation;
-      with no Invariant Sections, with no Front-Cover Texts, and with no
-      Back-Cover Texts.  A copy of the license is included in the
-      section entitled "GNU Free Documentation License".
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1
+or any later version published by the Free Software Foundation;
+with no Invariant Sections, with no Front-Cover Texts, and with no
+Back-Cover Texts.  A copy of the license is included in the
+section entitled "GNU Free Documentation License".
+@c man end
 
 @end titlepage
 @end iftex
@@ -121,6 +158,21 @@ section entitled "GNU Free Documentation License".
 
 @cindex @sc{gnu} linker
 @cindex what is this?
+
+@ifset man
+@c man begin SYNOPSIS
+ld [ options ] objfile...
+@c man end
+
+@c man begin SEEALSO
+ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and
+the Info entries for @file{binutils} and
+@file{ld}.
+@c man end
+@end ifset
+
+@c man begin DESCRIPTION
+
 @code{ld} combines a number of object and archive files, relocates
 their data and ties up symbol references. Usually the last step in
 compiling a program is to run @code{ld}.
@@ -129,6 +181,14 @@ compiling a program is to run @code{ld}.
 a superset of AT&T's Link Editor Command Language syntax,
 to provide explicit and total control over the linking process.
 
+@ifset man
+@c For the man only
+This man page does not describe the command language; see the 
+@code{ld} entry in @code{info}, or the manual
+ld: the GNU linker, for full details on the command language and 
+on other aspects of the GNU linker. 
+@end ifset
+
 @ifclear SingleFormat
 This version of @code{ld} uses the general purpose BFD libraries
 to operate on object files. This allows @code{ld} to read, combine, and
@@ -143,13 +203,19 @@ execution immediately upon encountering an error; whenever possible,
 @code{ld} continues executing, allowing you to identify other errors
 (or, in some cases, to get an output file in spite of the error).
 
+@c man end
+
 @node Invocation
 @chapter Invocation
 
+@c man begin DESCRIPTION
+
 The @sc{gnu} linker @code{ld} is meant to cover a broad range of situations,
 and to be as compatible as possible with other linkers.  As a result,
 you have many choices to control its behavior.
 
+@c man end
+
 @ifset UsesEnvVars
 @menu
 * Options::                     Command Line Options
@@ -162,6 +228,9 @@ you have many choices to control its behavior.
 
 @cindex command line
 @cindex options
+
+@c man begin OPTIONS
+
 The linker supports a plethora of command-line options, but in actual
 practice few of them are used in any particular context.
 @cindex standard Unix system
@@ -219,13 +288,20 @@ whitespace, or be given as separate arguments immediately following the
 option that requires them.
 
 For options whose names are multiple letters, either one dash or two can
-precede the option name; for example, @samp{--oformat} and
-@samp{--oformat} are equivalent.  Arguments to multiple-letter options
-must either be separated from the option name by an equals sign, or be
-given as separate arguments immediately following the option that
-requires them.  For example, @samp{--oformat srec} and
-@samp{--oformat=srec} are equivalent.  Unique abbreviations of the names
-of multiple-letter options are accepted.
+precede the option name; for example, @samp{-trace-symbol} and
+@samp{--trace-symbol} are equivalent.  Note - there is one exception to
+this rule.  Multiple letter options that start with a lower case 'o' can
+only be preceeded by two dashes.  This is to reduce confusion with the
+@samp{-o} option.  So for example @samp{-omagic} sets the output file
+name to @samp{magic} whereas @samp{--omagic} sets the NMAGIC flag on the
+output.
+
+Arguments to multiple-letter options must either be separated from the
+option name by an equals sign, or be given as separate arguments
+immediately following the option that requires them.  For example,
+@samp{--trace-symbol foo} and @samp{--trace-symbol=foo} are equivalent.
+Unique abbreviations of the names of multiple-letter options are
+accepted.
 
 Note - if the linker is being invoked indirectly, via a compiler driver
 (eg @samp{gcc}) then all the linker command line options should be
@@ -292,7 +368,7 @@ You may want to use this option if you are linking files with an unusual
 binary format.  You can also use @samp{-b} to switch formats explicitly (when
 linking object files of different formats), by including
 @samp{-b @var{input-format}} before each group of object files in a
-particular format.  
+particular format.
 
 The default format is taken from the environment variable
 @code{GNUTARGET}.
@@ -300,7 +376,10 @@ The default format is taken from the environment variable
 @xref{Environment}.
 @end ifset
 You can also define the input format from a script, using the command
-@code{TARGET}; see @ref{Format Commands}.
+@code{TARGET};
+@ifclear man
+see @ref{Format Commands}.
+@end ifclear
 @end ifclear
 
 @kindex -c @var{MRI-cmdfile}
@@ -310,7 +389,13 @@ You can also define the input format from a script, using the command
 @itemx --mri-script=@var{MRI-commandfile}
 For compatibility with linkers produced by MRI, @code{ld} accepts script
 files written in an alternate, restricted command language, described in
-@ref{MRI,,MRI Compatible Script Files}.  Introduce MRI script files with
+@ifclear man
+@ref{MRI,,MRI Compatible Script Files}.
+@end ifclear
+@ifset man
+the MRI Compatible Script Files section of GNU ld documentation.
+@end ifset
+Introduce MRI script files with
 the option @samp{-c}; use the @samp{-T} option to run linker
 scripts written in the general-purpose @code{ld} scripting language.
 If @var{MRI-cmdfile} does not exist, @code{ld} looks for it in the directories
@@ -320,7 +405,7 @@ specified by any @samp{-L} options.
 @kindex -d
 @kindex -dc
 @kindex -dp
-@item -d 
+@item -d
 @itemx -dc
 @itemx -dp
 These three options are equivalent; multiple forms are supported for
@@ -332,7 +417,7 @@ script command @code{FORCE_COMMON_ALLOCATION} has the same effect.
 @cindex entry point, from command line
 @kindex -e @var{entry}
 @kindex --entry=@var{entry}
-@item -e @var{entry} 
+@item -e @var{entry}
 @itemx --entry=@var{entry}
 Use @var{entry} as the explicit symbol for beginning execution of your
 program, rather than the default entry point.  If there is no symbol
@@ -360,6 +445,10 @@ back to the symbols defined by the program, rather than some other
 dynamic object, then you will probably need to use this option when
 linking the program itself.
 
+You can also use the version script to control what symbols should
+be added to the dynamic symbol table if the output format supports it.
+See the description of @samp{--version-script} in @ref{VERSION}.
+
 @cindex big-endian objects
 @cindex endianness
 @kindex -EB
@@ -502,7 +591,7 @@ behaviour of the AIX linker.
 @cindex search directory, from cmd line
 @kindex -L@var{dir}
 @kindex --library-path=@var{dir}
-@item -L@var{searchdir} 
+@item -L@var{searchdir}
 @itemx --library-path=@var{searchdir}
 Add path @var{searchdir} to the list of paths that @code{ld} will search
 for archive libraries and @code{ld} control scripts.  You may use this
@@ -559,13 +648,13 @@ which caused the archive member to be brought in.
 @item -n
 @itemx --nmagic
 Turn off page alignment of sections, and mark the output as
-@code{NMAGIC} if possible. 
+@code{NMAGIC} if possible.
 
 @kindex -N
 @kindex --omagic
 @cindex read/write from cmd line
 @cindex OMAGIC
-@item -N 
+@item -N
 @itemx --omagic
 Set the text and data sections to be readable and writable.  Also, do
 not page-align the data segment.  If the output format supports Unix
@@ -608,11 +697,17 @@ turn serve as input to @code{ld}.  This is often called @dfn{partial
 linking}.  As a side effect, in environments that support standard Unix
 magic numbers, this option also sets the output file's magic number to
 @code{OMAGIC}.
-@c ; see @code{-N}. 
+@c ; see @code{-N}.
 If this option is not specified, an absolute file is produced.  When
 linking C++ programs, this option @emph{will not} resolve references to
 constructors; to do that, use @samp{-Ur}.
 
+When an input file does not have the same format as the output file,
+partial linking is only supported if that input file does not contain any
+relocations.  Different output formats can have further restrictions; for
+example some @code{a.out}-based formats do not support partial linking
+with input files in other formats at all.
+
 This option does the same thing as @samp{-i}.
 
 @kindex -R @var{file}
@@ -632,21 +727,21 @@ the @code{-rpath} option.
 @kindex -s
 @kindex --strip-all
 @cindex strip all symbols
-@item -s 
+@item -s
 @itemx --strip-all
 Omit all symbol information from the output file.
 
 @kindex -S
 @kindex --strip-debug
 @cindex strip debugger symbols
-@item -S 
+@item -S
 @itemx --strip-debug
 Omit debugger symbol information (but not all symbols) from the output file.
 
 @kindex -t
 @kindex --trace
 @cindex input files, displaying
-@item -t 
+@item -t
 @itemx --trace
 Print the names of the input files as @code{ld} processes them.
 
@@ -678,7 +773,7 @@ option is equivalent to the @code{EXTERN} linker script command.
 
 @kindex -Ur
 @cindex constructors
-@item -Ur 
+@item -Ur
 For anything other than C++ programs, this option is equivalent to
 @samp{-r}: it generates relocatable output---i.e., an output file that can in
 turn serve as input to @code{ld}.  When linking C++ programs, @samp{-Ur}
@@ -688,13 +783,15 @@ with @samp{-Ur}; once the constructor table has been built, it cannot
 be added to.  Use @samp{-Ur} only for the last partial link, and
 @samp{-r} for the others.
 
-@kindex --unique
-@item --unique
-Creates a separate output section for every orphan input section.  This
-option prevents the normal merging of orphan input sections with the same
-name.  An orphan section is one not specifically mentioned in a linker
-script, so this option along with a custom linker script allows any
-selection of input sections to be merged while others are kept separate.
+@kindex --unique[=@var{SECTION}]
+@item --unique[=@var{SECTION}]
+Creates a separate output section for every input section matching
+@var{SECTION}, or if the optional wildcard @var{SECTION} argument is
+missing, for every orphan input section.  An orphan section is one not
+specifically mentioned in a linker script.  You may use this option
+multiple times on the command line;  It prevents the normal merging of
+input sections with the same name, overriding output section assignments
+in a linker script.
 
 @kindex -v
 @kindex -V
@@ -717,7 +814,7 @@ Delete all local symbols.
 @kindex --discard-locals
 @cindex local symbols, deleting
 @cindex L, deleting symbols beginning
-@item -X 
+@item -X
 @itemx --discard-locals
 Delete all temporary local symbols.  For most targets, this is all local
 symbols whose names begin with @samp{L}.
@@ -743,7 +840,8 @@ for Solaris compatibility.
 @item -z @var{keyword}
 The recognized keywords are @code{initfirst}, @code{interpose},
 @code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen},
-@code{nodump}, @code{now} and @code{origin}. The other keywords are
+@code{nodump}, @code{now}, @code{origin}, @code{combreloc} and
+@code{nocombreloc}. The other keywords are
 ignored for Solaris compatibility. @code{initfirst} marks the object
 to be initialized first at runtime before any other objects.
 @code{interpose} marks the object that its symbol table interposes
@@ -756,6 +854,10 @@ of this object will ignore any default library search paths.
 @code{nodump} marks the object can not be dumped by @code{dldump}.
 @code{now} marks the object with the non-lazy runtime binding.
 @code{origin} marks the object may contain $ORIGIN.
+@code{defs} disallows undefined symbols.
+@code{combreloc} combines multiple reloc sections and sorts them
+to make dynamic symbol lookup caching possible.
+@code{nocombreloc} disables multiple reloc sections combining.
 
 @kindex -(
 @cindex groups of archives
@@ -794,11 +896,19 @@ for compatibility with various systems.  You may use this option
 multiple times on the command line: it affects library searching for
 @code{-l} options which follow it.
 
+@kindex -Bgroup
+@item -Bgroup
+Set the @code{DF_1_GROUP} flag in the @code{DT_FLAGS_1} entry in the dynamic
+section.  This causes the runtime linker to handle lookups in this
+object and its dependencies to be performed only inside the group.
+@code{--no-undefined} is implied.  This option is only meaningful on ELF
+platforms which support shared libraries.
+
 @kindex -Bstatic
 @kindex -dn
 @kindex -non_shared
 @kindex -static
-@item -Bstatic 
+@item -Bstatic
 @itemx -dn
 @itemx -non_shared
 @itemx -static
@@ -864,13 +974,14 @@ These options control whether to demangle symbol names in error messages
 and other output.  When the linker is told to demangle, it tries to
 present symbol names in a readable fashion: it strips leading
 underscores if they are used by the object file format, and converts C++
-mangled symbol names into user readable names.  Different compilers have 
-different mangling styles.  The optional demangling style argument can be used 
-to choose an appropriate demangling style for your compiler.  The linker will 
+mangled symbol names into user readable names.  Different compilers have
+different mangling styles.  The optional demangling style argument can be used
+to choose an appropriate demangling style for your compiler.  The linker will
 demangle by default unless the environment variable @samp{COLLECT_NO_DEMANGLE}
 is set.  These options may be used to override the default.
 
 @cindex dynamic linker, from command line
+@kindex -I@var{file}
 @kindex --dynamic-linker @var{file}
 @item --dynamic-linker @var{file}
 Set the name of the dynamic linker.  This is only meaningful when
@@ -887,6 +998,11 @@ assembler.  It causes the linker to create a table which may be used at
 runtime to relocate any data which was statically initialized to pointer
 values.  See the code in testsuite/ld-empic for details.
 
+
+@kindex --fatal-warnings
+@item --fatal-warnings
+Treat all warnings as errors.
+
 @kindex --force-exe-suffix
 @item  --force-exe-suffix
 Make sure that an output file has a .exe suffix.
@@ -934,9 +1050,11 @@ necessary.  This may be required if @code{ld} runs out of memory space
 while linking a large executable.
 
 @kindex --no-undefined
+@kindex -z defs
 @item --no-undefined
+@itemx -z defs
 Normally when creating a non-symbolic shared library, undefined symbols
-are allowed and left to be resolved by the runtime loader.  This option
+are allowed and left to be resolved by the runtime loader.  These options
 disallows such undefined symbols.
 
 @kindex --allow-shlib-undefined
@@ -1003,7 +1121,7 @@ This option is ignored for SVR4 compatibility.
 @cindex synthesizing linker
 @cindex relaxing addressing modes
 @item --relax
-An option with machine dependent effects.  
+An option with machine dependent effects.
 @ifset GENERIC
 This option is only supported on a few targets.
 @end ifset
@@ -1151,7 +1269,7 @@ undefined symbols in the link.
 @kindex --sort-common
 This option tells @code{ld} to sort the common symbols by size when it
 places them in the appropriate output sections.  First come all the one
-byte symbols, then all the two bytes, then all the four bytes, and then
+byte symbols, then all the two byte, then all the four byte, and then
 everything else.  This is to prevent gaps between symbols due to
 alignment constraints.
 
@@ -1225,7 +1343,7 @@ for compatibility with other linkers, you may omit the leading
 @itemx --verbose
 Display the version number for @code{ld} and list the linker emulations
 supported.  Display which input files can and cannot be opened.  Display
-the linker script if using a default builtin script.
+the linker script being used by the linker.
 
 @kindex --version-script=@var{version-scriptfile}
 @cindex version script, symbol versions
@@ -1236,7 +1354,7 @@ about the version heirarchy for the library being created.  This option
 is only meaningful on ELF platforms which support shared libraries.
 @xref{VERSION}.
 
-@kindex --warn-comon
+@kindex --warn-common
 @cindex warnings, on combining symbols
 @cindex combining symbols, warnings on
 @item --warn-common
@@ -1368,6 +1486,12 @@ files.  This is normally used to turn an archive file into a shared
 library, forcing every object to be included in the resulting shared
 library.  This option may be used more than once.
 
+Two notes when using this option from gcc: First, gcc doesn't know
+about this option, so you have to use @code{-Wl,-whole-archive}.
+Second, don't forget to use @code{-Wl,-no-whole-archive} after your
+list of archives, because gcc will add its own list of archives to
+your link and you may not want this flag to affect those as well.
+
 @kindex --wrap
 @item --wrap @var{symbol}
 Use a wrapper function for @var{symbol}.  Any undefined reference to
@@ -1415,8 +1539,12 @@ those options are only available for ELF systems.
 
 @end table
 
+@c man end
+
 @subsection Options specific to i386 PE targets
 
+@c man begin OPTIONS
+
 The i386 PE linker supports the @code{-shared} option, which causes
 the output to be a dynamically linked library (DLL) instead of a
 normal executable.  You should name the output @code{*.dll} when you
@@ -1477,8 +1605,22 @@ otherwise wouldn't be any exported symbols.  When symbols are
 explicitly exported via DEF files or implicitly exported via function
 attributes, the default is to not export anything else unless this
 option is given.  Note that the symbols @code{DllMain@@12},
-@code{DllEntryPoint@@0}, and @code{impure_ptr} will not be automatically
-exported.
+@code{DllEntryPoint@@0}, @code{DllMainCRTStartup@@12}, and 
+@code{impure_ptr} will not be automatically
+exported.  Also, symbols imported from other DLLs will not be 
+re-exported, nor will symbols specifying the DLL's internal layout 
+such as those beginning with @code{_head_} or ending with 
+@code{_iname}.  In addition, no symbols from @code{libgcc}, 
+@code{libstd++}, @code{libmingw32}, or @code{crtX.o} will be exported.
+Symbols whose names begin with @code{__rtti_} or @code{__builtin_} will
+not be exported, to help with C++ DLLs.  Finally, there is an
+extensive list of cygwin-private symbols that are not exported 
+(obviously, this applies on when building DLLs for cygwin targets).
+These cygwin-excludes are: @code{_cygwin_dll_entry@@12}, 
+@code{_cygwin_crt0_common@@8}, @code{_cygwin_noncygwin_dll_entry@@12},
+@code{_fmode}, @code{_impure_ptr}, @code{cygwin_attach_dll}, 
+@code{cygwin_premain0}, @code{cygwin_premain1}, @code{cygwin_premain2},
+@code{cygwin_premain3}, and @code{environ}. 
 
 @kindex --exclude-symbols
 @item --exclude-symbols @var{symbol},@var{symbol},...
@@ -1548,6 +1690,55 @@ file corresponding to the DLL the linker is generating.  This DEF file
 library with @code{dlltool} or may be used as a reference to
 automatically or implicitly exported symbols.
 
+@cindex DLLs, creating
+@kindex --out-implib
+@item --out-implib @var{file}
+The linker will create the file @var{file} which will contain an
+import lib corresponding to the DLL the linker is generating. This
+import lib (which should be called @code{*.dll.a} or @code{*.a}
+may be used to link clients against the generated DLL; this behavior
+makes it possible to skip a separate @code{dlltool} import library
+creation step.
+
+@kindex --enable-auto-image-base
+@item --enable-auto-image-base
+Automatically choose the image base for DLLs, unless one is specified
+using the @code{--image-base} argument.  By using a hash generated
+from the dllname to create unique image bases for each DLL, in-memory
+collisions and relocations which can delay program execution are
+avoided.
+
+@kindex --disable-auto-image-base
+@item --disable-auto-image-base
+Do not automatically generate a unique image base.  If there is no
+user-specified image base (@code{--image-base}) then use the platform
+default.
+
+@cindex DLLs, linking to
+@kindex --dll-search-prefix
+@item --dll-search-prefix @var{string}
+When linking dynamically to a dll without an import library, i
+search for @code{<string><basename>.dll} in preference to 
+@code{lib<basename>.dll}. This behavior allows easy distinction
+between DLLs built for the various "subplatforms": native, cygwin,
+uwin, pw, etc.  For instance, cygwin DLLs typically use
+@code{--dll-search-prefix=cyg}. 
+
+@kindex --enable-auto-import
+@item --enable-auto-import
+Do sophisticalted linking of @code{_symbol} to @code{__imp__symbol} for 
+DATA imports from DLLs, and create the necessary thunking symbols when 
+building the DLLs with those DATA exports.
+
+@kindex --disable-auto-import
+@item --disable-auto-import
+Do not attempt to do sophisticalted linking of @code{_symbol} to 
+@code{__imp__symbol} for DATA imports from DLLs.
+
+@kindex --enable-extra-pe-debug
+@item --enable-extra-pe-debug
+Show additional debug info related to auto-import symbol thunking.
+
 @kindex --section-alignment
 @item --section-alignment
 Sets the section alignment.  Sections in memory will always begin at
@@ -1572,10 +1763,14 @@ subsystem version also.
 
 @end table
 
+@c man end
+
 @ifset UsesEnvVars
 @node Environment
 @section Environment Variables
 
+@c man begin ENVIRONMENT
+
 You can change the behavior of @code{ld} with the environment variables
 @code{GNUTARGET}, @code{LDEMULATION}, and @code{COLLECT_NO_DEMANGLE}.
 
@@ -1603,7 +1798,6 @@ available emulations with the @samp{--verbose} or @samp{-V} options.  If
 the @samp{-m} option is not used, and the @code{LDEMULATION} environment
 variable is not defined, the default emulation depends upon how the
 linker was configured.
-@end ifset
 
 @kindex COLLECT_NO_DEMANGLE
 @cindex demangling, default
@@ -1614,6 +1808,9 @@ a similar fashion by the @code{gcc} linker wrapper program.  The default
 may be overridden by the @samp{--demangle} and @samp{--no-demangle}
 options.
 
+@c man end
+@end ifset
+
 @node Scripts
 @chapter Linker Scripts
 
@@ -1832,15 +2029,15 @@ There are several ways to set the entry point.  The linker will set the
 entry point by trying each of the following methods in order, and
 stopping when one of them succeeds:
 @itemize @bullet
-@item 
+@item
 the @samp{-e} @var{entry} command-line option;
-@item 
+@item
 the @code{ENTRY(@var{symbol})} command in a linker script;
-@item 
+@item
 the value of the symbol @code{start}, if defined;
-@item 
+@item
 the address of the first byte of the @samp{.text} section, if present;
-@item 
+@item
 The address @code{0}.
 @end itemize
 
@@ -2095,7 +2292,7 @@ SECTIONS
       *(.text)
       _etext = .;
     @}
-  _bdata = (. + 3) & ~ 4;
+  _bdata = (. + 3) & ~ 3;
   .data : @{ *(.data) @}
 @}
 @end smallexample
@@ -2199,7 +2396,7 @@ in the first input file.  The first section will be at address zero.
 @subsection Output section description
 The full description of an output section looks like this:
 @smallexample
-@group 
+@group
 @var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
   @{
     @var{output-section-command}
@@ -2346,7 +2543,8 @@ There are two ways to include more than one section:
 @noindent
 The difference between these is the order in which the @samp{.text} and
 @samp{.rdata} input sections will appear in the output section.  In the
-first example, they will be intermingled.  In the second example, all
+first example, they will be intermingled, appearing in the same order as
+they are found in the linker input.  In the second example, all
 @samp{.text} input sections will appear first, followed by all
 @samp{.rdata} input sections.
 
@@ -2490,7 +2688,7 @@ notation is now considered obsolete.  It is equivalent to
 @cindex KEEP
 @cindex garbage collection
 When link-time garbage collection is in use (@samp{--gc-sections}),
-it is often useful to mark sections that should not be eliminated. 
+it is often useful to mark sections that should not be eliminated.
 This is accomplished by surrounding an input section's wildcard entry
 with @code{KEEP()}, as in @code{KEEP(*(.init))} or
 @code{KEEP(SORT(*)(.ctors))}.
@@ -2527,7 +2725,7 @@ SECTIONS @{
     @}
 @}
 @end group
-@end smallexample        
+@end smallexample
 
 @node Output Section Data
 @subsection Output section data
@@ -2587,16 +2785,16 @@ You may use the @code{FILL} command to set the fill pattern for the
 current section.  It is followed by an expression in parentheses.  Any
 otherwise unspecified regions of memory within the section (for example,
 gaps left due to the required alignment of input sections) are filled
-with the two least significant bytes of the expression, repeated as
+with the four least significant bytes of the expression, repeated as
 necessary.  A @code{FILL} statement covers memory locations after the
 point at which it occurs in the section definition; by including more
 than one @code{FILL} statement, you can have different fill patterns in
 different parts of an output section.
 
 This example shows how to fill unspecified regions of memory with the
-value @samp{0x9090}:
+value @samp{0x90}:
 @smallexample
-FILL(0x9090)
+FILL(0x90909090)
 @end smallexample
 
 The @code{FILL} command is similar to the @samp{=@var{fillexp}} output
@@ -2714,7 +2912,7 @@ section named @samp{/DISCARD/} are not included in the output file.
 We showed above that the full description of an output section looked
 like this:
 @smallexample
-@group 
+@group
 @var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
   @{
     @var{output-section-command}
@@ -2727,7 +2925,7 @@ We've already described @var{section}, @var{address}, and
 @var{output-section-command}.  In this section we will describe the
 remaining section attributes.
 
-@menu 
+@menu
 * Output Section Type::                Output section type
 * Output Section LMA::         Output section LMA
 * Output Section Region::      Output section region
@@ -2805,7 +3003,7 @@ counter holds the VMA value, not the LMA value.
 SECTIONS
   @{
   .text 0x1000 : @{ *(.text) _etext = . ; @}
-  .mdata 0x2000 : 
+  .mdata 0x2000 :
     AT ( ADDR (.text) + SIZEOF (.text) )
     @{ _data = . ; *(.data); _edata = . ;  @}
   .bss 0x3000 :
@@ -2882,7 +3080,7 @@ You can set the fill pattern for an entire section by using
 @samp{=@var{fillexp}}.  @var{fillexp} is an expression
 (@pxref{Expressions}).  Any otherwise unspecified regions of memory
 within the output section (for example, gaps left due to the required
-alignment of input sections) will be filled with the two least
+alignment of input sections) will be filled with the four least
 significant bytes of the value, repeated as necessary.
 
 You can also change the fill value with a @code{FILL} command in the
@@ -2891,7 +3089,7 @@ output section commands; see @ref{Output Section Data}.
 Here is a simple example:
 @smallexample
 @group
-SECTIONS @{ .text : @{ *(.text) @} =0x9090 @}
+SECTIONS @{ .text : @{ *(.text) @} =0x90909090 @}
 @end group
 @end smallexample
 
@@ -3032,7 +3230,7 @@ command.  However, you can define as many blocks of memory within it as
 you wish.  The syntax is:
 @smallexample
 @group
-MEMORY 
+MEMORY
   @{
     @var{name} [(@var{attr})] : ORIGIN = @var{origin}, LENGTH = @var{len}
     @dots{}
@@ -3107,7 +3305,7 @@ region.
 
 @smallexample
 @group
-MEMORY 
+MEMORY
   @{
     rom (rx)  : ORIGIN = 0, LENGTH = 256K
     ram (!rx) : org = 0x40000000, l = 4M
@@ -3311,9 +3509,9 @@ VERS_1.1 @{
         global:
                 foo1;
         local:
-                old*; 
-                original*; 
-                new*; 
+                old*;
+                original*;
+                new*;
 @};
 
 VERS_1.2 @{
@@ -3418,6 +3616,17 @@ within the shared library, you can use the aliases of convenience
 (i.e. @samp{old_foo}), or you can use the @samp{.symver} directive to
 specifically bind to an external version of the function in question.
 
+You can also specify the language in the version script:
+
+@smallexample
+VERSION extern "lang" @{ version-script-commands @}
+@end smallexample
+
+The supported @samp{lang}s are @samp{C}, @samp{C++}, and @samp{Java}. 
+The linker will iterate over the list of symbols at the link time and
+demangle them according to @samp{lang} before matching them to the
+patterns specified in @samp{version-script-commands}.
+
 @node Expressions
 @section Expressions in Linker Scripts
 @cindex expressions
@@ -3523,7 +3732,7 @@ SECTIONS
       file2(.text)
       . += 1000;
       file3(.text)
-    @} = 0x1234;
+    @} = 0x12345678;
 @}
 @end smallexample
 @noindent
@@ -3531,7 +3740,7 @@ In the previous example, the @samp{.text} section from @file{file1} is
 located at the beginning of the output section @samp{output}.  It is
 followed by a 1000 byte gap.  Then the @samp{.text} section from
 @file{file2} appears, also with a 1000 byte gap following before the
-@samp{.text} section from @file{file3}.  The notation @samp{= 0x1234}
+@samp{.text} section from @file{file3}.  The notation @samp{= 0x12345678}
 specifies what data to write in the gaps (@pxref{Output Section Fill}).
 
 @cindex dot inside sections
@@ -3595,7 +3804,7 @@ precedence      associativity   Operators                Notes
 (lowest)
 @end smallexample
 Notes:
-(1) Prefix operators 
+(1) Prefix operators
 (2) @xref{Assignments}.
 @c TEXI2ROFF-KILL
 @end ifinfo
@@ -3613,7 +3822,7 @@ height2pt&\omit&&\omit&&\omit&\cr
 height2pt&\omit&&\omit&&\omit&\cr
 &highest&&&&&\cr
 % '176 is tilde, '~' in tt font
-&1&&left&&\qquad-          \char'176\      !\qquad\dag&\cr 
+&1&&left&&\qquad-          \char'176\      !\qquad\dag&\cr
 &2&&left&&*          /        \%&\cr
 &3&&left&&+          -&\cr
 &4&&left&&>>         <<&\cr
@@ -3668,7 +3877,7 @@ following
 @group
 SECTIONS
   @{
-    .text 9+this_isnt_constant : 
+    .text 9+this_isnt_constant :
       @{ *(.text) @}
   @}
 @end group
@@ -3743,7 +3952,7 @@ identical values:
 @group
 SECTIONS @{ @dots{}
   .output1 :
-    @{ 
+    @{
     start_of_output_1 = ABSOLUTE(.);
     @dots{}
     @}
@@ -4056,7 +4265,7 @@ non-interworking aware Thumb code.
 @cindex entry point, thumb
 @kindex --thumb-entry=@var{entry}
 The @samp{--thumb-entry} switch is a duplicate of the generic
-@samp{--entry} switch, in that it sets the program's starting address.  
+@samp{--entry} switch, in that it sets the program's starting address.
 But it also sets the bottom bit of the address, so that it can be
 branched to using a BX instruction, and the program will start
 executing in Thumb mode straight away.
@@ -4216,7 +4425,7 @@ individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
 distribution.
 
 Otherwise, send bug reports for @code{ld} to
-@samp{bug-gnu-utils@@gnu.org}.
+@samp{bug-binutils@@gnu.org}.
 
 The fundamental principle of reporting bugs usefully is this:
 @strong{report all the facts}.  If you are not sure whether to state a
@@ -4434,10 +4643,10 @@ This command does nothing whatever; it's only accepted for compatibility.
 @cindex @code{FORMAT} (MRI)
 @item FORMAT @var{output-format}
 Similar to the @code{OUTPUT_FORMAT} command in the more general linker
-language, but restricted to one of these output formats: 
+language, but restricted to one of these output formats:
 
 @enumerate
-@item 
+@item
 S-records, if @var{output-format} is @samp{S}
 
 @item
@@ -4500,12 +4709,12 @@ If you have more than one @code{SECT} statement for the same
 @cindex GNU Free Documentation License
 
                 GNU Free Documentation License
-                
+
                    Version 1.1, March 2000
 
  Copyright (C) 2000  Free Software Foundation, Inc.
   59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-     
+
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -4882,5 +5091,3 @@ to permit their use in free software.
 
 @contents
 @bye
-
-