* bfd/bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
[deliverable/binutils-gdb.git] / ld / ld.texinfo
index b85c6bfebbc302956233103103710280e6e08421..7860e2505914a435095c31bd253099782d398f94 100644 (file)
@@ -1,7 +1,7 @@
 \input texinfo
 @setfilename ld.info
 @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-@c 2001, 2002, 2003 Free Software Foundation, Inc.
+@c 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 @syncodeindex ky cp
 @include configdoc.texi
 @c (configdoc.texi is generated by the Makefile)
 @set PJ
 @set SH
 @set SPARC
-@set C54X
+@set TIC54X
 @set V850
 @set VAX
 @set WIN32
+@set XTENSA
 @end ifset
 @c man end
 
@@ -60,7 +61,7 @@ END-INFO-DIR-ENTRY
 This file documents the @sc{gnu} linker LD version @value{VERSION}.
 
 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
-2001, 2002, 2003 Free Software Foundation, Inc.
+2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 @ignore
 
@@ -69,7 +70,7 @@ 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".
+section entitled ``GNU Free Documentation License''.
 
 Permission is granted to process this file through Tex and print the
 results, provided the printed document carries copying permission
@@ -105,14 +106,14 @@ notice identical to this one except for the removal of this paragraph
 @vskip 0pt plus 1filll
 @c man begin COPYRIGHT
 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001,
-2002, 2003 Free Software Foundation, Inc.
+2002, 2003, 2004 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".
+section entitled ``GNU Free Documentation License''.
 @c man end
 
 @end titlepage
@@ -126,7 +127,7 @@ This file documents the @sc{gnu} linker ld version @value{VERSION}.
 
 This document is distributed under the terms of the GNU Free
 Documentation License.  A copy of the license is included in the
-section entitled "GNU Free Documentation License".
+section entitled ``GNU Free Documentation License''.
 
 @menu
 * Overview::                    Overview
@@ -139,18 +140,30 @@ section entitled "GNU Free Documentation License".
 @ifset H8300
 * H8/300::                      ld and the H8/300
 @end ifset
-@ifset Hitachi
-* Hitachi::                     ld and other Hitachi micros
+@ifset Renesas
+* Renesas::                     ld and other Renesas micros
 @end ifset
 @ifset I960
 * i960::                        ld and the Intel 960 family
 @end ifset
+@ifset ARM
+* ARM::                                ld and the ARM family
+@end ifset
+@ifset HPPA
+* HPPA ELF32::                  ld and HPPA 32-bit ELF
+@end ifset
+@ifset M68HC11
+* M68HC11/68HC12::              ld and the Motorola 68HC11 and 68HC12 families
+@end ifset
 @ifset TICOFF
 * TI COFF::                     ld and the TI COFF
 @end ifset
 @ifset WIN32
 * Win32::                       ld and WIN32 (cygwin/mingw)
 @end ifset
+@ifset XTENSA
+* Xtensa::                      ld and Xtensa Processors
+@end ifset
 @end ifclear
 @ifclear SingleFormat
 * BFD::                         BFD
@@ -280,7 +293,7 @@ and the script command language.  If @emph{no} binary input files at all
 are specified, the linker does not produce any output, and issues the
 message @samp{No input files}.
 
-If the linker can not recognize the format of an object file, it will
+If the linker cannot recognize the format of an object file, it will
 assume that it is a linker script.  A script specified in this way
 augments the main linker script used for the link (either the default
 linker script or the one specified by using @samp{-T}).  This feature
@@ -298,7 +311,7 @@ option that requires them.
 
 For options whose names are multiple letters, either one dash or two can
 precede the option name; for example, @samp{-trace-symbol} and
-@samp{--trace-symbol} are equivalent.  Note - there is one exception to
+@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
@@ -312,8 +325,8 @@ immediately following the option that requires them.  For example,
 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
+Note---if the linker is being invoked indirectly, via a compiler driver
+(e.g. @samp{gcc}) then all the linker command line options should be
 prefixed by @samp{-Wl,} (or whatever is appropriate for the particular
 compiler driver) like this:
 
@@ -436,6 +449,17 @@ base 10; you may use a leading @samp{0x} for base 16, or a leading
 @samp{0} for base 8).  @xref{Entry Point}, for a discussion of defaults
 and other ways of specifying the entry point.
 
+@kindex --exclude-libs
+@item --exclude-libs @var{lib},@var{lib},...
+Specifies a list of archive libraries from which symbols should not be automatically
+exported. The library names may be delimited by commas or colons.  Specifying
+@code{--exclude-libs ALL} excludes symbols in all archive libraries from
+automatic export.  This option is available only for the i386 PE targeted
+port of the linker and for ELF targeted ports.  For i386 PE, symbols
+explicitly listed in a .def file are still exported, regardless of this
+option.  For ELF targeted ports, symbols affected by this option will
+be treated as hidden.
+
 @cindex dynamic symbol table
 @kindex -E
 @kindex --export-dynamic
@@ -458,6 +482,7 @@ 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}.
 
+@ifclear SingleFormat
 @cindex big-endian objects
 @cindex endianness
 @kindex -EB
@@ -468,6 +493,7 @@ Link big-endian objects.  This affects the default output format.
 @kindex -EL
 @item -EL
 Link little-endian objects.  This affects the default output format.
+@end ifclear
 
 @kindex -f
 @kindex --auxiliary
@@ -510,11 +536,15 @@ used to select a subset of the symbols provided by the object
 
 Some older linkers used the @option{-F} option throughout a compilation
 toolchain for specifying object-file format for both input and output
-object files.  The @sc{gnu} linker uses other mechanisms for this
-purpose: the @option{-b}, @option{--format}, @option{--oformat} options, the
+object files.
+@ifclear SingleFormat
+The @sc{gnu} linker uses other mechanisms for this purpose: the
+@option{-b}, @option{--format}, @option{--oformat} options, the 
 @code{TARGET} command in linker scripts, and the @code{GNUTARGET}
-environment variable.  The @sc{gnu} linker will ignore the @option{-F}
-option when not creating an ELF shared object.
+environment variable.
+@end ifclear
+The @sc{gnu} linker will ignore the @option{-F} option when not
+creating an ELF shared object.
 
 @cindex finalization function
 @kindex -fini
@@ -671,7 +701,9 @@ Turn off page alignment of sections, and mark the output as
 Set the text and data sections to be readable and writable.  Also, do
 not page-align the data segment, and disable linking against shared
 libraries.  If the output format supports Unix style magic numbers,
-mark the output as @code{OMAGIC}.
+mark the output as @code{OMAGIC}. Note: Although a writable text section
+is allowed for PE-COFF targets, it does not conform to the format
+specification published by Microsoft.
 
 @kindex --no-omagic
 @cindex OMAGIC
@@ -712,9 +744,9 @@ This option is currently only supported on ELF platforms.
 @cindex partial link
 @cindex relocatable output
 @kindex -r
-@kindex --relocateable
+@kindex --relocatable
 @item -r
-@itemx --relocateable
+@itemx --relocatable
 Generate relocatable output---i.e., generate an output file that can in
 turn serve as input to @command{ld}.  This is often called @dfn{partial
 linking}.  As a side effect, in environments that support standard Unix
@@ -859,29 +891,68 @@ for Solaris compatibility.
 
 @kindex -z @var{keyword}
 @item -z @var{keyword}
