Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/ld/ld.texinfo

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    22@setfilename ld.info
    33@c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
    4 @c 2001 Free Software Foundation, Inc.
     4@c 2001, 2002, 2003 Free Software Foundation, Inc.
    55@syncodeindex ky cp
    66@include configdoc.texi
     
    99
    1010@c @smallbook
     11
     12@macro gcctabopt{body}
     13@code{\body\}
     14@end macro
     15
     16@c man begin NAME
     17@ifset man
     18@c Configure for the generation of man pages
     19@set UsesEnvVars
     20@set GENERIC
     21@set A29K
     22@set ARC
     23@set ARM
     24@set D10V
     25@set D30V
     26@set H8/300
     27@set H8/500
     28@set HPPA
     29@set I370
     30@set I80386
     31@set I860
     32@set I960
     33@set M32R
     34@set M68HC11
     35@set M680X0
     36@set MCORE
     37@set MIPS
     38@set MMIX
     39@set MSP430
     40@set PDP11
     41@set PJ
     42@set SH
     43@set SPARC
     44@set TIC54X
     45@set V850
     46@set VAX
     47@set WIN32
     48@set XTENSA
     49@end ifset
     50@c man end
    1151
    1252@ifinfo
     
    2161This file documents the @sc{gnu} linker LD version @value{VERSION}.
    2262
    23 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
     63Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
     642001, 2002, 2003 Free Software Foundation, Inc.
    2465
    2566@ignore
     
    3071with no Invariant Sections, with no Front-Cover Texts, and with no
    3172Back-Cover Texts.  A copy of the license is included in the
    32 section entitled "GNU Free Documentation License".
     73section entitled ``GNU Free Documentation License''.
    3374
    3475Permission is granted to process this file through Tex and print the
     
    64105
    65106@vskip 0pt plus 1filll
    66 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
    67 
    68       Permission is granted to copy, distribute and/or modify this document
    69       under the terms of the GNU Free Documentation License, Version 1.1
    70       or any later version published by the Free Software Foundation;
    71       with no Invariant Sections, with no Front-Cover Texts, and with no
    72       Back-Cover Texts.  A copy of the license is included in the
    73       section entitled "GNU Free Documentation License".
     107@c man begin COPYRIGHT
     108Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001,
     1092002, 2003 Free Software Foundation, Inc.
     110
     111Permission is granted to copy, distribute and/or modify this document
     112under the terms of the GNU Free Documentation License, Version 1.1
     113or any later version published by the Free Software Foundation;
     114with no Invariant Sections, with no Front-Cover Texts, and with no
     115Back-Cover Texts.  A copy of the license is included in the
     116section entitled ``GNU Free Documentation License''.
     117@c man end
    74118
    75119@end titlepage
     
    77121@c FIXME: Talk about importance of *order* of args, cmds to linker!
    78122
    79 @ifinfo
     123@ifnottex
    80124@node Top
    81125@top Using ld
     
    84128This document is distributed under the terms of the GNU Free
    85129Documentation License.  A copy of the license is included in the
    86 section entitled "GNU Free Documentation License".
     130section entitled ``GNU Free Documentation License''.
    87131
    88132@menu
     
    97141* H8/300::                      ld and the H8/300
    98142@end ifset
    99 @ifset Hitachi
    100 * Hitachi::                     ld and other Hitachi micros
     143@ifset Renesas
     144* Renesas::                     ld and other Renesas micros
    101145@end ifset
    102146@ifset I960
    103147* i960::                        ld and the Intel 960 family
    104148@end ifset
     149@ifset ARM
     150* ARM::                         ld and the ARM family
     151@end ifset
     152@ifset HPPA
     153* HPPA ELF32::                  ld and HPPA 32-bit ELF
     154@end ifset
    105155@ifset TICOFF
    106156* TI COFF::                     ld and the TI COFF
     157@end ifset
     158@ifset WIN32
     159* Win32::                       ld and WIN32 (cygwin/mingw)
     160@end ifset
     161@ifset XTENSA
     162* Xtensa::                      ld and Xtensa Processors
    107163@end ifset
    108164@end ifclear
     
    117173* Index::                       Index
    118174@end menu
    119 @end ifinfo
     175@end ifnottex
    120176
    121177@node Overview
     
    124180@cindex @sc{gnu} linker
    125181@cindex what is this?
    126 @code{ld} combines a number of object and archive files, relocates
     182
     183@ifset man
     184@c man begin SYNOPSIS
     185ld [@b{options}] @var{objfile} @dots{}
     186@c man end
     187
     188@c man begin SEEALSO
     189ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and
     190the Info entries for @file{binutils} and
     191@file{ld}.
     192@c man end
     193@end ifset
     194
     195@c man begin DESCRIPTION
     196
     197@command{ld} combines a number of object and archive files, relocates
    127198their data and ties up symbol references. Usually the last step in
    128 compiling a program is to run @code{ld}.
    129 
    130 @code{ld} accepts Linker Command Language files written in
     199compiling a program is to run @command{ld}.
     200
     201@command{ld} accepts Linker Command Language files written in
    131202a superset of AT&T's Link Editor Command Language syntax,
    132203to provide explicit and total control over the linking process.
    133204
     205@ifset man
     206@c For the man only
     207This man page does not describe the command language; see the
     208@command{ld} entry in @code{info}, or the manual
     209ld: the GNU linker, for full details on the command language and
     210on other aspects of the GNU linker.
     211@end ifset
     212
    134213@ifclear SingleFormat
    135 This version of @code{ld} uses the general purpose BFD libraries
    136 to operate on object files. This allows @code{ld} to read, combine, and
     214This version of @command{ld} uses the general purpose BFD libraries
     215to operate on object files. This allows @command{ld} to read, combine, and
    137216write object files in many different formats---for example, COFF or
    138217@code{a.out}.  Different formats may be linked together to produce any
     
    143222linkers in providing diagnostic information.  Many linkers abandon
    144223execution immediately upon encountering an error; whenever possible,
    145 @code{ld} continues executing, allowing you to identify other errors
     224@command{ld} continues executing, allowing you to identify other errors
    146225(or, in some cases, to get an output file in spite of the error).
     226
     227@c man end
    147228
    148229@node Invocation
    149230@chapter Invocation
    150231
    151 The @sc{gnu} linker @code{ld} is meant to cover a broad range of situations,
     232@c man begin DESCRIPTION
     233
     234The @sc{gnu} linker @command{ld} is meant to cover a broad range of situations,
    152235and to be as compatible as possible with other linkers.  As a result,
    153236you have many choices to control its behavior.
     237
     238@c man end
    154239
    155240@ifset UsesEnvVars
     
    165250@cindex command line
    166251@cindex options
     252
     253@c man begin OPTIONS
     254
    167255The linker supports a plethora of command-line options, but in actual
    168256practice few of them are used in any particular context.
    169257@cindex standard Unix system
    170 For instance, a frequent use of @code{ld} is to link standard Unix
     258For instance, a frequent use of @command{ld} is to link standard Unix
    171259object files on a standard, supported Unix system.  On such a system, to
    172260link a file @code{hello.o}:
     
    176264@end smallexample
    177265
    178 This tells @code{ld} to produce a file called @var{output} as the
     266This tells @command{ld} to produce a file called @var{output} as the
    179267result of linking the file @code{/lib/crt0.o} with @code{hello.o} and
    180268the library @code{libc.a}, which will come from the standard search
    181269directories.  (See the discussion of the @samp{-l} option below.)
    182270
    183 Some of the command-line options to @code{ld} may be specified at any
     271Some of the command-line options to @command{ld} may be specified at any
    184272point in the command line.  However, options which refer to files, such
    185273as @samp{-l} or @samp{-T}, cause the file to be read at the point at
     
    203291message @samp{No input files}.
    204292
    205 If the linker can not recognize the format of an object file, it will
     293If the linker cannot recognize the format of an object file, it will
    206294assume that it is a linker script.  A script specified in this way
    207295augments the main linker script used for the link (either the default
     
    210298or an archive, but actually merely defines some symbol values, or uses
    211299@code{INPUT} or @code{GROUP} to load other objects.  Note that
    212 specifying a script in this way should only be used to augment the main
    213 linker script; if you want to use some command that logically can only
    214 appear once, such as the @code{SECTIONS} or @code{MEMORY} command, you
    215 must replace the default linker script using the @samp{-T} option.
     300specifying a script in this way merely augments the main linker script;
     301use the @samp{-T} option to replace the default linker script entirely.
    216302@xref{Scripts}.
    217303
     
    223309For options whose names are multiple letters, either one dash or two can
    224310precede the option name; for example, @samp{-trace-symbol} and
    225 @samp{--trace-symbol} are equivalent.  Note - there is one exception to
     311@samp{--trace-symbol} are equivalent.  Note---there is one exception to
    226312this rule.  Multiple letter options that start with a lower case 'o' can
    227313only be preceeded by two dashes.  This is to reduce confusion with the
     
    237323accepted.
    238324
    239 Note - if the linker is being invoked indirectly, via a compiler driver
    240 (eg @samp{gcc}) then all the linker command line options should be
     325Note---if the linker is being invoked indirectly, via a compiler driver
     326(e.g. @samp{gcc}) then all the linker command line options should be
    241327prefixed by @samp{-Wl,} (or whatever is appropriate for the particular
    242328compiler driver) like this:
     
    252338linker:
    253339
    254 @table @code
     340@table @gcctabopt
    255341@kindex -a@var{keyword}
    256342@item -a@var{keyword}
     
    267353@kindex --architecture=@var{arch}
    268354@itemx --architecture=@var{architecture}
    269 In the current release of @code{ld}, this option is useful only for the
    270 Intel 960 family of architectures.  In that @code{ld} configuration, the
     355In the current release of @command{ld}, this option is useful only for the
     356Intel 960 family of architectures.  In that @command{ld} configuration, the
    271357@var{architecture} argument identifies the particular architecture in
    272358the 960 family, enabling some safeguards and modifying the
    273 archive-library search path.  @xref{i960,,@code{ld} and the Intel 960
     359archive-library search path.  @xref{i960,,@command{ld} and the Intel 960
    274360family}, for details.
    275361
    276 Future releases of @code{ld} may support similar functionality for
     362Future releases of @command{ld} may support similar functionality for
    277363other architecture families.
    278364@end ifset
     
    286372@item -b @var{input-format}
    287373@itemx --format=@var{input-format}
    288 @code{ld} may be configured to support more than one kind of object
    289 file.  If your @code{ld} is configured this way, you can use the
     374@command{ld} may be configured to support more than one kind of object
     375file.  If your @command{ld} is configured this way, you can use the
    290376@samp{-b} option to specify the binary format for input object files
    291 that follow this option on the command line.  Even when @code{ld} is
     377that follow this option on the command line.  Even when @command{ld} is
    292378configured to support alternative object formats, you don't usually need
    293 to specify this, as @code{ld} should be configured to expect as a
     379to specify this, as @command{ld} should be configured to expect as a
    294380default input format the most usual format on each machine.
    295381@var{input-format} is a text string, the name of a particular format
     
    310396@end ifset
    311397You can also define the input format from a script, using the command
    312 @code{TARGET}; see @ref{Format Commands}.
     398@code{TARGET};
     399@ifclear man
     400see @ref{Format Commands}.
     401@end ifclear
    313402@end ifclear
    314403
     
    318407@item -c @var{MRI-commandfile}
    319408@itemx --mri-script=@var{MRI-commandfile}
    320 For compatibility with linkers produced by MRI, @code{ld} accepts script
     409For compatibility with linkers produced by MRI, @command{ld} accepts script
    321410files written in an alternate, restricted command language, described in
    322 @ref{MRI,,MRI Compatible Script Files}.  Introduce MRI script files with
     411@ifclear man
     412@ref{MRI,,MRI Compatible Script Files}.
     413@end ifclear
     414@ifset man
     415the MRI Compatible Script Files section of GNU ld documentation.
     416@end ifset
     417Introduce MRI script files with
    323418the option @samp{-c}; use the @samp{-T} option to run linker
    324 scripts written in the general-purpose @code{ld} scripting language.
    325 If @var{MRI-cmdfile} does not exist, @code{ld} looks for it in the directories
     419scripts written in the general-purpose @command{ld} scripting language.
     420If @var{MRI-cmdfile} does not exist, @command{ld} looks for it in the directories
    326421specified by any @samp{-L} options.
    327422
     
    370465linking the program itself.
    371466
     467You can also use the version script to control what symbols should
     468be added to the dynamic symbol table if the output format supports it.
     469See the description of @samp{--version-script} in @ref{VERSION}.
     470
     471@ifclear SingleFormat
    372472@cindex big-endian objects
    373473@cindex endianness
     
    380480@item -EL
    381481Link little-endian objects.  This affects the default output format.
     482@end ifclear
    382483
    383484@kindex -f
     
    420521@var{name}.
    421522
    422 Some older linkers used the @code{-F} option throughout a compilation
     523Some older linkers used the @option{-F} option throughout a compilation
    423524toolchain for specifying object-file format for both input and output
    424 object files.  The @sc{gnu} linker uses other mechanisms for this
    425 purpose: the @code{-b}, @code{--format}, @code{--oformat} options, the
     525object files.
     526@ifclear SingleFormat
     527The @sc{gnu} linker uses other mechanisms for this purpose: the
     528@option{-b}, @option{--format}, @option{--oformat} options, the
    426529@code{TARGET} command in linker scripts, and the @code{GNUTARGET}
    427 environment variable.  The @sc{gnu} linker will ignore the @code{-F}
    428 option when not creating an ELF shared object.
     530environment variable.
     531@end ifclear
     532The @sc{gnu} linker will ignore the @option{-F} option when not
     533creating an ELF shared object.
    429534
    430535@cindex finalization function
     
    480585@itemx --library=@var{archive}
    481586Add archive file @var{archive} to the list of files to link.  This
    482 option may be used any number of times.  @code{ld} will search its
     587option may be used any number of times.  @command{ld} will search its
    483588path-list for occurrences of @code{lib@var{archive}.a} for every
    484589@var{archive} specified.
    485590
    486 On systems which support shared libraries, @code{ld} may also search for
     591On systems which support shared libraries, @command{ld} may also search for
    487592libraries with extensions other than @code{.a}.  Specifically, on ELF
    488 and SunOS systems, @code{ld} will search a directory for a library with
     593and SunOS systems, @command{ld} will search a directory for a library with
    489594an extension of @code{.so} before searching for one with an extension of
    490595@code{.a}.  By convention, a @code{.so} extension indicates a shared
     
    498603the command line will not cause the linker to search the archive again.
    499604
    500 See the @code{-(} option for a way to force the linker to search
     605See the @option{-(} option for a way to force the linker to search
    501606archives multiple times.
    502607
     
    505610@ifset GENERIC
    506611This type of archive searching is standard for Unix linkers.  However,
    507 if you are using @code{ld} on AIX, note that it is different from the
     612if you are using @command{ld} on AIX, note that it is different from the
    508613behaviour of the AIX linker.
    509614@end ifset
     
    514619@item -L@var{searchdir}
    515620@itemx --library-path=@var{searchdir}
    516 Add path @var{searchdir} to the list of paths that @code{ld} will search
    517 for archive libraries and @code{ld} control scripts.  You may use this
     621Add path @var{searchdir} to the list of paths that @command{ld} will search
     622for archive libraries and @command{ld} control scripts.  You may use this
    518623option any number of times.  The directories are searched in the order
    519624in which they are specified on the command line.  Directories specified
    520625on the command line are searched before the default directories.  All
    521 @code{-L} options apply to all @code{-l} options, regardless of the
     626@option{-L} options apply to all @option{-l} options, regardless of the
    522627order in which the options appear.
     628
     629If @var{searchdir} begins with @code{=}, then the @code{=} will be replaced
     630by the @dfn{sysroot prefix}, a path specified when the linker is configured.
    523631
    524632@ifset UsesEnvVars
    525633The default set of paths searched (without being specified with
    526 @samp{-L}) depends on which emulation mode @code{ld} is using, and in
     634@samp{-L}) depends on which emulation mode @command{ld} is using, and in
    527635some cases also on how it was configured.  @xref{Environment}.
    528636@end ifset
     
    578686@itemx --omagic
    579687Set the text and data sections to be readable and writable.  Also, do
    580 not page-align the data segment.  If the output format supports Unix
    581 style magic numbers, mark the output as @code{OMAGIC}.
     688not page-align the data segment, and disable linking against shared
     689libraries.  If the output format supports Unix style magic numbers,
     690mark the output as @code{OMAGIC}.
     691
     692@kindex --no-omagic
     693@cindex OMAGIC
     694@item --no-omagic
     695This option negates most of the effects of the @option{-N} option.  It
     696sets the text section to be read-only, and forces the data segment to
     697be page-aligned.  Note - this option does not enable linking against
     698shared libraries.  Use @option{-Bdynamic} for this.
    582699
    583700@kindex -o @var{output}
     
    586703@item -o @var{output}
    587704@itemx --output=@var{output}
    588 Use @var{output} as the name for the program produced by @code{ld}; if this
     705Use @var{output} as the name for the program produced by @command{ld}; if this
    589706option is not specified, the name @file{a.out} is used by default.  The
    590707script command @code{OUTPUT} can also specify the output file name.
     
    593710@cindex generating optimized output
    594711@item -O @var{level}
    595 If @var{level} is a numeric values greater than zero @code{ld} optimizes
     712If @var{level} is a numeric values greater than zero @command{ld} optimizes
    596713the output.  This might take significantly longer and therefore probably
    597714should only be enabled for the final binary.
     
    607724in larger executables.
    608725
     726This option is currently only supported on ELF platforms.
     727
    609728@cindex partial link
    610729@cindex relocatable output
     
    614733@itemx --relocateable
    615734Generate relocatable output---i.e., generate an output file that can in
    616 turn serve as input to @code{ld}.  This is often called @dfn{partial
     735turn serve as input to @command{ld}.  This is often called @dfn{partial
    617736linking}.  As a side effect, in environments that support standard Unix
    618737magic numbers, this option also sets the output file's magic number to
    619738@code{OMAGIC}.
    620 @c ; see @code{-N}.
     739@c ; see @option{-N}.
    621740If this option is not specified, an absolute file is produced.  When
    622741linking C++ programs, this option @emph{will not} resolve references to
    623742constructors; to do that, use @samp{-Ur}.
     743
     744When an input file does not have the same format as the output file,
     745partial linking is only supported if that input file does not contain any
     746relocations.  Different output formats can have further restrictions; for
     747example some @code{a.out}-based formats do not support partial linking
     748with input files in other formats at all.
    624749
    625750This option does the same thing as @samp{-i}.
     
    635760programs.  You may use this option more than once.
    636761
    637 For compatibility with other ELF linkers, if the @code{-R} option is
     762For compatibility with other ELF linkers, if the @option{-R} option is
    638763followed by a directory name, rather than a file name, it is treated as
    639 the @code{-rpath} option.
     764the @option{-rpath} option.
    640765
    641766@kindex -s
     
    658783@item -t
    659784@itemx --trace
    660 Print the names of the input files as @code{ld} processes them.
     785Print the names of the input files as @command{ld} processes them.
    661786
    662787@kindex -T @var{script}
     
    666791@itemx --script=@var{scriptfile}
    667792Use @var{scriptfile} as the linker script.  This script replaces
    668 @code{ld}'s default linker script (rather than adding to it), so
     793@command{ld}'s default linker script (rather than adding to it), so
    669794@var{commandfile} must specify everything necessary to describe the
    670 output file.  You must use this option if you want to use a command
    671 which can only appear once in a linker script, such as the
    672 @code{SECTIONS} or @code{MEMORY} command.  @xref{Scripts}.  If
    673 @var{scriptfile} does not exist in the current directory, @code{ld}
    674 looks for it in the directories specified by any preceding @samp{-L}
    675 options.  Multiple @samp{-T} options accumulate.
     795output file.  @xref{Scripts}.  If @var{scriptfile} does not exist in
     796the current directory, @code{ld} looks for it in the directories
     797specified by any preceding @samp{-L} options.  Multiple @samp{-T}
     798options accumulate.
    676799
    677800@kindex -u @var{symbol}
     
    691814For anything other than C++ programs, this option is equivalent to
    692815@samp{-r}: it generates relocatable output---i.e., an output file that can in
    693 turn serve as input to @code{ld}.  When linking C++ programs, @samp{-Ur}
     816turn serve as input to @command{ld}.  When linking C++ programs, @samp{-Ur}
    694817@emph{does} resolve references to constructors, unlike @samp{-r}.
    695818It does not work to use @samp{-Ur} on files that were themselves linked
     
    715838@itemx --version
    716839@itemx -V
    717 Display the version number for @code{ld}.  The @code{-V} option also
     840Display the version number for @command{ld}.  The @option{-V} option also
    718841lists the supported emulations.
    719842
     
    755878The recognized keywords are @code{initfirst}, @code{interpose},
    756879@code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen},
    757 @code{nodump}, @code{now} and @code{origin}. The other keywords are
     880@code{nodump}, @code{now}, @code{origin}, @code{combreloc}, @code{nocombreloc}
     881and @code{nocopyreloc}.
     882The other keywords are
    758883ignored for Solaris compatibility. @code{initfirst} marks the object
    759884to be initialized first at runtime before any other objects.
     
    769894@code{origin} marks the object may contain $ORIGIN.
    770895@code{defs} disallows undefined symbols.
     896@code{muldefs} allows multiple definitions.
     897@code{combreloc} combines multiple reloc sections and sorts them
     898to make dynamic symbol lookup caching possible.
     899@code{nocombreloc} disables multiple reloc sections combining.
     900@code{nocopyreloc} disables production of copy relocs.
    771901
    772902@kindex -(
     
    789919it only when there are unavoidable circular references between two or
    790920more archives.
     921
     922@kindex --accept-unknown-input-arch
     923@kindex --no-accept-unknown-input-arch
     924@item --accept-unknown-input-arch
     925@itemx --no-accept-unknown-input-arch
     926Tells the linker to accept input files whose architecture cannot be
     927recognised.  The assumption is that the user knows what they are doing
     928and deliberately wants to link in these unknown input files.  This was
     929the default behaviour of the linker, before release 2.14.  The default
     930behaviour from release 2.14 onwards is to reject such input files, and
     931so the @samp{--accept-unknown-input-arch} option has been added to
     932restore the old behaviour.
    791933
    792934@kindex -assert @var{keyword}
     
    805947for compatibility with various systems.  You may use this option
    806948multiple times on the command line: it affects library searching for
    807 @code{-l} options which follow it.
     949@option{-l} options which follow it.
    808950
    809951@kindex -Bgroup
     
    812954section.  This causes the runtime linker to handle lookups in this
    813955object and its dependencies to be performed only inside the group.
    814 @code{--no-undefined} is implied.  This option is only meaningful on ELF
     956@option{--no-undefined} is implied.  This option is only meaningful on ELF
    815957platforms which support shared libraries.
    816958
     
    827969variants of this option are for compatibility with various systems.  You
    828970may use this option multiple times on the command line: it affects
    829 library searching for @code{-l} options which follow it.
     971library searching for @option{-l} options which follow it.
    830972
    831973@kindex -Bsymbolic
     
    8601002symbol is defined, the first file listed is the location of the
    8611003definition.  The remaining files contain references to the symbol.
     1004
     1005@cindex common allocation
     1006@kindex --no-define-common
     1007@item --no-define-common
     1008This option inhibits the assignment of addresses to common symbols.
     1009The script command @code{INHIBIT_COMMON_ALLOCATION} has the same effect.
     1010@xref{Miscellaneous Commands}.
     1011
     1012The @samp{--no-define-common} option allows decoupling
     1013the decision to assign addresses to Common symbols from the choice
     1014of the output file type; otherwise a non-Relocatable output type
     1015forces assigning addresses to Common symbols.
     1016Using @samp{--no-define-common} allows Common symbols that are referenced
     1017from a shared library to be assigned addresses only in the main program.
     1018This eliminates the unused duplicate space in the shared library,
     1019and also prevents any possible confusion over resolving to the wrong
     1020duplicate when there are many dynamic modules with specialized search
     1021paths for runtime symbol resolution.
    8621022
    8631023@cindex symbols, from command line
     
    8921052
    8931053@cindex dynamic linker, from command line
     1054@kindex -I@var{file}
    8941055@kindex --dynamic-linker @var{file}
    8951056@item --dynamic-linker @var{file}
     
    9071068runtime to relocate any data which was statically initialized to pointer
    9081069values.  See the code in testsuite/ld-empic for details.
     1070
     1071
     1072@kindex --fatal-warnings
     1073@item --fatal-warnings
     1074Treat all warnings as errors.
    9091075
    9101076@kindex --force-exe-suffix
     
    9481114@kindex --no-keep-memory
    9491115@item --no-keep-memory
    950 @code{ld} normally optimizes for speed over memory usage by caching the
    951 symbol tables of input files in memory.  This option tells @code{ld} to
     1116@command{ld} normally optimizes for speed over memory usage by caching the
     1117symbol tables of input files in memory.  This option tells @command{ld} to
    9521118instead optimize for memory usage, by rereading the symbol tables as
    953 necessary.  This may be required if @code{ld} runs out of memory space
     1119necessary.  This may be required if @command{ld} runs out of memory space
    9541120while linking a large executable.
    9551121
     
    9591125@itemx -z defs
    9601126Normally when creating a non-symbolic shared library, undefined symbols
    961 are allowed and left to be resolved by the runtime loader.  These options
    962 disallow such undefined symbols.
     1127are allowed and left to be resolved by the runtime loader.  This option
     1128disallows such undefined symbols if they come from regular object
     1129files.  The switch @samp{--no-allow-shlib-undefined} controls the
     1130behaviour for shared objects being linked into the shared library.
     1131
     1132@kindex --allow-multiple-definition
     1133@kindex -z muldefs
     1134@item --allow-multiple-definition
     1135@itemx -z muldefs
     1136Normally when a symbol is defined multiple times, the linker will
     1137report a fatal error. These options allow multiple definitions and the
     1138first definition will be used.
    9631139
    9641140@kindex --allow-shlib-undefined
     1141@kindex --no-allow-shlib-undefined
    9651142@item --allow-shlib-undefined
    966 Allow undefined symbols in shared objects even  when --no-undefined is
    967 set. The net result will be that undefined symbols in regular objects
    968 will still trigger an error, but undefined symbols in shared objects
    969 will be ignored.  The implementation of no_undefined makes the
    970 assumption that the runtime linker will choke on undefined symbols.
    971 However there is at least one system (BeOS) where undefined symbols in
    972 shared libraries is normal since the kernel patches them at load time to
    973 select which function is most appropriate for the current architecture.
    974 I.E. dynamically select an appropriate memset function.  Apparently it
    975 is also normal for HPPA shared libraries to have undefined symbols.
     1143@itemx --no-allow-shlib-undefined
     1144Allow (the default) or disallow undefined symbols in shared objects.
     1145The setting of this switch overrides @samp{--no-undefined} where
     1146shared objects are concerned.  Thus if @samp{--no-undefined} is set
     1147but @samp{--no-allow-shlib-undefined} is not, the net result will be
     1148that undefined symbols in regular object files will trigger an error,
     1149but undefined symbols in shared objects will be ignored.
     1150
     1151The reason that @samp{--allow-shlib-undefined} is the default is that
     1152the shared object being specified at link time may not be the same one
     1153that is available at load time, so the symbols might actually be
     1154resolvable at load time.  Plus there are some systems, (eg BeOS) where
     1155undefined symbols in shared libraries is normal since the kernel
     1156patches them at load time to select which function is most appropriate
     1157for the current architecture. eg. to dynamically select an appropriate
     1158memset function.  Apparently it is also normal for HPPA shared
     1159libraries to have undefined symbols.
     1160
     1161@kindex --no-undefined-version
     1162@item --no-undefined-version
     1163Normally when a symbol has an undefined version, the linker will ignore
     1164it. This option disallows symbols with undefined version and a fatal error
     1165will be issued instead.
    9761166
    9771167@kindex --no-warn-mismatch
    9781168@item --no-warn-mismatch
    979 Normally @code{ld} will give an error if you try to link together input
     1169Normally @command{ld} will give an error if you try to link together input
    9801170files that are mismatched for some reason, perhaps because they have
    9811171been compiled for different processors or for different endiannesses.
    982 This option tells @code{ld} that it should silently permit such possible
     1172This option tells @command{ld} that it should silently permit such possible
    9831173errors.  This option should only be used with care, in cases when you
    9841174have taken some special action that ensures that the linker errors are
     
    9871177@kindex --no-whole-archive
    9881178@item --no-whole-archive
    989 Turn off the effect of the @code{--whole-archive} option for subsequent
     1179Turn off the effect of the @option{--whole-archive} option for subsequent
    9901180archive files.
    9911181
     
    9981188when it issues any error whatsoever.
    9991189
     1190@kindex -nostdlib
     1191@item -nostdlib
     1192Only search library directories explicitly specified on the
     1193command line.  Library directories specified in linker scripts
     1194(including linker scripts specified on the command line) are ignored.
     1195
    10001196@ifclear SingleFormat
    10011197@kindex --oformat
    10021198@item --oformat @var{output-format}
    1003 @code{ld} may be configured to support more than one kind of object
    1004 file.  If your @code{ld} is configured this way, you can use the
     1199@command{ld} may be configured to support more than one kind of object
     1200file.  If your @command{ld} is configured this way, you can use the
    10051201@samp{--oformat} option to specify the binary format for the output
    1006 object file.  Even when @code{ld} is configured to support alternative
    1007 object formats, you don't usually need to specify this, as @code{ld}
     1202object file.  Even when @command{ld} is configured to support alternative
     1203object formats, you don't usually need to specify this, as @command{ld}
    10081204should be configured to produce as a default output format the most
    10091205usual format on each machine.  @var{output-format} is a text string, the
     
    10311227@end ifset
    10321228@ifset H8300
    1033 @xref{H8/300,,@code{ld} and the H8/300}.
     1229@xref{H8/300,,@command{ld} and the H8/300}.
    10341230@end ifset
    10351231@ifset I960
    1036 @xref{i960,, @code{ld} and the Intel 960 family}.
     1232@xref{i960,, @command{ld} and the Intel 960 family}.
    10371233@end ifset
    1038 
     1234@ifset XTENSA
     1235@xref{Xtensa,, @command{ld} and Xtensa Processors}.
     1236@end ifset
    10391237
    10401238On some platforms, the @samp{--relax} option performs global
     
    10791277@kindex -rpath
    10801278Add a directory to the runtime library search path.  This is used when
    1081 linking an ELF executable with shared objects.  All @code{-rpath}
     1279linking an ELF executable with shared objects.  All @option{-rpath}
    10821280arguments are concatenated and passed to the runtime linker, which uses
    1083 them to locate shared objects at runtime.  The @code{-rpath} option is
     1281them to locate shared objects at runtime.  The @option{-rpath} option is
    10841282also used when locating shared objects which are needed by shared
    10851283objects explicitly included in the link; see the description of the
    1086 @code{-rpath-link} option.  If @code{-rpath} is not used when linking an
     1284@option{-rpath-link} option.  If @option{-rpath} is not used when linking an
    10871285ELF executable, the contents of the environment variable
    10881286@code{LD_RUN_PATH} will be used if it is defined.
    10891287
    1090 The @code{-rpath} option may also be used on SunOS.  By default, on
     1288The @option{-rpath} option may also be used on SunOS.  By default, on
    10911289SunOS, the linker will form a runtime search patch out of all the
    1092 @code{-L} options it is given.  If a @code{-rpath} option is used, the
    1093 runtime search path will be formed exclusively using the @code{-rpath}
    1094 options, ignoring the @code{-L} options.  This can be useful when using
    1095 gcc, which adds many @code{-L} options which may be on NFS mounted
     1290@option{-L} options it is given.  If a @option{-rpath} option is used, the
     1291runtime search path will be formed exclusively using the @option{-rpath}
     1292options, ignoring the @option{-L} options.  This can be useful when using
     1293gcc, which adds many @option{-L} options which may be on NFS mounted
    10961294filesystems.
    10971295
    1098 For compatibility with other ELF linkers, if the @code{-R} option is
     1296For compatibility with other ELF linkers, if the @option{-R} option is
    10991297followed by a directory name, rather than a file name, it is treated as
    1100 the @code{-rpath} option.
     1298the @option{-rpath} option.
    11011299@end ifset
    11021300
     
    11121310non-relocatable link, it will automatically try to locate the required
    11131311shared library and include it in the link, if it is not included
    1114 explicitly.  In such a case, the @code{-rpath-link} option
     1312explicitly.  In such a case, the @option{-rpath-link} option
    11151313specifies the first set of directories to search.  The
    1116 @code{-rpath-link} option may specify a sequence of directory names
     1314@option{-rpath-link} option may specify a sequence of directory names
    11171315either by specifying a list of names separated by colons, or by
    11181316appearing multiple times.
     
    11271325@enumerate
    11281326@item
    1129 Any directories specified by @code{-rpath-link} options.
     1327Any directories specified by @option{-rpath-link} options.
    11301328@item
    1131 Any directories specified by @code{-rpath} options.  The difference
    1132 between @code{-rpath} and @code{-rpath-link} is that directories
    1133 specified by @code{-rpath} options are included in the executable and
    1134 used at runtime, whereas the @code{-rpath-link} option is only effective
     1329Any directories specified by @option{-rpath} options.  The difference
     1330between @option{-rpath} and @option{-rpath-link} is that directories
     1331specified by @option{-rpath} options are included in the executable and
     1332used at runtime, whereas the @option{-rpath-link} option is only effective
    11351333at link time. It is for the native linker only.
    11361334@item
    1137 On an ELF system, if the @code{-rpath} and @code{rpath-link} options
     1335On an ELF system, if the @option{-rpath} and @code{rpath-link} options
    11381336were not used, search the contents of the environment variable
    11391337@code{LD_RUN_PATH}. It is for the native linker only.
    11401338@item
    1141 On SunOS, if the @code{-rpath} option was not used, search any
    1142 directories specified using @code{-L} options.
     1339On SunOS, if the @option{-rpath} option was not used, search any
     1340directories specified using @option{-L} options.
    11431341@item
    11441342For a native linker, the contents of the environment variable
     
    11671365Create a shared library.  This is currently only supported on ELF, XCOFF
    11681366and SunOS platforms.  On SunOS, the linker will automatically create a
    1169 shared library if the @code{-e} option is not used and there are
     1367shared library if the @option{-e} option is not used and there are
    11701368undefined symbols in the link.
    11711369
    11721370@item --sort-common
    11731371@kindex --sort-common
    1174 This option tells @code{ld} to sort the common symbols by size when it
     1372This option tells @command{ld} to sort the common symbols by size when it
    11751373places them in the appropriate output sections.  First come all the one
    1176 byte symbols, then all the two bytes, then all the four bytes, and then
     1374byte symbols, then all the two byte, then all the four byte, and then
    11771375everything else.  This is to prevent gaps between symbols due to
    11781376alignment constraints.
     
    11801378@kindex --split-by-file
    11811379@item --split-by-file [@var{size}]
    1182 Similar to @code{--split-by-reloc} but creates a new output section for
     1380Similar to @option{--split-by-reloc} but creates a new output section for
    11831381each input file when @var{size} is reached.  @var{size} defaults to a
    11841382size of 1 if not given.
     
    12051403@cindex traditional format
    12061404@item --traditional-format
    1207 For some targets, the output of @code{ld} is different in some ways from
    1208 the output of some existing linker.  This switch requests @code{ld} to
     1405For some targets, the output of @command{ld} is different in some ways from
     1406the output of some existing linker.  This switch requests @command{ld} to
    12091407use the traditional format instead.
    12101408
    12111409@cindex dbx
    1212 For example, on SunOS, @code{ld} combines duplicate entries in the
     1410For example, on SunOS, @command{ld} combines duplicate entries in the
    12131411symbol string table.  This can reduce the size of an output file with
    12141412full debugging information by over 30 percent.  Unfortunately, the SunOS
    12151413@code{dbx} program can not read the resulting program (@code{gdb} has no
    1216 trouble).  The @samp{--traditional-format} switch tells @code{ld} to not
     1414trouble).  The @samp{--traditional-format} switch tells @command{ld} to not
    12171415combine duplicate entries.
    12181416
     
    12361434@itemx -Tdata @var{org}
    12371435@itemx -Ttext @var{org}
    1238 Use @var{org} as the starting address for---respectively---the
    1239 @code{bss}, @code{data}, or the @code{text} segment of the output file.
    1240 @var{org} must be a single hexadecimal integer;
    1241 for compatibility with other linkers, you may omit the leading
    1242 @samp{0x} usually associated with hexadecimal values.
     1436Same as --section-start, with @code{.bss}, @code{.data} or
     1437@code{.text} as the @var{sectionname}.
    12431438
    12441439@kindex --verbose
     
    12461441@item --dll-verbose
    12471442@itemx --verbose
    1248 Display the version number for @code{ld} and list the linker emulations
     1443Display the version number for @command{ld} and list the linker emulations
    12491444supported.  Display which input files can and cannot be opened.  Display
    1250 the linker script if using a default builtin script.
     1445the linker script being used by the linker.
    12511446
    12521447@kindex --version-script=@var{version-scriptfile}
     
    12551450Specify the name of a version script to the linker.  This is typically
    12561451used when creating shared libraries to specify additional information
    1257 about the version heirarchy for the library being created.  This option
     1452about the version hierarchy for the library being created.  This option
    12581453is only meaningful on ELF platforms which support shared libraries.
    12591454@xref{VERSION}.
    12601455
    1261 @kindex --warn-comon
     1456@kindex --warn-common
    12621457@cindex warnings, on combining symbols
    12631458@cindex combining symbols, warnings on
     
    13851580@item --whole-archive
    13861581For each archive mentioned on the command line after the
    1387 @code{--whole-archive} option, include every object file in the archive
     1582@option{--whole-archive} option, include every object file in the archive
    13881583in the link, rather than searching the archive for the required object
    13891584files.  This is normally used to turn an archive file into a shared
     
    13921587
    13931588Two notes when using this option from gcc: First, gcc doesn't know
    1394 about this option, so you have to use @code{-Wl,-whole-archive}.
    1395 Second, don't forget to use @code{-Wl,-no-whole-archive} after your
     1589about this option, so you have to use @option{-Wl,-whole-archive}.
     1590Second, don't forget to use @option{-Wl,-no-whole-archive} after your
    13961591list of archives, because gcc will add its own list of archives to
    13971592your link and you may not want this flag to affect those as well.
     
    14201615@end smallexample
    14211616
    1422 If you link other code with this file using @code{--wrap malloc}, then
     1617If you link other code with this file using @option{--wrap malloc}, then
    14231618all calls to @code{malloc} will call the function @code{__wrap_malloc}
    14241619instead.  The call to @code{__real_malloc} in @code{__wrap_malloc} will
     
    14261621
    14271622You may wish to provide a @code{__real_malloc} function as well, so that
    1428 links without the @code{--wrap} option will succeed.  If you do this,
     1623links without the @option{--wrap} option will succeed.  If you do this,
    14291624you should not put the definition of @code{__real_malloc} in the same
    14301625file as @code{__wrap_malloc}; if you do, the assembler may resolve the
     
    14371632This linker can create the new dynamic tags in ELF. But the older ELF
    14381633systems may not understand them. If you specify
    1439 @code{--enable-new-dtags}, the dynamic tags will be created as needed.
    1440 If you specify @code{--disable-new-dtags}, no new dynamic tags will be
     1634@option{--enable-new-dtags}, the dynamic tags will be created as needed.
     1635If you specify @option{--disable-new-dtags}, no new dynamic tags will be
    14411636created. By default, the new dynamic tags are not created. Note that
    14421637those options are only available for ELF systems.
     
    14441639@end table
    14451640
    1446 @subsection Options specific to i386 PE targets
    1447 
    1448 The i386 PE linker supports the @code{-shared} option, which causes
     1641@c man end
     1642
     1643@subsection Options Specific to i386 PE Targets
     1644
     1645@c man begin OPTIONS
     1646
     1647The i386 PE linker supports the @option{-shared} option, which causes
    14491648the output to be a dynamically linked library (DLL) instead of a
    14501649normal executable.  You should name the output @code{*.dll} when you
     
    14601659values by either a space or an equals sign.
    14611660
    1462 @table @code
     1661@table @gcctabopt
    14631662
    14641663@kindex --add-stdcall-alias
     
    14661665If given, symbols with a stdcall suffix (@@@var{nn}) will be exported
    14671666as-is and also with the suffix stripped.
     1667[This option is specific to the i386 PE targeted port of the linker]
    14681668
    14691669@kindex --base-file
     
    14721672addresses of all the relocations needed for generating DLLs with
    14731673@file{dlltool}.
     1674[This is an i386 PE specific option]
    14741675
    14751676@kindex --dll
    14761677@item --dll
    14771678Create a DLL instead of a regular executable.  You may also use
    1478 @code{-shared} or specify a @code{LIBRARY} in a given @code{.def}
     1679@option{-shared} or specify a @code{LIBRARY} in a given @code{.def}
    14791680file.
     1681[This option is specific to the i386 PE targeted port of the linker]
    14801682
    14811683@kindex --enable-stdcall-fixup
     
    14841686@itemx --disable-stdcall-fixup
    14851687If the link finds a symbol that it cannot resolve, it will attempt to
    1486 do "fuzzy linking" by looking for another defined symbol that differs
     1688do ``fuzzy linking'' by looking for another defined symbol that differs
    14871689only in the format of the symbol name (cdecl vs stdcall) and will
    14881690resolve that symbol by linking to the match.  For example, the
     
    14921694warning, since it normally should have failed to link, but sometimes
    14931695import libraries generated from third-party dlls may need this feature
    1494 to be usable.  If you specify @code{--enable-stdcall-fixup}, this
     1696to be usable.  If you specify @option{--enable-stdcall-fixup}, this
    14951697feature is fully enabled and warnings are not printed.  If you specify
    1496 @code{--disable-stdcall-fixup}, this feature is disabled and such
     1698@option{--disable-stdcall-fixup}, this feature is disabled and such
    14971699mismatches are considered to be errors.
     1700[This option is specific to the i386 PE targeted port of the linker]
    14981701
    14991702@cindex DLLs, creating
     
    15061709attributes, the default is to not export anything else unless this
    15071710option is given.  Note that the symbols @code{DllMain@@12},
    1508 @code{DllEntryPoint@@0}, and @code{impure_ptr} will not be automatically
    1509 exported.
     1711@code{DllEntryPoint@@0}, @code{DllMainCRTStartup@@12}, and
     1712@code{impure_ptr} will not be automatically
     1713exported.  Also, symbols imported from other DLLs will not be
     1714re-exported, nor will symbols specifying the DLL's internal layout
     1715such as those beginning with @code{_head_} or ending with
     1716@code{_iname}.  In addition, no symbols from @code{libgcc},
     1717@code{libstd++}, @code{libmingw32}, or @code{crtX.o} will be exported.
     1718Symbols whose names begin with @code{__rtti_} or @code{__builtin_} will
     1719not be exported, to help with C++ DLLs.  Finally, there is an
     1720extensive list of cygwin-private symbols that are not exported
     1721(obviously, this applies on when building DLLs for cygwin targets).
     1722These cygwin-excludes are: @code{_cygwin_dll_entry@@12},
     1723@code{_cygwin_crt0_common@@8}, @code{_cygwin_noncygwin_dll_entry@@12},
     1724@code{_fmode}, @code{_impure_ptr}, @code{cygwin_attach_dll},
     1725@code{cygwin_premain0}, @code{cygwin_premain1}, @code{cygwin_premain2},
     1726@code{cygwin_premain3}, and @code{environ}.
     1727[This option is specific to the i386 PE targeted port of the linker]
    15101728
    15111729@kindex --exclude-symbols
     
    15131731Specifies a list of symbols which should not be automatically
    15141732exported.  The symbol names may be delimited by commas or colons.
     1733[This option is specific to the i386 PE targeted port of the linker]
     1734
     1735@kindex --exclude-libs
     1736@item --exclude-libs @var{lib},@var{lib},...
     1737Specifies a list of archive libraries from which symbols should not be automatically
     1738exported. The library names may be delimited by commas or colons.  Specifying
     1739@code{--exclude-libs ALL} excludes symbols in all archive libraries from
     1740automatic export. Symbols explicitly listed in a .def file are still exported,
     1741regardless of this option.
     1742[This option is specific to the i386 PE targeted port of the linker]
    15151743
    15161744@kindex --file-alignment
     
    15191747file offsets which are multiples of this number.  This defaults to
    15201748512.
     1749[This option is specific to the i386 PE targeted port of the linker]
    15211750
    15221751@cindex heap size
     
    15271756used as heap for this program.  The default is 1Mb reserved, 4K
    15281757committed.
     1758[This option is specific to the i386 PE targeted port of the linker]
    15291759
    15301760@cindex image base
     
    15371767other dlls.  The default is 0x400000 for executables, and 0x10000000
    15381768for dlls.
     1769[This option is specific to the i386 PE targeted port of the linker]
    15391770
    15401771@kindex --kill-at
     
    15421773If given, the stdcall suffixes (@@@var{nn}) will be stripped from
    15431774symbols before they are exported.
     1775[This option is specific to the i386 PE targeted port of the linker]
    15441776
    15451777@kindex --major-image-version
    15461778@item --major-image-version @var{value}
    1547 Sets the major number of the "image version".  Defaults to 1.
     1779Sets the major number of the ``image version''.  Defaults to 1.
     1780[This option is specific to the i386 PE targeted port of the linker]
    15481781
    15491782@kindex --major-os-version
    15501783@item --major-os-version @var{value}
    1551 Sets the major number of the "os version".  Defaults to 4.
     1784Sets the major number of the ``os version''.  Defaults to 4.
     1785[This option is specific to the i386 PE targeted port of the linker]
    15521786
    15531787@kindex --major-subsystem-version
    15541788@item --major-subsystem-version @var{value}
    1555 Sets the major number of the "subsystem version".  Defaults to 4.
     1789Sets the major number of the ``subsystem version''.  Defaults to 4.
     1790[This option is specific to the i386 PE targeted port of the linker]
    15561791
    15571792@kindex --minor-image-version
    15581793@item --minor-image-version @var{value}
    1559 Sets the minor number of the "image version".  Defaults to 0.
     1794Sets the minor number of the ``image version''.  Defaults to 0.
     1795[This option is specific to the i386 PE targeted port of the linker]
    15601796
    15611797@kindex --minor-os-version
    15621798@item --minor-os-version @var{value}
    1563 Sets the minor number of the "os version".  Defaults to 0.
     1799Sets the minor number of the ``os version''.  Defaults to 0.
     1800[This option is specific to the i386 PE targeted port of the linker]
    15641801
    15651802@kindex --minor-subsystem-version
    15661803@item --minor-subsystem-version @var{value}
    1567 Sets the minor number of the "subsystem version".  Defaults to 0.
     1804Sets the minor number of the ``subsystem version''.  Defaults to 0.
     1805[This option is specific to the i386 PE targeted port of the linker]
    15681806
    15691807@cindex DEF files, creating
     
    15761814library with @code{dlltool} or may be used as a reference to
    15771815automatically or implicitly exported symbols.
     1816[This option is specific to the i386 PE targeted port of the linker]
     1817
     1818@cindex DLLs, creating
     1819@kindex --out-implib
     1820@item --out-implib @var{file}
     1821The linker will create the file @var{file} which will contain an
     1822import lib corresponding to the DLL the linker is generating. This
     1823import lib (which should be called @code{*.dll.a} or @code{*.a}
     1824may be used to link clients against the generated DLL; this behavior
     1825makes it possible to skip a separate @code{dlltool} import library
     1826creation step.
     1827[This option is specific to the i386 PE targeted port of the linker]
     1828
     1829@kindex --enable-auto-image-base
     1830@item --enable-auto-image-base
     1831Automatically choose the image base for DLLs, unless one is specified
     1832using the @code{--image-base} argument.  By using a hash generated
     1833from the dllname to create unique image bases for each DLL, in-memory
     1834collisions and relocations which can delay program execution are
     1835avoided.
     1836[This option is specific to the i386 PE targeted port of the linker]
     1837
     1838@kindex --disable-auto-image-base
     1839@item --disable-auto-image-base
     1840Do not automatically generate a unique image base.  If there is no
     1841user-specified image base (@code{--image-base}) then use the platform
     1842default.
     1843[This option is specific to the i386 PE targeted port of the linker]
     1844
     1845@cindex DLLs, linking to
     1846@kindex --dll-search-prefix
     1847@item --dll-search-prefix @var{string}
     1848When linking dynamically to a dll without an import library,
     1849search for @code{<string><basename>.dll} in preference to
     1850@code{lib<basename>.dll}. This behavior allows easy distinction
     1851between DLLs built for the various "subplatforms": native, cygwin,
     1852uwin, pw, etc.  For instance, cygwin DLLs typically use
     1853@code{--dll-search-prefix=cyg}.
     1854[This option is specific to the i386 PE targeted port of the linker]
     1855
     1856@kindex --enable-auto-import
     1857@item --enable-auto-import
     1858Do sophisticated linking of @code{_symbol} to @code{__imp__symbol} for
     1859DATA imports from DLLs, and create the necessary thunking symbols when
     1860building the import libraries with those DATA exports.  This generally
     1861will 'just work' -- but sometimes you may see this message:
     1862
     1863"variable '<var>' can't be auto-imported. Please read the
     1864documentation for ld's @code{--enable-auto-import} for details."
     1865
     1866This message occurs when some (sub)expression accesses an address
     1867ultimately given by the sum of two constants (Win32 import tables only
     1868allow one).  Instances where this may occur include accesses to member
     1869fields of struct variables imported from a DLL, as well as using a
     1870constant index into an array variable imported from a DLL.  Any
     1871multiword variable (arrays, structs, long long, etc) may trigger
     1872this error condition.  However, regardless of the exact data type
     1873of the offending exported variable, ld will always detect it, issue
     1874the warning, and exit.
     1875
     1876There are several ways to address this difficulty, regardless of the
     1877data type of the exported variable:
     1878
     1879One way is to use --enable-runtime-pseudo-reloc switch. This leaves the task
     1880of adjusting references in your client code for runtime environment, so
     1881this method works only when runtime environtment supports this feature.
     1882
     1883A second solution is to force one of the 'constants' to be a variable --
     1884that is, unknown and un-optimizable at compile time.  For arrays,
     1885there are two possibilities: a) make the indexee (the array's address)
     1886a variable, or b) make the 'constant' index a variable.  Thus:
     1887
     1888@example
     1889extern type extern_array[];
     1890extern_array[1] -->
     1891   @{ volatile type *t=extern_array; t[1] @}
     1892@end example
     1893
     1894or
     1895
     1896@example
     1897extern type extern_array[];
     1898extern_array[1] -->
     1899   @{ volatile int t=1; extern_array[t] @}
     1900@end example
     1901
     1902For structs (and most other multiword data types) the only option
     1903is to make the struct itself (or the long long, or the ...) variable:
     1904
     1905@example
     1906extern struct s extern_struct;
     1907extern_struct.field -->
     1908   @{ volatile struct s *t=&extern_struct; t->field @}
     1909@end example
     1910
     1911or
     1912
     1913@example
     1914extern long long extern_ll;
     1915extern_ll -->
     1916  @{ volatile long long * local_ll=&extern_ll; *local_ll @}
     1917@end example
     1918
     1919A third method of dealing with this difficulty is to abandon
     1920'auto-import' for the offending symbol and mark it with
     1921@code{__declspec(dllimport)}.  However, in practice that
     1922requires using compile-time #defines to indicate whether you are
     1923building a DLL, building client code that will link to the DLL, or
     1924merely building/linking to a static library.   In making the choice
     1925between the various methods of resolving the 'direct address with
     1926constant offset' problem, you should consider typical real-world usage:
     1927
     1928Original:
     1929@example
     1930--foo.h
     1931extern int arr[];
     1932--foo.c
     1933#include "foo.h"
     1934void main(int argc, char **argv)@{
     1935  printf("%d\n",arr[1]);
     1936@}
     1937@end example
     1938
     1939Solution 1:
     1940@example
     1941--foo.h
     1942extern int arr[];
     1943--foo.c
     1944#include "foo.h"
     1945void main(int argc, char **argv)@{
     1946  /* This workaround is for win32 and cygwin; do not "optimize" */
     1947  volatile int *parr = arr;
     1948  printf("%d\n",parr[1]);
     1949@}
     1950@end example
     1951
     1952Solution 2:
     1953@example
     1954--foo.h
     1955/* Note: auto-export is assumed (no __declspec(dllexport)) */
     1956#if (defined(_WIN32) || defined(__CYGWIN__)) && \
     1957  !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
     1958#define FOO_IMPORT __declspec(dllimport)
     1959#else
     1960#define FOO_IMPORT
     1961#endif
     1962extern FOO_IMPORT int arr[];
     1963--foo.c
     1964#include "foo.h"
     1965void main(int argc, char **argv)@{
     1966  printf("%d\n",arr[1]);
     1967@}
     1968@end example
     1969
     1970A fourth way to avoid this problem is to re-code your
     1971library to use a functional interface rather than a data interface
     1972for the offending variables (e.g. set_foo() and get_foo() accessor
     1973functions).
     1974[This option is specific to the i386 PE targeted port of the linker]
     1975
     1976@kindex --disable-auto-import
     1977@item --disable-auto-import
     1978Do not attempt to do sophisticalted linking of @code{_symbol} to
     1979@code{__imp__symbol} for DATA imports from DLLs.
     1980[This option is specific to the i386 PE targeted port of the linker]
     1981
     1982@kindex --enable-runtime-pseudo-reloc
     1983@item --enable-runtime-pseudo-reloc
     1984If your code contains expressions described in --enable-auto-import section,
     1985that is, DATA imports from DLL with non-zero offset, this switch will create
     1986a vector of 'runtime pseudo relocations' which can be used by runtime
     1987environment to adjust references to such data in your client code.
     1988[This option is specific to the i386 PE targeted port of the linker]
     1989
     1990@kindex --disable-runtime-pseudo-reloc
     1991@item --disable-runtime-pseudo-reloc
     1992Do not create pseudo relocations for non-zero offset DATA imports from
     1993DLLs.  This is the default.
     1994[This option is specific to the i386 PE targeted port of the linker]
     1995
     1996@kindex --enable-extra-pe-debug
     1997@item --enable-extra-pe-debug
     1998Show additional debug info related to auto-import symbol thunking.
     1999[This option is specific to the i386 PE targeted port of the linker]
    15782000
    15792001@kindex --section-alignment
     
    15812003Sets the section alignment.  Sections in memory will always begin at
    15822004addresses which are a multiple of this number.  Defaults to 0x1000.
     2005[This option is specific to the i386 PE targeted port of the linker]
    15832006
    15842007@cindex stack size
     
    15872010@itemx --stack @var{reserve},@var{commit}
    15882011Specify the amount of memory to reserve (and optionally commit) to be
    1589 used as stack for this program.  The default is 32Mb reserved, 4K
     2012used as stack for this program.  The default is 2Mb reserved, 4K
    15902013committed.
     2014[This option is specific to the i386 PE targeted port of the linker]
    15912015
    15922016@kindex --subsystem
     
    15982022@code{console}, and @code{posix}.  You may optionally set the
    15992023subsystem version also.
     2024[This option is specific to the i386 PE targeted port of the linker]
    16002025
    16012026@end table
     2027
     2028@c man end
    16022029
    16032030@ifset UsesEnvVars
     
    16052032@section Environment Variables
    16062033
    1607 You can change the behavior of @code{ld} with the environment variables
    1608 @code{GNUTARGET}, @code{LDEMULATION}, and @code{COLLECT_NO_DEMANGLE}.
    1609 
     2034@c man begin ENVIRONMENT
     2035
     2036You can change the behavior of @command{ld} with the environment variables
     2037@ifclear SingleFormat
     2038@code{GNUTARGET},
     2039@end ifclear
     2040@code{LDEMULATION} and @code{COLLECT_NO_DEMANGLE}.
     2041
     2042@ifclear SingleFormat
    16102043@kindex GNUTARGET
    16112044@cindex default input format
     
    16132046use @samp{-b} (or its synonym @samp{--format}).  Its value should be one
    16142047of the BFD names for an input format (@pxref{BFD}).  If there is no
    1615 @code{GNUTARGET} in the environment, @code{ld} uses the natural format
     2048@code{GNUTARGET} in the environment, @command{ld} uses the natural format
    16162049of the target. If @code{GNUTARGET} is set to @code{default} then BFD
    16172050attempts to discover the input format by examining binary input files;
     
    16212054BFD on each system places the conventional format for that system first
    16222055in the search-list, so ambiguities are resolved in favor of convention.
     2056@end ifclear
    16232057
    16242058@kindex LDEMULATION
     
    16322066variable is not defined, the default emulation depends upon how the
    16332067linker was configured.
    1634 @end ifset
    16352068
    16362069@kindex COLLECT_NO_DEMANGLE
     
    16422075may be overridden by the @samp{--demangle} and @samp{--no-demangle}
    16432076options.
     2077
     2078@c man end
     2079@end ifset
    16442080
    16452081@node Scripts
     
    18452281
    18462282@node Entry Point
    1847 @subsection Setting the entry point
     2283@subsection Setting the Entry Point
    18482284@kindex ENTRY(@var{symbol})
    18492285@cindex start of execution
     
    18742310
    18752311@node File Commands
    1876 @subsection Commands dealing with files
     2312@subsection Commands Dealing with Files
    18772313@cindex linker script file commands
    18782314Several linker script commands deal with files.
     
    18842320Include the linker script @var{filename} at this point.  The file will
    18852321be searched for in the current directory, and in any directory specified
    1886 with the @code{-L} option.  You can nest calls to @code{INCLUDE} up to
     2322with the @option{-L} option.  You can nest calls to @code{INCLUDE} up to
    1887232310 levels deep.
    18882324
     
    19032339script, and then invoke the linker with nothing but a @samp{-T} option.
    19042340
    1905 The linker will first try to open the file in the current directory.  If
    1906 it is not found, the linker will search through the archive library
    1907 search path.  See the description of @samp{-L} in @ref{Options,,Command
    1908 Line Options}.
    1909 
    1910 If you use @samp{INPUT (-l@var{file})}, @code{ld} will transform the
     2341In case a @dfn{sysroot prefix} is configured, and the filename starts
     2342with the @samp{/} character, and the script being processed was
     2343located inside the @dfn{sysroot prefix}, the filename will be looked
     2344for in the @dfn{sysroot prefix}.  Otherwise, the linker will try to
     2345open the file in the current directory.  If it is not found, the
     2346linker will search through the archive library search path.  See the
     2347description of @samp{-L} in @ref{Options,,Command Line Options}.
     2348
     2349If you use @samp{INPUT (-l@var{file})}, @command{ld} will transform the
    19112350name to @code{lib@var{file}.a}, as with the command line argument
    19122351@samp{-l}.
     
    19432382@cindex search path in linker script
    19442383The @code{SEARCH_DIR} command adds @var{path} to the list of paths where
    1945 @code{ld} looks for archive libraries.  Using
     2384@command{ld} looks for archive libraries.  Using
    19462385@code{SEARCH_DIR(@var{path})} is exactly like using @samp{-L @var{path}}
    19472386on the command line (@pxref{Options,,Command Line Options}).  If both
     
    19612400@ifclear SingleFormat
    19622401@node Format Commands
    1963 @subsection Commands dealing with object file formats
     2402@subsection Commands Dealing with Object File Formats
    19642403A couple of linker script commands deal with object file formats.
    19652404
     
    19712410The @code{OUTPUT_FORMAT} command names the BFD format to use for the
    19722411output file (@pxref{BFD}).  Using @code{OUTPUT_FORMAT(@var{bfdname})} is
    1973 exactly like using @samp{-oformat @var{bfdname}} on the command line
     2412exactly like using @samp{--oformat @var{bfdname}} on the command line
    19742413(@pxref{Options,,Command Line Options}).  If both are used, the command
    19752414line option takes precedence.
     
    20082447
    20092448@node Miscellaneous Commands
    2010 @subsection Other linker script commands
     2449@subsection Other Linker Script Commands
    20112450There are a few other linker scripts commands.
    20122451
     
    20312470@cindex common allocation in linker script
    20322471This command has the same effect as the @samp{-d} command-line option:
    2033 to make @code{ld} assign space to common symbols even if a relocatable
     2472to make @command{ld} assign space to common symbols even if a relocatable
    20342473output file is specified (@samp{-r}).
     2474
     2475@item INHIBIT_COMMON_ALLOCATION
     2476@kindex INHIBIT_COMMON_ALLOCATION
     2477@cindex common allocation in linker script
     2478This command has the same effect as the @samp{--no-define-common}
     2479command-line option: to make @code{ld} omit the assignment of addresses
     2480to common symbols even for a non-relocatable output file.
    20352481
    20362482@item NOCROSSREFS(@var{section} @var{section} @dots{})
    20372483@kindex NOCROSSREFS(@var{sections})
    20382484@cindex cross references
    2039 This command may be used to tell @code{ld} to issue an error about any
     2485This command may be used to tell @command{ld} to issue an error about any
    20402486references among certain output sections.
    20412487
     
    20472493
    20482494The @code{NOCROSSREFS} command takes a list of output section names.  If
    2049 @code{ld} detects any cross references between the sections, it reports
     2495@command{ld} detects any cross references between the sections, it reports
    20502496an error and returns a non-zero exit status.  Note that the
    20512497@code{NOCROSSREFS} command uses output section names, not input section
     
    21242570      _etext = .;
    21252571    @}
    2126   _bdata = (. + 3) & ~ 4;
     2572  _bdata = (. + 3) & ~ 3;
    21272573  .data : @{ *(.data) @}
    21282574@}
     
    21682614
    21692615@node SECTIONS
    2170 @section SECTIONS command
     2616@section SECTIONS Command
    21712617@kindex SECTIONS
    21722618The @code{SECTIONS} command tells the linker how to map input sections
     
    22252671
    22262672@node Output Section Description
    2227 @subsection Output section description
     2673@subsection Output Section Description
    22282674The full description of an output section looks like this:
    22292675@smallexample
     
    22582704
    22592705@node Output Section Name
    2260 @subsection Output section name
     2706@subsection Output Section Name
    22612707@cindex name, section
    22622708@cindex section name
     
    22762722
    22772723@node Output Section Address
    2278 @subsection Output section address
     2724@subsection Output Section Description
    22792725@cindex address, section
    22802726@cindex section address
     
    23232769
    23242770@node Input Section
    2325 @subsection Input section description
     2771@subsection Input Section Description
    23262772@cindex input sections
    23272773@cindex mapping input sections to output sections
     
    23422788
    23432789@node Input Section Basics
    2344 @subsubsection Input section basics
     2790@subsubsection Input Section Basics
    23452791@cindex input section basics
    23462792An input section description consists of a file name optionally followed
     
    23752821The difference between these is the order in which the @samp{.text} and
    23762822@samp{.rdata} input sections will appear in the output section.  In the
    2377 first example, they will be intermingled.  In the second example, all
     2823first example, they will be intermingled, appearing in the same order as
     2824they are found in the linker input.  In the second example, all
    23782825@samp{.text} input sections will appear first, followed by all
    23792826@samp{.rdata} input sections.
     
    24022849
    24032850@node Input Section Wildcards
    2404 @subsubsection Input section wildcard patterns
     2851@subsubsection Input Section Wildcard Patterns
    24052852@cindex input section wildcards
    24062853@cindex wildcard file name patterns
     
    24792926
    24802927@node Input Section Common
    2481 @subsubsection Input section for common symbols
     2928@subsubsection Input Section for Common Symbols
    24822929@cindex common symbol placement
    24832930@cindex uninitialized data placement
     
    25152962
    25162963@node Input Section Keep
    2517 @subsubsection Input section and garbage collection
     2964@subsubsection Input Section and Garbage Collection
    25182965@cindex KEEP
    25192966@cindex garbage collection
     
    25252972
    25262973@node Input Section Example
    2527 @subsubsection Input section example
     2974@subsubsection Input Section Example
    25282975The following example is a complete linker script.  It tells the linker
    25292976to read all of the sections from file @file{all.o} and place them at the
     
    25442991    foo.o (.input1)
    25452992    @}
     2993@end group
     2994@group
    25462995  outputb :
    25472996    @{
     
    25492998    foo1.o (.input1)
    25502999    @}
     3000@end group
     3001@group
    25513002  outputc :
    25523003    @{
     
    25593010
    25603011@node Output Section Data
    2561 @subsection Output section data
     3012@subsection Output Section Data
    25623013@cindex data
    25633014@cindex section data
     
    25993050endianness of the first input object file.
    26003051
    2601 Note - these commands only work inside a section description and not
     3052Note---these commands only work inside a section description and not
    26023053between them, so the following will produce an error from the linker:
    26033054@smallexample
     
    26163067otherwise unspecified regions of memory within the section (for example,
    26173068gaps left due to the required alignment of input sections) are filled
    2618 with the two least significant bytes of the expression, repeated as
     3069with the value of the expression, repeated as
    26193070necessary.  A @code{FILL} statement covers memory locations after the
    26203071point at which it occurs in the section definition; by including more
     
    26233074
    26243075This example shows how to fill unspecified regions of memory with the
    2625 value @samp{0x9090}:
    2626 @smallexample
    2627 FILL(0x9090)
     3076value @samp{0x90}:
     3077@smallexample
     3078FILL(0x90909090)
    26283079@end smallexample
    26293080
    26303081The @code{FILL} command is similar to the @samp{=@var{fillexp}} output
    2631 section attribute (@pxref{Output Section Fill}), but it only affects the
     3082section attribute, but it only affects the
    26323083part of the section following the @code{FILL} command, rather than the
    26333084entire section.  If both are used, the @code{FILL} command takes
    2634 precedence.
     3085precedence.  @xref{Output Section Fill}, for details on the fill
     3086expression.
    26353087
    26363088@node Output Section Keywords
    2637 @subsection Output section keywords
     3089@subsection Output Section Keywords
    26383090There are a couple of keywords which can appear as output section
    26393091commands.
     
    27143166
    27153167@node Output Section Discarding
    2716 @subsection Output section discarding
     3168@subsection Output Section Discarding
    27173169@cindex discarding sections
    27183170@cindex sections, discarding
     
    27383190
    27393191@node Output Section Attributes
    2740 @subsection Output section attributes
     3192@subsection Output Section Attributes
    27413193@cindex output section attributes
    27423194We showed above that the full description of an output section looked
     
    27653217
    27663218@node Output Section Type
    2767 @subsubsection Output section type
     3219@subsubsection Output Section Type
    27683220Each output section may have a type.  The type is a keyword in
    27693221parentheses.  The following types are defined:
     
    28023254
    28033255@node Output Section LMA
    2804 @subsubsection Output section LMA
     3256@subsubsection Output Section LMA
    28053257@kindex AT>@var{lma_region}
    28063258@kindex AT(@var{lma})
     
    28673319
    28683320@node Output Section Region
    2869 @subsubsection Output section region
     3321@subsubsection Output Section Region
    28703322@kindex >@var{region}
    28713323@cindex section, assigning to memory region
     
    28833335
    28843336@node Output Section Phdr
    2885 @subsubsection Output section phdr
     3337@subsubsection Output Section Phdr
    28863338@kindex :@var{phdr}
    28873339@cindex section, assigning to program header
     
    29033355
    29043356@node Output Section Fill
    2905 @subsubsection Output section fill
     3357@subsubsection Output Section Fill
    29063358@kindex =@var{fillexp}
    29073359@cindex section fill pattern
     
    29113363(@pxref{Expressions}).  Any otherwise unspecified regions of memory
    29123364within the output section (for example, gaps left due to the required
    2913 alignment of input sections) will be filled with the two least
    2914 significant bytes of the value, repeated as necessary.
     3365alignment of input sections) will be filled with the value, repeated as
     3366necessary.  If the fill expression is a simple hex number, ie. a string
     3367of hex digit starting with @samp{0x} and without a trailing @samp{k} or @samp{M}, then
     3368an arbitrarily long sequence of hex digits can be used to specify the
     3369fill pattern;  Leading zeros become part of the pattern too.  For all
     3370other cases, including extra parentheses or a unary @code{+}, the fill
     3371pattern is the four least significant bytes of the value of the
     3372expression.  In all cases, the number is big-endian.
    29153373
    29163374You can also change the fill value with a @code{FILL} command in the
    2917 output section commands; see @ref{Output Section Data}.
     3375output section commands; (@pxref{Output Section Data}).
    29183376
    29193377Here is a simple example:
    29203378@smallexample
    29213379@group
    2922 SECTIONS @{ .text : @{ *(.text) @} =0x9090 @}
     3380SECTIONS @{ .text : @{ *(.text) @} =0x90909090 @}
    29233381@end group
    29243382@end smallexample
    29253383
    29263384@node Overlay Description
    2927 @subsection Overlay description
     3385@subsection Overlay Description
    29283386@kindex OVERLAY
    29293387@cindex overlays
     
    30393497
    30403498@node MEMORY
    3041 @section MEMORY command
     3499@section MEMORY Command
    30423500@kindex MEMORY
    30433501@cindex memory regions
     
    33583816The script binds the symbol @samp{foo1} to @samp{VERS_1.1}.  It reduces
    33593817a number of symbols to local scope so that they are not visible outside
    3360 of the shared library.
     3818of the shared library; this is done using wildcard patterns, so that any
     3819symbol whose name begins with @samp{old}, @samp{original}, or @samp{new}
     3820is matched.  The wildcard patterns available are the same as those used
     3821in the shell when matching filenames (also known as ``globbing'').
    33613822
    33623823Next, the version script defines node @samp{VERS_1.2}.  This node
     
    33713832specifically bound to a version node, it will effectively bind it to an
    33723833unspecified base version of the library.  You can bind all otherwise
    3373 unspecified symbols to a given version node by using @samp{global: *}
     3834unspecified symbols to a given version node by using @samp{global: *;}
    33743835somewhere in the version script.
    33753836
     
    33783839could just as well have appeared in between @samp{1.1} and @samp{1.2}.
    33793840However, this would be a confusing way to write a version script.
     3841
     3842Node name can be omited, provided it is the only version node
     3843in the version script.  Such version script doesn't assign any versions to
     3844symbols, only selects which symbols will be globally visible out and which
     3845won't.
     3846
     3847@smallexample
     3848@{ global: foo; bar; local: *; @};
     3849@end smallexample
    33803850
    33813851When you link an application against a shared library that has versioned
     
    34123882be an alias for @samp{foo} bound to the version node @samp{VERS_1.1}.
    34133883The @samp{local:} directive can be used to prevent the symbol
    3414 @samp{original_foo} from being exported.
     3884@samp{original_foo} from being exported. A @samp{.symver} directive
     3885takes precedence over a version script.
    34153886
    34163887The second GNU extension is to allow multiple versions of the same
     
    34443915If you wish to bind a reference to a specific version of the symbol
    34453916within the shared library, you can use the aliases of convenience
    3446 (i.e. @samp{old_foo}), or you can use the @samp{.symver} directive to
     3917(i.e., @samp{old_foo}), or you can use the @samp{.symver} directive to
    34473918specifically bind to an external version of the function in question.
     3919
     3920You can also specify the language in the version script:
     3921
     3922@smallexample
     3923VERSION extern "lang" @{ version-script-commands @}
     3924@end smallexample
     3925
     3926The supported @samp{lang}s are @samp{C}, @samp{C++}, and @samp{Java}.
     3927The linker will iterate over the list of symbols at the link time and
     3928demangle them according to @samp{lang} before matching them to the
     3929patterns specified in @samp{version-script-commands}.
    34483930
    34493931@node Expressions
     
    34893971constant by
    34903972@c TEXI2ROFF-KILL
    3491 @ifinfo
     3973@ifnottex
    34923974@c END TEXI2ROFF-KILL
    34933975@code{1024} or @code{1024*1024}
    34943976@c TEXI2ROFF-KILL
    3495 @end ifinfo
     3977@end ifnottex
    34963978@tex
    34973979${\rm 1024}$ or ${\rm 1024}^2$
     
    35003982respectively. For example, the following all refer to the same quantity:
    35013983@smallexample
    3502   _fourk_1 = 4K;
    3503   _fourk_2 = 4096;
    3504   _fourk_3 = 0x1000;
     3984_fourk_1 = 4K;
     3985_fourk_2 = 4096;
     3986_fourk_3 = 0x1000;
    35053987@end smallexample
    35063988
     
    35173999keyword by surrounding the symbol name in double quotes:
    35184000@smallexample
    3519   "SECTION" = 9;
    3520   "with a space" = "also with a space" + 10;
     4001"SECTION" = 9;
     4002"with a space" = "also with a space" + 10;
    35214003@end smallexample
    35224004
     
    35524034      . += 1000;
    35534035      file3(.text)
    3554     @} = 0x1234;
     4036    @} = 0x12345678;
    35554037@}
    35564038@end smallexample
     
    35604042followed by a 1000 byte gap.  Then the @samp{.text} section from
    35614043@file{file2} appears, also with a 1000 byte gap following before the
    3562 @samp{.text} section from @file{file3}.  The notation @samp{= 0x1234}
     4044@samp{.text} section from @file{file3}.  The notation @samp{= 0x12345678}
    35634045specifies what data to write in the gaps (@pxref{Output Section Fill}).
    35644046
     
    35664048Note: @code{.} actually refers to the byte offset from the start of the
    35674049current containing object.  Normally this is the @code{SECTIONS}
    3568 statement, whoes start address is 0, hence @code{.} can be used as an
     4050statement, whose start address is 0, hence @code{.} can be used as an
    35694051absolute address.  If @code{.} is used inside a section description
    35704052however, it refers to the byte offset from the start of that section,
     
    36054087the standard bindings and precedence levels:
    36064088@c TEXI2ROFF-KILL
    3607 @ifinfo
     4089@ifnottex
    36084090@c END TEXI2ROFF-KILL
    36094091@smallexample
     
    36274109(2) @xref{Assignments}.
    36284110@c TEXI2ROFF-KILL
    3629 @end ifinfo
     4111@end ifnottex
    36304112@tex
    36314113\vskip \baselineskip
     
    37904272@cindex align location counter
    37914273Return the location counter (@code{.}) aligned to the next @var{exp}
    3792 boundary.  @var{exp} must be an expression whose value is a power of
    3793 two.  This is equivalent to
    3794 @smallexample
    3795 (. + @var{exp} - 1) & ~(@var{exp} - 1)
    3796 @end smallexample
    3797 
     4274boundary.
    37984275@code{ALIGN} doesn't change the value of the location counter---it just
    37994276does arithmetic on it.  Here is an example which aligns the output
     
    38244301scripts.  It is most often seen when setting the address of an output
    38254302section.
     4303
     4304@item DATA_SEGMENT_ALIGN(@var{maxpagesize}, @var{commonpagesize})
     4305@kindex DATA_SEGMENT_ALIGN(@var{maxpagesize}, @var{commonpagesize})
     4306This is equivalent to either
     4307@smallexample
     4308(ALIGN(@var{maxpagesize}) + (. & (@var{maxpagesize} - 1)))
     4309@end smallexample
     4310or
     4311@smallexample
     4312(ALIGN(@var{maxpagesize}) + (. & (@var{maxpagesize} - @var{commonpagesize})))
     4313@end smallexample
     4314@noindent
     4315depending on whether the latter uses fewer @var{commonpagesize} sized pages
     4316for the data segment (area between the result of this expression and
     4317@code{DATA_SEGMENT_END}) than the former or not.
     4318If the latter form is used, it means @var{commonpagesize} bytes of runtime
     4319memory will be saved at the expense of up to @var{commonpagesize} wasted
     4320bytes in the on-disk file.
     4321
     4322This expression can only be used directly in @code{SECTIONS} commands, not in
     4323any output section descriptions and only once in the linker script.
     4324@var{commonpagesize} should be less or equal to @var{maxpagesize} and should
     4325be the system page size the object wants to be optimized for (while still
     4326working on system page sizes up to @var{maxpagesize}).
     4327
     4328@noindent
     4329Example:
     4330@smallexample
     4331  . = DATA_SEGMENT_ALIGN(0x10000, 0x2000);
     4332@end smallexample
     4333
     4334@item DATA_SEGMENT_END(@var{exp})
     4335@kindex DATA_SEGMENT_END(@var{exp})
     4336This defines the end of data segment for @code{DATA_SEGMENT_ALIGN}
     4337evaluation purposes.
     4338
     4339@smallexample
     4340  . = DATA_SEGMENT_END(.);
     4341@end smallexample
    38264342
    38274343@item DEFINED(@var{symbol})
     
    39384454
    39394455@cindex machine dependencies
    3940 @code{ld} has additional features on some platforms; the following
    3941 sections describe them.  Machines where @code{ld} has no additional
     4456@command{ld} has additional features on some platforms; the following
     4457sections describe them.  Machines where @command{ld} has no additional
    39424458functionality are not listed.
    39434459
    39444460@menu
    3945 * H8/300::                      @code{ld} and the H8/300
    3946 * i960::                        @code{ld} and the Intel 960 family
    3947 * ARM::                         @code{ld} and the ARM family
    3948 * HPPA ELF32::                  @code{ld} and HPPA 32-bit ELF
     4461@ifset H8300
     4462* H8/300::                      @command{ld} and the H8/300
     4463@end ifset
     4464@ifset I960
     4465* i960::                        @command{ld} and the Intel 960 family
     4466@end ifset
     4467@ifset ARM
     4468* ARM::                         @command{ld} and the ARM family
     4469@end ifset
     4470@ifset HPPA
     4471* HPPA ELF32::                  @command{ld} and HPPA 32-bit ELF
     4472@end ifset
     4473@ifset MMIX
     4474* MMIX::                        @command{ld} and MMIX
     4475@end ifset
     4476@ifset MSP430
     4477* MSP430::                      @command{ld} and MSP430
     4478@end ifset
    39494479@ifset TICOFF
    3950 * TI COFF::                     @code{ld} and TI COFF
     4480* TI COFF::                     @command{ld} and TI COFF
     4481@end ifset
     4482@ifset WIN32
     4483* WIN32::                       @command{ld} and WIN32 (cygwin/mingw)
     4484@end ifset
     4485@ifset XTENSA
     4486* Xtensa::                      @command{ld} and Xtensa Processors
    39514487@end ifset
    39524488@end menu
    39534489@end ifset
    39544490
    3955 @c FIXME!  This could use @raisesections/@lowersections, but there seems to be a conflict
    3956 @c         between those and node-defaulting.
    39574491@ifset H8300
    39584492@ifclear GENERIC
     
    39614495
    39624496@node H8/300
    3963 @section @code{ld} and the H8/300
     4497@section @command{ld} and the H8/300
    39644498
    39654499@cindex H8/300 support
    3966 For the H8/300, @code{ld} can perform these global optimizations when
     4500For the H8/300, @command{ld} can perform these global optimizations when
    39674501you specify the @samp{--relax} command-line option.
    39684502
     
    39704504@cindex relaxing on H8/300
    39714505@item relaxing address modes
    3972 @code{ld} finds all @code{jsr} and @code{jmp} instructions whose
     4506@command{ld} finds all @code{jsr} and @code{jmp} instructions whose
    39734507targets are within eight bits, and turns them into eight-bit
    39744508program-counter relative @code{bsr} and @code{bra} instructions,
     
    39784512@item synthesizing instructions
    39794513@c FIXME: specifically mov.b, or any mov instructions really?
    3980 @code{ld} finds all @code{mov.b} instructions which use the
     4514@command{ld} finds all @code{mov.b} instructions which use the
    39814515sixteen-bit absolute address form, but refer to the top
    39824516page of memory, and changes them to use the eight-bit address form.
     
    39924526
    39934527@ifclear GENERIC
    3994 @ifset Hitachi
     4528@ifset Renesas
    39954529@c This stuff is pointless to say unless you're especially concerned
    3996 @c with Hitachi chips; don't enable it for generic case, please.
    3997 @node Hitachi
    3998 @chapter @code{ld} and other Hitachi chips
    3999 
    4000 @code{ld} also supports the H8/300H, the H8/500, and the Hitachi SH.  No
    4001 special features, commands, or command-line options are required for
    4002 these chips.
     4530@c with Renesas chips; don't enable it for generic case, please.
     4531@node Renesas
     4532@chapter @command{ld} and Other Renesas Chips
     4533
     4534@command{ld} also supports the Renesas (formerly Hitachi) H8/300H,
     4535H8/500, and SH chips.  No special features, commands, or command-line
     4536options are required for these chips.
    40034537@end ifset
    40044538@end ifclear
     
    40104544
    40114545@node i960
    4012 @section @code{ld} and the Intel 960 family
     4546@section @command{ld} and the Intel 960 Family
    40134547
    40144548@cindex i960 support
     
    40224556search loop names suffixed with the string identifying the architecture.
    40234557
    4024 For example, if your @code{ld} command line included @w{@samp{-ACA}} as
     4558For example, if your @command{ld} command line included @w{@samp{-ACA}} as
    40254559well as @w{@samp{-ltry}}, the linker would look (in its built-in search
    40264560paths, and in any paths you specify with @samp{-L}) for a library with
     
    40454579specifies a library.
    40464580
    4047 @cindex @code{--relax} on i960
     4581@cindex @option{--relax} on i960
    40484582@cindex relaxing on i960
    4049 @code{ld} supports the @samp{--relax} option for the i960 family.  If
    4050 you specify @samp{--relax}, @code{ld} finds all @code{balx} and
     4583@command{ld} supports the @samp{--relax} option for the i960 family.  If
     4584you specify @samp{--relax}, @command{ld} finds all @code{balx} and
    40514585@code{calx} instructions whose targets are within 24 bits, and turns
    40524586them into 24-bit program-counter relative @code{bal} and @code{cal}
    4053 instructions, respectively.  @code{ld} also turns @code{cal}
     4587instructions, respectively.  @command{ld} also turns @code{cal}
    40544588instructions into @code{bal} instructions when it determines that the
    40554589target subroutine is a leaf routine (that is, the target subroutine does
     
    40614595@end ifset
    40624596
     4597@ifset ARM
    40634598@ifclear GENERIC
    40644599@raisesections
     
    40664601
    40674602@node ARM
    4068 @section @code{ld}'s support for interworking between ARM and Thumb code
     4603@section @command{ld}'s Support for Interworking Between ARM and Thumb Code
    40694604
    40704605@cindex ARM interworking support
    40714606@kindex --support-old-code
    4072 For the ARM, @code{ld} will generate code stubs to allow functions calls
     4607For the ARM, @command{ld} will generate code stubs to allow functions calls
    40734608betweem ARM and Thumb code.  These stubs only work with code that has
    40744609been compiled and assembled with the @samp{-mthumb-interwork} command
     
    40904625executing in Thumb mode straight away.
    40914626
     4627@ifclear GENERIC
     4628@lowersections
     4629@end ifclear
     4630@end ifset
     4631
     4632@ifset HPPA
     4633@ifclear GENERIC
     4634@raisesections
     4635@end ifclear
     4636
    40924637@node HPPA ELF32
    4093 @section @code{ld} and HPPA 32-bit ELF support
     4638@section @command{ld} and HPPA 32-bit ELF Support
    40944639@cindex HPPA multiple sub-space stubs
    40954640@kindex --multi-subspace
    4096 When generating a shared library, @code{ld} will by default generate
     4641When generating a shared library, @command{ld} will by default generate
    40974642import stubs suitable for use with a single sub-space application.
    4098 The @samp{--multi-subspace} switch causes @code{ld} to generate export
     4643The @samp{--multi-subspace} switch causes @command{ld} to generate export
    40994644stubs, and different (larger) import stubs suitable for use with
    41004645multiple sub-spaces.
     
    41024647@cindex HPPA stub grouping
    41034648@kindex --stub-group-size=@var{N}
    4104 Long branch stubs and import/export stubs are placed by @code{ld} in
     4649Long branch stubs and import/export stubs are placed by @command{ld} in
    41054650stub sections located between groups of input sections.
    41064651@samp{--stub-group-size} specifies the maximum size of a group of input
     
    41134658branches to stubs always use a negative offset.  Two special values of
    41144659@samp{N} are recognized, @samp{1} and @samp{-1}.  These both instruct
    4115 @code{ld} to automatically size input section groups for the branch types
     4660@command{ld} to automatically size input section groups for the branch types
    41164661detected, with the same behaviour regarding stub placement as other
    41174662positive or negative values of @samp{N} respectively.
     
    41224667large, it may not be possible for a branch to reach its stub.
    41234668
     4669@ifclear GENERIC
     4670@lowersections
     4671@end ifclear
     4672@end ifset
     4673
     4674@ifset MMIX
     4675@ifclear GENERIC
     4676@raisesections
     4677@end ifclear
     4678
     4679@node MMIX
     4680@section @code{ld} and MMIX
     4681For MMIX, there is a choice of generating @code{ELF} object files or
     4682@code{mmo} object files when linking.  The simulator @code{mmix}
     4683understands the @code{mmo} format.  The binutils @code{objcopy} utility
     4684can translate between the two formats.
     4685
     4686There is one special section, the @samp{.MMIX.reg_contents} section.
     4687Contents in this section is assumed to correspond to that of global
     4688registers, and symbols referring to it are translated to special symbols,
     4689equal to registers.  In a final link, the start address of the
     4690@samp{.MMIX.reg_contents} section corresponds to the first allocated
     4691global register multiplied by 8.  Register @code{$255} is not included in
     4692this section; it is always set to the program entry, which is at the
     4693symbol @code{Main} for @code{mmo} files.
     4694
     4695Symbols with the prefix @code{__.MMIX.start.}, for example
     4696@code{__.MMIX.start..text} and @code{__.MMIX.start..data} are special;
     4697there must be only one each, even if they are local.  The default linker
     4698script uses these to set the default start address of a section.
     4699
     4700Initial and trailing multiples of zero-valued 32-bit words in a section,
     4701are left out from an mmo file.
     4702
     4703@ifclear GENERIC
     4704@lowersections
     4705@end ifclear
     4706@end ifset
     4707
     4708@ifset MSP430
     4709@ifclear GENERIC
     4710@raisesections
     4711@end ifclear
     4712
     4713@node  MSP430
     4714@section @code{ld} and MSP430
     4715For the MSP430 it is possible to select the MPU architecture.  The flag @samp{-m [mpu type]}
     4716will select an appropriate linker script for selected MPU type.  (To get a list of known MPUs
     4717just pass @samp{-m help} option to the linker).
     4718
     4719@cindex MSP430 extra sections
     4720The linker will recognize some extra sections which are MSP430 specific:
     4721
     4722@table @code
     4723@item @samp{.vectors}
     4724Defines a portion of ROM where interrupt vectors located.
     4725
     4726@item @samp{.bootloader}
     4727Defines the bootloader portion of the ROM (if applicable).  Any code
     4728in this section will be uploaded to the MPU.
     4729
     4730@item @samp{.infomem}
     4731Defines an information memory section (if applicable).  Any code in
     4732this section will be uploaded to the MPU.
     4733
     4734@item @samp{.infomemnobits}
     4735This is the same as the @samp{.infomem} section except that any code
     4736in this section will not be uploaded to the MPU.
     4737
     4738@item @samp{.noinit}
     4739Denotes a portion of RAM located above @samp{.bss} section.
     4740
     4741The last two sections are used by gcc.
     4742@end table
     4743
     4744@ifclear GENERIC
     4745@lowersections
     4746@end ifclear
     4747@end ifset
     4748
    41244749@ifset TICOFF
     4750@ifclear GENERIC
     4751@raisesections
     4752@end ifclear
     4753
    41254754@node TI COFF
    4126 @section @code{ld}'s support for various TI COFF versions
     4755@section @command{ld}'s Support for Various TI COFF Versions
    41274756@cindex TI COFF versions
    41284757@kindex --format=@var{version}
     
    41304759TI COFF versions.  The latest of this writing is 2; versions 0 and 1 are
    41314760also supported.  The TI COFF versions also vary in header byte-order
    4132 format; @code{ld} will read any version or byte order, but the output
     4761format; @command{ld} will read any version or byte order, but the output
    41334762header format depends on the default specified by the specific target.
    4134 @end ifset
    41354763
    41364764@ifclear GENERIC
    41374765@lowersections
    41384766@end ifclear
     4767@end ifset
     4768
     4769@ifset WIN32
     4770@ifclear GENERIC
     4771@raisesections
     4772@end ifclear
     4773
     4774@node WIN32
     4775@section @command{ld} and WIN32 (cygwin/mingw)
     4776
     4777This section describes some of the win32 specific @command{ld} issues.
     4778See @ref{Options,,Command Line Options} for detailed decription of the
     4779command line options mentioned here.
     4780
     4781@table @emph
     4782@cindex import libraries
     4783@item import libraries
     4784The standard Windows linker creates and uses so-called import
     4785libraries, which contains information for linking to dll's.  They are
     4786regular static archives and are handled as any other static
     4787archive.  The cygwin and mingw ports of @command{ld} have specific
     4788support for creating such libraries provided with the
     4789@samp{--out-implib} command line option.
     4790
     4791@item   exporting DLL symbols
     4792@cindex exporting DLL symbols
     4793The cygwin/mingw @command{ld} has several ways to export symbols for dll's.
     4794
     4795@table @emph
     4796@item   using auto-export functionality
     4797@cindex using auto-export functionality
     4798By default @command{ld} exports symbols with the auto-export functionality,
     4799which is controlled by the following command line options:
     4800
     4801@itemize
     4802@item --export-all-symbols   [This is the default]
     4803@item --exclude-symbols
     4804@item --exclude-libs
     4805@end itemize
     4806
     4807If, however, @samp{--export-all-symbols} is not given explicitly on the
     4808command line, then the default auto-export behavior will be @emph{disabled}
     4809if either of the following are true:
     4810
     4811@itemize
     4812@item A DEF file is used.
     4813@item Any symbol in any object file was marked with the __declspec(dllexport) attribute.
     4814@end itemize
     4815
     4816@item   using a DEF file
     4817@cindex using a DEF file
     4818Another way of exporting symbols is using a DEF file.  A DEF file is
     4819an ASCII file containing definitions of symbols which should be
     4820exported when a dll is created.  Usually it is named @samp{<dll
     4821name>.def} and is added as any other object file to the linker's
     4822command line.  The file's name must end in @samp{.def} or @samp{.DEF}.
     4823
     4824@example
     4825gcc -o <output> <objectfiles> <dll name>.def
     4826@end example
     4827
     4828Using a DEF file turns off the normal auto-export behavior, unless the
     4829@samp{--export-all-symbols} option is also used.
     4830
     4831Here is an example of a DEF file for a shared library called @samp{xyz.dll}:
     4832
     4833@example
     4834LIBRARY "xyz.dll" BASE=0x10000000
     4835
     4836EXPORTS
     4837foo
     4838bar
     4839_bar = bar
     4840@end example
     4841
     4842This example defines a base address and three symbols.  The third
     4843symbol is an alias for the second.  For the complete format
     4844specification see ld/deffilep.y in the binutils sources.
     4845
     4846@cindex creating a DEF file
     4847While linking a shared dll, @command{ld} is able to create a DEF file
     4848with the @samp{--output-def <file>} command line option.
     4849
     4850@item   Using decorations
     4851@cindex Using decorations
     4852Another way of marking symbols for export is to modify the source code
     4853itself, so that when building the DLL each symbol to be exported is
     4854declared as:
     4855
     4856@example
     4857__declspec(dllexport) int a_variable
     4858__declspec(dllexport) void a_function(int with_args)
     4859@end example
     4860
     4861All such symbols will be exported from the DLL.  If, however,
     4862any of the object files in the DLL contain symbols decorated in
     4863this way, then the normal auto-export behavior is disabled, unless
     4864the @samp{--export-all-symbols} option is also used.
     4865
     4866Note that object files that wish to access these symbols must @emph{not}
     4867decorate them with dllexport.  Instead, they should use dllimport,
     4868instead:
     4869
     4870@example
     4871__declspec(dllimport) int a_variable
     4872__declspec(dllimport) void a_function(int with_args)
     4873@end example
     4874
     4875This complicates the structure of library header files, because
     4876when included by the library itself the header must declare the
     4877variables and functions as dllexport, but when included by client
     4878code the header must declare them as dllimport.  There are a number
     4879of idioms that are typically used to do this; often client code can
     4880omit the __declspec() declaration completely.  See
     4881@samp{--enable-auto-import} and @samp{automatic data imports} for more
     4882imformation.
     4883@end table
     4884
     4885@cindex automatic data imports
     4886@item automatic data imports
     4887The standard Windows dll format supports data imports from dlls only
     4888by adding special decorations (dllimport/dllexport), which let the
     4889compiler produce specific assembler instructions to deal with this
     4890issue.  This increases the effort necessary to port existing Un*x
     4891code to these platforms, especially for large
     4892c++ libraries and applications.  The auto-import feature, which was
     4893initially provided by Paul Sokolovsky, allows one to omit the
     4894decorations to archieve a behavior that conforms to that on POSIX/Un*x
     4895platforms. This feature is enabled with the @samp{--enable-auto-import}
     4896command-line option, although it is enabled by default on cygwin/mingw.
     4897The @samp{--enable-auto-import} option itself now serves mainly to
     4898suppress any warnings that are ordinarily emitted when linked objects
     4899trigger the feature's use.
     4900
     4901auto-import of variables does not always work flawlessly without
     4902additional assistance.  Sometimes, you will see this message
     4903
     4904"variable '<var>' can't be auto-imported. Please read the
     4905documentation for ld's @code{--enable-auto-import} for details."
     4906
     4907The @samp{--enable-auto-import} documentation explains why this error
     4908occurs, and several methods that can be used to overcome this difficulty. 
     4909One of these methods is the @emph{runtime pseudo-relocs} feature, described
     4910below.
     4911
     4912@cindex runtime pseudo-relocation
     4913For complex variables imported from DLLs (such as structs or classes),
     4914object files typically contain a base address for the variable and an
     4915offset (@emph{addend}) within the variable--to specify a particular
     4916field or public member, for instance.  Unfortunately, the runtime loader used
     4917in win32 environments is incapable of fixing these references at runtime
     4918without the additional information supplied by dllimport/dllexport decorations.
     4919The standard auto-import feature described above is unable to resolve these
     4920references.
     4921
     4922The @samp{--enable-runtime-pseudo-relocs} switch allows these references to
     4923be resolved without error, while leaving the task of adjusting the references
     4924themselves (with their non-zero addends) to specialized code provided by the
     4925runtime environment.  Recent versions of the cygwin and mingw environments and
     4926compilers provide this runtime support; older versions do not.  However, the
     4927support is only necessary on the developer's platform; the compiled result will
     4928run without error on an older system.
     4929
     4930@samp{--enable-runtime-pseudo-relocs} is not the default; it must be explicitly
     4931enabled as needed.
     4932
     4933@cindex direct linking to a dll
     4934@item direct linking to a dll
     4935The cygwin/mingw ports of @command{ld} support the direct linking,
     4936including data symbols, to a dll without the usage of any import
     4937libraries.  This is much faster and uses much less memory than does the
     4938traditional import library method, expecially when linking large
     4939libraries or applications.  When @command{ld} creates an import lib, each
     4940function or variable exported from the dll is stored in its own bfd, even
     4941though a single bfd could contain many exports.  The overhead involved in
     4942storing, loading, and processing so many bfd's is quite large, and explains the
     4943tremendous time, memory, and storage needed to link against particularly
     4944large or complex libraries when using import libs.
     4945
     4946Linking directly to a dll uses no extra command-line switches other than
     4947@samp{-L} and @samp{-l}, because @command{ld} already searches for a number
     4948of names to match each library.  All that is needed from the developer's
     4949perspective is an understanding of this search, in order to force ld to
     4950select the dll instead of an import library.
     4951
     4952
     4953For instance, when ld is called with the argument @samp{-lxxx} it will attempt
     4954to find, in the first directory of its search path,
     4955
     4956@example
     4957libxxx.dll.a
     4958xxx.dll.a
     4959libxxx.a
     4960cygxxx.dll (*)
     4961libxxx.dll
     4962xxx.dll
     4963@end example
     4964
     4965before moving on to the next directory in the search path.
     4966
     4967(*) Actually, this is not @samp{cygxxx.dll} but in fact is @samp{<prefix>xxx.dll},
     4968where @samp{<prefix>} is set by the @command{ld} option
     4969@samp{--dll-search-prefix=<prefix>}. In the case of cygwin, the standard gcc spec
     4970file includes @samp{--dll-search-prefix=cyg}, so in effect we actually search for
     4971@samp{cygxxx.dll}.
     4972
     4973Other win32-based unix environments, such as mingw or pw32, may use other
     4974@samp{<prefix>}es, although at present only cygwin makes use of this feature.  It
     4975was originally intended to help avoid name conflicts among dll's built for the
     4976various win32/un*x environments, so that (for example) two versions of a zlib dll
     4977could coexist on the same machine.
     4978
     4979The generic cygwin/mingw path layout uses a @samp{bin} directory for
     4980applications and dll's and a @samp{lib} directory for the import
     4981libraries (using cygwin nomenclature):
     4982
     4983@example
     4984bin/
     4985        cygxxx.dll
     4986lib/
     4987        libxxx.dll.a   (in case of dll's)
     4988        libxxx.a       (in case of static archive)
     4989@end example
     4990
     4991Linking directly to a dll without using the import library can be
     4992done two ways:
     4993
     49941. Use the dll directly by adding the @samp{bin} path to the link line
     4995@example
     4996gcc -Wl,-verbose  -o a.exe -L../bin/ -lxxx
     4997@end example
     4998
     4999However, as the dll's often have version numbers appended to their names
     5000(@samp{cygncurses-5.dll}) this will often fail, unless one specifies
     5001@samp{-L../bin -lncurses-5} to include the version.  Import libs are generally
     5002not versioned, and do not have this difficulty.
     5003
     50042. Create a symbolic link from the dll to a file in the @samp{lib}
     5005directory according to the above mentioned search pattern.  This
     5006should be used to avoid unwanted changes in the tools needed for
     5007making the app/dll.
     5008
     5009@example
     5010ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a]
     5011@end example
     5012
     5013Then you can link without any make environment changes.
     5014
     5015@example
     5016gcc -Wl,-verbose  -o a.exe -L../lib/ -lxxx
     5017@end example
     5018
     5019This technique also avoids the version number problems, because the following is
     5020perfectly legal
     5021
     5022@example
     5023bin/
     5024        cygxxx-5.dll
     5025lib/
     5026        libxxx.dll.a -> ../bin/cygxxx-5.dll
     5027@end example
     5028
     5029Linking directly to a dll without using an import lib will work
     5030even when auto-import features are exercised, and even when
     5031@samp{--enable-runtime-pseudo-relocs} is used.
     5032
     5033Given the improvements in speed and memory usage, one might justifiably
     5034wonder why import libraries are used at all.  There are two reasons:
     5035
     50361. Until recently, the link-directly-to-dll functionality did @emph{not}
     5037work with auto-imported data.
     5038
     50392. Sometimes it is necessary to include pure static objects within the
     5040import library (which otherwise contains only bfd's for indirection
     5041symbols that point to the exports of a dll).  Again, the import lib
     5042for the cygwin kernel makes use of this ability, and it is not
     5043possible to do this without an import lib.
     5044
     5045So, import libs are not going away.  But the ability to replace
     5046true import libs with a simple symbolic link to (or a copy of)
     5047a dll, in most cases, is a useful addition to the suite of tools
     5048binutils makes available to the win32 developer.  Given the
     5049massive improvements in memory requirements during linking, storage
     5050requirements, and linking speed, we expect that many developers
     5051will soon begin to use this feature whenever possible.
     5052
     5053@item symbol aliasing 
     5054@table @emph
     5055@item adding additional names
     5056Sometimes, it is useful to export symbols with additional names. 
     5057A symbol @samp{foo} will be exported as @samp{foo}, but it can also be
     5058exported as @samp{_foo} by using special directives in the DEF file
     5059when creating the dll.  This will affect also the optional created
     5060import library.  Consider the following DEF file:
     5061
     5062@example
     5063LIBRARY "xyz.dll" BASE=0x61000000
     5064
     5065EXPORTS
     5066foo
     5067_foo = foo
     5068@end example
     5069
     5070The line @samp{_foo = foo} maps the symbol @samp{foo} to @samp{_foo}.
     5071
     5072Another method for creating a symbol alias is to create it in the
     5073source code using the "weak" attribute:
     5074
     5075@example
     5076void foo () @{ /* Do something.  */; @}
     5077void _foo () __attribute__ ((weak, alias ("foo")));
     5078@end example
     5079
     5080See the gcc manual for more information about attributes and weak
     5081symbols.
     5082
     5083@item renaming symbols
     5084Sometimes it is useful to rename exports.  For instance, the cygwin
     5085kernel does this regularly.  A symbol @samp{_foo} can be exported as
     5086@samp{foo} but not as @samp{_foo} by using special directives in the
     5087DEF file. (This will also affect the import library, if it is
     5088created).  In the following example:
     5089
     5090@example
     5091LIBRARY "xyz.dll" BASE=0x61000000
     5092
     5093EXPORTS
     5094_foo = foo
     5095@end example
     5096
     5097The line @samp{_foo = foo} maps the exported symbol @samp{foo} to
     5098@samp{_foo}.
     5099@end table
     5100
     5101Note: using a DEF file disables the default auto-export behavior,
     5102unless the @samp{--export-all-symbols} command line option is used.
     5103If, however, you are trying to rename symbols, then you should list
     5104@emph{all} desired exports in the DEF file, including the symbols
     5105that are not being renamed, and do @emph{not} use the
     5106@samp{--export-all-symbols} option.  If you list only the
     5107renamed symbols in the DEF file, and use @samp{--export-all-symbols}
     5108to handle the other symbols, then the both the new names @emph{and}
     5109the original names for the the renamed symbols will be exported. 
     5110In effect, you'd be aliasing those symbols, not renaming them,
     5111which is probably not what you wanted.
     5112@end table
     5113
     5114@ifclear GENERIC
     5115@lowersections
     5116@end ifclear
     5117@end ifset
     5118
     5119@ifset XTENSA
     5120@ifclear GENERIC
     5121@raisesections
     5122@end ifclear
     5123
     5124@node Xtensa
     5125@section @code{ld} and Xtensa Processors
     5126
     5127@cindex Xtensa processors
     5128The default @command{ld} behavior for Xtensa processors is to interpret
     5129@code{SECTIONS} commands so that lists of explicitly named sections in a
     5130specification with a wildcard file will be interleaved when necessary to
     5131keep literal pools within the range of PC-relative load offsets.  For
     5132example, with the command:
     5133
     5134@smallexample
     5135SECTIONS
     5136@{
     5137  .text : @{
     5138    *(.literal .text)
     5139  @}
     5140@}
     5141@end smallexample
     5142
     5143@noindent
     5144@command{ld} may interleave some of the @code{.literal}
     5145and @code{.text} sections from different object files to ensure that the
     5146literal pools are within the range of PC-relative load offsets.  A valid
     5147interleaving might place the @code{.literal} sections from an initial
     5148group of files followed by the @code{.text} sections of that group of
     5149files.  Then, the @code{.literal} sections from the rest of the files
     5150and the @code{.text} sections from the rest of the files would follow.
     5151The non-interleaved order can still be specified as:
     5152
     5153@smallexample
     5154SECTIONS
     5155@{
     5156  .text : @{
     5157    *(.literal) *(.text)
     5158  @}
     5159@}
     5160@end smallexample
     5161
     5162@cindex @code{--relax} on Xtensa
     5163@cindex relaxing on Xtensa
     5164@kindex --no-relax
     5165The Xtensa version of @command{ld} enables the @option{--relax} option by
     5166default to attempt to reduce space in the output image by combining
     5167literals with identical values.  It also provides the
     5168@option{--no-relax} option to disable this optimization.  When enabled,
     5169the relaxation algorithm ensures that a literal will only be merged with
     5170another literal when the new merged literal location is within the
     5171offset range of all of its uses.
     5172
     5173The relaxation mechanism will also attempt to optimize
     5174assembler-generated ``longcall'' sequences of
     5175@code{L32R}/@code{CALLX@var{n}} when the target is known to fit into a
     5176@code{CALL@var{n}} instruction encoding.  The current optimization
     5177converts the sequence into @code{NOP}/@code{CALL@var{n}} and removes the
     5178literal referenced by the @code{L32R} instruction.
     5179
     5180@ifclear GENERIC
     5181@lowersections
     5182@end ifclear
     5183@end ifset
    41395184
    41405185@ifclear SingleFormat
     
    41765221
    41775222@node BFD outline
    4178 @section How it works: an outline of BFD
     5223@section How It Works: An Outline of BFD
    41795224@cindex opening object files
    41805225@include bfdsumm.texi
     
    41835228@node Reporting Bugs
    41845229@chapter Reporting Bugs
    4185 @cindex bugs in @code{ld}
    4186 @cindex reporting bugs in @code{ld}
    4187 
    4188 Your bug reports play an essential role in making @code{ld} reliable.
     5230@cindex bugs in @command{ld}
     5231@cindex reporting bugs in @command{ld}
     5232
     5233Your bug reports play an essential role in making @command{ld} reliable.
    41895234
    41905235Reporting a bug may help you by bringing a solution to your problem, or
    41915236it may not.  But in any case the principal function of a bug report is
    4192 to help the entire community by making the next version of @code{ld}
     5237to help the entire community by making the next version of @command{ld}
    41935238work better.  Bug reports are your contribution to the maintenance of
    4194 @code{ld}.
     5239@command{ld}.
    41955240
    41965241In order for a bug report to serve its purpose, you must include the
     
    42035248
    42045249@node Bug Criteria
    4205 @section Have you found a bug?
     5250@section Have You Found a Bug?
    42065251@cindex bug criteria
    42075252
     
    42145259@item
    42155260If the linker gets a fatal signal, for any input whatever, that is a
    4216 @code{ld} bug.  Reliable linkers never crash.
     5261@command{ld} bug.  Reliable linkers never crash.
    42175262
    42185263@cindex error on valid input
    42195264@item
    4220 If @code{ld} produces an error message for valid input, that is a bug.
     5265If @command{ld} produces an error message for valid input, that is a bug.
    42215266
    42225267@cindex invalid input
    42235268@item
    4224 If @code{ld} does not produce an error message for invalid input, that
     5269If @command{ld} does not produce an error message for invalid input, that
    42255270may be a bug.  In the general case, the linker can not verify that
    42265271object files are correct.
     
    42285273@item
    42295274If you are an experienced user of linkers, your suggestions for
    4230 improvement of @code{ld} are welcome in any case.
     5275improvement of @command{ld} are welcome in any case.
    42315276@end itemize
    42325277
    42335278@node Bug Reporting
    4234 @section How to report bugs
     5279@section How to Report Bugs
    42355280@cindex bug reports
    4236 @cindex @code{ld} bugs, reporting
     5281@cindex @command{ld} bugs, reporting
    42375282
    42385283A number of companies and individuals offer support for @sc{gnu}
    4239 products.  If you obtained @code{ld} from a support organization, we
     5284products.  If you obtained @command{ld} from a support organization, we
    42405285recommend you contact that organization first.
    42415286
     
    42445289distribution.
    42455290
    4246 Otherwise, send bug reports for @code{ld} to
     5291Otherwise, send bug reports for @command{ld} to
    42475292@samp{bug-binutils@@gnu.org}.
    42485293
     
    42535298Often people omit facts because they think they know what causes the
    42545299problem and assume that some details do not matter.  Thus, you might
    4255 assume that the name of a symbol you use in an example does not matter.
    4256 Well, probably it does not, but one cannot be sure.  Perhaps the bug is
    4257 a stray memory reference which happens to fetch from the location where
    4258 that name is stored in memory; perhaps, if the name were different, the
    4259 contents of that location would fool the linker into doing the right
    4260 thing despite the bug.  Play it safe and give a specific, complete
    4261 example.  That is the easiest thing for you to do, and the most helpful.
    4262 
    4263 Keep in mind that the purpose of a bug report is to enable us to fix the bug if
    4264 it is new to us.  Therefore, always write your bug reports on the assumption
    4265 that the bug has not been reported previously.
     5300assume that the name of a symbol you use in an example does not
     5301matter.  Well, probably it does not, but one cannot be sure.  Perhaps
     5302the bug is a stray memory reference which happens to fetch from the
     5303location where that name is stored in memory; perhaps, if the name
     5304were different, the contents of that location would fool the linker
     5305into doing the right thing despite the bug.  Play it safe and give a
     5306specific, complete example.  That is the easiest thing for you to do,
     5307and the most helpful.
     5308
     5309Keep in mind that the purpose of a bug report is to enable us to fix
     5310the bug if it is new to us.  Therefore, always write your bug reports
     5311on the assumption that the bug has not been reported previously.
    42665312
    42675313Sometimes people give a few sketchy facts and ask, ``Does this ring a
    4268 bell?''  Those bug reports are useless, and we urge everyone to
    4269 @emph{refuse to respond to them} except to chide the sender to report
    4270 bugs properly.
     5314bell?''  This cannot help us fix a bug, so it is basically useless.  We
     5315respond by asking for enough details to enable us to investigate.
     5316You might as well expedite matters by sending them to begin with.
    42715317
    42725318To enable us to fix the bug, you should include all these things:
     
    42745320@itemize @bullet
    42755321@item
    4276 The version of @code{ld}.  @code{ld} announces it if you start it with
     5322The version of @command{ld}.  @command{ld} announces it if you start it with
    42775323the @samp{--version} argument.
    42785324
    42795325Without this, we will not know whether there is any point in looking for
    4280 the bug in the current version of @code{ld}.
     5326the bug in the current version of @command{ld}.
    42815327
    42825328@item
    4283 Any patches you may have applied to the @code{ld} source, including any
     5329Any patches you may have applied to the @command{ld} source, including any
    42845330patches made to the @code{BFD} library.
    42855331
     
    42895335
    42905336@item
    4291 What compiler (and its version) was used to compile @code{ld}---e.g.
     5337What compiler (and its version) was used to compile @command{ld}---e.g.
    42925338``@code{gcc-2.7}''.
    42935339
     
    43035349@item
    43045350A complete input file, or set of input files, that will reproduce the
    4305 bug.  It is generally most helpful to send the actual object files,
    4306 uuencoded if necessary to get them through the mail system.  Making them
    4307 available for anonymous FTP is not as good, but may be the only
    4308 reasonable choice for large object files.
     5351bug.  It is generally most helpful to send the actual object files
     5352provided that they are reasonably small.  Say no more than 10K.  For
     5353bigger files you can either make them available by FTP or HTTP or else
     5354state that you are willing to send the object file(s) to whomever
     5355requests them.  (Note - your email will be going to a mailing list, so
     5356we do not want to clog it up with large attachments).  But small
     5357attachments are best.
    43095358
    43105359If the source files were assembled using @code{gas} or compiled using
     
    43185367incorrect.  For example, ``It gets a fatal signal.''
    43195368
    4320 Of course, if the bug is that @code{ld} gets a fatal signal, then we
     5369Of course, if the bug is that @command{ld} gets a fatal signal, then we
    43215370will certainly notice it.  But if the bug is incorrect output, we might
    43225371not notice unless it is glaringly wrong.  You might as well not give us
     
    43255374Even if the problem you experience is a fatal signal, you should still
    43265375say so explicitly.  Suppose something strange is going on, such as, your
    4327 copy of @code{ld} is out of synch, or you have encountered a bug in the
     5376copy of @command{ld} is out of synch, or you have encountered a bug in the
    43285377C library on your system.  (This has happened!)  Your copy might crash
    43295378and ours would not.  If you told us to expect a crash, then when ours
     
    43335382
    43345383@item
    4335 If you wish to suggest changes to the @code{ld} source, send us context
     5384If you wish to suggest changes to the @command{ld} source, send us context
    43365385diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or
    43375386@samp{-p} option.  Always send diffs from the old file to the new file.
    4338 If you even discuss something in the @code{ld} source, refer to it by
     5387If you even discuss something in the @command{ld} source, refer to it by
    43395388context, not by line number.
    43405389
     
    43745423to fix the problem another way, or we might not understand it at all.
    43755424
    4376 Sometimes with a program as complicated as @code{ld} it is very hard to
     5425Sometimes with a program as complicated as @command{ld} it is very hard to
    43775426construct an example that will make the program follow a certain path
    43785427through the code.  If you do not send us the example, we will not be
     
    43945443@appendix MRI Compatible Script Files
    43955444@cindex MRI compatibility
    4396 To aid users making the transition to @sc{gnu} @code{ld} from the MRI
    4397 linker, @code{ld} can use MRI compatible linker scripts as an
     5445To aid users making the transition to @sc{gnu} @command{ld} from the MRI
     5446linker, @command{ld} can use MRI compatible linker scripts as an
    43985447alternative to the more general-purpose linker scripting language
    43995448described in @ref{Scripts}.  MRI compatible linker scripts have a much
    44005449simpler command set than the scripting language otherwise used with
    4401 @code{ld}.  @sc{gnu} @code{ld} supports the most commonly used MRI
     5450@command{ld}.  @sc{gnu} @command{ld} supports the most commonly used MRI
    44025451linker commands; these commands are described here.
    44035452
     
    44125461command line starts with the keyword that identifies the command (though
    44135462blank lines are also allowed for punctuation).  If a line of an
    4414 MRI-compatible script begins with an unrecognized keyword, @code{ld}
     5463MRI-compatible script begins with an unrecognized keyword, @command{ld}
    44155464issues a warning message, but continues processing the script.
    44165465
     
    44255474@item ABSOLUTE @var{secname}
    44265475@itemx ABSOLUTE @var{secname}, @var{secname}, @dots{} @var{secname}
    4427 Normally, @code{ld} includes in the output file all sections from all
     5476Normally, @command{ld} includes in the output file all sections from all
    44285477the input files.  However, in an MRI-compatible script, you can use the
    44295478@code{ABSOLUTE} command to restrict the sections that will be present in
     
    44805529@item LIST @var{anything}@dots{}
    44815530Print (to the standard output file) a link map, as produced by the
    4482 @code{ld} command-line option @samp{-M}.
     5531@command{ld} command-line option @samp{-M}.
    44835532
    44845533The keyword @code{LIST} may be followed by anything on the
     
    44895538@itemx LOAD @var{filename}, @var{filename}, @dots{} @var{filename}
    44905539Include one or more object file @var{filename} in the link; this has the
    4491 same effect as specifying @var{filename} directly on the @code{ld}
     5540same effect as specifying @var{filename} directly on the @command{ld}
    44925541command line.
    44935542
    44945543@cindex @code{NAME} (MRI)
    44955544@item NAME @var{output-name}
    4496 @var{output-name} is the name for the program produced by @code{ld}; the
     5545@var{output-name} is the name for the program produced by @command{ld}; the
    44975546MRI-compatible command @code{NAME} is equivalent to the command-line
    44985547option @samp{-o} or the general script language command @code{OUTPUT}.
     
    45015550@item ORDER @var{secname}, @var{secname}, @dots{} @var{secname}
    45025551@itemx ORDER @var{secname} @var{secname} @var{secname}
    4503 Normally, @code{ld} orders the sections in its output file in the
     5552Normally, @command{ld} orders the sections in its output file in the
    45045553order in which they first appear in the input files.  In an MRI-compatible
    45055554script, you can override this ordering with the @code{ORDER} command.  The
     
    45245573@end table
    45255574
    4526 @node GNU Free Documentation License
    4527 @appendix GNU Free Documentation License
    4528 @cindex GNU Free Documentation License
    4529 
    4530                 GNU Free Documentation License
    4531 
    4532                    Version 1.1, March 2000
    4533 
    4534  Copyright (C) 2000  Free Software Foundation, Inc.
    4535   59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4536 
    4537  Everyone is permitted to copy and distribute verbatim copies
    4538  of this license document, but changing it is not allowed.
    4539 
    4540 
    4541 0. PREAMBLE
    4542 
    4543 The purpose of this License is to make a manual, textbook, or other
    4544 written document "free" in the sense of freedom: to assure everyone
    4545 the effective freedom to copy and redistribute it, with or without
    4546 modifying it, either commercially or noncommercially.  Secondarily,
    4547 this License preserves for the author and publisher a way to get
    4548 credit for their work, while not being considered responsible for
    4549 modifications made by others.
    4550 
    4551 This License is a kind of "copyleft", which means that derivative
    4552 works of the document must themselves be free in the same sense.  It
    4553 complements the GNU General Public License, which is a copyleft
    4554 license designed for free software.
    4555 
    4556 We have designed this License in order to use it for manuals for free
    4557 software, because free software needs free documentation: a free
    4558 program should come with manuals providing the same freedoms that the
    4559 software does.  But this License is not limited to software manuals;
    4560 it can be used for any textual work, regardless of subject matter or
    4561 whether it is published as a printed book.  We recommend this License
    4562 principally for works whose purpose is instruction or reference.
    4563 
    4564 
    4565 1. APPLICABILITY AND DEFINITIONS
    4566 
    4567 This License applies to any manual or other work that contains a
    4568 notice placed by the copyright holder saying it can be distributed
    4569 under the terms of this License.  The "Document", below, refers to any
    4570 such manual or work.  Any member of the public is a licensee, and is
    4571 addressed as "you".
    4572 
    4573 A "Modified Version" of the Document means any work containing the
    4574 Document or a portion of it, either copied verbatim, or with
    4575 modifications and/or translated into another language.
    4576 
    4577 A "Secondary Section" is a named appendix or a front-matter section of
    4578 the Document that deals exclusively with the relationship of the
    4579 publishers or authors of the Document to the Document's overall subject
    4580 (or to related matters) and contains nothing that could fall directly
    4581 within that overall subject.  (For example, if the Document is in part a
    4582 textbook of mathematics, a Secondary Section may not explain any
    4583 mathematics.)  The relationship could be a matter of historical
    4584 connection with the subject or with related matters, or of legal,
    4585 commercial, philosophical, ethical or political position regarding
    4586 them.
    4587 
    4588 The "Invariant Sections" are certain Secondary Sections whose titles
    4589 are designated, as being those of Invariant Sections, in the notice
    4590 that says that the Document is released under this License.
    4591 
    4592 The "Cover Texts" are certain short passages of text that are listed,
    4593 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
    4594 the Document is released under this License.
    4595 
    4596 A "Transparent" copy of the Document means a machine-readable copy,
    4597 represented in a format whose specification is available to the
    4598 general public, whose contents can be viewed and edited directly and
    4599 straightforwardly with generic text editors or (for images composed of
    4600 pixels) generic paint programs or (for drawings) some widely available
    4601 drawing editor, and that is suitable for input to text formatters or
    4602 for automatic translation to a variety of formats suitable for input
    4603 to text formatters.  A copy made in an otherwise Transparent file
    4604 format whose markup has been designed to thwart or discourage
    4605 subsequent modification by readers is not Transparent.  A copy that is
    4606 not "Transparent" is called "Opaque".
    4607 
    4608 Examples of suitable formats for Transparent copies include plain
    4609 ASCII without markup, Texinfo input format, LaTeX input format, SGML
    4610 or XML using a publicly available DTD, and standard-conforming simple
    4611 HTML designed for human modification.  Opaque formats include
    4612 PostScript, PDF, proprietary formats that can be read and edited only
    4613 by proprietary word processors, SGML or XML for which the DTD and/or
    4614 processing tools are not generally available, and the
    4615 machine-generated HTML produced by some word processors for output
    4616 purposes only.
    4617 
    4618 The "Title Page" means, for a printed book, the title page itself,
    4619 plus such following pages as are needed to hold, legibly, the material
    4620 this License requires to appear in the title page.  For works in
    4621 formats which do not have any title page as such, "Title Page" means
    4622 the text near the most prominent appearance of the work's title,
    4623 preceding the beginning of the body of the text.
    4624 
    4625 
    4626 2. VERBATIM COPYING
    4627 
    4628 You may copy and distribute the Document in any medium, either
    4629 commercially or noncommercially, provided that this License, the
    4630 copyright notices, and the license notice saying this License applies
    4631 to the Document are reproduced in all copies, and that you add no other
    4632 conditions whatsoever to those of this License.  You may not use
    4633 technical measures to obstruct or control the reading or further
    4634 copying of the copies you make or distribute.  However, you may accept
    4635 compensation in exchange for copies.  If you distribute a large enough
    4636 number of copies you must also follow the conditions in section 3.
    4637 
    4638 You may also lend copies, under the same conditions stated above, and
    4639 you may publicly display copies.
    4640 
    4641 
    4642 3. COPYING IN QUANTITY
    4643 
    4644 If you publish printed copies of the Document numbering more than 100,
    4645 and the Document's license notice requires Cover Texts, you must enclose
    4646 the copies in covers that carry, clearly and legibly, all these Cover
    4647 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
    4648 the back cover.  Both covers must also clearly and legibly identify
    4649 you as the publisher of these copies.  The front cover must present
    4650 the full title with all words of the title equally prominent and
    4651 visible.  You may add other material on the covers in addition.
    4652 Copying with changes limited to the covers, as long as they preserve
    4653 the title of the Document and satisfy these conditions, can be treated
    4654 as verbatim copying in other respects.
    4655 
    4656 If the required texts for either cover are too voluminous to fit
    4657 legibly, you should put the first ones listed (as many as fit
    4658 reasonably) on the actual cover, and continue the rest onto adjacent
    4659 pages.
    4660 
    4661 If you publish or distribute Opaque copies of the Document numbering
    4662 more than 100, you must either include a machine-readable Transparent
    4663 copy along with each Opaque copy, or state in or with each Opaque copy
    4664 a publicly-accessible computer-network location containing a complete
    4665 Transparent copy of the Document, free of added material, which the
    4666 general network-using public has access to download anonymously at no
    4667 charge using public-standard network protocols.  If you use the latter
    4668 option, you must take reasonably prudent steps, when you begin
    4669 distribution of Opaque copies in quantity, to ensure that this
    4670 Transparent copy will remain thus accessible at the stated location
    4671 until at least one year after the last time you distribute an Opaque
    4672 copy (directly or through your agents or retailers) of that edition to
    4673 the public.
    4674 
    4675 It is requested, but not required, that you contact the authors of the
    4676 Document well before redistributing any large number of copies, to give
    4677 them a chance to provide you with an updated version of the Document.
    4678 
    4679 
    4680 4. MODIFICATIONS
    4681 
    4682 You may copy and distribute a Modified Version of the Document under
    4683 the conditions of sections 2 and 3 above, provided that you release
    4684 the Modified Version under precisely this License, with the Modified
    4685 Version filling the role of the Document, thus licensing distribution
    4686 and modification of the Modified Version to whoever possesses a copy
    4687 of it.  In addition, you must do these things in the Modified Version:
    4688 
    4689 A. Use in the Title Page (and on the covers, if any) a title distinct
    4690    from that of the Document, and from those of previous versions
    4691    (which should, if there were any, be listed in the History section
    4692    of the Document).  You may use the same title as a previous version
    4693    if the original publisher of that version gives permission.
    4694 B. List on the Title Page, as authors, one or more persons or entities
    4695    responsible for authorship of the modifications in the Modified
    4696    Version, together with at least five of the principal authors of the
    4697    Document (all of its principal authors, if it has less than five).
    4698 C. State on the Title page the name of the publisher of the
    4699    Modified Version, as the publisher.
    4700 D. Preserve all the copyright notices of the Document.
    4701 E. Add an appropriate copyright notice for your modifications
    4702    adjacent to the other copyright notices.
    4703 F. Include, immediately after the copyright notices, a license notice
    4704    giving the public permission to use the Modified Version under the
    4705    terms of this License, in the form shown in the Addendum below.
    4706 G. Preserve in that license notice the full lists of Invariant Sections
    4707    and required Cover Texts given in the Document's license notice.
    4708 H. Include an unaltered copy of this License.
    4709 I. Preserve the section entitled "History", and its title, and add to
    4710    it an item stating at least the title, year, new authors, and
    4711    publisher of the Modified Version as given on the Title Page.  If
    4712    there is no section entitled "History" in the Document, create one
    4713    stating the title, year, authors, and publisher of the Document as
    4714    given on its Title Page, then add an item describing the Modified
    4715    Version as stated in the previous sentence.
    4716 J. Preserve the network location, if any, given in the Document for
    4717    public access to a Transparent copy of the Document, and likewise
    4718    the network locations given in the Document for previous versions
    4719    it was based on.  These may be placed in the "History" section.
    4720    You may omit a network location for a work that was published at
    4721    least four years before the Document itself, or if the original
    4722    publisher of the version it refers to gives permission.
    4723 K. In any section entitled "Acknowledgements" or "Dedications",
    4724    preserve the section's title, and preserve in the section all the
    4725    substance and tone of each of the contributor acknowledgements
    4726    and/or dedications given therein.
    4727 L. Preserve all the Invariant Sections of the Document,
    4728    unaltered in their text and in their titles.  Section numbers
    4729    or the equivalent are not considered part of the section titles.
    4730 M. Delete any section entitled "Endorsements".  Such a section
    4731    may not be included in the Modified Version.
    4732 N. Do not retitle any existing section as "Endorsements"
    4733    or to conflict in title with any Invariant Section.
    4734 
    4735 If the Modified Version includes new front-matter sections or
    4736 appendices that qualify as Secondary Sections and contain no material
    4737 copied from the Document, you may at your option designate some or all
    4738 of these sections as invariant.  To do this, add their titles to the
    4739 list of Invariant Sections in the Modified Version's license notice.
    4740 These titles must be distinct from any other section titles.
    4741 
    4742 You may add a section entitled "Endorsements", provided it contains
    4743 nothing but endorsements of your Modified Version by various
    4744 parties--for example, statements of peer review or that the text has
    4745 been approved by an organization as the authoritative definition of a
    4746 standard.
    4747 
    4748 You may add a passage of up to five words as a Front-Cover Text, and a
    4749 passage of up to 25 words as a Back-Cover Text, to the end of the list
    4750 of Cover Texts in the Modified Version.  Only one passage of
    4751 Front-Cover Text and one of Back-Cover Text may be added by (or
    4752 through arrangements made by) any one entity.  If the Document already
    4753 includes a cover text for the same cover, previously added by you or
    4754 by arrangement made by the same entity you are acting on behalf of,
    4755 you may not add another; but you may replace the old one, on explicit
    4756 permission from the previous publisher that added the old one.
    4757 
    4758 The author(s) and publisher(s) of the Document do not by this License
    4759 give permission to use their names for publicity for or to assert or
    4760 imply endorsement of any Modified Version.
    4761 
    4762 
    4763 5. COMBINING DOCUMENTS
    4764 
    4765 You may combine the Document with other documents released under this
    4766 License, under the terms defined in section 4 above for modified
    4767 versions, provided that you include in the combination all of the
    4768 Invariant Sections of all of the original documents, unmodified, and
    4769 list them all as Invariant Sections of your combined work in its
    4770 license notice.
    4771 
    4772 The combined work need only contain one copy of this License, and
    4773 multiple identical Invariant Sections may be replaced with a single
    4774 copy.  If there are multiple Invariant Sections with the same name but
    4775 different contents, make the title of each such section unique by
    4776 adding at the end of it, in parentheses, the name of the original
    4777 author or publisher of that section if known, or else a unique number.
    4778 Make the same adjustment to the section titles in the list of
    4779 Invariant Sections in the license notice of the combined work.
    4780 
    4781 In the combination, you must combine any sections entitled "History"
    4782 in the various original documents, forming one section entitled
    4783 "History"; likewise combine any sections entitled "Acknowledgements",
    4784 and any sections entitled "Dedications".  You must delete all sections
    4785 entitled "Endorsements."
    4786 
    4787 
    4788 6. COLLECTIONS OF DOCUMENTS
    4789 
    4790 You may make a collection consisting of the Document and other documents
    4791 released under this License, and replace the individual copies of this
    4792 License in the various documents with a single copy that is included in
    4793 the collection, provided that you follow the rules of this License for
    4794 verbatim copying of each of the documents in all other respects.
    4795 
    4796 You may extract a single document from such a collection, and distribute
    4797 it individually under this License, provided you insert a copy of this
    4798 License into the extracted document, and follow this License in all
    4799 other respects regarding verbatim copying of that document.
    4800 
    4801 
    4802 7. AGGREGATION WITH INDEPENDENT WORKS
    4803 
    4804 A compilation of the Document or its derivatives with other separate
    4805 and independent documents or works, in or on a volume of a storage or
    4806 distribution medium, does not as a whole count as a Modified Version
    4807 of the Document, provided no compilation copyright is claimed for the
    4808 compilation.  Such a compilation is called an "aggregate", and this
    4809 License does not apply to the other self-contained works thus compiled
    4810 with the Document, on account of their being thus compiled, if they
    4811 are not themselves derivative works of the Document.
    4812 
    4813 If the Cover Text requirement of section 3 is applicable to these
    4814 copies of the Document, then if the Document is less than one quarter
    4815 of the entire aggregate, the Document's Cover Texts may be placed on
    4816 covers that surround only the Document within the aggregate.
    4817 Otherwise they must appear on covers around the whole aggregate.
    4818 
    4819 
    4820 8. TRANSLATION
    4821 
    4822 Translation is considered a kind of modification, so you may
    4823 distribute translations of the Document under the terms of section 4.
    4824 Replacing Invariant Sections with translations requires special
    4825 permission from their copyright holders, but you may include
    4826 translations of some or all Invariant Sections in addition to the
    4827 original versions of these Invariant Sections.  You may include a
    4828 translation of this License provided that you also include the
    4829 original English version of this License.  In case of a disagreement
    4830 between the translation and the original English version of this
    4831 License, the original English version will prevail.
    4832 
    4833 
    4834 9. TERMINATION
    4835 
    4836 You may not copy, modify, sublicense, or distribute the Document except
    4837 as expressly provided for under this License.  Any other attempt to
    4838 copy, modify, sublicense or distribute the Document is void, and will
    4839 automatically terminate your rights under this License.  However,
    4840 parties who have received copies, or rights, from you under this
    4841 License will not have their licenses terminated so long as such
    4842 parties remain in full compliance.
    4843 
    4844 
    4845 10. FUTURE REVISIONS OF THIS LICENSE
    4846 
    4847 The Free Software Foundation may publish new, revised versions
    4848 of the GNU Free Documentation License from time to time.  Such new
    4849 versions will be similar in spirit to the present version, but may
    4850 differ in detail to address new problems or concerns.  See
    4851 http://www.gnu.org/copyleft/.
    4852 
    4853 Each version of the License is given a distinguishing version number.
    4854 If the Document specifies that a particular numbered version of this
    4855 License "or any later version" applies to it, you have the option of
    4856 following the terms and conditions either of that specified version or
    4857 of any later version that has been published (not as a draft) by the
    4858 Free Software Foundation.  If the Document does not specify a version
    4859 number of this License, you may choose any version ever published (not
    4860 as a draft) by the Free Software Foundation.
    4861 
    4862 
    4863 ADDENDUM: How to use this License for your documents
    4864 
    4865 To use this License in a document you have written, include a copy of
    4866 the License in the document and put the following copyright and
    4867 license notices just after the title page:
    4868 
    4869 @smallexample
    4870     Copyright (c)  YEAR  YOUR NAME.
    4871     Permission is granted to copy, distribute and/or modify this document
    4872     under the terms of the GNU Free Documentation License, Version 1.1
    4873     or any later version published by the Free Software Foundation;
    4874     with the Invariant Sections being LIST THEIR TITLES, with the
    4875     Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
    4876     A copy of the license is included in the section entitled "GNU
    4877     Free Documentation License".
    4878 @end smallexample
    4879 
    4880 If you have no Invariant Sections, write "with no Invariant Sections"
    4881 instead of saying which ones are invariant.  If you have no
    4882 Front-Cover Texts, write "no Front-Cover Texts" instead of
    4883 "Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
    4884 
    4885 If your document contains nontrivial examples of program code, we
    4886 recommend releasing these examples in parallel under your choice of
    4887 free software license, such as the GNU General Public License,
    4888 to permit their use in free software.
     5575@include fdl.texi
    48895576
    48905577@node Index
     
    49115598@contents
    49125599@bye
    4913 
    4914 
Note: See TracChangeset for help on using the changeset viewer.