-The recognized keywords are @code{initfirst}, @code{interpose},
-@code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen},
-@code{nodump}, @code{now}, @code{origin}, @code{combreloc}, @code{nocombreloc} 
-and @code{nocopyreloc}.
-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
-before all symbols but the primary executable. @code{loadfltr} marks
-the object that its filtees be processed immediately at runtime.
-@code{nodefaultlib} marks the object that the search for dependencies
-of this object will ignore any default library search paths.
-@code{nodelete} marks the object shouldn't be unloaded at runtime.
-@code{nodlopen} marks the object not available to @code{dlopen}.
-@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{muldefs} allows multiple definitions.
-@code{combreloc} combines multiple reloc sections and sorts them
-to make dynamic symbol lookup caching possible.
-@code{nocombreloc} disables multiple reloc sections combining.
-@code{nocopyreloc} disables production of copy relocs.
+The recognized keywords are:
+@table @samp
+
+@item combreloc
+Combines multiple reloc sections and sorts them to make dynamic symbol
+lookup caching possible.
+
+@item defs
+Disallows undefined symbols in object files.  Undefined symbols in
+shared libraries are still allowed.
+
+@item initfirst
+This option is only meaningful when building a shared object.
+It marks the object so that its runtime initialization will occur
+before the runtime initialization of any other objects brought into
+the process at the same time.  Similarly the runtime finalization of
+the object will occur after the runtime finalization of any other
+objects.
+
+@item interpose
+Marks the object that its symbol table interposes before all symbols
+but the primary executable.
+
+@item loadfltr
+Marks  the object that its filters be processed immediately at
+runtime.
+
+@item muldefs
+Allows multiple definitions.
+
+@item nocombreloc
+Disables multiple reloc sections combining.
+
+@item nocopyreloc
+Disables production of copy relocs.
+
+@item nodefaultlib
+Marks the object that the search for dependencies of this object will
+ignore any default library search paths.
+
+@item nodelete
+Marks the object shouldn't be unloaded at runtime.
+
+@item nodlopen
+Marks the object not available to @code{dlopen}.
+
+@item nodump
+Marks the object can not be dumped by @code{dldump}.
+
+@item now
+When generating an executable or shared library, mark it to tell the
+dynamic linker to resolve all symbols when the program is started, or
+when the shared library is linked to using dlopen, instead of
+deferring function call resolution to the point when the function is
+first called.
+
+@item origin
+Marks the object may contain $ORIGIN.
+
+@end table
+
+Other keywords are ignored for Solaris compatibility.  
 
 @kindex -(
 @cindex groups of archives
@@ -915,6 +986,31 @@ behaviour from release 2.14 onwards is to reject such input files, and
 so the @samp{--accept-unknown-input-arch} option has been added to
 restore the old behaviour.
 
+@kindex --as-needed
+@kindex --no-as-needed
+@item --as-needed
+@itemx --no-as-needed
+This option affects ELF DT_NEEDED tags for dynamic libraries mentioned
+on the command line after the @option{--as-needed} option.  Normally,
+the linker will add a DT_NEEDED tag for each dynamic library mentioned
+on the command line, regardless of whether the library is actually
+needed.  @option{--as-needed} causes DT_NEEDED tags to only be emitted
+for libraries that satisfy some symbol reference from regular objects
+which is undefined at the point that the library was linked.
+@option{--no-as-needed} restores the default behaviour.
+
+@kindex --add-needed
+@kindex --no-add-needed
+@item --add-needed
+@itemx --no-add-needed
+This option affects the treatment of dynamic libraries from ELF
+DT_NEEDED tags in dynamic libraries mentioned on the command line after
+the @option{--no-add-needed} option.  Normally, the linker will add
+a DT_NEEDED tag for each dynamic library from DT_NEEDED tags.
+@option{--no-add-needed} causes DT_NEEDED tags will never be emitted
+for those libraries from DT_NEEDED tags. @option{--add-needed} restores
+the default behaviour.
+
 @kindex -assert @var{keyword}
 @item -assert @var{keyword}
 This option is ignored for SunOS compatibility.
@@ -937,8 +1033,8 @@ multiple times on the command line: it affects library searching for
 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.
-@option{--no-undefined} is implied.  This option is only meaningful on ELF
-platforms which support shared libraries.
+@option{--unresolved-symbols=report-all} is implied.  This option is
+only meaningful on ELF platforms which support shared libraries.
 
 @kindex -Bstatic
 @kindex -dn
@@ -952,7 +1048,8 @@ Do not link against shared libraries.  This is only meaningful on
 platforms for which shared libraries are supported.  The different
 variants of this option are for compatibility with various systems.  You
 may use this option multiple times on the command line: it affects
-library searching for @option{-l} options which follow it.
+library searching for @option{-l} options which follow it.  This
+option also implies @option{--unresolved-symbols=report-all}.
 
 @kindex -Bsymbolic
 @item -Bsymbolic
@@ -971,7 +1068,7 @@ been assigned to see if there any overlaps.  Normally the linker will
 perform this check, and if it finds any overlaps it will produce
 suitable error messages.  The linker does know about, and does make
 allowances for sections in overlays.  The default behaviour can be
-restored by using the command line switch @samp{--check-sections}.
+restored by using the command line switch @option{--check-sections}.
 
 @cindex cross reference table
 @kindex --cref
@@ -1043,15 +1140,6 @@ generating dynamically linked ELF executables.  The default dynamic
 linker is normally correct; don't use this unless you know what you are
 doing.
 
-@cindex MIPS embedded PIC code
-@kindex --embedded-relocs
-@item --embedded-relocs
-This option is only meaningful when linking MIPS embedded PIC code,
-generated by the -membedded-pic option to the @sc{gnu} compiler and
-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
@@ -1075,9 +1163,9 @@ it ends in a @code{.exe} suffix.
 @itemx --gc-sections
 Enable garbage collection of unused input sections.  It is ignored on
 targets that do not support this option.  This option is not compatible
-with @samp{-r}, nor should it be used with dynamic linking.  The default
-behaviour (of not performing this garbage collection) can be restored by
-specifying @samp{--no-gc-sections} on the command line.
+with @samp{-r}. The default behaviour (of not performing this garbage
+collection) can be restored by specifying @samp{--no-gc-sections} on
+the command line.
 
 @cindex help
 @cindex usage
@@ -1092,7 +1180,7 @@ Print a summary of all target specific options on the standard output and exit.
 @kindex -Map
 @item -Map @var{mapfile}
 Print a link map to the file @var{mapfile}.  See the description of the
-@samp{-M} option, above.
+@option{-M} option, above.
 
 @cindex memory usage
 @kindex --no-keep-memory
@@ -1107,9 +1195,11 @@ while linking a large executable.
 @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.  These options
-disallows such undefined symbols.
+Report unresolved symbol references from regular object files.  This
+is done even if the linker is creating a non-symbolic shared library.
+The switch @option{--[no-]allow-shlib-undefined} controls the
+behaviour for reporting unresolved references found in shared
+libraries being linked in.  
 
 @kindex --allow-multiple-definition
 @kindex -z muldefs
@@ -1120,17 +1210,24 @@ report a fatal error. These options allow multiple definitions and the
 first definition will be used.
 
 @kindex --allow-shlib-undefined
+@kindex --no-allow-shlib-undefined
 @item --allow-shlib-undefined
-Allow undefined symbols in shared objects even  when --no-undefined is
-set. The net result will be that undefined symbols in regular objects
-will still trigger an error, but undefined symbols in shared objects
-will be ignored.  The implementation of no_undefined makes the
-assumption that the runtime linker will choke on undefined symbols.
-However there is at least one system (BeOS) where undefined symbols in
-shared libraries is normal since the kernel patches them at load time to
-select which function is most appropriate for the current architecture.
-I.E. dynamically select an appropriate memset function.  Apparently it
-is also normal for HPPA shared libraries to have undefined symbols.
+@itemx --no-allow-shlib-undefined
+Allows (the default) or disallows undefined symbols in shared libraries.
+This switch is similar to @option{--no-undefined} except that it
+determines the behaviour when the undefined symbols are in a
+shared library rather than a regular object file.  It does not affect
+how undefined symbols in regular object files are handled.
+
+The reason that @option{--allow-shlib-undefined} is the default is that
+the shared library being specified at link time may not be the same as
+the one that is available at load time, so the symbols might actually be
+resolvable at load time.  Plus there are some systems, (eg BeOS) where
+undefined symbols in shared libraries is normal.  (The kernel patches
+them at load time to select which function is most appropriate 
+for the current architecture.  This is used for example to dynamically
+select an appropriate memset function).  Apparently it is also normal
+for HPPA shared libraries to have undefined symbols.
 
 @kindex --no-undefined-version
 @item --no-undefined-version
@@ -1138,6 +1235,16 @@ Normally when a symbol has an undefined version, the linker will ignore
 it. This option disallows symbols with undefined version and a fatal error
 will be issued instead.
 
+@kindex --default-symver
+@item --default-symver
+Create and use a default symbol version (the soname) for unversioned
+exported symbols.
+
+@kindex --default-imported-symver
+@item --default-imported-symver
+Create and use a default symbol version (the soname) for unversioned
+imported symbols.
+
 @kindex --no-warn-mismatch
 @item --no-warn-mismatch
 Normally @command{ld} will give an error if you try to link together input
@@ -1183,6 +1290,18 @@ command @code{OUTPUT_FORMAT} can also specify the output format, but
 this option overrides it.  @xref{BFD}.
 @end ifclear
 
+@kindex -pie
+@kindex --pic-executable
+@item -pie
+@itemx --pic-executable
+@cindex position independent executables
+Create a position independent executable.  This is currently only supported on
+ELF platforms.  Position independent executables are similar to shared
+libraries in that they are relocated by the dynamic linker to the virtual
+address the OS chooses for them (which can vary between invocations).  Like
+normal dynamically linked executables they can be executed and symbols
+defined in the executable cannot be overridden by shared libraries.
+
 @kindex -qmagic
 @item -qmagic
 This option is ignored for Linux compatibility.
@@ -1205,7 +1324,12 @@ This option is only supported on a few targets.
 @ifset I960
 @xref{i960,, @command{ld} and the Intel 960 family}.
 @end ifset
-
+@ifset XTENSA
+@xref{Xtensa,, @command{ld} and Xtensa Processors}.
+@end ifset
+@ifset M68HC11
+@xref{M68HC11/68HC12,,@command{ld} and the 68HC11 and 68HC12}.
+@end ifset
 
 On some platforms, the @samp{--relax} option performs global
 optimizations that become possible when the linker resolves addressing
@@ -1347,6 +1471,16 @@ 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.
 
+@kindex --sort-section name
+@item --sort-section name
+This option will apply @code{SORT_BY_NAME} to all wildcard section
+patterns in the linker script.
+
+@kindex --sort-section alignment
+@item --sort-section alignment
+This option will apply @code{SORT_BY_ALIGNMENT} to all wildcard section
+patterns in the linker script.
+
 @kindex --split-by-file
 @item --split-by-file [@var{size}]
 Similar to @option{--split-by-reloc} but creates a new output section for
@@ -1371,6 +1505,12 @@ many relocations.  @var{count} defaults to a value of 32768.
 Compute and display statistics about the operation of the linker, such
 as execution time and memory usage.
 
+@kindex --sysroot
+@item --sysroot=@var{directory}
+Use @var{directory} as the location of the sysroot, overriding the
+configure-time default.  This option is only supported by linkers
+that were configured using @option{--with-sysroot}.
+
 @kindex --traditional-format
 @cindex traditional format
 @item --traditional-format
@@ -1405,11 +1545,39 @@ sign (``@key{=}''), and @var{org}.
 @item -Tbss @var{org}
 @itemx -Tdata @var{org}
 @itemx -Ttext @var{org}
-Use @var{org} as the starting address for---respectively---the
-@code{bss}, @code{data}, or the @code{text} segment of the output file.
-@var{org} must be a single hexadecimal integer;
-for compatibility with other linkers, you may omit the leading
-@samp{0x} usually associated with hexadecimal values.
+Same as --section-start, with @code{.bss}, @code{.data} or
+@code{.text} as the @var{sectionname}.
+
+@kindex --unresolved-symbols
+@item --unresolved-symbols=@var{method}
+Determine how to handle unresolved symbols.  There are four possible
+values for @samp{method}:
+
+@table @samp
+@item ignore-all
+Do not report any unresolved symbols.
+
+@item report-all
+Report all unresolved symbols.  This is the default.
+
+@item ignore-in-object-files
+Report unresolved symbols that are contained in shared libraries, but
+ignore them if they come from regular object files.
+
+@item ignore-in-shared-libs
+Report unresolved symbols that come from regular object files, but
+ignore them if they come from shared libraries.  This can be useful
+when creating a dynamic binary and it is known that all the shared
+libraries that it should be referencing are included on the linker's
+command line.
+@end table
+
+The behaviour for shared libraries on their own can also be controlled
+by the @option{--[no-]allow-shlib-undefined} option.
+
+Normally the linker will generate an error message for each reported
+unresolved symbol but the option @option{--warn-unresolved-symbols}
+can change this to a warning.
 
 @kindex --verbose
 @cindex verbose
@@ -1424,7 +1592,7 @@ the linker script being used by the linker.
 @itemx --version-script=@var{version-scriptfile}
 Specify the name of a version script to the linker.  This is typically
 used when creating shared libraries to specify additional information
-about the version heirarchy for the library being created.  This option
+about the version hierarchy for the library being created.  This option
 is only meaningful on ELF platforms which support shared libraries.
 @xref{VERSION}.
 
@@ -1433,10 +1601,10 @@ is only meaningful on ELF platforms which support shared libraries.
 @cindex combining symbols, warnings on
 @item --warn-common
 Warn when a common symbol is combined with another common symbol or with
-a symbol definition.  Unix linkers allow this somewhat sloppy practice,
+a symbol definition.  Unix linkers allow this somewhat sloppy practise,
 but linkers on some other operating systems do not.  This option allows
 you to find potential problems from combining global symbols.
-Unfortunately, some C libraries use this practice, so you may get some
+Unfortunately, some C libraries use this practise, so you may get some
 warnings about symbols in the libraries as well as in your programs.
 
 There are three kinds of global symbols, illustrated here by C examples:
@@ -1550,6 +1718,21 @@ The address will only be changed if it not explicitly specified; that
 is, if the @code{SECTIONS} command does not specify a start address for
 the section (@pxref{SECTIONS}).
 
+@kindex --warn-shared-textrel
+@item --warn-shared-textrel
+Warn if the linker adds a DT_TEXTREL to a shared object.  
+
+@kindex --warn-unresolved-symbols
+@item --warn-unresolved-symbols
+If the linker is going to report an unresolved symbol (see the option
+@option{--unresolved-symbols}) it will normally generate an error.
+This option makes it generate a warning instead.
+
+@kindex --error-unresolved-symbols
+@item --error-unresolved-symbols
+This restores the linker's default behaviour of generating errors when
+it is reporting unresolved symbols.
+
 @kindex --whole-archive
 @cindex including an entire archive
 @item --whole-archive
@@ -1582,9 +1765,9 @@ Here is a trivial example:
 
 @smallexample
 void *
-__wrap_malloc (int c)
+__wrap_malloc (size_t c)
 @{
-  printf ("malloc called with %ld\n", c);
+  printf ("malloc called with %zu\n", c);
   return __real_malloc (c);
 @}
 @end smallexample
@@ -1611,11 +1794,33 @@ If you specify @option{--disable-new-dtags}, no new dynamic tags will be
 created. By default, the new dynamic tags are not created. Note that
 those options are only available for ELF systems.
 
+@kindex --hash-size=@var{number}
+Set the default size of the linker's hash tables to a prime number
+close to @var{number}.  Increasing this value can reduce the length of
+time it takes the linker to perform its tasks, at the expense of
+increasing the linker's memory requirements.  Similarly reducing this
+value can reduce the memory requirements at the expense of speed.
+
+@kindex --reduce-memory-overheads
+@item --reduce-memory-overheads
+This option reduces memory requirements at ld runtime, at the expense of
+linking speed.  This was introduced to to select the old O(n^2) algorithm
+for link map file generation, rather than the new O(n) algorithm which uses
+about 40% more memory for symbol storage.
+
+Another affect of the switch is to set the default hash table size to
+1021, which again saves memory at the cost of lengthening the linker's
+run time.  This is not done however if the @option{--hash-size} switch
+has been used.
+
+The @option{--reduce-memory-overheads} switch may be also be used to
+enable other tradeoffs in future versions of the linker.
+
 @end table
 
 @c man end
 
-@subsection Options specific to i386 PE targets
+@subsection Options Specific to i386 PE Targets
 
 @c man begin OPTIONS
 
@@ -1639,25 +1844,28 @@ values by either a space or an equals sign.
 @item --add-stdcall-alias
 If given, symbols with a stdcall suffix (@@@var{nn}) will be exported
 as-is and also with the suffix stripped.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --base-file
 @item --base-file @var{file}
 Use @var{file} as the name of a file in which to save the base
 addresses of all the relocations needed for generating DLLs with
 @file{dlltool}.
+[This is an i386 PE specific option]
 
 @kindex --dll
 @item --dll
 Create a DLL instead of a regular executable.  You may also use
 @option{-shared} or specify a @code{LIBRARY} in a given @code{.def}
 file.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --enable-stdcall-fixup
 @kindex --disable-stdcall-fixup
 @item --enable-stdcall-fixup
 @itemx --disable-stdcall-fixup
 If the link finds a symbol that it cannot resolve, it will attempt to
-do "fuzzy linking" by looking for another defined symbol that differs
+do ``fuzzy linking'' by looking for another defined symbol that differs
 only in the format of the symbol name (cdecl vs stdcall) and will
 resolve that symbol by linking to the match.  For example, the
 undefined symbol @code{_foo} might be linked to the function
@@ -1669,6 +1877,7 @@ to be usable.  If you specify @option{--enable-stdcall-fixup}, this
 feature is fully enabled and warnings are not printed.  If you specify
 @option{--disable-stdcall-fixup}, this feature is disabled and such
 mismatches are considered to be errors.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @cindex DLLs, creating
 @kindex --export-all-symbols
@@ -1695,25 +1904,20 @@ These cygwin-excludes are: @code{_cygwin_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}. 
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --exclude-symbols
 @item --exclude-symbols @var{symbol},@var{symbol},...
 Specifies a list of symbols which should not be automatically
 exported.  The symbol names may be delimited by commas or colons.
-
-@kindex --exclude-libs
-@item --exclude-libs @var{lib},@var{lib},...
-Specifies a list of archive libraries from which symbols should not be automatically
-exported. The library names may be delimited by commas or colons.  Specifying
-@code{--exclude-libs ALL} excludes symbols in all archive libraries from
-automatic export. Symbols explicitly listed in a .def file are still exported,
-regardless of this option. 
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --file-alignment
 @item --file-alignment
 Specify the file alignment.  Sections in the file will always begin at
 file offsets which are multiples of this number.  This defaults to
 512.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @cindex heap size
 @kindex --heap
@@ -1722,6 +1926,7 @@ file offsets which are multiples of this number.  This defaults to
 Specify the amount of memory to reserve (and optionally commit) to be
 used as heap for this program.  The default is 1Mb reserved, 4K
 committed.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @cindex image base
 @kindex --image-base
@@ -1732,35 +1937,52 @@ is loaded.  To reduce the need to relocate and improve performance of
 your dlls, each should have a unique base address and not overlap any
 other dlls.  The default is 0x400000 for executables, and 0x10000000
 for dlls.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --kill-at
 @item --kill-at
 If given, the stdcall suffixes (@@@var{nn}) will be stripped from
 symbols before they are exported.
+[This option is specific to the i386 PE targeted port of the linker]
+
+@kindex --large-address-aware
+@item --large-address-aware
+If given, the appropriate bit in the ``Charateristics'' field of the COFF
+header is set to indicate that this executable supports virtual addresses
+greater than 2 gigabytes.  This should be used in conjuction with the /3GB
+or /USERVA=@var{value} megabytes switch in the ``[operating systems]''
+section of the BOOT.INI.  Otherwise, this bit has no effect.
+[This option is specific to PE targeted ports of the linker]
 
 @kindex --major-image-version
 @item --major-image-version @var{value}
-Sets the major number of the "image version".  Defaults to 1.
+Sets the major number of the ``image version''.  Defaults to 1.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --major-os-version
 @item --major-os-version @var{value}
-Sets the major number of the "os version".  Defaults to 4.
+Sets the major number of the ``os version''.  Defaults to 4.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --major-subsystem-version
 @item --major-subsystem-version @var{value}
-Sets the major number of the "subsystem version".  Defaults to 4.
+Sets the major number of the ``subsystem version''.  Defaults to 4.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --minor-image-version
 @item --minor-image-version @var{value}
-Sets the minor number of the "image version".  Defaults to 0.
+Sets the minor number of the ``image version''.  Defaults to 0.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --minor-os-version
 @item --minor-os-version @var{value}
-Sets the minor number of the "os version".  Defaults to 0.
+Sets the minor number of the ``os version''.  Defaults to 0.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --minor-subsystem-version
 @item --minor-subsystem-version @var{value}
-Sets the minor number of the "subsystem version".  Defaults to 0.
+Sets the minor number of the ``subsystem version''.  Defaults to 0.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @cindex DEF files, creating
 @cindex DLLs, creating
@@ -1771,6 +1993,7 @@ file corresponding to the DLL the linker is generating.  This DEF file
 (which should be called @code{*.def}) may be used to create an import
 library with @code{dlltool} or may be used as a reference to
 automatically or implicitly exported symbols.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @cindex DLLs, creating
 @kindex --out-implib
@@ -1778,9 +2001,10 @@ automatically or implicitly exported symbols.
 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
+may be used to link clients against the generated DLL; this behaviour
 makes it possible to skip a separate @code{dlltool} import library
 creation step.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --enable-auto-image-base
 @item --enable-auto-image-base
@@ -1789,29 +2013,37 @@ 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.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @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.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @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
+When linking dynamically to a dll without an import library,
 search for @code{<string><basename>.dll} in preference to 
-@code{lib<basename>.dll}. This behavior allows easy distinction
+@code{lib<basename>.dll}. This behaviour 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}. 
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --enable-auto-import
 @item --enable-auto-import
 Do sophisticated linking of @code{_symbol} to @code{__imp__symbol} for 
 DATA imports from DLLs, and create the necessary thunking symbols when 
-building the import libraries with those DATA exports.  This generally 
-will 'just work' -- but sometimes you may see this message:
+building the import libraries with those DATA exports. Note: Use of the
+'auto-import' extension will cause the text section of the image file
+to be made writable. This does not conform to the PE-COFF format
+specification published by Microsoft.
+
+Using 'auto-import' generally will 'just work' -- but sometimes you may
+see this message:
 
 "variable '<var>' can't be auto-imported. Please read the 
 documentation for ld's @code{--enable-auto-import} for details."
@@ -1831,7 +2063,7 @@ data type of the exported variable:
 
 One way is to use --enable-runtime-pseudo-reloc switch. This leaves the task
 of adjusting references in your client code for runtime environment, so
-this method works only when runtime environtment supports this feature.
+this method works only when runtime environment supports this feature.
 
 A second solution is to force one of the 'constants' to be a variable -- 
 that is, unknown and un-optimizable at compile time.  For arrays, 
@@ -1871,7 +2103,7 @@ extern_ll -->
 
 A third method of dealing with this difficulty is to abandon
 'auto-import' for the offending symbol and mark it with 
-@code{__declspec(dllimport)}.  However, in practice that
+@code{__declspec(dllimport)}.  However, in practise that
 requires using compile-time #defines to indicate whether you are
 building a DLL, building client code that will link to the DLL, or 
 merely building/linking to a static library.   In making the choice 
@@ -1924,11 +2156,13 @@ A fourth way to avoid this problem is to re-code your
 library to use a functional interface rather than a data interface
 for the offending variables (e.g. set_foo() and get_foo() accessor
 functions).
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --disable-auto-import
 @item --disable-auto-import
-Do not attempt to do sophisticalted linking of @code{_symbol} to 
+Do not attempt to do sophisticated linking of @code{_symbol} to 
 @code{__imp__symbol} for DATA imports from DLLs.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --enable-runtime-pseudo-reloc
 @item --enable-runtime-pseudo-reloc
@@ -1936,20 +2170,24 @@ If your code contains expressions described in --enable-auto-import section,
 that is, DATA imports from DLL with non-zero offset, this switch will create
 a vector of 'runtime pseudo relocations' which can be used by runtime
 environment to adjust references to such data in your client code. 
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --disable-runtime-pseudo-reloc
 @item --disable-runtime-pseudo-reloc
 Do not create pseudo relocations for non-zero offset DATA imports from
 DLLs.  This is the default.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --enable-extra-pe-debug
 @item --enable-extra-pe-debug
 Show additional debug info related to auto-import symbol thunking.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --section-alignment
 @item --section-alignment
 Sets the section alignment.  Sections in memory will always begin at
 addresses which are a multiple of this number.  Defaults to 0x1000.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @cindex stack size
 @kindex --stack
@@ -1958,6 +2196,7 @@ addresses which are a multiple of this number.  Defaults to 0x1000.
 Specify the amount of memory to reserve (and optionally commit) to be
 used as stack for this program.  The default is 2Mb reserved, 4K
 committed.
+[This option is specific to the i386 PE targeted port of the linker]
 
 @kindex --subsystem
 @item --subsystem @var{which}
@@ -1965,12 +2204,42 @@ committed.
 @itemx --subsystem @var{which}:@var{major}.@var{minor}
 Specifies the subsystem under which your program will execute.  The
 legal values for @var{which} are @code{native}, @code{windows},
-@code{console}, and @code{posix}.  You may optionally set the
-subsystem version also.
+@code{console}, @code{posix}, and @code{xbox}.  You may optionally set
+the subsystem version also.  Numeric values are also accepted for
+@var{which}.
+[This option is specific to the i386 PE targeted port of the linker]
+
+@end table
+
+@c man end
+
+@ifset M68HC11
+@subsection Options specific to Motorola 68HC11 and 68HC12 targets
+
+@c man begin OPTIONS
+
+The 68HC11 and 68HC12 linkers support specific options to control the
+memory bank switching mapping and trampoline code generation.
+
+@table @gcctabopt
+
+@kindex --no-trampoline
+@item --no-trampoline
+This option disables the generation of trampoline. By default a trampoline
+is generated for each far function which is called using a @code{jsr}
+instruction (this happens when a pointer to a far function is taken).
+
+@kindex --bank-window
+@item --bank-window @var{name}
+This option indicates to the linker the name of the memory region in
+the @samp{MEMORY} specification that describes the memory bank window.
+The definition of such region is then used by the linker to compute
+paging and addresses within the memory window.
 
 @end table
 
 @c man end
+@end ifset
 
 @ifset UsesEnvVars
 @node Environment
@@ -1978,9 +2247,13 @@ subsystem version also.
 
 @c man begin ENVIRONMENT
 
-You can change the behavior of @command{ld} with the environment variables
-@code{GNUTARGET}, @code{LDEMULATION}, and @code{COLLECT_NO_DEMANGLE}.
+You can change the behaviour of @command{ld} with the environment variables
+@ifclear SingleFormat
+@code{GNUTARGET},
+@end ifclear
+@code{LDEMULATION} and @code{COLLECT_NO_DEMANGLE}.
 
+@ifclear SingleFormat
 @kindex GNUTARGET
 @cindex default input format
 @code{GNUTARGET} determines the input-file object format if you don't
@@ -1994,6 +2267,7 @@ there is no method of ensuring that the magic number used to specify
 object-file formats is unique.  However, the configuration procedure for
 BFD on each system places the conventional format for that system first
 in the search-list, so ambiguities are resolved in favor of convention.
+@end ifclear
 
 @kindex LDEMULATION
 @cindex default emulation
@@ -2193,7 +2467,7 @@ at address @samp{0x8000000}.  After the linker places the @samp{.data}
 output section, the value of the location counter will be
 @samp{0x8000000} plus the size of the @samp{.data} output section.  The
 effect is that the linker will place the @samp{.bss} output section
-immediately after the @samp{.data} output section in memory
+immediately after the @samp{.data} output section in memory.
 
 The linker will ensure that each output section has the required
 alignment, by increasing the location counter if necessary.  In this
@@ -2220,7 +2494,7 @@ In this section we describe the simple linker script commands.
 @end menu
 
 @node Entry Point
-@subsection Setting the entry point
+@subsection Setting the Entry Point
 @kindex ENTRY(@var{symbol})
 @cindex start of execution
 @cindex first instruction
@@ -2249,7 +2523,7 @@ The address @code{0}.
 @end itemize
 
 @node File Commands
-@subsection Commands dealing with files
+@subsection Commands Dealing with Files
 @cindex linker script file commands
 Several linker script commands deal with files.
 
@@ -2278,10 +2552,13 @@ then you can put @samp{INPUT (subr.o)} in your linker script.
 In fact, if you like, you can list all of your input files in the linker
 script, and then invoke the linker with nothing but a @samp{-T} option.
 
-The linker will first try to open the file in the current directory.  If
-it is not found, the linker will search through the archive library
-search path.  See the description of @samp{-L} in @ref{Options,,Command
-Line Options}.
+In case a @dfn{sysroot prefix} is configured, and the filename starts
+with the @samp{/} character, and the script being processed was
+located inside the @dfn{sysroot prefix}, the filename will be looked
+for in the @dfn{sysroot prefix}.  Otherwise, the linker will try to
+open the file in the current directory.  If it is not found, the
+linker will search through the archive library search path.  See the
+description of @samp{-L} in @ref{Options,,Command Line Options}.
 
 If you use @samp{INPUT (-l@var{file})}, @command{ld} will transform the
 name to @code{lib@var{file}.a}, as with the command line argument
@@ -2300,6 +2577,18 @@ files should all be archives, and they are searched repeatedly until no
 new undefined references are created.  See the description of @samp{-(}
 in @ref{Options,,Command Line Options}.
 
+@item AS_NEEDED(@var{file}, @var{file}, @dots{})
+@itemx AS_NEEDED(@var{file} @var{file} @dots{})
+@kindex AS_NEEDED(@var{files})
+This construct can appear only inside of the @code{INPUT} or @code{GROUP}
+commands, among other filenames.  The files listed will be handled
+as if they appear directly in the @code{INPUT} or @code{GROUP} commands,
+with the exception of ELF shared libraries, that will be added only
+when they are actually needed.  This construct essentially enables
+@option{--as-needed} option for all the files listed inside of it
+and restores previous @option{--as-needed} resp. @option{--no-as-needed}
+setting afterwards.
+
 @item OUTPUT(@var{filename})
 @kindex OUTPUT(@var{filename})
 @cindex output file name in linker scripot
@@ -2336,7 +2625,7 @@ first file.
 
 @ifclear SingleFormat
 @node Format Commands
-@subsection Commands dealing with object file formats
+@subsection Commands Dealing with Object File Formats
 A couple of linker script commands deal with object file formats.
 
 @table @code
@@ -2383,7 +2672,7 @@ command is also used to set the format for the output file.  @xref{BFD}.
 @end ifclear
 
 @node Miscellaneous Commands
-@subsection Other linker script commands
+@subsection Other Linker Script Commands
 There are a few other linker scripts commands.
 
 @table @code
@@ -2452,11 +2741,12 @@ the @samp{-f} option.
 @cindex symbol definition, scripts
 @cindex variables, defining
 You may assign a value to a symbol in a linker script.  This will define
-the symbol as a global symbol.
+the symbol and place it into the symbol table with a global scope.
 
 @menu
 * Simple Assignments::         Simple Assignments
 * PROVIDE::                    PROVIDE
+* Source Code Reference::      How to use a linker script defined symbol in source code
 @end menu
 
 @node Simple Assignments
@@ -2481,7 +2771,7 @@ The first case will define @var{symbol} to the value of
 defined, and the value will be adjusted accordingly.
 
 The special symbol name @samp{.} indicates the location counter.  You
-may only use this within a @code{SECTIONS} command.
+may only use this within a @code{SECTIONS} command.  @xref{Location Counter}.
 
 The semicolon after @var{expression} is required.
 
@@ -2549,8 +2839,115 @@ underscore), the linker will silently use the definition in the program.
 If the program references @samp{etext} but does not define it, the
 linker will use the definition in the linker script.
 
+@node Source Code Reference
+@subsection Source Code Reference
+
+Accessing a linker script defined variable from source code is not
+intuitive.  In particular a linker script symbol is not equivalent to
+a variable declaration in a high level language, it is instead a
+symbol that does not have a value.
+
+Before going further, it is important to note that compilers often
+transform names in the source code into different names when they are
+stored in the symbol table.  For example, Fortran compilers commonly
+prepend or append an underscore, and C++ performs extensive @samp{name
+mangling}.  Therefore there might be a discrepancy between the name
+of a variable as it is used in source code and the name of the same
+variable as it is defined in a linker script.  For example in C a
+linker script variable might be referred to as:
+
+@smallexample
+  extern int foo;
+@end smallexample
+
+But in the linker script it might be defined as:
+
+@smallexample
+  _foo = 1000;
+@end smallexample
+
+In the remaining examples however it is assumed that no name
+transformation has taken place.
+
+When a symbol is declared in a high level language such as C, two
+things happen.  The first is that the compiler reserves enough space
+in the program's memory to hold the @emph{value} of the symbol.  The
+second is that the compiler creates an entry in the program's symbol
+table which holds the symbol's @emph{address}.  ie the symbol table
+contains the address of the block of memory holding the symbol's
+value.  So for example the following C declaration, at file scope:
+
+@smallexample
+  int foo = 1000;
+@end smallexample
+
+creates a entry called @samp{foo} in the symbol table.  This entry
+holds the address of an @samp{int} sized block of memory where the
+number 1000 is initially stored.
+
+When a program references a symbol the compiler generates code that
+first accesses the symbol table to find the address of the symbol's
+memory block and then code to read the value from that memory block.
+So:
+
+@smallexample
+  foo = 1;
+@end smallexample
+
+looks up the symbol @samp{foo} in the symbol table, gets the address
+associated with this symbol and then writes the value 1 into that
+address.  Whereas:
+
+@smallexample
+  int * a = & foo;
+@end smallexample
+
+looks up the symbol @samp{foo} in the symbol table, gets it address
+and then copies this address into the block of memory associated with
+the variable @samp{a}.
+
+Linker scripts symbol declarations, by contrast, create an entry in
+the symbol table but do not assign any memory to them.  Thus they are
+an address without a value.  So for example the linker script definition:
+
+@smallexample
+  foo = 1000;
+@end smallexample
+
+creates an entry in the symbol table called @samp{foo} which holds
+the address of memory location 1000, but nothing special is stored at
+address 1000.  This means that you cannot access the @emph{value} of a
+linker script defined symbol - it has no value - all you can do is
+access the @emph{address} of a linker script defined symbol.
+
+Hence when you are using a linker script defined symbol in source code
+you should always take the address of the symbol, and never attempt to
+use its value.  For example suppose you want to copy the contents of a
+section of memory called .ROM into a section called .FLASH and the
+linker script contains these declarations:
+
+@smallexample
+@group
+  start_of_ROM   = .ROM;
+  end_of_ROM     = .ROM + sizeof (.ROM) - 1;
+  start_of_FLASH = .FLASH;
+@end group
+@end smallexample
+
+Then the C source code to perform the copy would be:
+
+@smallexample
+@group
+  extern char start_of_ROM, end_of_ROM, start_of_FLASH;
+  
+  memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM);
+@end group
+@end smallexample
+
+Note the use of the @samp{&} operators.  These are correct.
+
 @node SECTIONS
-@section SECTIONS command
+@section SECTIONS Command
 @kindex SECTIONS
 The @code{SECTIONS} command tells the linker how to map input sections
 into output sections, and how to place the output sections in memory.
@@ -2607,11 +3004,12 @@ in the first input file.  The first section will be at address zero.
 @end menu
 
 @node Output Section Description
-@subsection Output section description
+@subsection Output Section Description
 The full description of an output section looks like this:
 @smallexample
 @group
-@var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
+@var{section} [@var{address}] [(@var{type})] :
+  [AT(@var{lma})] [SUBALIGN(@var{subsection_align})]
   @{
     @var{output-section-command}
     @var{output-section-command}
@@ -2640,7 +3038,7 @@ a special output section keyword (@pxref{Output Section Keywords})
 @end itemize
 
 @node Output Section Name
-@subsection Output section name
+@subsection Output Section Name
 @cindex name, section
 @cindex section name
 The name of the output section is @var{section}.  @var{section} must
@@ -2658,7 +3056,7 @@ The output section name @samp{/DISCARD/} is special; @ref{Output Section
 Discarding}.
 
 @node Output Section Address
-@subsection Output section address
+@subsection Output Section Address
 @cindex address, section
 @cindex section address
 The @var{address} is an expression for the VMA (the virtual memory
@@ -2705,7 +3103,7 @@ Specifying @var{address} for a section will change the value of the
 location counter.
 
 @node Input Section
-@subsection Input section description
+@subsection Input Section Description
 @cindex input sections
 @cindex mapping input sections to output sections
 The most common output section command is an input section description.
@@ -2724,7 +3122,7 @@ map the input files into your memory layout.
 @end menu
 
 @node Input Section Basics
-@subsubsection Input section basics
+@subsubsection Input Section Basics
 @cindex input section basics
 An input section description consists of a file name optionally followed
 by a list of section names in parentheses.
@@ -2785,7 +3183,7 @@ though it appeared on the command line.  Note that this differs from an
 the archive search path.
 
 @node Input Section Wildcards
-@subsubsection Input section wildcard patterns
+@subsubsection Input Section Wildcard Patterns
 @cindex input section wildcards
 @cindex wildcard file name patterns
 @cindex file name wildcard patterns
@@ -2832,14 +3230,66 @@ sequence of input section descriptions is probably in error, because the
 .data1 : @{ data.o(.data) @}
 @end smallexample
 
-@cindex SORT
+@cindex SORT_BY_NAME
 Normally, the linker will place files and sections matched by wildcards
 in the order in which they are seen during the link.  You can change
-this by using the @code{SORT} keyword, which appears before a wildcard
-pattern in parentheses (e.g., @code{SORT(.text*)}).  When the
-@code{SORT} keyword is used, the linker will sort the files or sections
+this by using the @code{SORT_BY_NAME} keyword, which appears before a wildcard
+pattern in parentheses (e.g., @code{SORT_BY_NAME(.text*)}).  When the
+@code{SORT_BY_NAME} keyword is used, the linker will sort the files or sections
 into ascending order by name before placing them in the output file.
 
+@cindex SORT_BY_ALIGNMENT
+@code{SORT_BY_ALIGNMENT} is very similar to @code{SORT_BY_NAME}. The
+difference is @code{SORT_BY_ALIGNMENT} will sort sections into
+ascending order by alignment before placing them in the output file.
+
+@cindex SORT
+@code{SORT} is an alias for @code{SORT_BY_NAME}.
+
+When there are nested section sorting commands in linker script, there
+can be at most 1 level of nesting for section sorting commands.
+
+@enumerate
+@item
+@code{SORT_BY_NAME} (@code{SORT_BY_ALIGNMENT} (wildcard section pattern)).
+It will sort the input sections by name first, then by alignment if 2
+sections have the same name.
+@item
+@code{SORT_BY_ALIGNMENT} (@code{SORT_BY_NAME} (wildcard section pattern)).
+It will sort the input sections by alignment first, then by name if 2
+sections have the same alignment.
+@item
+@code{SORT_BY_NAME} (@code{SORT_BY_NAME} (wildcard section pattern)) is 
+treated the same as @code{SORT_BY_NAME} (wildcard section pattern).
+@item
+@code{SORT_BY_ALIGNMENT} (@code{SORT_BY_ALIGNMENT} (wildcard section pattern))
+is treated the same as @code{SORT_BY_ALIGNMENT} (wildcard section pattern).
+@item
+All other nested section sorting commands are invalid.
+@end enumerate
+
+When both command line section sorting option and linker script
+section sorting command are used, section sorting command always
+takes precedence over the command line option.
+
+If the section sorting command in linker script isn't nested, the
+command line option will make the section sorting command to be
+treated as nested sorting command.
+
+@enumerate
+@item
+@code{SORT_BY_NAME} (wildcard section pattern ) with
+@option{--sort-sections alignment} is equivalent to
+@code{SORT_BY_NAME} (@code{SORT_BY_ALIGNMENT} (wildcard section pattern)).
+@item
+@code{SORT_BY_ALIGNMENT} (wildcard section pattern) with
+@option{--sort-section name} is equivalent to
+@code{SORT_BY_ALIGNMENT} (@code{SORT_BY_NAME} (wildcard section pattern)).
+@end enumerate
+
+If the section sorting command in linker script is nested, the
+command line option will be ignored.
+
 If you ever get confused about where input sections are going, use the
 @samp{-M} linker option to generate a map file.  The map file shows
 precisely how input sections are mapped to output sections.
@@ -2862,7 +3312,7 @@ SECTIONS @{
 @end smallexample
 
 @node Input Section Common
-@subsubsection Input section for common symbols
+@subsubsection Input Section for Common Symbols
 @cindex common symbol placement
 @cindex uninitialized data placement
 A special notation is needed for common symbols, because in many object
@@ -2898,17 +3348,17 @@ notation is now considered obsolete.  It is equivalent to
 @samp{*(COMMON)}.
 
 @node Input Section Keep
-@subsubsection Input section and garbage collection
+@subsubsection Input Section and Garbage Collection
 @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.
 This is accomplished by surrounding an input section's wildcard entry
 with @code{KEEP()}, as in @code{KEEP(*(.init))} or
-@code{KEEP(SORT(*)(.ctors))}.
+@code{KEEP(SORT_BY_NAME(*)(.ctors))}.
 
 @node Input Section Example
-@subsubsection Input section example
+@subsubsection Input Section Example
 The following example is a complete linker script.  It tells the linker
 to read all of the sections from file @file{all.o} and place them at the
 start of output section @samp{outputa} which starts at location
@@ -2927,11 +3377,15 @@ SECTIONS @{
     all.o
     foo.o (.input1)
     @}
+@end group
+@group
   outputb :
     @{
     foo.o (.input2)
     foo1.o (.input1)
     @}
+@end group
+@group
   outputc :
     @{
     *(.input1)
@@ -2942,7 +3396,7 @@ SECTIONS @{
 @end smallexample
 
 @node Output Section Data
-@subsection Output section data
+@subsection Output Section Data
 @cindex data
 @cindex section data
 @cindex output section data
@@ -2982,7 +3436,7 @@ When the object file format does not have an explicit endianness, as is
 true of, for example, S-records, the value will be stored in the
 endianness of the first input object file.
 
-Note - these commands only work inside a section description and not
+Note---these commands only work inside a section description and not
 between them, so the following will produce an error from the linker:
 @smallexample
 SECTIONS @{@ .text : @{@ *(.text) @}@ LONG(1) .data : @{@ *(.data) @}@ @}@
@@ -3019,7 +3473,7 @@ precedence.  @xref{Output Section Fill}, for details on the fill
 expression.
 
 @node Output Section Keywords
-@subsection Output section keywords
+@subsection Output Section Keywords
 There are a couple of keywords which can appear as output section
 commands.
 
@@ -3051,7 +3505,9 @@ linker to place constructor information in the output section where the
 ignored for other object file formats.
 
 The symbol @w{@code{__CTOR_LIST__}} marks the start of the global
-constructors, and the symbol @w{@code{__DTOR_LIST}} marks the end.  The
+constructors, and the symbol @w{@code{__CTOR_END__}} marks the end.
+Similarly, @w{@code{__DTOR_LIST__}} and @w{@code{__DTOR_END__}} mark
+the start and end of the global destructors.  The
 first word in the list is the number of entries, followed by the address
 of each constructor or destructor, followed by a zero word.  The
 compiler must arrange to actually run the code.  For these object file
@@ -3085,9 +3541,9 @@ If you are using the @sc{gnu} C++ support for initialization priority,
 which provides some control over the order in which global constructors
 are run, you must sort the constructors at link time to ensure that they
 are executed in the correct order.  When using the @code{CONSTRUCTORS}
-command, use @samp{SORT(CONSTRUCTORS)} instead.  When using the
-@code{.ctors} and @code{.dtors} sections, use @samp{*(SORT(.ctors))} and
-@samp{*(SORT(.dtors))} instead of just @samp{*(.ctors)} and
+command, use @samp{SORT_BY_NAME(CONSTRUCTORS)} instead.  When using the
+@code{.ctors} and @code{.dtors} sections, use @samp{*(SORT_BY_NAME(.ctors))} and
+@samp{*(SORT_BY_NAME(.dtors))} instead of just @samp{*(.ctors)} and
 @samp{*(.dtors)}.
 
 Normally the compiler and linker will handle these issues automatically,
@@ -3098,7 +3554,7 @@ scripts.
 @end table
 
 @node Output Section Discarding
-@subsection Output section discarding
+@subsection Output Section Discarding
 @cindex discarding sections
 @cindex sections, discarding
 @cindex removing sections
@@ -3122,13 +3578,14 @@ input sections.  Any input sections which are assigned to an output
 section named @samp{/DISCARD/} are not included in the output file.
 
 @node Output Section Attributes
-@subsection Output section attributes
+@subsection Output Section Attributes
 @cindex output section attributes
 We showed above that the full description of an output section looked
 like this:
 @smallexample
 @group
-@var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
+@var{section} [@var{address}] [(@var{type})] :
+  [AT(@var{lma})] [SUBALIGN(@var{subsection_align})]
   @{
     @var{output-section-command}
     @var{output-section-command}
@@ -3143,13 +3600,14 @@ remaining section attributes.
 @menu
 * Output Section Type::                Output section type
 * Output Section LMA::         Output section LMA
+* Forced Input Alignment::     Forced Input Alignment
 * Output Section Region::      Output section region
 * Output Section Phdr::                Output section phdr
 * Output Section Fill::                Output section fill
 @end menu
 
 @node Output Section Type
-@subsubsection Output section type
+@subsubsection Output Section Type
 Each output section may have a type.  The type is a keyword in
 parentheses.  The following types are defined:
 
@@ -3186,7 +3644,7 @@ SECTIONS @{
 @end smallexample
 
 @node Output Section LMA
-@subsubsection Output section LMA
+@subsubsection Output Section LMA
 @kindex AT>@var{lma_region}
 @kindex AT(@var{lma})
 @cindex load address
@@ -3199,8 +3657,13 @@ Address}).
 The linker will normally set the LMA equal to the VMA.  You can change
 that by using the @code{AT} keyword.  The expression @var{lma} that
 follows the @code{AT} keyword specifies the load address of the
-section.  Alternatively, with @samp{AT>@var{lma_region}} expression,
-you may specify a memory region for the section's load address. @xref{MEMORY}.
+section.
+
+Alternatively, with @samp{AT>@var{lma_region}} expression, you may
+specify a memory region for the section's load address. @xref{MEMORY}.
+Note that if the section has not had a VMA assigned to it then the
+linker will use the @var{lma_region} as the VMA region as well.
+@xref{Output Section Region}.
 
 @cindex ROM initialized data
 @cindex initialized data in ROM
@@ -3250,8 +3713,17 @@ for (dst = &_bstart; dst< &_bend; dst++)
 @end group
 @end smallexample
 
+@node Forced Input Alignment
+@subsubsection Forced Input Alignment
+@kindex SUBALIGN(@var{subsection_align})
+@cindex forcing input section alignment
+@cindex input section alignment
+You can force input section alignment within an output section by using
+SUBALIGN.  The value specified overrides any alignment given by input
+sections, whether larger or smaller.
+
 @node Output Section Region
-@subsubsection Output section region
+@subsubsection Output Section Region
 @kindex >@var{region}
 @cindex section, assigning to memory region
 @cindex memory regions and sections
@@ -3267,7 +3739,7 @@ SECTIONS @{ ROM : @{ *(.text) @} >rom @}
 @end smallexample
 
 @node Output Section Phdr
-@subsubsection Output section phdr
+@subsubsection Output Section Phdr
 @kindex :@var{phdr}
 @cindex section, assigning to program header
 @cindex program headers and sections
@@ -3287,7 +3759,7 @@ SECTIONS @{ .text : @{ *(.text) @} :text @}
 @end smallexample
 
 @node Output Section Fill
-@subsubsection Output section fill
+@subsubsection Output Section Fill
 @kindex =@var{fillexp}
 @cindex section fill pattern
 @cindex fill pattern, entire section
@@ -3315,7 +3787,7 @@ SECTIONS @{ .text : @{ *(.text) @} =0x90909090 @}
 @end smallexample
 
 @node Overlay Description
-@subsection Overlay description
+@subsection Overlay Description
 @kindex OVERLAY
 @cindex overlays
 An overlay description provides an easy way to describe sections which
@@ -3429,7 +3901,7 @@ example could have been written identically as follows.
 @end smallexample
 
 @node MEMORY
-@section MEMORY command
+@section MEMORY Command
 @kindex MEMORY
 @cindex memory regions
 @cindex regions of memory
@@ -3501,19 +3973,19 @@ attributes.
 @kindex ORIGIN =
 @kindex o =
 @kindex org =
-The @var{origin} is an expression for the start address of the memory
-region.  The expression must evaluate to a constant before memory
-allocation is performed, which means that you may not use any section
-relative symbols.  The keyword @code{ORIGIN} may be abbreviated to
-@code{org} or @code{o} (but not, for example, @code{ORG}).
+The @var{origin} is an numerical expression for the start address of
+the memory region.  The expression must evaluate to a constant and it
+cannot involve any symbols.  The keyword @code{ORIGIN} may be
+abbreviated to @code{org} or @code{o} (but not, for example,
+@code{ORG}).
 
 @kindex LENGTH =
 @kindex len =
 @kindex l =
 The @var{len} is an expression for the size in bytes of the memory
 region.  As with the @var{origin} expression, the expression must
-evaluate to a constant before memory allocation is performed.  The
-keyword @code{LENGTH} may be abbreviated to @code{len} or @code{l}.
+be numerical only and must evaluate to a constant.  The keyword
+@code{LENGTH} may be abbreviated to @code{len} or @code{l}.
 
 In the following example, we specify that there are two memory regions
 available for allocation: one starting at @samp{0} for 256 kilobytes,
@@ -3544,6 +4016,16 @@ the next available address within the memory region.  If the combined
 output sections directed to a memory region are too large for the
 region, the linker will issue an error message.
 
+It is possible to access the origin and length of a memory in an
+expression via the @code{ORIGIN(@var{memory})} and 
+@code{LENGTH(@var{memory})} functions:
+
+@smallexample
+@group
+  _fstack = ORIGIN(ram) + LENGTH(ram) - 4;  
+@end group
+@end smallexample
+
 @node PHDRS
 @section PHDRS Command
 @kindex PHDRS
@@ -3847,7 +4329,7 @@ you would effectively have multiple definitions of the same symbol.
 
 If you wish to bind a reference to a specific version of the symbol
 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
+(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:
@@ -3903,20 +4385,20 @@ hexadecimal.  The linker considers other integers to be decimal.
 In addition, you can use the suffixes @code{K} and @code{M} to scale a
 constant by
 @c TEXI2ROFF-KILL
-@ifinfo
+@ifnottex
 @c END TEXI2ROFF-KILL
 @code{1024} or @code{1024*1024}
 @c TEXI2ROFF-KILL
-@end ifinfo
+@end ifnottex
 @tex
 ${\rm 1024}$ or ${\rm 1024}^2$
 @end tex
 @c END TEXI2ROFF-KILL
 respectively. For example, the following all refer to the same quantity:
 @smallexample
-  _fourk_1 = 4K;
-  _fourk_2 = 4096;
-  _fourk_3 = 0x1000;
+_fourk_1 = 4K;
+_fourk_2 = 4096;
+_fourk_3 = 0x1000;
 @end smallexample
 
 @node Symbols
@@ -3931,8 +4413,8 @@ Unquoted symbol names must not conflict with any keywords.  You can
 specify a symbol which contains odd characters or has the same name as a
 keyword by surrounding the symbol name in double quotes:
 @smallexample
-  "SECTION" = 9;
-  "with a space" = "also with a space" + 10;
+"SECTION" = 9;
+"with a space" = "also with a space" + 10;
 @end smallexample
 
 Since symbols can contain many non-alphabetic characters, it is safest
@@ -4010,6 +4492,74 @@ and it will have an extra 0x600 bytes worth of space after the end of
 the values from the @samp{.data} input sections and before the end of
 the @samp{.data} output section itself.
 
+@cindex dot outside sections
+Setting symbols to the value of the location counter outside of an
+output section statement can result in unexpected values if the linker
+needs to place orphan sections.  For example, given the following:
+
+@smallexample
+SECTIONS
+@{
+    start_of_text = . ;
+    .text: @{ *(.text) @}
+    end_of_text = . ;
+
+    start_of_data = . ;
+    .data: @{ *(.data) @}
+    end_of_data = . ;
+@}
+@end smallexample
+
+If the linker needs to place some input section, e.g. @code{.rodata},
+not mentioned in the script, it might choose to place that section
+between @code{.text} and @code{.data}.  You might think the linker
+should place @code{.rodata} on the blank line in the above script, but
+blank lines are of no particular significance to the linker.  As well,
+the linker doesn't associate the above symbol names with their
+sections.  Instead, it assumes that all assignments or other
+statements belong to the previous output section, except for the
+special case of an assignment to @code{.}.  I.e., the linker will
+place the orphan @code{.rodata} section as if the script was written
+as follows:
+
+@smallexample
+SECTIONS
+@{
+    start_of_text = . ;
+    .text: @{ *(.text) @}
+    end_of_text = . ;
+
+    start_of_data = . ;
+    .rodata: @{ *(.rodata) @}
+    .data: @{ *(.data) @}
+    end_of_data = . ;
+@}
+@end smallexample
+
+This may or may not be the script author's intention for the value of
+@code{start_of_data}.  One way to influence the orphan section
+placement is to assign the location counter to itself, as the linker
+assumes that an assignment to @code{.} is setting the start address of
+a following output section and thus should be grouped with that
+section.  So you could write:
+
+@smallexample
+SECTIONS
+@{
+    start_of_text = . ;
+    .text: @{ *(.text) @}
+    end_of_text = . ;
+
+    . = . ;
+    start_of_data = . ;
+    .data: @{ *(.data) @}
+    end_of_data = . ;
+@}
+@end smallexample
+
+Now, the orphan @code{.rodata} section will be placed between
+@code{end_of_text} and @code{start_of_data}.
+
 @need 2000
 @node Operators
 @subsection Operators
@@ -4019,7 +4569,7 @@ the @samp{.data} output section itself.
 The linker recognizes the standard C set of arithmetic operators, with
 the standard bindings and precedence levels:
 @c TEXI2ROFF-KILL
-@ifinfo
+@ifnottex
 @c END TEXI2ROFF-KILL
 @smallexample
 precedence      associativity   Operators                Notes
@@ -4041,7 +4591,7 @@ Notes:
 (1) Prefix operators
 (2) @xref{Assignments}.
 @c TEXI2ROFF-KILL
-@end ifinfo
+@end ifnottex
 @tex
 \vskip \baselineskip
 %"lispnarrowing" is the extra indent used generally for smallexample
@@ -4199,17 +4749,25 @@ SECTIONS @{ @dots{}
 @end group
 @end smallexample
 
-@item ALIGN(@var{exp})
-@kindex ALIGN(@var{exp})
+@item ALIGN(@var{align})
+@itemx ALIGN(@var{exp},@var{align})
+@kindex ALIGN(@var{align})
+@kindex ALIGN(@var{exp},@var{align})
 @cindex round up location counter
 @cindex align location counter
-Return the location counter (@code{.}) aligned to the next @var{exp}
-boundary.
-@code{ALIGN} doesn't change the value of the location counter---it just
-does arithmetic on it.  Here is an example which aligns the output
-@code{.data} section to the next @code{0x2000} byte boundary after the
-preceding section and sets a variable within the section to the next
-@code{0x8000} boundary after the input sections:
+@cindex round up expression
+@cindex align expression
+Return the location counter (@code{.}) or arbitrary expression aligned
+to the next @var{align} boundary.  The single operand @code{ALIGN}
+doesn't change the value of the location counter---it just does
+arithmetic on it.  The two operand @code{ALIGN} allows an arbitrary
+expression to be aligned upwards (@code{ALIGN(@var{align})} is
+equivalent to @code{ALIGN(., @var{align})}).
+
+Here is an example which aligns the output @code{.data} section to the
+next @code{0x2000} byte boundary after the preceding section and sets a
+variable within the section to the next @code{0x8000} boundary after the
+input sections:
 @smallexample
 @group
 SECTIONS @{ @dots{}
@@ -4273,11 +4831,27 @@ evaluation purposes.
   . = DATA_SEGMENT_END(.);
 @end smallexample
 
+@item DATA_SEGMENT_RELRO_END(@var{offset}, @var{exp})
+@kindex DATA_SEGMENT_RELRO_END(@var{offset}, @var{exp})
+This defines the end of the @code{PT_GNU_RELRO} segment when
+@samp{-z relro} option is used.  Second argument is returned.
+When @samp{-z relro} option is not present, @code{DATA_SEGMENT_RELRO_END}
+does nothing, otherwise @code{DATA_SEGMENT_ALIGN} is padded so that
+@var{exp} + @var{offset} is aligned to the most commonly used page
+boundary for particular target.  If present in the linker script,
+it must always come in between @code{DATA_SEGMENT_ALIGN} and
+@code{DATA_SEGMENT_END}.
+
+@smallexample
+  . = DATA_SEGMENT_RELRO_END(24, .);
+@end smallexample
+
 @item DEFINED(@var{symbol})
 @kindex DEFINED(@var{symbol})
 @cindex symbol defaults
 Return 1 if @var{symbol} is in the linker global symbol table and is
-defined, otherwise return 0.  You can use this function to provide
+defined before the statement using DEFINED in the script, otherwise
+return 0.  You can use this function to provide
 default values for symbols.  For example, the following script fragment
 shows how to set a global symbol @samp{begin} to the first location in
 the @samp{.text} section---but if a symbol called @samp{begin} already
@@ -4295,6 +4869,10 @@ SECTIONS @{ @dots{}
 @end group
 @end smallexample
 
+@item LENGTH(@var{memory})
+@kindex LENGTH(@var{memory})
+Return the length of the memory region named @var{memory}.
+
 @item LOADADDR(@var{section})
 @kindex LOADADDR(@var{section})
 @cindex section load address in expression
@@ -4319,6 +4897,20 @@ This function is closely related to @code{ALIGN(@var{exp})}; unless you
 use the @code{MEMORY} command to define discontinuous memory for the
 output file, the two functions are equivalent.
 
+@item ORIGIN(@var{memory})
+@kindex ORIGIN(@var{memory})
+Return the origin of the memory region named @var{memory}.
+
+@item SEGMENT_START(@var{segment}, @var{default})
+@kindex SEGMENT_START(@var{segment}, @var{default})
+Return the base address of the named @var{segment}.  If an explicit
+value has been given for this segment (with a command-line @samp{-T}
+option) that value will be returned; otherwise the value will be
+@var{default}.  At present, the @samp{-T} command-line option can only
+be used to set the base address for the ``text'', ``data'', and
+``bss'' sections, but you use @code{SEGMENT_START} with any segment
+name.
+
 @item SIZEOF(@var{section})
 @kindex SIZEOF(@var{section})
 @cindex section size
@@ -4391,15 +4983,26 @@ sections describe them.  Machines where @command{ld} has no additional
 functionality are not listed.
 
 @menu
-* H8/300::                      @code{ld} and the H8/300
-* i960::                        @code{ld} and the Intel 960 family
-* ARM::                                @code{ld} and the ARM family
-* HPPA ELF32::                  @code{ld} and HPPA 32-bit ELF
+@ifset H8300
+* H8/300::                      @command{ld} and the H8/300
+@end ifset
+@ifset I960
+* i960::                        @command{ld} and the Intel 960 family
+@end ifset
+@ifset ARM
+* ARM::                                @command{ld} and the ARM family
+@end ifset
+@ifset HPPA
+* HPPA ELF32::                  @command{ld} and HPPA 32-bit ELF
+@end ifset
 @ifset MMIX
-* MMIX::                       @code{ld} and MMIX
+* MMIX::                       @command{ld} and MMIX
 @end ifset
 @ifset MSP430
-* MSP430::                     @code{ld} and MSP430
+* MSP430::                     @command{ld} and MSP430
+@end ifset
+@ifset M68HC11
+* M68HC11/68HC12::             @code{ld} and the Motorola 68HC11 and 68HC12 families
 @end ifset
 @ifset TICOFF
 * TI COFF::                     @command{ld} and TI COFF
@@ -4407,11 +5010,12 @@ functionality are not listed.
 @ifset WIN32
 * WIN32::                       @command{ld} and WIN32 (cygwin/mingw)
 @end ifset
+@ifset XTENSA
+* Xtensa::                      @command{ld} and Xtensa Processors
+@end ifset
 @end menu
 @end ifset
 
-@c FIXME!  This could use @raisesections/@lowersections, but there seems to be a conflict
-@c         between those and node-defaulting.
 @ifset H8300
 @ifclear GENERIC
 @raisesections
@@ -4441,6 +5045,23 @@ page of memory, and changes them to use the eight-bit address form.
 (That is: the linker turns @samp{mov.b @code{@@}@var{aa}:16} into
 @samp{mov.b @code{@@}@var{aa}:8} whenever the address @var{aa} is in the
 top page of memory).
+
+@item bit manipulation instructions
+@command{ld} finds all bit manipulation instructions like @code{band, bclr, 
+biand, bild, bior, bist, bixor, bld, bnot, bor, bset, bst, btst, bxor}
+which use 32 bit and 16 bit absolute address form, but refer to the top 
+page of memory, and changes them to use the 8 bit address form.
+(That is: the linker turns @samp{bset #xx:3,@code{@@}@var{aa}:32} into
+@samp{bset #xx:3,@code{@@}@var{aa}:8} whenever the address @var{aa} is in 
+the top page of memory).
+
+@item system control instructions
+@command{ld} finds all @code{ldc.w, stc.w} instrcutions which use the 
+32 bit absolute address form, but refer to the top page of memory, and 
+changes them to use 16 bit address form.
+(That is: the linker turns @samp{ldc.w @code{@@}@var{aa}:32,ccr} into
+@samp{ldc.w @code{@@}@var{aa}:16,ccr} whenever the address @var{aa} is in 
+the top page of memory).
 @end table
 
 @ifclear GENERIC
@@ -4448,37 +5069,383 @@ top page of memory).
 @end ifclear
 @end ifset
 
-@ifset WIN32
+@ifclear GENERIC
+@ifset Renesas
+@c This stuff is pointless to say unless you're especially concerned
+@c with Renesas chips; don't enable it for generic case, please.
+@node Renesas
+@chapter @command{ld} and Other Renesas Chips
+
+@command{ld} also supports the Renesas (formerly Hitachi) H8/300H,
+H8/500, and SH chips.  No special features, commands, or command-line
+options are required for these chips.
+@end ifset
+@end ifclear
+
+@ifset I960
 @ifclear GENERIC
 @raisesections
 @end ifclear
 
-@node WIN32
-@section @command{ld} and WIN32 (cygwin/mingw)
+@node i960
+@section @command{ld} and the Intel 960 Family
 
-This section describes some of the win32 specific @command{ld} issues. 
-See @ref{Options,,Command Line Options} for detailed decription of the
-command line options mentioned here.
+@cindex i960 support
 
-@table @emph
-@cindex import libraries 
-@item import libraries 
-The standard Windows linker creates and uses so-called import
-libraries, which contains information for linking to dll's.  They are
-regular static archives and are handled as any other static
-archive.  The cygwin and mingw ports of @command{ld} have specific
-support for creating such libraries provided with the
-@samp{--out-implib} command line option.
+You can use the @samp{-A@var{architecture}} command line option to
+specify one of the two-letter names identifying members of the 960
+family; the option specifies the desired output target, and warns of any
+incompatible instructions in the input files.  It also modifies the
+linker's search strategy for archive libraries, to support the use of
+libraries specific to each particular architecture, by including in the
+search loop names suffixed with the string identifying the architecture.
 
-@item   exporting DLL symbols 
-@cindex exporting DLL symbols 
-The cygwin/mingw @command{ld} has several ways to export symbols for dll's.
+For example, if your @command{ld} command line included @w{@samp{-ACA}} as
+well as @w{@samp{-ltry}}, the linker would look (in its built-in search
+paths, and in any paths you specify with @samp{-L}) for a library with
+the names
 
-@table @emph
-@item   using auto-export functionality
-@cindex using auto-export functionality
-By default @command{ld} exports symbols with the auto-export functionality,
-which is controlled by the following command line options:
+@smallexample
+@group
+try
+libtry.a
+tryca
+libtryca.a
+@end group
+@end smallexample
+
+@noindent
+The first two possibilities would be considered in any event; the last
+two are due to the use of @w{@samp{-ACA}}.
+
+You can meaningfully use @samp{-A} more than once on a command line, since
+the 960 architecture family allows combination of target architectures; each
+use will add another pair of name variants to search for when @w{@samp{-l}}
+specifies a library.
+
+@cindex @option{--relax} on i960
+@cindex relaxing on i960
+@command{ld} supports the @samp{--relax} option for the i960 family.  If
+you specify @samp{--relax}, @command{ld} finds all @code{balx} and
+@code{calx} instructions whose targets are within 24 bits, and turns
+them into 24-bit program-counter relative @code{bal} and @code{cal}
+instructions, respectively.  @command{ld} also turns @code{cal}
+instructions into @code{bal} instructions when it determines that the
+target subroutine is a leaf routine (that is, the target subroutine does
+not itself call any subroutines).
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset ARM
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@ifset M68HC11
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node M68HC11/68HC12
+@section @command{ld} and the Motorola 68HC11 and 68HC12 families
+
+@cindex M68HC11 and 68HC12 support
+
+@subsection Linker Relaxation
+
+For the Motorola 68HC11, @command{ld} can perform these global
+optimizations when you specify the @samp{--relax} command-line option.
+
+@table @emph
+@cindex relaxing on M68HC11
+@item relaxing address modes
+@command{ld} finds all @code{jsr} and @code{jmp} instructions whose
+targets are within eight bits, and turns them into eight-bit
+program-counter relative @code{bsr} and @code{bra} instructions,
+respectively.
+
+@command{ld} also looks at all 16-bit extended addressing modes and
+transforms them in a direct addressing mode when the address is in
+page 0 (between 0 and 0x0ff).
+
+@item relaxing gcc instruction group
+When @command{gcc} is called with @option{-mrelax}, it can emit group
+of instructions that the linker can optimize to use a 68HC11 direct
+addressing mode. These instructions consists of @code{bclr} or
+@code{bset} instructions.
+
+@end table
+
+@subsection Trampoline Generation
+
+@cindex trampoline generation on M68HC11
+@cindex trampoline generation on M68HC12
+For 68HC11 and 68HC12, @command{ld} can generate trampoline code to
+call a far function using a normal @code{jsr} instruction. The linker
+will also change the relocation to some far function to use the 
+trampoline address instead of the function address. This is typically the
+case when a pointer to a function is taken. The pointer will in fact
+point to the function trampoline.
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@node ARM
+@section @command{ld} and the ARM family
+
+@cindex ARM interworking support
+@kindex --support-old-code
+For the ARM, @command{ld} will generate code stubs to allow functions calls
+betweem ARM and Thumb code.  These stubs only work with code that has
+been compiled and assembled with the @samp{-mthumb-interwork} command
+line option.  If it is necessary to link with old ARM object files or
+libraries, which have not been compiled with the -mthumb-interwork
+option then the @samp{--support-old-code} command line switch should be
+given to the linker.  This will make it generate larger stub functions
+which will work with non-interworking aware ARM code.  Note, however,
+the linker does not support generating stubs for function calls to
+non-interworking aware Thumb code.
+
+@cindex thumb entry point
+@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.
+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.
+
+@cindex BE8
+@kindex --be8
+The @samp{--be8} switch instructs @command{ld} to generate BE8 format
+executables.  This option is only valid when linking big-endian objects.
+The resulting image will contain big-endian data and little-endian code.
+
+@cindex TARGET1
+@kindex --target1-rel
+@kindex --target1-abs
+The @samp{R_ARM_TARGET1} relocation is typically used for entries in the
+@samp{.init_array} section.  It is interpreted as either @samp{R_ARM_REL32}
+or @samp{R_ARM_ABS32}, depending on the target.  The @samp{--target1-rel}
+and @samp{--target1-abs} switches override the default.
+
+@cindex TARGET2
+@kindex --target2=@var{type}
+The @samp{--target2=type} switch overrides the default definition of the
+@samp{R_ARM_TARGET2} relocation.  Valid values for @samp{type}, their
+meanings, and target defaults are as follows:
+@table @samp
+@item rel
+@samp{R_ARM_REL32} (arm*-*-elf, arm*-*-eabi)
+@item abs
+@samp{R_ARM_ABS32} (arm*-*-symbianelf)
+@item got-rel
+@samp{R_ARM_GOT_PREL} (arm*-*-linux, arm*-*-*bsd)
+@end table
+
+@cindex FIX_V4BX
+@kindex --fix-v4bx
+The @samp{R_ARM_V4BX} relocation (defined by the ARM AAELF
+specification) enables objects compiled for the ARMv4 architecture to be
+interworking-safe when linked with other objects compiled for ARMv4t, but
+also allows pure ARMv4 binaries to be built from the same ARMv4 objects.
+
+In the latter case, the switch @option{--fix-v4bx} must be passed to the
+linker, which causes v4t @code{BX rM} instructions to be rewritten as
+@code{MOV PC,rM}, since v4 processors do not have a @code{BX} instruction.
+
+In the former case, the switch should not be used, and @samp{R_ARM_V4BX}
+relocations are ignored.
+
+@cindex USE_BLX
+@kindex --use-blx
+The @samp{--use-blx} switch enables the linker to use ARM/Thumb
+BLX instructions (available on ARMv5t and above) in various
+situations. Currently it is used to perform calls via the PLT from Thumb
+code using BLX rather than using BX and a mode-switching stub before
+each PLT entry. This should lead to such calls executing slightly faster.
+
+This option is enabled implicitly for SymbianOS, so there is no need to
+specify it if you are using that target.
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset HPPA
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node HPPA ELF32
+@section @command{ld} and HPPA 32-bit ELF Support
+@cindex HPPA multiple sub-space stubs
+@kindex --multi-subspace
+When generating a shared library, @command{ld} will by default generate
+import stubs suitable for use with a single sub-space application.
+The @samp{--multi-subspace} switch causes @command{ld} to generate export
+stubs, and different (larger) import stubs suitable for use with
+multiple sub-spaces.
+
+@cindex HPPA stub grouping
+@kindex --stub-group-size=@var{N}
+Long branch stubs and import/export stubs are placed by @command{ld} in
+stub sections located between groups of input sections.
+@samp{--stub-group-size} specifies the maximum size of a group of input
+sections handled by one stub section.  Since branch offsets are signed,
+a stub section may serve two groups of input sections, one group before
+the stub section, and one group after it.  However, when using
+conditional branches that require stubs, it may be better (for branch
+prediction) that stub sections only serve one group of input sections.
+A negative value for @samp{N} chooses this scheme, ensuring that
+branches to stubs always use a negative offset.  Two special values of
+@samp{N} are recognized, @samp{1} and @samp{-1}.  These both instruct
+@command{ld} to automatically size input section groups for the branch types
+detected, with the same behaviour regarding stub placement as other
+positive or negative values of @samp{N} respectively.
+
+Note that @samp{--stub-group-size} does not split input sections.  A
+single input section larger than the group size specified will of course
+create a larger group (of one section).  If input sections are too
+large, it may not be possible for a branch to reach its stub.
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset MMIX
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node MMIX
+@section @code{ld} and MMIX
+For MMIX, there is a choice of generating @code{ELF} object files or
+@code{mmo} object files when linking.  The simulator @code{mmix}
+understands the @code{mmo} format.  The binutils @code{objcopy} utility
+can translate between the two formats.
+
+There is one special section, the @samp{.MMIX.reg_contents} section.
+Contents in this section is assumed to correspond to that of global
+registers, and symbols referring to it are translated to special symbols,
+equal to registers.  In a final link, the start address of the
+@samp{.MMIX.reg_contents} section corresponds to the first allocated
+global register multiplied by 8.  Register @code{$255} is not included in
+this section; it is always set to the program entry, which is at the
+symbol @code{Main} for @code{mmo} files.
+
+Symbols with the prefix @code{__.MMIX.start.}, for example
+@code{__.MMIX.start..text} and @code{__.MMIX.start..data} are special;
+there must be only one each, even if they are local.  The default linker
+script uses these to set the default start address of a section.
+
+Initial and trailing multiples of zero-valued 32-bit words in a section,
+are left out from an mmo file.
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset MSP430
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node  MSP430
+@section @code{ld} and MSP430
+For the MSP430 it is possible to select the MPU architecture.  The flag @samp{-m [mpu type]}
+will select an appropriate linker script for selected MPU type.  (To get a list of known MPUs
+just pass @samp{-m help} option to the linker).
+
+@cindex MSP430 extra sections
+The linker will recognize some extra sections which are MSP430 specific:
+
+@table @code
+@item @samp{.vectors}
+Defines a portion of ROM where interrupt vectors located.
+
+@item @samp{.bootloader}
+Defines the bootloader portion of the ROM (if applicable).  Any code
+in this section will be uploaded to the MPU.
+
+@item @samp{.infomem}
+Defines an information memory section (if applicable).  Any code in
+this section will be uploaded to the MPU.
+
+@item @samp{.infomemnobits} 
+This is the same as the @samp{.infomem} section except that any code
+in this section will not be uploaded to the MPU.
+
+@item @samp{.noinit}
+Denotes a portion of RAM located above @samp{.bss} section.
+
+The last two sections are used by gcc. 
+@end table
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset TICOFF
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node TI COFF
+@section @command{ld}'s Support for Various TI COFF Versions
+@cindex TI COFF versions
+@kindex --format=@var{version}
+The @samp{--format} switch allows selection of one of the various
+TI COFF versions.  The latest of this writing is 2; versions 0 and 1 are
+also supported.  The TI COFF versions also vary in header byte-order
+format; @command{ld} will read any version or byte order, but the output
+header format depends on the default specified by the specific target.
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
+@ifset WIN32
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node WIN32
+@section @command{ld} and WIN32 (cygwin/mingw)
+
+This section describes some of the win32 specific @command{ld} issues. 
+See @ref{Options,,Command Line Options} for detailed decription of the
+command line options mentioned here.
+
+@table @emph
+@cindex import libraries 
+@item import libraries 
+The standard Windows linker creates and uses so-called import
+libraries, which contains information for linking to dll's.  They are
+regular static archives and are handled as any other static
+archive.  The cygwin and mingw ports of @command{ld} have specific
+support for creating such libraries provided with the
+@samp{--out-implib} command line option.
+
+@item   exporting DLL symbols 
+@cindex exporting DLL symbols 
+The cygwin/mingw @command{ld} has several ways to export symbols for dll's.
+
+@table @emph
+@item   using auto-export functionality
+@cindex using auto-export functionality
+By default @command{ld} exports symbols with the auto-export functionality,
+which is controlled by the following command line options:
 
 @itemize
 @item --export-all-symbols   [This is the default]
@@ -4788,9 +5755,27 @@ that are not being renamed, and do @emph{not} use the
 @samp{--export-all-symbols} option.  If you list only the 
 renamed symbols in the DEF file, and use @samp{--export-all-symbols} 
 to handle the other symbols, then the both the new names @emph{and} 
-the original names for the the renamed symbols will be exported.  
+the original names for the renamed symbols will be exported.  
 In effect, you'd be aliasing those symbols, not renaming them, 
 which is probably not what you wanted.
+
+@cindex weak externals
+@item weak externals
+The Windows object format, PE, specifies a form of weak symbols called
+weak externals.  When a weak symbol is linked and the symbol is not
+defined, the weak symbol becomes an alias for some other symbol.  There
+are three variants of weak externals:
+@itemize
+@item Definition is searched for in objects and libraries, historically
+called lazy externals.
+@item Definition is searched for only in other objects, not in libraries.
+This form is not presently implemented.
+@item No search; the symbol is an alias.  This form is not presently
+implemented.
+@end itemize
+As a GNU extension, weak symbols that do not specify an alternate symbol
+are supported.  If the symbol is undefined when linking, the symbol
+uses a default value.
 @end table
 
 @ifclear GENERIC
@@ -4798,211 +5783,90 @@ which is probably not what you wanted.
 @end ifclear
 @end ifset
 
-@ifclear GENERIC
-@ifset Hitachi
-@c This stuff is pointless to say unless you're especially concerned
-@c with Hitachi chips; don't enable it for generic case, please.
-@node Hitachi
-@chapter @command{ld} and other Hitachi chips
-
-@command{ld} also supports the H8/300H, the H8/500, and the Hitachi SH.  No
-special features, commands, or command-line options are required for
-these chips.
-@end ifset
-@end ifclear
-
-@ifset I960
+@ifset XTENSA
 @ifclear GENERIC
 @raisesections
 @end ifclear
 
-@node i960
-@section @command{ld} and the Intel 960 family
-
-@cindex i960 support
+@node Xtensa
+@section @code{ld} and Xtensa Processors
 
-You can use the @samp{-A@var{architecture}} command line option to
-specify one of the two-letter names identifying members of the 960
-family; the option specifies the desired output target, and warns of any
-incompatible instructions in the input files.  It also modifies the
-linker's search strategy for archive libraries, to support the use of
-libraries specific to each particular architecture, by including in the
-search loop names suffixed with the string identifying the architecture.
-
-For example, if your @command{ld} command line included @w{@samp{-ACA}} as
-well as @w{@samp{-ltry}}, the linker would look (in its built-in search
-paths, and in any paths you specify with @samp{-L}) for a library with
-the names
+@cindex Xtensa processors
+The default @command{ld} behavior for Xtensa processors is to interpret
+@code{SECTIONS} commands so that lists of explicitly named sections in a
+specification with a wildcard file will be interleaved when necessary to
+keep literal pools within the range of PC-relative load offsets.  For
+example, with the command:
 
 @smallexample
-@group
-try
-libtry.a
-tryca
-libtryca.a
-@end group
+SECTIONS
+@{
+  .text : @{
+    *(.literal .text)
+  @}
+@}
 @end smallexample
 
 @noindent
-The first two possibilities would be considered in any event; the last
-two are due to the use of @w{@samp{-ACA}}.
-
-You can meaningfully use @samp{-A} more than once on a command line, since
-the 960 architecture family allows combination of target architectures; each
-use will add another pair of name variants to search for when @w{@samp{-l}}
-specifies a library.
-
-@cindex @option{--relax} on i960
-@cindex relaxing on i960
-@command{ld} supports the @samp{--relax} option for the i960 family.  If
-you specify @samp{--relax}, @command{ld} finds all @code{balx} and
-@code{calx} instructions whose targets are within 24 bits, and turns
-them into 24-bit program-counter relative @code{bal} and @code{cal}
-instructions, respectively.  @command{ld} also turns @code{cal}
-instructions into @code{bal} instructions when it determines that the
-target subroutine is a leaf routine (that is, the target subroutine does
-not itself call any subroutines).
-
-@ifclear GENERIC
-@lowersections
-@end ifclear
-@end ifset
-
-@ifclear GENERIC
-@raisesections
-@end ifclear
-
-@node ARM
-@section @command{ld}'s support for interworking between ARM and Thumb code
-
-@cindex ARM interworking support
-@kindex --support-old-code
-For the ARM, @command{ld} will generate code stubs to allow functions calls
-betweem ARM and Thumb code.  These stubs only work with code that has
-been compiled and assembled with the @samp{-mthumb-interwork} command
-line option.  If it is necessary to link with old ARM object files or
-libraries, which have not been compiled with the -mthumb-interwork
-option then the @samp{--support-old-code} command line switch should be
-given to the linker.  This will make it generate larger stub functions
-which will work with non-interworking aware ARM code.  Note, however,
-the linker does not support generating stubs for function calls to
-non-interworking aware Thumb code.
-
-@cindex thumb entry point
-@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.
-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.
-
-@node HPPA ELF32
-@section @command{ld} and HPPA 32-bit ELF support
-@cindex HPPA multiple sub-space stubs
-@kindex --multi-subspace
-When generating a shared library, @command{ld} will by default generate
-import stubs suitable for use with a single sub-space application.
-The @samp{--multi-subspace} switch causes @command{ld} to generate export
-stubs, and different (larger) import stubs suitable for use with
-multiple sub-spaces.
-
-@cindex HPPA stub grouping
-@kindex --stub-group-size=@var{N}
-Long branch stubs and import/export stubs are placed by @command{ld} in
-stub sections located between groups of input sections.
-@samp{--stub-group-size} specifies the maximum size of a group of input
-sections handled by one stub section.  Since branch offsets are signed,
-a stub section may serve two groups of input sections, one group before
-the stub section, and one group after it.  However, when using
-conditional branches that require stubs, it may be better (for branch
-prediction) that stub sections only serve one group of input sections.
-A negative value for @samp{N} chooses this scheme, ensuring that
-branches to stubs always use a negative offset.  Two special values of
-@samp{N} are recognized, @samp{1} and @samp{-1}.  These both instruct
-@command{ld} to automatically size input section groups for the branch types
-detected, with the same behaviour regarding stub placement as other
-positive or negative values of @samp{N} respectively.
-
-Note that @samp{--stub-group-size} does not split input sections.  A
-single input section larger than the group size specified will of course
-create a larger group (of one section).  If input sections are too
-large, it may not be possible for a branch to reach its stub.
-
-@ifset MMIX
-@node MMIX
-@section @code{ld} and MMIX
-For MMIX, there is choice of generating @code{ELF} object files or
-@code{mmo} object files when linking.  The simulator @code{mmix}
-understands the @code{mmo} format.  The binutils @code{objcopy} utility
-can translate between the two formats.
-
-There is one special section, the @samp{.MMIX.reg_contents} section.
-Contents in this section is assumed to correspond to that of global
-registers, and symbols referring to it are translated to special symbols,
-equal to registers.  In a final link, the start address of the
-@samp{.MMIX.reg_contents} section corresponds to the first allocated
-global register multiplied by 8.  Register @code{$255} is not included in
-this section; it is always set to the program entry, which is at the
-symbol @code{Main} for @code{mmo} files.
-
-Symbols with the prefix @code{__.MMIX.start.}, for example
-@code{__.MMIX.start..text} and @code{__.MMIX.start..data} are special;
-there must be only one each, even if they are local.  The default linker
-script uses these to set the default start address of a section.
-
-Initial and trailing multiples of zero-valued 32-bit words in a section,
-are left out from an mmo file.
-@end ifset
-
-@ifset MSP430
-@node  MSP430
-@section @code{ld} and MSP430
-For the MSP430 it is possible to select the MPU architecture.  The flag @samp{-m [mpu type]}
-will select an appropriate linker script for selected MPU type.  (To get a list of known MPUs
-just pass @samp{-m help} option to the linker).
-
-@cindex MSP430 extra sections
-The linker will recognize some extra sections which are MSP430 specific:
-
-@table @code
-@item @samp{.vectors}
-Defines a portion of ROM where interrupt vectors located.
-
-@item @samp{.bootloader}
-Defines the bootloader portion of the ROM (if applicable).  Any code
-in this section will be uploaded to the MPU.
-
-@item @samp{.infomem}
-Defines an information memory section (if applicable).  Any code in
-this section will be uploaded to the MPU.
-
-@item @samp{.infomemnobits} 
-This is the same as the @samp{.infomem} section except that any code
-in this section will not be uploaded to the MPU.
-
-@item @samp{.noinit}
-Denotes a portion of RAM located above @samp{.bss} section.
-
-The last two sections are used by gcc. 
+@command{ld} may interleave some of the @code{.literal}
+and @code{.text} sections from different object files to ensure that the
+literal pools are within the range of PC-relative load offsets.  A valid
+interleaving might place the @code{.literal} sections from an initial
+group of files followed by the @code{.text} sections of that group of
+files.  Then, the @code{.literal} sections from the rest of the files
+and the @code{.text} sections from the rest of the files would follow.
+
+@cindex @option{--relax} on Xtensa
+@cindex relaxing on Xtensa
+Relaxation is enabled by default for the Xtensa version of @command{ld} and
+provides two important link-time optimizations.  The first optimization
+is to combine identical literal values to reduce code size.  A redundant
+literal will be removed and all the @code{L32R} instructions that use it
+will be changed to reference an identical literal, as long as the
+location of the replacement literal is within the offset range of all
+the @code{L32R} instructions.  The second optimization is to remove
+unnecessary overhead from assembler-generated ``longcall'' sequences of
+@code{L32R}/@code{CALLX@var{n}} when the target functions are within
+range of direct @code{CALL@var{n}} instructions.
+
+For each of these cases where an indirect call sequence can be optimized
+to a direct call, the linker will change the @code{CALLX@var{n}}
+instruction to a @code{CALL@var{n}} instruction, remove the @code{L32R}
+instruction, and remove the literal referenced by the @code{L32R}
+instruction if it is not used for anything else.  Removing the
+@code{L32R} instruction always reduces code size but can potentially
+hurt performance by changing the alignment of subsequent branch targets.
+By default, the linker will always preserve alignments, either by
+switching some instructions between 24-bit encodings and the equivalent
+density instructions or by inserting a no-op in place of the @code{L32R}
+instruction that was removed.  If code size is more important than
+performance, the @option{--size-opt} option can be used to prevent the
+linker from widening density instructions or inserting no-ops, except in
+a few cases where no-ops are required for correctness.
+
+The following Xtensa-specific command-line options can be used to
+control the linker:
+
+@cindex Xtensa options
+@table @option
+@kindex --no-relax
+@item --no-relax
+Since the Xtensa version of @code{ld} enables the @option{--relax} option
+by default, the @option{--no-relax} option is provided to disable
+relaxation.
+
+@item --size-opt
+When optimizing indirect calls to direct calls, optimize for code size
+more than performance.  With this option, the linker will not insert
+no-ops or widen density instructions to preserve branch target
+alignment.  There may still be some cases where no-ops are required to
+preserve the correctness of the code.
 @end table
-@end ifset
-
-@ifset TICOFF
-@node TI COFF
-@section @command{ld}'s support for various TI COFF versions
-@cindex TI COFF versions
-@kindex --format=@var{version}
-The @samp{--format} switch allows selection of one of the various
-TI COFF versions.  The latest of this writing is 2; versions 0 and 1 are
-also supported.  The TI COFF versions also vary in header byte-order
-format; @command{ld} will read any version or byte order, but the output
-header format depends on the default specified by the specific target.
-@end ifset
 
 @ifclear GENERIC
 @lowersections
 @end ifclear
+@end ifset
 
 @ifclear SingleFormat
 @node BFD
@@ -5042,7 +5906,7 @@ conversion and during output. @xref{BFD information loss}.
 @end menu
 
 @node BFD outline
-@section How it works: an outline of BFD
+@section How It Works: An Outline of BFD
 @cindex opening object files
 @include bfdsumm.texi
 @end ifclear
@@ -5069,7 +5933,7 @@ information that enables us to fix the bug.
 @end menu
 
 @node Bug Criteria
-@section Have you found a bug?
+@section Have You Found a Bug?
 @cindex bug criteria
 
 If you are not sure whether you have found a bug, here are some guidelines:
@@ -5098,7 +5962,7 @@ improvement of @command{ld} are welcome in any case.
 @end itemize
 
 @node Bug Reporting
-@section How to report bugs
+@section How to Report Bugs
 @cindex bug reports
 @cindex @command{ld} bugs, reporting
 
@@ -5133,9 +5997,9 @@ the bug if it is new to us.  Therefore, always write your bug reports
 on the assumption that the bug has not been reported previously.
 
 Sometimes people give a few sketchy facts and ask, ``Does this ring a
-bell?''  Those bug reports are useless, and we urge everyone to
-@emph{refuse to respond to them} except to chide the sender to report
-bugs properly.
+bell?''  This cannot help us fix a bug, so it is basically useless.  We
+respond by asking for enough details to enable us to investigate.
+You might as well expedite matters by sending them to begin with.
 
 To enable us to fix the bug, you should include all these things:
 
@@ -5394,369 +6258,7 @@ If you have more than one @code{SECT} statement for the same
 @var{secname}, only the @emph{first} sets the start address.
 @end table
 
-@node GNU Free Documentation License
-@appendix GNU Free Documentation License
-@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.
-
-
-0. PREAMBLE
-
-The purpose of this License is to make a manual, textbook, or other
-written document "free" in the sense of freedom: to assure everyone
-the effective freedom to copy and redistribute it, with or without
-modifying it, either commercially or noncommercially.  Secondarily,
-this License preserves for the author and publisher a way to get
-credit for their work, while not being considered responsible for
-modifications made by others.
-
-This License is a kind of "copyleft", which means that derivative
-works of the document must themselves be free in the same sense.  It
-complements the GNU General Public License, which is a copyleft
-license designed for free software.
-
-We have designed this License in order to use it for manuals for free
-software, because free software needs free documentation: a free
-program should come with manuals providing the same freedoms that the
-software does.  But this License is not limited to software manuals;
-it can be used for any textual work, regardless of subject matter or
-whether it is published as a printed book.  We recommend this License
-principally for works whose purpose is instruction or reference.
-
-
-1. APPLICABILITY AND DEFINITIONS
-
-This License applies to any manual or other work that contains a
-notice placed by the copyright holder saying it can be distributed
-under the terms of this License.  The "Document", below, refers to any
-such manual or work.  Any member of the public is a licensee, and is
-addressed as "you".
-
-A "Modified Version" of the Document means any work containing the
-Document or a portion of it, either copied verbatim, or with
-modifications and/or translated into another language.
-
-A "Secondary Section" is a named appendix or a front-matter section of
-the Document that deals exclusively with the relationship of the
-publishers or authors of the Document to the Document's overall subject
-(or to related matters) and contains nothing that could fall directly
-within that overall subject.  (For example, if the Document is in part a
-textbook of mathematics, a Secondary Section may not explain any
-mathematics.)  The relationship could be a matter of historical
-connection with the subject or with related matters, or of legal,
-commercial, philosophical, ethical or political position regarding
-them.
-
-The "Invariant Sections" are certain Secondary Sections whose titles
-are designated, as being those of Invariant Sections, in the notice
-that says that the Document is released under this License.
-
-The "Cover Texts" are certain short passages of text that are listed,
-as Front-Cover Texts or Back-Cover Texts, in the notice that says that
-the Document is released under this License.
-
-A "Transparent" copy of the Document means a machine-readable copy,
-represented in a format whose specification is available to the
-general public, whose contents can be viewed and edited directly and
-straightforwardly with generic text editors or (for images composed of
-pixels) generic paint programs or (for drawings) some widely available
-drawing editor, and that is suitable for input to text formatters or
-for automatic translation to a variety of formats suitable for input
-to text formatters.  A copy made in an otherwise Transparent file
-format whose markup has been designed to thwart or discourage
-subsequent modification by readers is not Transparent.  A copy that is
-not "Transparent" is called "Opaque".
-
-Examples of suitable formats for Transparent copies include plain
-ASCII without markup, Texinfo input format, LaTeX input format, SGML
-or XML using a publicly available DTD, and standard-conforming simple
-HTML designed for human modification.  Opaque formats include
-PostScript, PDF, proprietary formats that can be read and edited only
-by proprietary word processors, SGML or XML for which the DTD and/or
-processing tools are not generally available, and the
-machine-generated HTML produced by some word processors for output
-purposes only.
-
-The "Title Page" means, for a printed book, the title page itself,
-plus such following pages as are needed to hold, legibly, the material
-this License requires to appear in the title page.  For works in
-formats which do not have any title page as such, "Title Page" means
-the text near the most prominent appearance of the work's title,
-preceding the beginning of the body of the text.
-
-
-2. VERBATIM COPYING
-
-You may copy and distribute the Document in any medium, either
-commercially or noncommercially, provided that this License, the
-copyright notices, and the license notice saying this License applies
-to the Document are reproduced in all copies, and that you add no other
-conditions whatsoever to those of this License.  You may not use
-technical measures to obstruct or control the reading or further
-copying of the copies you make or distribute.  However, you may accept
-compensation in exchange for copies.  If you distribute a large enough
-number of copies you must also follow the conditions in section 3.
-
-You may also lend copies, under the same conditions stated above, and
-you may publicly display copies.
-
-
-3. COPYING IN QUANTITY
-
-If you publish printed copies of the Document numbering more than 100,
-and the Document's license notice requires Cover Texts, you must enclose
-the copies in covers that carry, clearly and legibly, all these Cover
-Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
-the back cover.  Both covers must also clearly and legibly identify
-you as the publisher of these copies.  The front cover must present
-the full title with all words of the title equally prominent and
-visible.  You may add other material on the covers in addition.
-Copying with changes limited to the covers, as long as they preserve
-the title of the Document and satisfy these conditions, can be treated
-as verbatim copying in other respects.
-
-If the required texts for either cover are too voluminous to fit
-legibly, you should put the first ones listed (as many as fit
-reasonably) on the actual cover, and continue the rest onto adjacent
-pages.
-
-If you publish or distribute Opaque copies of the Document numbering
-more than 100, you must either include a machine-readable Transparent
-copy along with each Opaque copy, or state in or with each Opaque copy
-a publicly-accessible computer-network location containing a complete
-Transparent copy of the Document, free of added material, which the
-general network-using public has access to download anonymously at no
-charge using public-standard network protocols.  If you use the latter
-option, you must take reasonably prudent steps, when you begin
-distribution of Opaque copies in quantity, to ensure that this
-Transparent copy will remain thus accessible at the stated location
-until at least one year after the last time you distribute an Opaque
-copy (directly or through your agents or retailers) of that edition to
-the public.
-
-It is requested, but not required, that you contact the authors of the
-Document well before redistributing any large number of copies, to give
-them a chance to provide you with an updated version of the Document.
-
-
-4. MODIFICATIONS
-
-You may copy and distribute a Modified Version of the Document under
-the conditions of sections 2 and 3 above, provided that you release
-the Modified Version under precisely this License, with the Modified
-Version filling the role of the Document, thus licensing distribution
-and modification of the Modified Version to whoever possesses a copy
-of it.  In addition, you must do these things in the Modified Version:
-
-A. Use in the Title Page (and on the covers, if any) a title distinct
-   from that of the Document, and from those of previous versions
-   (which should, if there were any, be listed in the History section
-   of the Document).  You may use the same title as a previous version
-   if the original publisher of that version gives permission.
-B. List on the Title Page, as authors, one or more persons or entities
-   responsible for authorship of the modifications in the Modified
-   Version, together with at least five of the principal authors of the
-   Document (all of its principal authors, if it has less than five).
-C. State on the Title page the name of the publisher of the
-   Modified Version, as the publisher.
-D. Preserve all the copyright notices of the Document.
-E. Add an appropriate copyright notice for your modifications
-   adjacent to the other copyright notices.
-F. Include, immediately after the copyright notices, a license notice
-   giving the public permission to use the Modified Version under the
-   terms of this License, in the form shown in the Addendum below.
-G. Preserve in that license notice the full lists of Invariant Sections
-   and required Cover Texts given in the Document's license notice.
-H. Include an unaltered copy of this License.
-I. Preserve the section entitled "History", and its title, and add to
-   it an item stating at least the title, year, new authors, and
-   publisher of the Modified Version as given on the Title Page.  If
-   there is no section entitled "History" in the Document, create one
-   stating the title, year, authors, and publisher of the Document as
-   given on its Title Page, then add an item describing the Modified
-   Version as stated in the previous sentence.
-J. Preserve the network location, if any, given in the Document for
-   public access to a Transparent copy of the Document, and likewise
-   the network locations given in the Document for previous versions
-   it was based on.  These may be placed in the "History" section.
-   You may omit a network location for a work that was published at
-   least four years before the Document itself, or if the original
-   publisher of the version it refers to gives permission.
-K. In any section entitled "Acknowledgements" or "Dedications",
-   preserve the section's title, and preserve in the section all the
-   substance and tone of each of the contributor acknowledgements
-   and/or dedications given therein.
-L. Preserve all the Invariant Sections of the Document,
-   unaltered in their text and in their titles.  Section numbers
-   or the equivalent are not considered part of the section titles.
-M. Delete any section entitled "Endorsements".  Such a section
-   may not be included in the Modified Version.
-N. Do not retitle any existing section as "Endorsements"
-   or to conflict in title with any Invariant Section.
-
-If the Modified Version includes new front-matter sections or
-appendices that qualify as Secondary Sections and contain no material
-copied from the Document, you may at your option designate some or all
-of these sections as invariant.  To do this, add their titles to the
-list of Invariant Sections in the Modified Version's license notice.
-These titles must be distinct from any other section titles.
-
-You may add a section entitled "Endorsements", provided it contains
-nothing but endorsements of your Modified Version by various
-parties--for example, statements of peer review or that the text has
-been approved by an organization as the authoritative definition of a
-standard.
-
-You may add a passage of up to five words as a Front-Cover Text, and a
-passage of up to 25 words as a Back-Cover Text, to the end of the list
-of Cover Texts in the Modified Version.  Only one passage of
-Front-Cover Text and one of Back-Cover Text may be added by (or
-through arrangements made by) any one entity.  If the Document already
-includes a cover text for the same cover, previously added by you or
-by arrangement made by the same entity you are acting on behalf of,
-you may not add another; but you may replace the old one, on explicit
-permission from the previous publisher that added the old one.
-
-The author(s) and publisher(s) of the Document do not by this License
-give permission to use their names for publicity for or to assert or
-imply endorsement of any Modified Version.
-
-
-5. COMBINING DOCUMENTS
-
-You may combine the Document with other documents released under this
-License, under the terms defined in section 4 above for modified
-versions, provided that you include in the combination all of the
-Invariant Sections of all of the original documents, unmodified, and
-list them all as Invariant Sections of your combined work in its
-license notice.
-
-The combined work need only contain one copy of this License, and
-multiple identical Invariant Sections may be replaced with a single
-copy.  If there are multiple Invariant Sections with the same name but
-different contents, make the title of each such section unique by
-adding at the end of it, in parentheses, the name of the original
-author or publisher of that section if known, or else a unique number.
-Make the same adjustment to the section titles in the list of
-Invariant Sections in the license notice of the combined work.
-
-In the combination, you must combine any sections entitled "History"
-in the various original documents, forming one section entitled
-"History"; likewise combine any sections entitled "Acknowledgements",
-and any sections entitled "Dedications".  You must delete all sections
-entitled "Endorsements."
-
-
-6. COLLECTIONS OF DOCUMENTS
-
-You may make a collection consisting of the Document and other documents
-released under this License, and replace the individual copies of this
-License in the various documents with a single copy that is included in
-the collection, provided that you follow the rules of this License for
-verbatim copying of each of the documents in all other respects.
-
-You may extract a single document from such a collection, and distribute
-it individually under this License, provided you insert a copy of this
-License into the extracted document, and follow this License in all
-other respects regarding verbatim copying of that document.
-
-
-7. AGGREGATION WITH INDEPENDENT WORKS
-
-A compilation of the Document or its derivatives with other separate
-and independent documents or works, in or on a volume of a storage or
-distribution medium, does not as a whole count as a Modified Version
-of the Document, provided no compilation copyright is claimed for the
-compilation.  Such a compilation is called an "aggregate", and this
-License does not apply to the other self-contained works thus compiled
-with the Document, on account of their being thus compiled, if they
-are not themselves derivative works of the Document.
-
-If the Cover Text requirement of section 3 is applicable to these
-copies of the Document, then if the Document is less than one quarter
-of the entire aggregate, the Document's Cover Texts may be placed on
-covers that surround only the Document within the aggregate.
-Otherwise they must appear on covers around the whole aggregate.
-
-
-8. TRANSLATION
-
-Translation is considered a kind of modification, so you may
-distribute translations of the Document under the terms of section 4.
-Replacing Invariant Sections with translations requires special
-permission from their copyright holders, but you may include
-translations of some or all Invariant Sections in addition to the
-original versions of these Invariant Sections.  You may include a
-translation of this License provided that you also include the
-original English version of this License.  In case of a disagreement
-between the translation and the original English version of this
-License, the original English version will prevail.
-
-
-9. TERMINATION
-
-You may not copy, modify, sublicense, or distribute the Document except
-as expressly provided for under this License.  Any other attempt to
-copy, modify, sublicense or distribute the Document is void, and will
-automatically terminate your rights under this License.  However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-
-10. FUTURE REVISIONS OF THIS LICENSE
-
-The Free Software Foundation may publish new, revised versions
-of the GNU Free Documentation License from time to time.  Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.  See
-http://www.gnu.org/copyleft/.
-
-Each version of the License is given a distinguishing version number.
-If the Document specifies that a particular numbered version of this
-License "or any later version" applies to it, you have the option of
-following the terms and conditions either of that specified version or
-of any later version that has been published (not as a draft) by the
-Free Software Foundation.  If the Document does not specify a version
-number of this License, you may choose any version ever published (not
-as a draft) by the Free Software Foundation.
-
-
-ADDENDUM: How to use this License for your documents
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and
-license notices just after the title page:
-
-@smallexample
-    Copyright (c)  YEAR  YOUR NAME.
-    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 the Invariant Sections being LIST THEIR TITLES, with the
-    Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
-    A copy of the license is included in the section entitled "GNU
-    Free Documentation License".
-@end smallexample
-
-If you have no Invariant Sections, write "with no Invariant Sections"
-instead of saying which ones are invariant.  If you have no
-Front-Cover Texts, write "no Front-Cover Texts" instead of
-"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
-
-If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of
-free software license, such as the GNU General Public License,
-to permit their use in free software.
+@include fdl.texi
 
 @node Index
 @unnumbered Index
This page took 0.060797 seconds and 4 git commands to generate.