1This is ld.info, produced by makeinfo version 4.8 from ld.texinfo.
2
3INFO-DIR-SECTION Software development
4START-INFO-DIR-ENTRY
5* Ld: (ld).                       The GNU linker.
6END-INFO-DIR-ENTRY
7
8   This file documents the GNU linker LD (GNU Binutils) version 2.21.1.
9
10   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
112000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
12Software Foundation, Inc.
13
14   Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3 or
16any later version published by the Free Software Foundation; with no
17Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
18Texts.  A copy of the license is included in the section entitled "GNU
19Free Documentation License".
20
21
22File: ld.info,  Node: Top,  Next: Overview,  Up: (dir)
23
24LD
25**
26
27This file documents the GNU linker ld (GNU Binutils) version 2.21.1.
28
29   This document is distributed under the terms of the GNU Free
30Documentation License version 1.3.  A copy of the license is included
31in the section entitled "GNU Free Documentation License".
32
33* Menu:
34
35* Overview::                    Overview
36* Invocation::                  Invocation
37* Scripts::                     Linker Scripts
38
39* Machine Dependent::           Machine Dependent Features
40
41* BFD::                         BFD
42
43* Reporting Bugs::              Reporting Bugs
44* MRI::                         MRI Compatible Script Files
45* GNU Free Documentation License::  GNU Free Documentation License
46* LD Index::                       LD Index
47
48
49File: ld.info,  Node: Overview,  Next: Invocation,  Prev: Top,  Up: Top
50
511 Overview
52**********
53
54`ld' combines a number of object and archive files, relocates their
55data and ties up symbol references. Usually the last step in compiling
56a program is to run `ld'.
57
58   `ld' accepts Linker Command Language files written in a superset of
59AT&T's Link Editor Command Language syntax, to provide explicit and
60total control over the linking process.
61
62   This version of `ld' uses the general purpose BFD libraries to
63operate on object files. This allows `ld' to read, combine, and write
64object files in many different formats--for example, COFF or `a.out'.
65Different formats may be linked together to produce any available kind
66of object file.  *Note BFD::, for more information.
67
68   Aside from its flexibility, the GNU linker is more helpful than other
69linkers in providing diagnostic information.  Many linkers abandon
70execution immediately upon encountering an error; whenever possible,
71`ld' continues executing, allowing you to identify other errors (or, in
72some cases, to get an output file in spite of the error).
73
74
75File: ld.info,  Node: Invocation,  Next: Scripts,  Prev: Overview,  Up: Top
76
772 Invocation
78************
79
80The GNU linker `ld' is meant to cover a broad range of situations, and
81to be as compatible as possible with other linkers.  As a result, you
82have many choices to control its behavior.
83
84* Menu:
85
86* Options::                     Command Line Options
87* Environment::                 Environment Variables
88
89
90File: ld.info,  Node: Options,  Next: Environment,  Up: Invocation
91
922.1 Command Line Options
93========================
94
95   The linker supports a plethora of command-line options, but in actual
96practice few of them are used in any particular context.  For instance,
97a frequent use of `ld' is to link standard Unix object files on a
98standard, supported Unix system.  On such a system, to link a file
99`hello.o':
100
101     ld -o OUTPUT /lib/crt0.o hello.o -lc
102
103   This tells `ld' to produce a file called OUTPUT as the result of
104linking the file `/lib/crt0.o' with `hello.o' and the library `libc.a',
105which will come from the standard search directories.  (See the
106discussion of the `-l' option below.)
107
108   Some of the command-line options to `ld' may be specified at any
109point in the command line.  However, options which refer to files, such
110as `-l' or `-T', cause the file to be read at the point at which the
111option appears in the command line, relative to the object files and
112other file options.  Repeating non-file options with a different
113argument will either have no further effect, or override prior
114occurrences (those further to the left on the command line) of that
115option.  Options which may be meaningfully specified more than once are
116noted in the descriptions below.
117
118   Non-option arguments are object files or archives which are to be
119linked together.  They may follow, precede, or be mixed in with
120command-line options, except that an object file argument may not be
121placed between an option and its argument.
122
123   Usually the linker is invoked with at least one object file, but you
124can specify other forms of binary input files using `-l', `-R', and the
125script command language.  If _no_ binary input files at all are
126specified, the linker does not produce any output, and issues the
127message `No input files'.
128
129   If the linker cannot recognize the format of an object file, it will
130assume that it is a linker script.  A script specified in this way
131augments the main linker script used for the link (either the default
132linker script or the one specified by using `-T').  This feature
133permits the linker to link against a file which appears to be an object
134or an archive, but actually merely defines some symbol values, or uses
135`INPUT' or `GROUP' to load other objects.  Specifying a script in this
136way merely augments the main linker script, with the extra commands
137placed after the main script; use the `-T' option to replace the
138default linker script entirely, but note the effect of the `INSERT'
139command.  *Note Scripts::.
140
141   For options whose names are a single letter, option arguments must
142either follow the option letter without intervening whitespace, or be
143given as separate arguments immediately following the option that
144requires them.
145
146   For options whose names are multiple letters, either one dash or two
147can precede the option name; for example, `-trace-symbol' and
148`--trace-symbol' are equivalent.  Note--there is one exception to this
149rule.  Multiple letter options that start with a lower case 'o' can
150only be preceded by two dashes.  This is to reduce confusion with the
151`-o' option.  So for example `-omagic' sets the output file name to
152`magic' whereas `--omagic' sets the NMAGIC flag on the output.
153
154   Arguments to multiple-letter options must either be separated from
155the option name by an equals sign, or be given as separate arguments
156immediately following the option that requires them.  For example,
157`--trace-symbol foo' and `--trace-symbol=foo' are equivalent.  Unique
158abbreviations of the names of multiple-letter options are accepted.
159
160   Note--if the linker is being invoked indirectly, via a compiler
161driver (e.g. `gcc') then all the linker command line options should be
162prefixed by `-Wl,' (or whatever is appropriate for the particular
163compiler driver) like this:
164
165       gcc -Wl,--start-group foo.o bar.o -Wl,--end-group
166
167   This is important, because otherwise the compiler driver program may
168silently drop the linker options, resulting in a bad link.  Confusion
169may also arise when passing options that require values through a
170driver, as the use of a space between option and argument acts as a
171separator, and causes the driver to pass only the option to the linker
172and the argument to the compiler.  In this case, it is simplest to use
173the joined forms of both single- and multiple-letter options, such as:
174
175       gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map
176
177   Here is a table of the generic command line switches accepted by the
178GNU linker:
179
180`@FILE'
181     Read command-line options from FILE.  The options read are
182     inserted in place of the original @FILE option.  If FILE does not
183     exist, or cannot be read, then the option will be treated
184     literally, and not removed.
185
186     Options in FILE are separated by whitespace.  A whitespace
187     character may be included in an option by surrounding the entire
188     option in either single or double quotes.  Any character
189     (including a backslash) may be included by prefixing the character
190     to be included with a backslash.  The FILE may itself contain
191     additional @FILE options; any such options will be processed
192     recursively.
193
194`-a KEYWORD'
195     This option is supported for HP/UX compatibility.  The KEYWORD
196     argument must be one of the strings `archive', `shared', or
197     `default'.  `-aarchive' is functionally equivalent to `-Bstatic',
198     and the other two keywords are functionally equivalent to
199     `-Bdynamic'.  This option may be used any number of times.
200
201`--audit AUDITLIB'
202     Adds AUDITLIB to the `DT_AUDIT' entry of the dynamic section.
203     AUDITLIB is not checked for existence, nor will it use the
204     DT_SONAME specified in the library.  If specified multiple times
205     `DT_AUDIT' will contain a colon separated list of audit interfaces
206     to use. If the linker finds an object with an audit entry while
207     searching for shared libraries, it will add a corresponding
208     `DT_DEPAUDIT' entry in the output file.  This option is only
209     meaningful on ELF platforms supporting the rtld-audit interface.
210
211`-A ARCHITECTURE'
212`--architecture=ARCHITECTURE'
213     In the current release of `ld', this option is useful only for the
214     Intel 960 family of architectures.  In that `ld' configuration, the
215     ARCHITECTURE argument identifies the particular architecture in
216     the 960 family, enabling some safeguards and modifying the
217     archive-library search path.  *Note `ld' and the Intel 960 family:
218     i960, for details.
219
220     Future releases of `ld' may support similar functionality for
221     other architecture families.
222
223`-b INPUT-FORMAT'
224`--format=INPUT-FORMAT'
225     `ld' may be configured to support more than one kind of object
226     file.  If your `ld' is configured this way, you can use the `-b'
227     option to specify the binary format for input object files that
228     follow this option on the command line.  Even when `ld' is
229     configured to support alternative object formats, you don't
230     usually need to specify this, as `ld' should be configured to
231     expect as a default input format the most usual format on each
232     machine.  INPUT-FORMAT is a text string, the name of a particular
233     format supported by the BFD libraries.  (You can list the
234     available binary formats with `objdump -i'.)  *Note BFD::.
235
236     You may want to use this option if you are linking files with an
237     unusual binary format.  You can also use `-b' to switch formats
238     explicitly (when linking object files of different formats), by
239     including `-b INPUT-FORMAT' before each group of object files in a
240     particular format.
241
242     The default format is taken from the environment variable
243     `GNUTARGET'.  *Note Environment::.  You can also define the input
244     format from a script, using the command `TARGET'; see *Note Format
245     Commands::.
246
247`-c MRI-COMMANDFILE'
248`--mri-script=MRI-COMMANDFILE'
249     For compatibility with linkers produced by MRI, `ld' accepts script
250     files written in an alternate, restricted command language,
251     described in *Note MRI Compatible Script Files: MRI.  Introduce
252     MRI script files with the option `-c'; use the `-T' option to run
253     linker scripts written in the general-purpose `ld' scripting
254     language.  If MRI-CMDFILE does not exist, `ld' looks for it in the
255     directories specified by any `-L' options.
256
257`-d'
258`-dc'
259`-dp'
260     These three options are equivalent; multiple forms are supported
261     for compatibility with other linkers.  They assign space to common
262     symbols even if a relocatable output file is specified (with
263     `-r').  The script command `FORCE_COMMON_ALLOCATION' has the same
264     effect.  *Note Miscellaneous Commands::.
265
266`--depaudit AUDITLIB'
267`-P AUDITLIB'
268     Adds AUDITLIB to the `DT_DEPAUDIT' entry of the dynamic section.
269     AUDITLIB is not checked for existence, nor will it use the
270     DT_SONAME specified in the library.  If specified multiple times
271     `DT_DEPAUDIT' will contain a colon separated list of audit
272     interfaces to use.  This option is only meaningful on ELF
273     platforms supporting the rtld-audit interface.  The -P option is
274     provided for Solaris compatibility.
275
276`-e ENTRY'
277`--entry=ENTRY'
278     Use ENTRY as the explicit symbol for beginning execution of your
279     program, rather than the default entry point.  If there is no
280     symbol named ENTRY, the linker will try to parse ENTRY as a number,
281     and use that as the entry address (the number will be interpreted
282     in base 10; you may use a leading `0x' for base 16, or a leading
283     `0' for base 8).  *Note Entry Point::, for a discussion of defaults
284     and other ways of specifying the entry point.
285
286`--exclude-libs LIB,LIB,...'
287     Specifies a list of archive libraries from which symbols should
288     not be automatically exported.  The library names may be delimited
289     by commas or colons.  Specifying `--exclude-libs ALL' excludes
290     symbols in all archive libraries from automatic export.  This
291     option is available only for the i386 PE targeted port of the
292     linker and for ELF targeted ports.  For i386 PE, symbols
293     explicitly listed in a .def file are still exported, regardless of
294     this option.  For ELF targeted ports, symbols affected by this
295     option will be treated as hidden.
296
297`--exclude-modules-for-implib MODULE,MODULE,...'
298     Specifies a list of object files or archive members, from which
299     symbols should not be automatically exported, but which should be
300     copied wholesale into the import library being generated during
301     the link.  The module names may be delimited by commas or colons,
302     and must match exactly the filenames used by `ld' to open the
303     files; for archive members, this is simply the member name, but
304     for object files the name listed must include and match precisely
305     any path used to specify the input file on the linker's
306     command-line.  This option is available only for the i386 PE
307     targeted port of the linker.  Symbols explicitly listed in a .def
308     file are still exported, regardless of this option.
309
310`-E'
311`--export-dynamic'
312`--no-export-dynamic'
313     When creating a dynamically linked executable, using the `-E'
314     option or the `--export-dynamic' option causes the linker to add
315     all symbols to the dynamic symbol table.  The dynamic symbol table
316     is the set of symbols which are visible from dynamic objects at
317     run time.
318
319     If you do not use either of these options (or use the
320     `--no-export-dynamic' option to restore the default behavior), the
321     dynamic symbol table will normally contain only those symbols
322     which are referenced by some dynamic object mentioned in the link.
323
324     If you use `dlopen' to load a dynamic object which needs to refer
325     back to the symbols defined by the program, rather than some other
326     dynamic object, then you will probably need to use this option when
327     linking the program itself.
328
329     You can also use the dynamic list to control what symbols should
330     be added to the dynamic symbol table if the output format supports
331     it.  See the description of `--dynamic-list'.
332
333     Note that this option is specific to ELF targeted ports.  PE
334     targets support a similar function to export all symbols from a
335     DLL or EXE; see the description of `--export-all-symbols' below.
336
337`-EB'
338     Link big-endian objects.  This affects the default output format.
339
340`-EL'
341     Link little-endian objects.  This affects the default output
342     format.
343
344`-f NAME'
345`--auxiliary=NAME'
346     When creating an ELF shared object, set the internal DT_AUXILIARY
347     field to the specified name.  This tells the dynamic linker that
348     the symbol table of the shared object should be used as an
349     auxiliary filter on the symbol table of the shared object NAME.
350
351     If you later link a program against this filter object, then, when
352     you run the program, the dynamic linker will see the DT_AUXILIARY
353     field.  If the dynamic linker resolves any symbols from the filter
354     object, it will first check whether there is a definition in the
355     shared object NAME.  If there is one, it will be used instead of
356     the definition in the filter object.  The shared object NAME need
357     not exist.  Thus the shared object NAME may be used to provide an
358     alternative implementation of certain functions, perhaps for
359     debugging or for machine specific performance.
360
361     This option may be specified more than once.  The DT_AUXILIARY
362     entries will be created in the order in which they appear on the
363     command line.
364
365`-F NAME'
366`--filter=NAME'
367     When creating an ELF shared object, set the internal DT_FILTER
368     field to the specified name.  This tells the dynamic linker that
369     the symbol table of the shared object which is being created
370     should be used as a filter on the symbol table of the shared
371     object NAME.
372
373     If you later link a program against this filter object, then, when
374     you run the program, the dynamic linker will see the DT_FILTER
375     field.  The dynamic linker will resolve symbols according to the
376     symbol table of the filter object as usual, but it will actually
377     link to the definitions found in the shared object NAME.  Thus the
378     filter object can be used to select a subset of the symbols
379     provided by the object NAME.
380
381     Some older linkers used the `-F' option throughout a compilation
382     toolchain for specifying object-file format for both input and
383     output object files.  The GNU linker uses other mechanisms for
384     this purpose: the `-b', `--format', `--oformat' options, the
385     `TARGET' command in linker scripts, and the `GNUTARGET'
386     environment variable.  The GNU linker will ignore the `-F' option
387     when not creating an ELF shared object.
388
389`-fini=NAME'
390     When creating an ELF executable or shared object, call NAME when
391     the executable or shared object is unloaded, by setting DT_FINI to
392     the address of the function.  By default, the linker uses `_fini'
393     as the function to call.
394
395`-g'
396     Ignored.  Provided for compatibility with other tools.
397
398`-G VALUE'
399`--gpsize=VALUE'
400     Set the maximum size of objects to be optimized using the GP
401     register to SIZE.  This is only meaningful for object file formats
402     such as MIPS ECOFF which supports putting large and small objects
403     into different sections.  This is ignored for other object file
404     formats.
405
406`-h NAME'
407`-soname=NAME'
408     When creating an ELF shared object, set the internal DT_SONAME
409     field to the specified name.  When an executable is linked with a
410     shared object which has a DT_SONAME field, then when the
411     executable is run the dynamic linker will attempt to load the
412     shared object specified by the DT_SONAME field rather than the
413     using the file name given to the linker.
414
415`-i'
416     Perform an incremental link (same as option `-r').
417
418`-init=NAME'
419     When creating an ELF executable or shared object, call NAME when
420     the executable or shared object is loaded, by setting DT_INIT to
421     the address of the function.  By default, the linker uses `_init'
422     as the function to call.
423
424`-l NAMESPEC'
425`--library=NAMESPEC'
426     Add the archive or object file specified by NAMESPEC to the list
427     of files to link.  This option may be used any number of times.
428     If NAMESPEC is of the form `:FILENAME', `ld' will search the
429     library path for a file called FILENAME, otherwise it will search
430     the library path for a file called `libNAMESPEC.a'.
431
432     On systems which support shared libraries, `ld' may also search for
433     files other than `libNAMESPEC.a'.  Specifically, on ELF and SunOS
434     systems, `ld' will search a directory for a library called
435     `libNAMESPEC.so' before searching for one called `libNAMESPEC.a'.
436     (By convention, a `.so' extension indicates a shared library.)
437     Note that this behavior does not apply to `:FILENAME', which
438     always specifies a file called FILENAME.
439
440     The linker will search an archive only once, at the location where
441     it is specified on the command line.  If the archive defines a
442     symbol which was undefined in some object which appeared before
443     the archive on the command line, the linker will include the
444     appropriate file(s) from the archive.  However, an undefined
445     symbol in an object appearing later on the command line will not
446     cause the linker to search the archive again.
447
448     See the `-(' option for a way to force the linker to search
449     archives multiple times.
450
451     You may list the same archive multiple times on the command line.
452
453     This type of archive searching is standard for Unix linkers.
454     However, if you are using `ld' on AIX, note that it is different
455     from the behaviour of the AIX linker.
456
457`-L SEARCHDIR'
458`--library-path=SEARCHDIR'
459     Add path SEARCHDIR to the list of paths that `ld' will search for
460     archive libraries and `ld' control scripts.  You may use this
461     option any number of times.  The directories are searched in the
462     order in which they are specified on the command line.
463     Directories specified on the command line are searched before the
464     default directories.  All `-L' options apply to all `-l' options,
465     regardless of the order in which the options appear.  `-L' options
466     do not affect how `ld' searches for a linker script unless `-T'
467     option is specified.
468
469     If SEARCHDIR begins with `=', then the `=' will be replaced by the
470     "sysroot prefix", a path specified when the linker is configured.
471
472     The default set of paths searched (without being specified with
473     `-L') depends on which emulation mode `ld' is using, and in some
474     cases also on how it was configured.  *Note Environment::.
475
476     The paths can also be specified in a link script with the
477     `SEARCH_DIR' command.  Directories specified this way are searched
478     at the point in which the linker script appears in the command
479     line.
480
481`-m EMULATION'
482     Emulate the EMULATION linker.  You can list the available
483     emulations with the `--verbose' or `-V' options.
484
485     If the `-m' option is not used, the emulation is taken from the
486     `LDEMULATION' environment variable, if that is defined.
487
488     Otherwise, the default emulation depends upon how the linker was
489     configured.
490
491`-M'
492`--print-map'
493     Print a link map to the standard output.  A link map provides
494     information about the link, including the following:
495
496        * Where object files are mapped into memory.
497
498        * How common symbols are allocated.
499
500        * All archive members included in the link, with a mention of
501          the symbol which caused the archive member to be brought in.
502
503        * The values assigned to symbols.
504
505          Note - symbols whose values are computed by an expression
506          which involves a reference to a previous value of the same
507          symbol may not have correct result displayed in the link map.
508          This is because the linker discards intermediate results and
509          only retains the final value of an expression.  Under such
510          circumstances the linker will display the final value
511          enclosed by square brackets.  Thus for example a linker
512          script containing:
513
514                  foo = 1
515                  foo = foo * 4
516                  foo = foo + 8
517
518          will produce the following output in the link map if the `-M'
519          option is used:
520
521                  0x00000001                foo = 0x1
522                  [0x0000000c]                foo = (foo * 0x4)
523                  [0x0000000c]                foo = (foo + 0x8)
524
525          See *Note Expressions:: for more information about
526          expressions in linker scripts.
527
528`-n'
529`--nmagic'
530     Turn off page alignment of sections, and disable linking against
531     shared libraries.  If the output format supports Unix style magic
532     numbers, mark the output as `NMAGIC'.
533
534`-N'
535`--omagic'
536     Set the text and data sections to be readable and writable.  Also,
537     do not page-align the data segment, and disable linking against
538     shared libraries.  If the output format supports Unix style magic
539     numbers, mark the output as `OMAGIC'. Note: Although a writable
540     text section is allowed for PE-COFF targets, it does not conform
541     to the format specification published by Microsoft.
542
543`--no-omagic'
544     This option negates most of the effects of the `-N' option.  It
545     sets the text section to be read-only, and forces the data segment
546     to be page-aligned.  Note - this option does not enable linking
547     against shared libraries.  Use `-Bdynamic' for this.
548
549`-o OUTPUT'
550`--output=OUTPUT'
551     Use OUTPUT as the name for the program produced by `ld'; if this
552     option is not specified, the name `a.out' is used by default.  The
553     script command `OUTPUT' can also specify the output file name.
554
555`-O LEVEL'
556     If LEVEL is a numeric values greater than zero `ld' optimizes the
557     output.  This might take significantly longer and therefore
558     probably should only be enabled for the final binary.  At the
559     moment this option only affects ELF shared library generation.
560     Future releases of the linker may make more use of this option.
561     Also currently there is no difference in the linker's behaviour
562     for different non-zero values of this option.  Again this may
563     change with future releases.
564
565`-q'
566`--emit-relocs'
567     Leave relocation sections and contents in fully linked executables.
568     Post link analysis and optimization tools may need this
569     information in order to perform correct modifications of
570     executables.  This results in larger executables.
571
572     This option is currently only supported on ELF platforms.
573
574`--force-dynamic'
575     Force the output file to have dynamic sections.  This option is
576     specific to VxWorks targets.
577
578`-r'
579`--relocatable'
580     Generate relocatable output--i.e., generate an output file that
581     can in turn serve as input to `ld'.  This is often called "partial
582     linking".  As a side effect, in environments that support standard
583     Unix magic numbers, this option also sets the output file's magic
584     number to `OMAGIC'.  If this option is not specified, an absolute
585     file is produced.  When linking C++ programs, this option _will
586     not_ resolve references to constructors; to do that, use `-Ur'.
587
588     When an input file does not have the same format as the output
589     file, partial linking is only supported if that input file does
590     not contain any relocations.  Different output formats can have
591     further restrictions; for example some `a.out'-based formats do
592     not support partial linking with input files in other formats at
593     all.
594
595     This option does the same thing as `-i'.
596
597`-R FILENAME'
598`--just-symbols=FILENAME'
599     Read symbol names and their addresses from FILENAME, but do not
600     relocate it or include it in the output.  This allows your output
601     file to refer symbolically to absolute locations of memory defined
602     in other programs.  You may use this option more than once.
603
604     For compatibility with other ELF linkers, if the `-R' option is
605     followed by a directory name, rather than a file name, it is
606     treated as the `-rpath' option.
607
608`-s'
609`--strip-all'
610     Omit all symbol information from the output file.
611
612`-S'
613`--strip-debug'
614     Omit debugger symbol information (but not all symbols) from the
615     output file.
616
617`-t'
618`--trace'
619     Print the names of the input files as `ld' processes them.
620
621`-T SCRIPTFILE'
622`--script=SCRIPTFILE'
623     Use SCRIPTFILE as the linker script.  This script replaces `ld''s
624     default linker script (rather than adding to it), so COMMANDFILE
625     must specify everything necessary to describe the output file.
626     *Note Scripts::.  If SCRIPTFILE does not exist in the current
627     directory, `ld' looks for it in the directories specified by any
628     preceding `-L' options.  Multiple `-T' options accumulate.
629
630`-dT SCRIPTFILE'
631`--default-script=SCRIPTFILE'
632     Use SCRIPTFILE as the default linker script.  *Note Scripts::.
633
634     This option is similar to the `--script' option except that
635     processing of the script is delayed until after the rest of the
636     command line has been processed.  This allows options placed after
637     the `--default-script' option on the command line to affect the
638     behaviour of the linker script, which can be important when the
639     linker command line cannot be directly controlled by the user.
640     (eg because the command line is being constructed by another tool,
641     such as `gcc').
642
643`-u SYMBOL'
644`--undefined=SYMBOL'
645     Force SYMBOL to be entered in the output file as an undefined
646     symbol.  Doing this may, for example, trigger linking of additional
647     modules from standard libraries.  `-u' may be repeated with
648     different option arguments to enter additional undefined symbols.
649     This option is equivalent to the `EXTERN' linker script command.
650
651`-Ur'
652     For anything other than C++ programs, this option is equivalent to
653     `-r': it generates relocatable output--i.e., an output file that
654     can in turn serve as input to `ld'.  When linking C++ programs,
655     `-Ur' _does_ resolve references to constructors, unlike `-r'.  It
656     does not work to use `-Ur' on files that were themselves linked
657     with `-Ur'; once the constructor table has been built, it cannot
658     be added to.  Use `-Ur' only for the last partial link, and `-r'
659     for the others.
660
661`--unique[=SECTION]'
662     Creates a separate output section for every input section matching
663     SECTION, or if the optional wildcard SECTION argument is missing,
664     for every orphan input section.  An orphan section is one not
665     specifically mentioned in a linker script.  You may use this option
666     multiple times on the command line;  It prevents the normal
667     merging of input sections with the same name, overriding output
668     section assignments in a linker script.
669
670`-v'
671`--version'
672`-V'
673     Display the version number for `ld'.  The `-V' option also lists
674     the supported emulations.
675
676`-x'
677`--discard-all'
678     Delete all local symbols.
679
680`-X'
681`--discard-locals'
682     Delete all temporary local symbols.  (These symbols start with
683     system-specific local label prefixes, typically `.L' for ELF
684     systems or `L' for traditional a.out systems.)
685
686`-y SYMBOL'
687`--trace-symbol=SYMBOL'
688     Print the name of each linked file in which SYMBOL appears.  This
689     option may be given any number of times.  On many systems it is
690     necessary to prepend an underscore.
691
692     This option is useful when you have an undefined symbol in your
693     link but don't know where the reference is coming from.
694
695`-Y PATH'
696     Add PATH to the default library search path.  This option exists
697     for Solaris compatibility.
698
699`-z KEYWORD'
700     The recognized keywords are:
701    `combreloc'
702          Combines multiple reloc sections and sorts them to make
703          dynamic symbol lookup caching possible.
704
705    `defs'
706          Disallows undefined symbols in object files.  Undefined
707          symbols in shared libraries are still allowed.
708
709    `execstack'
710          Marks the object as requiring executable stack.
711
712    `initfirst'
713          This option is only meaningful when building a shared object.
714          It marks the object so that its runtime initialization will
715          occur before the runtime initialization of any other objects
716          brought into the process at the same time.  Similarly the
717          runtime finalization of the object will occur after the
718          runtime finalization of any other objects.
719
720    `interpose'
721          Marks the object that its symbol table interposes before all
722          symbols but the primary executable.
723
724    `lazy'
725          When generating an executable or shared library, mark it to
726          tell the dynamic linker to defer function call resolution to
727          the point when the function is called (lazy binding), rather
728          than at load time.  Lazy binding is the default.
729
730    `loadfltr'
731          Marks  the object that its filters be processed immediately at
732          runtime.
733
734    `muldefs'
735          Allows multiple definitions.
736
737    `nocombreloc'
738          Disables multiple reloc sections combining.
739
740    `nocopyreloc'
741          Disables production of copy relocs.
742
743    `nodefaultlib'
744          Marks the object that the search for dependencies of this
745          object will ignore any default library search paths.
746
747    `nodelete'
748          Marks the object shouldn't be unloaded at runtime.
749
750    `nodlopen'
751          Marks the object not available to `dlopen'.
752
753    `nodump'
754          Marks the object can not be dumped by `dldump'.
755
756    `noexecstack'
757          Marks the object as not requiring executable stack.
758
759    `norelro'
760          Don't create an ELF `PT_GNU_RELRO' segment header in the
761          object.
762
763    `now'
764          When generating an executable or shared library, mark it to
765          tell the dynamic linker to resolve all symbols when the
766          program is started, or when the shared library is linked to
767          using dlopen, instead of deferring function call resolution
768          to the point when the function is first called.
769
770    `origin'
771          Marks the object may contain $ORIGIN.
772
773    `relro'
774          Create an ELF `PT_GNU_RELRO' segment header in the object.
775
776    `max-page-size=VALUE'
777          Set the emulation maximum page size to VALUE.
778
779    `common-page-size=VALUE'
780          Set the emulation common page size to VALUE.
781
782
783     Other keywords are ignored for Solaris compatibility.
784
785`-( ARCHIVES -)'
786`--start-group ARCHIVES --end-group'
787     The ARCHIVES should be a list of archive files.  They may be
788     either explicit file names, or `-l' options.
789
790     The specified archives are searched repeatedly until no new
791     undefined references are created.  Normally, an archive is
792     searched only once in the order that it is specified on the
793     command line.  If a symbol in that archive is needed to resolve an
794     undefined symbol referred to by an object in an archive that
795     appears later on the command line, the linker would not be able to
796     resolve that reference.  By grouping the archives, they all be
797     searched repeatedly until all possible references are resolved.
798
799     Using this option has a significant performance cost.  It is best
800     to use it only when there are unavoidable circular references
801     between two or more archives.
802
803`--accept-unknown-input-arch'
804`--no-accept-unknown-input-arch'
805     Tells the linker to accept input files whose architecture cannot be
806     recognised.  The assumption is that the user knows what they are
807     doing and deliberately wants to link in these unknown input files.
808     This was the default behaviour of the linker, before release
809     2.14.  The default behaviour from release 2.14 onwards is to
810     reject such input files, and so the `--accept-unknown-input-arch'
811     option has been added to restore the old behaviour.
812
813`--as-needed'
814`--no-as-needed'
815     This option affects ELF DT_NEEDED tags for dynamic libraries
816     mentioned on the command line after the `--as-needed' option.
817     Normally the linker will add a DT_NEEDED tag for each dynamic
818     library mentioned on the command line, regardless of whether the
819     library is actually needed or not.  `--as-needed' causes a
820     DT_NEEDED tag to only be emitted for a library that satisfies an
821     undefined symbol reference from a regular object file or, if the
822     library is not found in the DT_NEEDED lists of other libraries
823     linked up to that point, an undefined symbol reference from
824     another dynamic library.  `--no-as-needed' restores the default
825     behaviour.
826
827`--add-needed'
828`--no-add-needed'
829     These two options have been deprecated because of the similarity of
830     their names to the `--as-needed' and `--no-as-needed' options.
831     They have been replaced by `--copy-dt-needed-entries' and
832     `--no-copy-dt-needed-entries'.
833
834`-assert KEYWORD'
835     This option is ignored for SunOS compatibility.
836
837`-Bdynamic'
838`-dy'
839`-call_shared'
840     Link against dynamic libraries.  This is only meaningful on
841     platforms for which shared libraries are supported.  This option
842     is normally the default on such platforms.  The different variants
843     of this option are for compatibility with various systems.  You
844     may use this option multiple times on the command line: it affects
845     library searching for `-l' options which follow it.
846
847`-Bgroup'
848     Set the `DF_1_GROUP' flag in the `DT_FLAGS_1' entry in the dynamic
849     section.  This causes the runtime linker to handle lookups in this
850     object and its dependencies to be performed only inside the group.
851     `--unresolved-symbols=report-all' is implied.  This option is only
852     meaningful on ELF platforms which support shared libraries.
853
854`-Bstatic'
855`-dn'
856`-non_shared'
857`-static'
858     Do not link against shared libraries.  This is only meaningful on
859     platforms for which shared libraries are supported.  The different
860     variants of this option are for compatibility with various
861     systems.  You may use this option multiple times on the command
862     line: it affects library searching for `-l' options which follow
863     it.  This option also implies `--unresolved-symbols=report-all'.
864     This option can be used with `-shared'.  Doing so means that a
865     shared library is being created but that all of the library's
866     external references must be resolved by pulling in entries from
867     static libraries.
868
869`-Bsymbolic'
870     When creating a shared library, bind references to global symbols
871     to the definition within the shared library, if any.  Normally, it
872     is possible for a program linked against a shared library to
873     override the definition within the shared library.  This option is
874     only meaningful on ELF platforms which support shared libraries.
875
876`-Bsymbolic-functions'
877     When creating a shared library, bind references to global function
878     symbols to the definition within the shared library, if any.  This
879     option is only meaningful on ELF platforms which support shared
880     libraries.
881
882`--dynamic-list=DYNAMIC-LIST-FILE'
883     Specify the name of a dynamic list file to the linker.  This is
884     typically used when creating shared libraries to specify a list of
885     global symbols whose references shouldn't be bound to the
886     definition within the shared library, or creating dynamically
887     linked executables to specify a list of symbols which should be
888     added to the symbol table in the executable.  This option is only
889     meaningful on ELF platforms which support shared libraries.
890
891     The format of the dynamic list is the same as the version node
892     without scope and node name.  See *Note VERSION:: for more
893     information.
894
895`--dynamic-list-data'
896     Include all global data symbols to the dynamic list.
897
898`--dynamic-list-cpp-new'
899     Provide the builtin dynamic list for C++ operator new and delete.
900     It is mainly useful for building shared libstdc++.
901
902`--dynamic-list-cpp-typeinfo'
903     Provide the builtin dynamic list for C++ runtime type
904     identification.
905
906`--check-sections'
907`--no-check-sections'
908     Asks the linker _not_ to check section addresses after they have
909     been assigned to see if there are any overlaps.  Normally the
910     linker will perform this check, and if it finds any overlaps it
911     will produce suitable error messages.  The linker does know about,
912     and does make allowances for sections in overlays.  The default
913     behaviour can be restored by using the command line switch
914     `--check-sections'.  Section overlap is not usually checked for
915     relocatable links.  You can force checking in that case by using
916     the `--check-sections' option.
917
918`--copy-dt-needed-entries'
919`--no-copy-dt-needed-entries'
920     This option affects the treatment of dynamic libraries referred to
921     by DT_NEEDED tags _inside_ ELF dynamic libraries mentioned on the
922     command line.  Normally the linker will add a DT_NEEDED tag to the
923     output binary for each library mentioned in a DT_NEEDED tag in an
924     input dynamic library.  With `--no-copy-dt-needed-entries'
925     specified on the command line however any dynamic libraries that
926     follow it will have their DT_NEEDED entries ignored.  The default
927     behaviour can be restored with `--copy-dt-needed-entries'.
928
929     This option also has an effect on the resolution of symbols in
930     dynamic libraries.  With the default setting dynamic libraries
931     mentioned on the command line will be recursively searched,
932     following their DT_NEEDED tags to other libraries, in order to
933     resolve symbols required by the output binary.  With
934     `--no-copy-dt-needed-entries' specified however the searching of
935     dynamic libraries that follow it will stop with the dynamic
936     library itself.  No DT_NEEDED links will be traversed to resolve
937     symbols.
938
939`--cref'
940     Output a cross reference table.  If a linker map file is being
941     generated, the cross reference table is printed to the map file.
942     Otherwise, it is printed on the standard output.
943
944     The format of the table is intentionally simple, so that it may be
945     easily processed by a script if necessary.  The symbols are
946     printed out, sorted by name.  For each symbol, a list of file
947     names is given.  If the symbol is defined, the first file listed
948     is the location of the definition.  The remaining files contain
949     references to the symbol.
950
951`--no-define-common'
952     This option inhibits the assignment of addresses to common symbols.
953     The script command `INHIBIT_COMMON_ALLOCATION' has the same effect.
954     *Note Miscellaneous Commands::.
955
956     The `--no-define-common' option allows decoupling the decision to
957     assign addresses to Common symbols from the choice of the output
958     file type; otherwise a non-Relocatable output type forces
959     assigning addresses to Common symbols.  Using `--no-define-common'
960     allows Common symbols that are referenced from a shared library to
961     be assigned addresses only in the main program.  This eliminates
962     the unused duplicate space in the shared library, and also
963     prevents any possible confusion over resolving to the wrong
964     duplicate when there are many dynamic modules with specialized
965     search paths for runtime symbol resolution.
966
967`--defsym=SYMBOL=EXPRESSION'
968     Create a global symbol in the output file, containing the absolute
969     address given by EXPRESSION.  You may use this option as many
970     times as necessary to define multiple symbols in the command line.
971     A limited form of arithmetic is supported for the EXPRESSION in
972     this context: you may give a hexadecimal constant or the name of
973     an existing symbol, or use `+' and `-' to add or subtract
974     hexadecimal constants or symbols.  If you need more elaborate
975     expressions, consider using the linker command language from a
976     script (*note Assignment: Symbol Definitions: Assignments.).
977     _Note:_ there should be no white space between SYMBOL, the equals
978     sign ("<=>"), and EXPRESSION.
979
980`--demangle[=STYLE]'
981`--no-demangle'
982     These options control whether to demangle symbol names in error
983     messages and other output.  When the linker is told to demangle,
984     it tries to present symbol names in a readable fashion: it strips
985     leading underscores if they are used by the object file format,
986     and converts C++ mangled symbol names into user readable names.
987     Different compilers have different mangling styles.  The optional
988     demangling style argument can be used to choose an appropriate
989     demangling style for your compiler.  The linker will demangle by
990     default unless the environment variable `COLLECT_NO_DEMANGLE' is
991     set.  These options may be used to override the default.
992
993`-IFILE'
994`--dynamic-linker=FILE'
995     Set the name of the dynamic linker.  This is only meaningful when
996     generating dynamically linked ELF executables.  The default dynamic
997     linker is normally correct; don't use this unless you know what
998     you are doing.
999
1000`--fatal-warnings'
1001`--no-fatal-warnings'
1002     Treat all warnings as errors.  The default behaviour can be
1003     restored with the option `--no-fatal-warnings'.
1004
1005`--force-exe-suffix'
1006     Make sure that an output file has a .exe suffix.
1007
1008     If a successfully built fully linked output file does not have a
1009     `.exe' or `.dll' suffix, this option forces the linker to copy the
1010     output file to one of the same name with a `.exe' suffix. This
1011     option is useful when using unmodified Unix makefiles on a
1012     Microsoft Windows host, since some versions of Windows won't run
1013     an image unless it ends in a `.exe' suffix.
1014
1015`--gc-sections'
1016`--no-gc-sections'
1017     Enable garbage collection of unused input sections.  It is ignored
1018     on targets that do not support this option.  The default behaviour
1019     (of not performing this garbage collection) can be restored by
1020     specifying `--no-gc-sections' on the command line.
1021
1022     `--gc-sections' decides which input sections are used by examining
1023     symbols and relocations.  The section containing the entry symbol
1024     and all sections containing symbols undefined on the command-line
1025     will be kept, as will sections containing symbols referenced by
1026     dynamic objects.  Note that when building shared libraries, the
1027     linker must assume that any visible symbol is referenced.  Once
1028     this initial set of sections has been determined, the linker
1029     recursively marks as used any section referenced by their
1030     relocations.  See `--entry' and `--undefined'.
1031
1032     This option can be set when doing a partial link (enabled with
1033     option `-r').  In this case the root of symbols kept must be
1034     explicitly specified either by an `--entry' or `--undefined'
1035     option or by a `ENTRY' command in the linker script.
1036
1037`--print-gc-sections'
1038`--no-print-gc-sections'
1039     List all sections removed by garbage collection.  The listing is
1040     printed on stderr.  This option is only effective if garbage
1041     collection has been enabled via the `--gc-sections') option.  The
1042     default behaviour (of not listing the sections that are removed)
1043     can be restored by specifying `--no-print-gc-sections' on the
1044     command line.
1045
1046`--help'
1047     Print a summary of the command-line options on the standard output
1048     and exit.
1049
1050`--target-help'
1051     Print a summary of all target specific options on the standard
1052     output and exit.
1053
1054`-Map=MAPFILE'
1055     Print a link map to the file MAPFILE.  See the description of the
1056     `-M' option, above.
1057
1058`--no-keep-memory'
1059     `ld' normally optimizes for speed over memory usage by caching the
1060     symbol tables of input files in memory.  This option tells `ld' to
1061     instead optimize for memory usage, by rereading the symbol tables
1062     as necessary.  This may be required if `ld' runs out of memory
1063     space while linking a large executable.
1064
1065`--no-undefined'
1066`-z defs'
1067     Report unresolved symbol references from regular object files.
1068     This is done even if the linker is creating a non-symbolic shared
1069     library.  The switch `--[no-]allow-shlib-undefined' controls the
1070     behaviour for reporting unresolved references found in shared
1071     libraries being linked in.
1072
1073`--allow-multiple-definition'
1074`-z muldefs'
1075     Normally when a symbol is defined multiple times, the linker will
1076     report a fatal error. These options allow multiple definitions and
1077     the first definition will be used.
1078
1079`--allow-shlib-undefined'
1080`--no-allow-shlib-undefined'
1081     Allows or disallows undefined symbols in shared libraries.  This
1082     switch is similar to `--no-undefined' except that it determines
1083     the behaviour when the undefined symbols are in a shared library
1084     rather than a regular object file.  It does not affect how
1085     undefined symbols in regular object files are handled.
1086
1087     The default behaviour is to report errors for any undefined symbols
1088     referenced in shared libraries if the linker is being used to
1089     create an executable, but to allow them if the linker is being
1090     used to create a shared library.
1091
1092     The reasons for allowing undefined symbol references in shared
1093     libraries specified at link time are that:
1094
1095        * A shared library specified at link time may not be the same
1096          as the one that is available at load time, so the symbol
1097          might actually be resolvable at load time.
1098
1099        * There are some operating systems, eg BeOS and HPPA, where
1100          undefined symbols in shared libraries are normal.
1101
1102          The BeOS kernel for example patches shared libraries at load
1103          time to select whichever function is most appropriate for the
1104          current architecture.  This is used, for example, to
1105          dynamically select an appropriate memset function.
1106
1107`--no-undefined-version'
1108     Normally when a symbol has an undefined version, the linker will
1109     ignore it. This option disallows symbols with undefined version
1110     and a fatal error will be issued instead.
1111
1112`--default-symver'
1113     Create and use a default symbol version (the soname) for
1114     unversioned exported symbols.
1115
1116`--default-imported-symver'
1117     Create and use a default symbol version (the soname) for
1118     unversioned imported symbols.
1119
1120`--no-warn-mismatch'
1121     Normally `ld' will give an error if you try to link together input
1122     files that are mismatched for some reason, perhaps because they
1123     have been compiled for different processors or for different
1124     endiannesses.  This option tells `ld' that it should silently
1125     permit such possible errors.  This option should only be used with
1126     care, in cases when you have taken some special action that
1127     ensures that the linker errors are inappropriate.
1128
1129`--no-warn-search-mismatch'
1130     Normally `ld' will give a warning if it finds an incompatible
1131     library during a library search.  This option silences the warning.
1132
1133`--no-whole-archive'
1134     Turn off the effect of the `--whole-archive' option for subsequent
1135     archive files.
1136
1137`--noinhibit-exec'
1138     Retain the executable output file whenever it is still usable.
1139     Normally, the linker will not produce an output file if it
1140     encounters errors during the link process; it exits without
1141     writing an output file when it issues any error whatsoever.
1142
1143`-nostdlib'
1144     Only search library directories explicitly specified on the
1145     command line.  Library directories specified in linker scripts
1146     (including linker scripts specified on the command line) are
1147     ignored.
1148
1149`--oformat=OUTPUT-FORMAT'
1150     `ld' may be configured to support more than one kind of object
1151     file.  If your `ld' is configured this way, you can use the
1152     `--oformat' option to specify the binary format for the output
1153     object file.  Even when `ld' is configured to support alternative
1154     object formats, you don't usually need to specify this, as `ld'
1155     should be configured to produce as a default output format the most
1156     usual format on each machine.  OUTPUT-FORMAT is a text string, the
1157     name of a particular format supported by the BFD libraries.  (You
1158     can list the available binary formats with `objdump -i'.)  The
1159     script command `OUTPUT_FORMAT' can also specify the output format,
1160     but this option overrides it.  *Note BFD::.
1161
1162`-pie'
1163`--pic-executable'
1164     Create a position independent executable.  This is currently only
1165     supported on ELF platforms.  Position independent executables are
1166     similar to shared libraries in that they are relocated by the
1167     dynamic linker to the virtual address the OS chooses for them
1168     (which can vary between invocations).  Like normal dynamically
1169     linked executables they can be executed and symbols defined in the
1170     executable cannot be overridden by shared libraries.
1171
1172`-qmagic'
1173     This option is ignored for Linux compatibility.
1174
1175`-Qy'
1176     This option is ignored for SVR4 compatibility.
1177
1178`--relax'
1179`--no-relax'
1180     An option with machine dependent effects.  This option is only
1181     supported on a few targets.  *Note `ld' and the H8/300: H8/300.
1182     *Note `ld' and the Intel 960 family: i960.  *Note `ld' and Xtensa
1183     Processors: Xtensa.  *Note `ld' and the 68HC11 and 68HC12:
1184     M68HC11/68HC12.  *Note `ld' and PowerPC 32-bit ELF Support:
1185     PowerPC ELF32.
1186
1187     On some platforms the `--relax' option performs target specific,
1188     global optimizations that become possible when the linker resolves
1189     addressing in the program, such as relaxing address modes,
1190     synthesizing new instructions, selecting shorter version of current
1191     instructions, and combinig constant values.
1192
1193     On some platforms these link time global optimizations may make
1194     symbolic debugging of the resulting executable impossible.  This
1195     is known to be the case for the Matsushita MN10200 and MN10300
1196     family of processors.
1197
1198     On platforms where this is not supported, `--relax' is accepted,
1199     but ignored.
1200
1201     On platforms where `--relax' is accepted the option `--no-relax'
1202     can be used to disable the feature.
1203
1204`--retain-symbols-file=FILENAME'
1205     Retain _only_ the symbols listed in the file FILENAME, discarding
1206     all others.  FILENAME is simply a flat file, with one symbol name
1207     per line.  This option is especially useful in environments (such
1208     as VxWorks) where a large global symbol table is accumulated
1209     gradually, to conserve run-time memory.
1210
1211     `--retain-symbols-file' does _not_ discard undefined symbols, or
1212     symbols needed for relocations.
1213
1214     You may only specify `--retain-symbols-file' once in the command
1215     line.  It overrides `-s' and `-S'.
1216
1217`-rpath=DIR'
1218     Add a directory to the runtime library search path.  This is used
1219     when linking an ELF executable with shared objects.  All `-rpath'
1220     arguments are concatenated and passed to the runtime linker, which
1221     uses them to locate shared objects at runtime.  The `-rpath'
1222     option is also used when locating shared objects which are needed
1223     by shared objects explicitly included in the link; see the
1224     description of the `-rpath-link' option.  If `-rpath' is not used
1225     when linking an ELF executable, the contents of the environment
1226     variable `LD_RUN_PATH' will be used if it is defined.
1227
1228     The `-rpath' option may also be used on SunOS.  By default, on
1229     SunOS, the linker will form a runtime search patch out of all the
1230     `-L' options it is given.  If a `-rpath' option is used, the
1231     runtime search path will be formed exclusively using the `-rpath'
1232     options, ignoring the `-L' options.  This can be useful when using
1233     gcc, which adds many `-L' options which may be on NFS mounted file
1234     systems.
1235
1236     For compatibility with other ELF linkers, if the `-R' option is
1237     followed by a directory name, rather than a file name, it is
1238     treated as the `-rpath' option.
1239
1240`-rpath-link=DIR'
1241     When using ELF or SunOS, one shared library may require another.
1242     This happens when an `ld -shared' link includes a shared library
1243     as one of the input files.
1244
1245     When the linker encounters such a dependency when doing a
1246     non-shared, non-relocatable link, it will automatically try to
1247     locate the required shared library and include it in the link, if
1248     it is not included explicitly.  In such a case, the `-rpath-link'
1249     option specifies the first set of directories to search.  The
1250     `-rpath-link' option may specify a sequence of directory names
1251     either by specifying a list of names separated by colons, or by
1252     appearing multiple times.
1253
1254     This option should be used with caution as it overrides the search
1255     path that may have been hard compiled into a shared library. In
1256     such a case it is possible to use unintentionally a different
1257     search path than the runtime linker would do.
1258
1259     The linker uses the following search paths to locate required
1260     shared libraries:
1261       1. Any directories specified by `-rpath-link' options.
1262
1263       2. Any directories specified by `-rpath' options.  The difference
1264          between `-rpath' and `-rpath-link' is that directories
1265          specified by `-rpath' options are included in the executable
1266          and used at runtime, whereas the `-rpath-link' option is only
1267          effective at link time. Searching `-rpath' in this way is
1268          only supported by native linkers and cross linkers which have
1269          been configured with the `--with-sysroot' option.
1270
1271       3. On an ELF system, for native linkers, if the `-rpath' and
1272          `-rpath-link' options were not used, search the contents of
1273          the environment variable `LD_RUN_PATH'.
1274
1275       4. On SunOS, if the `-rpath' option was not used, search any
1276          directories specified using `-L' options.
1277
1278       5. For a native linker, the search the contents of the
1279          environment variable `LD_LIBRARY_PATH'.
1280
1281       6. For a native ELF linker, the directories in `DT_RUNPATH' or
1282          `DT_RPATH' of a shared library are searched for shared
1283          libraries needed by it. The `DT_RPATH' entries are ignored if
1284          `DT_RUNPATH' entries exist.
1285
1286       7. The default directories, normally `/lib' and `/usr/lib'.
1287
1288       8. For a native linker on an ELF system, if the file
1289          `/etc/ld.so.conf' exists, the list of directories found in
1290          that file.
1291
1292     If the required shared library is not found, the linker will issue
1293     a warning and continue with the link.
1294
1295`-shared'
1296`-Bshareable'
1297     Create a shared library.  This is currently only supported on ELF,
1298     XCOFF and SunOS platforms.  On SunOS, the linker will
1299     automatically create a shared library if the `-e' option is not
1300     used and there are undefined symbols in the link.
1301
1302`--sort-common'
1303`--sort-common=ascending'
1304`--sort-common=descending'
1305     This option tells `ld' to sort the common symbols by alignment in
1306     ascending or descending order when it places them in the
1307     appropriate output sections.  The symbol alignments considered are
1308     sixteen-byte or larger, eight-byte, four-byte, two-byte, and
1309     one-byte. This is to prevent gaps between symbols due to alignment
1310     constraints.  If no sorting order is specified, then descending
1311     order is assumed.
1312
1313`--sort-section=name'
1314     This option will apply `SORT_BY_NAME' to all wildcard section
1315     patterns in the linker script.
1316
1317`--sort-section=alignment'
1318     This option will apply `SORT_BY_ALIGNMENT' to all wildcard section
1319     patterns in the linker script.
1320
1321`--split-by-file[=SIZE]'
1322     Similar to `--split-by-reloc' but creates a new output section for
1323     each input file when SIZE is reached.  SIZE defaults to a size of
1324     1 if not given.
1325
1326`--split-by-reloc[=COUNT]'
1327     Tries to creates extra sections in the output file so that no
1328     single output section in the file contains more than COUNT
1329     relocations.  This is useful when generating huge relocatable
1330     files for downloading into certain real time kernels with the COFF
1331     object file format; since COFF cannot represent more than 65535
1332     relocations in a single section.  Note that this will fail to work
1333     with object file formats which do not support arbitrary sections.
1334     The linker will not split up individual input sections for
1335     redistribution, so if a single input section contains more than
1336     COUNT relocations one output section will contain that many
1337     relocations.  COUNT defaults to a value of 32768.
1338
1339`--stats'
1340     Compute and display statistics about the operation of the linker,
1341     such as execution time and memory usage.
1342
1343`--sysroot=DIRECTORY'
1344     Use DIRECTORY as the location of the sysroot, overriding the
1345     configure-time default.  This option is only supported by linkers
1346     that were configured using `--with-sysroot'.
1347
1348`--traditional-format'
1349     For some targets, the output of `ld' is different in some ways from
1350     the output of some existing linker.  This switch requests `ld' to
1351     use the traditional format instead.
1352
1353     For example, on SunOS, `ld' combines duplicate entries in the
1354     symbol string table.  This can reduce the size of an output file
1355     with full debugging information by over 30 percent.
1356     Unfortunately, the SunOS `dbx' program can not read the resulting
1357     program (`gdb' has no trouble).  The `--traditional-format' switch
1358     tells `ld' to not combine duplicate entries.
1359
1360`--section-start=SECTIONNAME=ORG'
1361     Locate a section in the output file at the absolute address given
1362     by ORG.  You may use this option as many times as necessary to
1363     locate multiple sections in the command line.  ORG must be a
1364     single hexadecimal integer; for compatibility with other linkers,
1365     you may omit the leading `0x' usually associated with hexadecimal
1366     values.  _Note:_ there should be no white space between
1367     SECTIONNAME, the equals sign ("<=>"), and ORG.
1368
1369`-Tbss=ORG'
1370`-Tdata=ORG'
1371`-Ttext=ORG'
1372     Same as `--section-start', with `.bss', `.data' or `.text' as the
1373     SECTIONNAME.
1374
1375`-Ttext-segment=ORG'
1376     When creating an ELF executable or shared object, it will set the
1377     address of the first byte of the text segment.
1378
1379`--unresolved-symbols=METHOD'
1380     Determine how to handle unresolved symbols.  There are four
1381     possible values for `method':
1382
1383    `ignore-all'
1384          Do not report any unresolved symbols.
1385
1386    `report-all'
1387          Report all unresolved symbols.  This is the default.
1388
1389    `ignore-in-object-files'
1390          Report unresolved symbols that are contained in shared
1391          libraries, but ignore them if they come from regular object
1392          files.
1393
1394    `ignore-in-shared-libs'
1395          Report unresolved symbols that come from regular object
1396          files, but ignore them if they come from shared libraries.
1397          This can be useful when creating a dynamic binary and it is
1398          known that all the shared libraries that it should be
1399          referencing are included on the linker's command line.
1400
1401     The behaviour for shared libraries on their own can also be
1402     controlled by the `--[no-]allow-shlib-undefined' option.
1403
1404     Normally the linker will generate an error message for each
1405     reported unresolved symbol but the option
1406     `--warn-unresolved-symbols' can change this to a warning.
1407
1408`--dll-verbose'
1409`--verbose[=NUMBER]'
1410     Display the version number for `ld' and list the linker emulations
1411     supported.  Display which input files can and cannot be opened.
1412     Display the linker script being used by the linker. If the
1413     optional NUMBER argument > 1, plugin symbol status will also be
1414     displayed.
1415
1416`--version-script=VERSION-SCRIPTFILE'
1417     Specify the name of a version script to the linker.  This is
1418     typically used when creating shared libraries to specify
1419     additional information about the version hierarchy for the library
1420     being created.  This option is only fully supported on ELF
1421     platforms which support shared libraries; see *Note VERSION::.  It
1422     is partially supported on PE platforms, which can use version
1423     scripts to filter symbol visibility in auto-export mode: any
1424     symbols marked `local' in the version script will not be exported.
1425     *Note WIN32::.
1426
1427`--warn-common'
1428     Warn when a common symbol is combined with another common symbol
1429     or with a symbol definition.  Unix linkers allow this somewhat
1430     sloppy practise, but linkers on some other operating systems do
1431     not.  This option allows you to find potential problems from
1432     combining global symbols.  Unfortunately, some C libraries use
1433     this practise, so you may get some warnings about symbols in the
1434     libraries as well as in your programs.
1435
1436     There are three kinds of global symbols, illustrated here by C
1437     examples:
1438
1439    `int i = 1;'
1440          A definition, which goes in the initialized data section of
1441          the output file.
1442
1443    `extern int i;'
1444          An undefined reference, which does not allocate space.  There
1445          must be either a definition or a common symbol for the
1446          variable somewhere.
1447
1448    `int i;'
1449          A common symbol.  If there are only (one or more) common
1450          symbols for a variable, it goes in the uninitialized data
1451          area of the output file.  The linker merges multiple common
1452          symbols for the same variable into a single symbol.  If they
1453          are of different sizes, it picks the largest size.  The
1454          linker turns a common symbol into a declaration, if there is
1455          a definition of the same variable.
1456
1457     The `--warn-common' option can produce five kinds of warnings.
1458     Each warning consists of a pair of lines: the first describes the
1459     symbol just encountered, and the second describes the previous
1460     symbol encountered with the same name.  One or both of the two
1461     symbols will be a common symbol.
1462
1463       1. Turning a common symbol into a reference, because there is
1464          already a definition for the symbol.
1465               FILE(SECTION): warning: common of `SYMBOL'
1466                  overridden by definition
1467               FILE(SECTION): warning: defined here
1468
1469       2. Turning a common symbol into a reference, because a later
1470          definition for the symbol is encountered.  This is the same
1471          as the previous case, except that the symbols are encountered
1472          in a different order.
1473               FILE(SECTION): warning: definition of `SYMBOL'
1474                  overriding common
1475               FILE(SECTION): warning: common is here
1476
1477       3. Merging a common symbol with a previous same-sized common
1478          symbol.
1479               FILE(SECTION): warning: multiple common
1480                  of `SYMBOL'
1481               FILE(SECTION): warning: previous common is here
1482
1483       4. Merging a common symbol with a previous larger common symbol.
1484               FILE(SECTION): warning: common of `SYMBOL'
1485                  overridden by larger common
1486               FILE(SECTION): warning: larger common is here
1487
1488       5. Merging a common symbol with a previous smaller common
1489          symbol.  This is the same as the previous case, except that
1490          the symbols are encountered in a different order.
1491               FILE(SECTION): warning: common of `SYMBOL'
1492                  overriding smaller common
1493               FILE(SECTION): warning: smaller common is here
1494
1495`--warn-constructors'
1496     Warn if any global constructors are used.  This is only useful for
1497     a few object file formats.  For formats like COFF or ELF, the
1498     linker can not detect the use of global constructors.
1499
1500`--warn-multiple-gp'
1501     Warn if multiple global pointer values are required in the output
1502     file.  This is only meaningful for certain processors, such as the
1503     Alpha.  Specifically, some processors put large-valued constants
1504     in a special section.  A special register (the global pointer)
1505     points into the middle of this section, so that constants can be
1506     loaded efficiently via a base-register relative addressing mode.
1507     Since the offset in base-register relative mode is fixed and
1508     relatively small (e.g., 16 bits), this limits the maximum size of
1509     the constant pool.  Thus, in large programs, it is often necessary
1510     to use multiple global pointer values in order to be able to
1511     address all possible constants.  This option causes a warning to
1512     be issued whenever this case occurs.
1513
1514`--warn-once'
1515     Only warn once for each undefined symbol, rather than once per
1516     module which refers to it.
1517
1518`--warn-section-align'
1519     Warn if the address of an output section is changed because of
1520     alignment.  Typically, the alignment will be set by an input
1521     section.  The address will only be changed if it not explicitly
1522     specified; that is, if the `SECTIONS' command does not specify a
1523     start address for the section (*note SECTIONS::).
1524
1525`--warn-shared-textrel'
1526     Warn if the linker adds a DT_TEXTREL to a shared object.
1527
1528`--warn-alternate-em'
1529     Warn if an object has alternate ELF machine code.
1530
1531`--warn-unresolved-symbols'
1532     If the linker is going to report an unresolved symbol (see the
1533     option `--unresolved-symbols') it will normally generate an error.
1534     This option makes it generate a warning instead.
1535
1536`--error-unresolved-symbols'
1537     This restores the linker's default behaviour of generating errors
1538     when it is reporting unresolved symbols.
1539
1540`--whole-archive'
1541     For each archive mentioned on the command line after the
1542     `--whole-archive' option, include every object file in the archive
1543     in the link, rather than searching the archive for the required
1544     object files.  This is normally used to turn an archive file into
1545     a shared library, forcing every object to be included in the
1546     resulting shared library.  This option may be used more than once.
1547
1548     Two notes when using this option from gcc: First, gcc doesn't know
1549     about this option, so you have to use `-Wl,-whole-archive'.
1550     Second, don't forget to use `-Wl,-no-whole-archive' after your
1551     list of archives, because gcc will add its own list of archives to
1552     your link and you may not want this flag to affect those as well.
1553
1554`--wrap=SYMBOL'
1555     Use a wrapper function for SYMBOL.  Any undefined reference to
1556     SYMBOL will be resolved to `__wrap_SYMBOL'.  Any undefined
1557     reference to `__real_SYMBOL' will be resolved to SYMBOL.
1558
1559     This can be used to provide a wrapper for a system function.  The
1560     wrapper function should be called `__wrap_SYMBOL'.  If it wishes
1561     to call the system function, it should call `__real_SYMBOL'.
1562
1563     Here is a trivial example:
1564
1565          void *
1566          __wrap_malloc (size_t c)
1567          {
1568            printf ("malloc called with %zu\n", c);
1569            return __real_malloc (c);
1570          }
1571
1572     If you link other code with this file using `--wrap malloc', then
1573     all calls to `malloc' will call the function `__wrap_malloc'
1574     instead.  The call to `__real_malloc' in `__wrap_malloc' will call
1575     the real `malloc' function.
1576
1577     You may wish to provide a `__real_malloc' function as well, so that
1578     links without the `--wrap' option will succeed.  If you do this,
1579     you should not put the definition of `__real_malloc' in the same
1580     file as `__wrap_malloc'; if you do, the assembler may resolve the
1581     call before the linker has a chance to wrap it to `malloc'.
1582
1583`--eh-frame-hdr'
1584     Request creation of `.eh_frame_hdr' section and ELF
1585     `PT_GNU_EH_FRAME' segment header.
1586
1587`--enable-new-dtags'
1588`--disable-new-dtags'
1589     This linker can create the new dynamic tags in ELF. But the older
1590     ELF systems may not understand them. If you specify
1591     `--enable-new-dtags', the dynamic tags will be created as needed.
1592     If you specify `--disable-new-dtags', no new dynamic tags will be
1593     created. By default, the new dynamic tags are not created. Note
1594     that those options are only available for ELF systems.
1595
1596`--hash-size=NUMBER'
1597     Set the default size of the linker's hash tables to a prime number
1598     close to NUMBER.  Increasing this value can reduce the length of
1599     time it takes the linker to perform its tasks, at the expense of
1600     increasing the linker's memory requirements.  Similarly reducing
1601     this value can reduce the memory requirements at the expense of
1602     speed.
1603
1604`--hash-style=STYLE'
1605     Set the type of linker's hash table(s).  STYLE can be either
1606     `sysv' for classic ELF `.hash' section, `gnu' for new style GNU
1607     `.gnu.hash' section or `both' for both the classic ELF `.hash' and
1608     new style GNU `.gnu.hash' hash tables.  The default is `sysv'.
1609
1610`--reduce-memory-overheads'
1611     This option reduces memory requirements at ld runtime, at the
1612     expense of linking speed.  This was introduced to select the old
1613     O(n^2) algorithm for link map file generation, rather than the new
1614     O(n) algorithm which uses about 40% more memory for symbol storage.
1615
1616     Another effect of the switch is to set the default hash table size
1617     to 1021, which again saves memory at the cost of lengthening the
1618     linker's run time.  This is not done however if the `--hash-size'
1619     switch has been used.
1620
1621     The `--reduce-memory-overheads' switch may be also be used to
1622     enable other tradeoffs in future versions of the linker.
1623
1624`--build-id'
1625`--build-id=STYLE'
1626     Request creation of `.note.gnu.build-id' ELF note section.  The
1627     contents of the note are unique bits identifying this linked file.
1628     STYLE can be `uuid' to use 128 random bits, `sha1' to use a
1629     160-bit SHA1 hash on the normative parts of the output contents,
1630     `md5' to use a 128-bit MD5 hash on the normative parts of the
1631     output contents, or `0xHEXSTRING' to use a chosen bit string
1632     specified as an even number of hexadecimal digits (`-' and `:'
1633     characters between digit pairs are ignored).  If STYLE is omitted,
1634     `sha1' is used.
1635
1636     The `md5' and `sha1' styles produces an identifier that is always
1637     the same in an identical output file, but will be unique among all
1638     nonidentical output files.  It is not intended to be compared as a
1639     checksum for the file's contents.  A linked file may be changed
1640     later by other tools, but the build ID bit string identifying the
1641     original linked file does not change.
1642
1643     Passing `none' for STYLE disables the setting from any
1644     `--build-id' options earlier on the command line.
1645
16462.1.1 Options Specific to i386 PE Targets
1647-----------------------------------------
1648
1649The i386 PE linker supports the `-shared' option, which causes the
1650output to be a dynamically linked library (DLL) instead of a normal
1651executable.  You should name the output `*.dll' when you use this
1652option.  In addition, the linker fully supports the standard `*.def'
1653files, which may be specified on the linker command line like an object
1654file (in fact, it should precede archives it exports symbols from, to
1655ensure that they get linked in, just like a normal object file).
1656
1657   In addition to the options common to all targets, the i386 PE linker
1658support additional command line options that are specific to the i386
1659PE target.  Options that take values may be separated from their values
1660by either a space or an equals sign.
1661
1662`--add-stdcall-alias'
1663     If given, symbols with a stdcall suffix (@NN) will be exported
1664     as-is and also with the suffix stripped.  [This option is specific
1665     to the i386 PE targeted port of the linker]
1666
1667`--base-file FILE'
1668     Use FILE as the name of a file in which to save the base addresses
1669     of all the relocations needed for generating DLLs with `dlltool'.
1670     [This is an i386 PE specific option]
1671
1672`--dll'
1673     Create a DLL instead of a regular executable.  You may also use
1674     `-shared' or specify a `LIBRARY' in a given `.def' file.  [This
1675     option is specific to the i386 PE targeted port of the linker]
1676
1677`--enable-long-section-names'
1678`--disable-long-section-names'
1679     The PE variants of the Coff object format add an extension that
1680     permits the use of section names longer than eight characters, the
1681     normal limit for Coff.  By default, these names are only allowed
1682     in object files, as fully-linked executable images do not carry
1683     the Coff string table required to support the longer names.  As a
1684     GNU extension, it is possible to allow their use in executable
1685     images as well, or to (probably pointlessly!)  disallow it in
1686     object files, by using these two options.  Executable images
1687     generated with these long section names are slightly non-standard,
1688     carrying as they do a string table, and may generate confusing
1689     output when examined with non-GNU PE-aware tools, such as file
1690     viewers and dumpers.  However, GDB relies on the use of PE long
1691     section names to find Dwarf-2 debug information sections in an
1692     executable image at runtime, and so if neither option is specified
1693     on the command-line, `ld' will enable long section names,
1694     overriding the default and technically correct behaviour, when it
1695     finds the presence of debug information while linking an executable
1696     image and not stripping symbols.  [This option is valid for all PE
1697     targeted ports of the linker]
1698
1699`--enable-stdcall-fixup'
1700`--disable-stdcall-fixup'
1701     If the link finds a symbol that it cannot resolve, it will attempt
1702     to do "fuzzy linking" by looking for another defined symbol that
1703     differs only in the format of the symbol name (cdecl vs stdcall)
1704     and will resolve that symbol by linking to the match.  For
1705     example, the undefined symbol `_foo' might be linked to the
1706     function `_foo@12', or the undefined symbol `_bar@16' might be
1707     linked to the function `_bar'.  When the linker does this, it
1708     prints a warning, since it normally should have failed to link,
1709     but sometimes import libraries generated from third-party dlls may
1710     need this feature to be usable.  If you specify
1711     `--enable-stdcall-fixup', this feature is fully enabled and
1712     warnings are not printed.  If you specify
1713     `--disable-stdcall-fixup', this feature is disabled and such
1714     mismatches are considered to be errors.  [This option is specific
1715     to the i386 PE targeted port of the linker]
1716
1717`--leading-underscore'
1718`--no-leading-underscore'
1719     For most targets default symbol-prefix is an underscore and is
1720     defined in target's description. By this option it is possible to
1721     disable/enable the default underscore symbol-prefix.
1722
1723`--export-all-symbols'
1724     If given, all global symbols in the objects used to build a DLL
1725     will be exported by the DLL.  Note that this is the default if
1726     there otherwise wouldn't be any exported symbols.  When symbols are
1727     explicitly exported via DEF files or implicitly exported via
1728     function attributes, the default is to not export anything else
1729     unless this option is given.  Note that the symbols `DllMain@12',
1730     `DllEntryPoint@0', `DllMainCRTStartup@12', and `impure_ptr' will
1731     not be automatically exported.  Also, symbols imported from other
1732     DLLs will not be re-exported, nor will symbols specifying the
1733     DLL's internal layout such as those beginning with `_head_' or
1734     ending with `_iname'.  In addition, no symbols from `libgcc',
1735     `libstd++', `libmingw32', or `crtX.o' will be exported.  Symbols
1736     whose names begin with `__rtti_' or `__builtin_' will not be
1737     exported, to help with C++ DLLs.  Finally, there is an extensive
1738     list of cygwin-private symbols that are not exported (obviously,
1739     this applies on when building DLLs for cygwin targets).  These
1740     cygwin-excludes are: `_cygwin_dll_entry@12',
1741     `_cygwin_crt0_common@8', `_cygwin_noncygwin_dll_entry@12',
1742     `_fmode', `_impure_ptr', `cygwin_attach_dll', `cygwin_premain0',
1743     `cygwin_premain1', `cygwin_premain2', `cygwin_premain3', and
1744     `environ'.  [This option is specific to the i386 PE targeted port
1745     of the linker]
1746
1747`--exclude-symbols SYMBOL,SYMBOL,...'
1748     Specifies a list of symbols which should not be automatically
1749     exported.  The symbol names may be delimited by commas or colons.
1750     [This option is specific to the i386 PE targeted port of the
1751     linker]
1752
1753`--exclude-all-symbols'
1754     Specifies no symbols should be automatically exported.  [This
1755     option is specific to the i386 PE targeted port of the linker]
1756
1757`--file-alignment'
1758     Specify the file alignment.  Sections in the file will always
1759     begin at file offsets which are multiples of this number.  This
1760     defaults to 512.  [This option is specific to the i386 PE targeted
1761     port of the linker]
1762
1763`--heap RESERVE'
1764`--heap RESERVE,COMMIT'
1765     Specify the number of bytes of memory to reserve (and optionally
1766     commit) to be used as heap for this program.  The default is 1Mb
1767     reserved, 4K committed.  [This option is specific to the i386 PE
1768     targeted port of the linker]
1769
1770`--image-base VALUE'
1771     Use VALUE as the base address of your program or dll.  This is the
1772     lowest memory location that will be used when your program or dll
1773     is loaded.  To reduce the need to relocate and improve performance
1774     of your dlls, each should have a unique base address and not
1775     overlap any other dlls.  The default is 0x400000 for executables,
1776     and 0x10000000 for dlls.  [This option is specific to the i386 PE
1777     targeted port of the linker]
1778
1779`--kill-at'
1780     If given, the stdcall suffixes (@NN) will be stripped from symbols
1781     before they are exported.  [This option is specific to the i386 PE
1782     targeted port of the linker]
1783
1784`--large-address-aware'
1785     If given, the appropriate bit in the "Characteristics" field of
1786     the COFF header is set to indicate that this executable supports
1787     virtual addresses greater than 2 gigabytes.  This should be used
1788     in conjunction with the /3GB or /USERVA=VALUE megabytes switch in
1789     the "[operating systems]" section of the BOOT.INI.  Otherwise,
1790     this bit has no effect.  [This option is specific to PE targeted
1791     ports of the linker]
1792
1793`--major-image-version VALUE'
1794     Sets the major number of the "image version".  Defaults to 1.
1795     [This option is specific to the i386 PE targeted port of the
1796     linker]
1797
1798`--major-os-version VALUE'
1799     Sets the major number of the "os version".  Defaults to 4.  [This
1800     option is specific to the i386 PE targeted port of the linker]
1801
1802`--major-subsystem-version VALUE'
1803     Sets the major number of the "subsystem version".  Defaults to 4.
1804     [This option is specific to the i386 PE targeted port of the
1805     linker]
1806
1807`--minor-image-version VALUE'
1808     Sets the minor number of the "image version".  Defaults to 0.
1809     [This option is specific to the i386 PE targeted port of the
1810     linker]
1811
1812`--minor-os-version VALUE'
1813     Sets the minor number of the "os version".  Defaults to 0.  [This
1814     option is specific to the i386 PE targeted port of the linker]
1815
1816`--minor-subsystem-version VALUE'
1817     Sets the minor number of the "subsystem version".  Defaults to 0.
1818     [This option is specific to the i386 PE targeted port of the
1819     linker]
1820
1821`--output-def FILE'
1822     The linker will create the file FILE which will contain a DEF file
1823     corresponding to the DLL the linker is generating.  This DEF file
1824     (which should be called `*.def') may be used to create an import
1825     library with `dlltool' or may be used as a reference to
1826     automatically or implicitly exported symbols.  [This option is
1827     specific to the i386 PE targeted port of the linker]
1828
1829`--out-implib FILE'
1830     The linker will create the file FILE which will contain an import
1831     lib corresponding to the DLL the linker is generating. This import
1832     lib (which should be called `*.dll.a' or `*.a' may be used to link
1833     clients against the generated DLL; this behaviour makes it
1834     possible to skip a separate `dlltool' import library creation step.
1835     [This option is specific to the i386 PE targeted port of the
1836     linker]
1837
1838`--enable-auto-image-base'
1839     Automatically choose the image base for DLLs, unless one is
1840     specified using the `--image-base' argument.  By using a hash
1841     generated from the dllname to create unique image bases for each
1842     DLL, in-memory collisions and relocations which can delay program
1843     execution are avoided.  [This option is specific to the i386 PE
1844     targeted port of the linker]
1845
1846`--disable-auto-image-base'
1847     Do not automatically generate a unique image base.  If there is no
1848     user-specified image base (`--image-base') then use the platform
1849     default.  [This option is specific to the i386 PE targeted port of
1850     the linker]
1851
1852`--dll-search-prefix STRING'
1853     When linking dynamically to a dll without an import library,
1854     search for `<string><basename>.dll' in preference to
1855     `lib<basename>.dll'. This behaviour allows easy distinction
1856     between DLLs built for the various "subplatforms": native, cygwin,
1857     uwin, pw, etc.  For instance, cygwin DLLs typically use
1858     `--dll-search-prefix=cyg'.  [This option is specific to the i386
1859     PE targeted port of the linker]
1860
1861`--enable-auto-import'
1862     Do sophisticated linking of `_symbol' to `__imp__symbol' for DATA
1863     imports from DLLs, and create the necessary thunking symbols when
1864     building the import libraries with those DATA exports. Note: Use
1865     of the 'auto-import' extension will cause the text section of the
1866     image file to be made writable. This does not conform to the
1867     PE-COFF format specification published by Microsoft.
1868
1869     Note - use of the 'auto-import' extension will also cause read only
1870     data which would normally be placed into the .rdata section to be
1871     placed into the .data section instead.  This is in order to work
1872     around a problem with consts that is described here:
1873     http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
1874
1875     Using 'auto-import' generally will 'just work' - but sometimes you
1876     may see this message:
1877
1878     "variable '<var>' can't be auto-imported. Please read the
1879     documentation for ld's `--enable-auto-import' for details."
1880
1881     This message occurs when some (sub)expression accesses an address
1882     ultimately given by the sum of two constants (Win32 import tables
1883     only allow one).  Instances where this may occur include accesses
1884     to member fields of struct variables imported from a DLL, as well
1885     as using a constant index into an array variable imported from a
1886     DLL.  Any multiword variable (arrays, structs, long long, etc) may
1887     trigger this error condition.  However, regardless of the exact
1888     data type of the offending exported variable, ld will always
1889     detect it, issue the warning, and exit.
1890
1891     There are several ways to address this difficulty, regardless of
1892     the data type of the exported variable:
1893
1894     One way is to use -enable-runtime-pseudo-reloc switch. This leaves
1895     the task of adjusting references in your client code for runtime
1896     environment, so this method works only when runtime environment
1897     supports this feature.
1898
1899     A second solution is to force one of the 'constants' to be a
1900     variable - that is, unknown and un-optimizable at compile time.
1901     For arrays, there are two possibilities: a) make the indexee (the
1902     array's address) a variable, or b) make the 'constant' index a
1903     variable.  Thus:
1904
1905          extern type extern_array[];
1906          extern_array[1] -->
1907             { volatile type *t=extern_array; t[1] }
1908
1909     or
1910
1911          extern type extern_array[];
1912          extern_array[1] -->
1913             { volatile int t=1; extern_array[t] }
1914
1915     For structs (and most other multiword data types) the only option
1916     is to make the struct itself (or the long long, or the ...)
1917     variable:
1918
1919          extern struct s extern_struct;
1920          extern_struct.field -->
1921             { volatile struct s *t=&extern_struct; t->field }
1922
1923     or
1924
1925          extern long long extern_ll;
1926          extern_ll -->
1927            { volatile long long * local_ll=&extern_ll; *local_ll }
1928
1929     A third method of dealing with this difficulty is to abandon
1930     'auto-import' for the offending symbol and mark it with
1931     `__declspec(dllimport)'.  However, in practise that requires using
1932     compile-time #defines to indicate whether you are building a DLL,
1933     building client code that will link to the DLL, or merely
1934     building/linking to a static library.   In making the choice
1935     between the various methods of resolving the 'direct address with
1936     constant offset' problem, you should consider typical real-world
1937     usage:
1938
1939     Original:
1940          --foo.h
1941          extern int arr[];
1942          --foo.c
1943          #include "foo.h"
1944          void main(int argc, char **argv){
1945            printf("%d\n",arr[1]);
1946          }
1947
1948     Solution 1:
1949          --foo.h
1950          extern int arr[];
1951          --foo.c
1952          #include "foo.h"
1953          void main(int argc, char **argv){
1954            /* This workaround is for win32 and cygwin; do not "optimize" */
1955            volatile int *parr = arr;
1956            printf("%d\n",parr[1]);
1957          }
1958
1959     Solution 2:
1960          --foo.h
1961          /* Note: auto-export is assumed (no __declspec(dllexport)) */
1962          #if (defined(_WIN32) || defined(__CYGWIN__)) && \
1963            !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
1964          #define FOO_IMPORT __declspec(dllimport)
1965          #else
1966          #define FOO_IMPORT
1967          #endif
1968          extern FOO_IMPORT int arr[];
1969          --foo.c
1970          #include "foo.h"
1971          void main(int argc, char **argv){
1972            printf("%d\n",arr[1]);
1973          }
1974
1975     A fourth way to avoid this problem is to re-code your library to
1976     use a functional interface rather than a data interface for the
1977     offending variables (e.g. set_foo() and get_foo() accessor
1978     functions).  [This option is specific to the i386 PE targeted port
1979     of the linker]
1980
1981`--disable-auto-import'
1982     Do not attempt to do sophisticated linking of `_symbol' to
1983     `__imp__symbol' for DATA imports from DLLs.  [This option is
1984     specific to the i386 PE targeted port of the linker]
1985
1986`--enable-runtime-pseudo-reloc'
1987     If your code contains expressions described in -enable-auto-import
1988     section, that is, DATA imports from DLL with non-zero offset, this
1989     switch will create a vector of 'runtime pseudo relocations' which
1990     can be used by runtime environment to adjust references to such
1991     data in your client code.  [This option is specific to the i386 PE
1992     targeted port of the linker]
1993
1994`--disable-runtime-pseudo-reloc'
1995     Do not create pseudo relocations for non-zero offset DATA imports
1996     from DLLs.  This is the default.  [This option is specific to the
1997     i386 PE targeted port of the linker]
1998
1999`--enable-extra-pe-debug'
2000     Show additional debug info related to auto-import symbol thunking.
2001     [This option is specific to the i386 PE targeted port of the
2002     linker]
2003
2004`--section-alignment'
2005     Sets the section alignment.  Sections in memory will always begin
2006     at addresses which are a multiple of this number.  Defaults to
2007     0x1000.  [This option is specific to the i386 PE targeted port of
2008     the linker]
2009
2010`--stack RESERVE'
2011`--stack RESERVE,COMMIT'
2012     Specify the number of bytes of memory to reserve (and optionally
2013     commit) to be used as stack for this program.  The default is 2Mb
2014     reserved, 4K committed.  [This option is specific to the i386 PE
2015     targeted port of the linker]
2016
2017`--subsystem WHICH'
2018`--subsystem WHICH:MAJOR'
2019`--subsystem WHICH:MAJOR.MINOR'
2020     Specifies the subsystem under which your program will execute.  The
2021     legal values for WHICH are `native', `windows', `console',
2022     `posix', and `xbox'.  You may optionally set the subsystem version
2023     also.  Numeric values are also accepted for WHICH.  [This option
2024     is specific to the i386 PE targeted port of the linker]
2025
2026     The following options set flags in the `DllCharacteristics' field
2027     of the PE file header: [These options are specific to PE targeted
2028     ports of the linker]
2029
2030`--dynamicbase'
2031     The image base address may be relocated using address space layout
2032     randomization (ASLR).  This feature was introduced with MS Windows
2033     Vista for i386 PE targets.
2034
2035`--forceinteg'
2036     Code integrity checks are enforced.
2037
2038`--nxcompat'
2039     The image is compatible with the Data Execution Prevention.  This
2040     feature was introduced with MS Windows XP SP2 for i386 PE targets.
2041
2042`--no-isolation'
2043     Although the image understands isolation, do not isolate the image.
2044
2045`--no-seh'
2046     The image does not use SEH. No SE handler may be called from this
2047     image.
2048
2049`--no-bind'
2050     Do not bind this image.
2051
2052`--wdmdriver'
2053     The driver uses the MS Windows Driver Model.
2054
2055`--tsaware'
2056     The image is Terminal Server aware.
2057
2058
20592.1.2 Options specific to Motorola 68HC11 and 68HC12 targets
2060------------------------------------------------------------
2061
2062The 68HC11 and 68HC12 linkers support specific options to control the
2063memory bank switching mapping and trampoline code generation.
2064
2065`--no-trampoline'
2066     This option disables the generation of trampoline. By default a
2067     trampoline is generated for each far function which is called
2068     using a `jsr' instruction (this happens when a pointer to a far
2069     function is taken).
2070
2071`--bank-window NAME'
2072     This option indicates to the linker the name of the memory region
2073     in the `MEMORY' specification that describes the memory bank
2074     window.  The definition of such region is then used by the linker
2075     to compute paging and addresses within the memory window.
2076
2077
20782.1.3 Options specific to Motorola 68K target
2079---------------------------------------------
2080
2081The following options are supported to control handling of GOT
2082generation when linking for 68K targets.
2083
2084`--got=TYPE'
2085     This option tells the linker which GOT generation scheme to use.
2086     TYPE should be one of `single', `negative', `multigot' or
2087     `target'.  For more information refer to the Info entry for `ld'.
2088
2089
2090
2091File: ld.info,  Node: Environment,  Prev: Options,  Up: Invocation
2092
20932.2 Environment Variables
2094=========================
2095
2096You can change the behaviour of `ld' with the environment variables
2097`GNUTARGET', `LDEMULATION' and `COLLECT_NO_DEMANGLE'.
2098
2099   `GNUTARGET' determines the input-file object format if you don't use
2100`-b' (or its synonym `--format').  Its value should be one of the BFD
2101names for an input format (*note BFD::).  If there is no `GNUTARGET' in
2102the environment, `ld' uses the natural format of the target. If
2103`GNUTARGET' is set to `default' then BFD attempts to discover the input
2104format by examining binary input files; this method often succeeds, but
2105there are potential ambiguities, since there is no method of ensuring
2106that the magic number used to specify object-file formats is unique.
2107However, the configuration procedure for BFD on each system places the
2108conventional format for that system first in the search-list, so
2109ambiguities are resolved in favor of convention.
2110
2111   `LDEMULATION' determines the default emulation if you don't use the
2112`-m' option.  The emulation can affect various aspects of linker
2113behaviour, particularly the default linker script.  You can list the
2114available emulations with the `--verbose' or `-V' options.  If the `-m'
2115option is not used, and the `LDEMULATION' environment variable is not
2116defined, the default emulation depends upon how the linker was
2117configured.
2118
2119   Normally, the linker will default to demangling symbols.  However, if
2120`COLLECT_NO_DEMANGLE' is set in the environment, then it will default
2121to not demangling symbols.  This environment variable is used in a
2122similar fashion by the `gcc' linker wrapper program.  The default may
2123be overridden by the `--demangle' and `--no-demangle' options.
2124
2125
2126File: ld.info,  Node: Scripts,  Next: Machine Dependent,  Prev: Invocation,  Up: Top
2127
21283 Linker Scripts
2129****************
2130
2131Every link is controlled by a "linker script".  This script is written
2132in the linker command language.
2133
2134   The main purpose of the linker script is to describe how the
2135sections in the input files should be mapped into the output file, and
2136to control the memory layout of the output file.  Most linker scripts
2137do nothing more than this.  However, when necessary, the linker script
2138can also direct the linker to perform many other operations, using the
2139commands described below.
2140
2141   The linker always uses a linker script.  If you do not supply one
2142yourself, the linker will use a default script that is compiled into the
2143linker executable.  You can use the `--verbose' command line option to
2144display the default linker script.  Certain command line options, such
2145as `-r' or `-N', will affect the default linker script.
2146
2147   You may supply your own linker script by using the `-T' command line
2148option.  When you do this, your linker script will replace the default
2149linker script.
2150
2151   You may also use linker scripts implicitly by naming them as input
2152files to the linker, as though they were files to be linked.  *Note
2153Implicit Linker Scripts::.
2154
2155* Menu:
2156
2157* Basic Script Concepts::	Basic Linker Script Concepts
2158* Script Format::		Linker Script Format
2159* Simple Example::		Simple Linker Script Example
2160* Simple Commands::		Simple Linker Script Commands
2161* Assignments::			Assigning Values to Symbols
2162* SECTIONS::			SECTIONS Command
2163* MEMORY::			MEMORY Command
2164* PHDRS::			PHDRS Command
2165* VERSION::			VERSION Command
2166* Expressions::			Expressions in Linker Scripts
2167* Implicit Linker Scripts::	Implicit Linker Scripts
2168
2169
2170File: ld.info,  Node: Basic Script Concepts,  Next: Script Format,  Up: Scripts
2171
21723.1 Basic Linker Script Concepts
2173================================
2174
2175We need to define some basic concepts and vocabulary in order to
2176describe the linker script language.
2177
2178   The linker combines input files into a single output file.  The
2179output file and each input file are in a special data format known as an
2180"object file format".  Each file is called an "object file".  The
2181output file is often called an "executable", but for our purposes we
2182will also call it an object file.  Each object file has, among other
2183things, a list of "sections".  We sometimes refer to a section in an
2184input file as an "input section"; similarly, a section in the output
2185file is an "output section".
2186
2187   Each section in an object file has a name and a size.  Most sections
2188also have an associated block of data, known as the "section contents".
2189A section may be marked as "loadable", which mean that the contents
2190should be loaded into memory when the output file is run.  A section
2191with no contents may be "allocatable", which means that an area in
2192memory should be set aside, but nothing in particular should be loaded
2193there (in some cases this memory must be zeroed out).  A section which
2194is neither loadable nor allocatable typically contains some sort of
2195debugging information.
2196
2197   Every loadable or allocatable output section has two addresses.  The
2198first is the "VMA", or virtual memory address.  This is the address the
2199section will have when the output file is run.  The second is the
2200"LMA", or load memory address.  This is the address at which the
2201section will be loaded.  In most cases the two addresses will be the
2202same.  An example of when they might be different is when a data section
2203is loaded into ROM, and then copied into RAM when the program starts up
2204(this technique is often used to initialize global variables in a ROM
2205based system).  In this case the ROM address would be the LMA, and the
2206RAM address would be the VMA.
2207
2208   You can see the sections in an object file by using the `objdump'
2209program with the `-h' option.
2210
2211   Every object file also has a list of "symbols", known as the "symbol
2212table".  A symbol may be defined or undefined.  Each symbol has a name,
2213and each defined symbol has an address, among other information.  If
2214you compile a C or C++ program into an object file, you will get a
2215defined symbol for every defined function and global or static
2216variable.  Every undefined function or global variable which is
2217referenced in the input file will become an undefined symbol.
2218
2219   You can see the symbols in an object file by using the `nm' program,
2220or by using the `objdump' program with the `-t' option.
2221
2222
2223File: ld.info,  Node: Script Format,  Next: Simple Example,  Prev: Basic Script Concepts,  Up: Scripts
2224
22253.2 Linker Script Format
2226========================
2227
2228Linker scripts are text files.
2229
2230   You write a linker script as a series of commands.  Each command is
2231either a keyword, possibly followed by arguments, or an assignment to a
2232symbol.  You may separate commands using semicolons.  Whitespace is
2233generally ignored.
2234
2235   Strings such as file or format names can normally be entered
2236directly.  If the file name contains a character such as a comma which
2237would otherwise serve to separate file names, you may put the file name
2238in double quotes.  There is no way to use a double quote character in a
2239file name.
2240
2241   You may include comments in linker scripts just as in C, delimited by
2242`/*' and `*/'.  As in C, comments are syntactically equivalent to
2243whitespace.
2244
2245
2246File: ld.info,  Node: Simple Example,  Next: Simple Commands,  Prev: Script Format,  Up: Scripts
2247
22483.3 Simple Linker Script Example
2249================================
2250
2251Many linker scripts are fairly simple.
2252
2253   The simplest possible linker script has just one command:
2254`SECTIONS'.  You use the `SECTIONS' command to describe the memory
2255layout of the output file.
2256
2257   The `SECTIONS' command is a powerful command.  Here we will describe
2258a simple use of it.  Let's assume your program consists only of code,
2259initialized data, and uninitialized data.  These will be in the
2260`.text', `.data', and `.bss' sections, respectively.  Let's assume
2261further that these are the only sections which appear in your input
2262files.
2263
2264   For this example, let's say that the code should be loaded at address
22650x10000, and that the data should start at address 0x8000000.  Here is a
2266linker script which will do that:
2267     SECTIONS
2268     {
2269       . = 0x10000;
2270       .text : { *(.text) }
2271       . = 0x8000000;
2272       .data : { *(.data) }
2273       .bss : { *(.bss) }
2274     }
2275
2276   You write the `SECTIONS' command as the keyword `SECTIONS', followed
2277by a series of symbol assignments and output section descriptions
2278enclosed in curly braces.
2279
2280   The first line inside the `SECTIONS' command of the above example
2281sets the value of the special symbol `.', which is the location
2282counter.  If you do not specify the address of an output section in some
2283other way (other ways are described later), the address is set from the
2284current value of the location counter.  The location counter is then
2285incremented by the size of the output section.  At the start of the
2286`SECTIONS' command, the location counter has the value `0'.
2287
2288   The second line defines an output section, `.text'.  The colon is
2289required syntax which may be ignored for now.  Within the curly braces
2290after the output section name, you list the names of the input sections
2291which should be placed into this output section.  The `*' is a wildcard
2292which matches any file name.  The expression `*(.text)' means all
2293`.text' input sections in all input files.
2294
2295   Since the location counter is `0x10000' when the output section
2296`.text' is defined, the linker will set the address of the `.text'
2297section in the output file to be `0x10000'.
2298
2299   The remaining lines define the `.data' and `.bss' sections in the
2300output file.  The linker will place the `.data' output section at
2301address `0x8000000'.  After the linker places the `.data' output
2302section, the value of the location counter will be `0x8000000' plus the
2303size of the `.data' output section.  The effect is that the linker will
2304place the `.bss' output section immediately after the `.data' output
2305section in memory.
2306
2307   The linker will ensure that each output section has the required
2308alignment, by increasing the location counter if necessary.  In this
2309example, the specified addresses for the `.text' and `.data' sections
2310will probably satisfy any alignment constraints, but the linker may
2311have to create a small gap between the `.data' and `.bss' sections.
2312
2313   That's it!  That's a simple and complete linker script.
2314
2315
2316File: ld.info,  Node: Simple Commands,  Next: Assignments,  Prev: Simple Example,  Up: Scripts
2317
23183.4 Simple Linker Script Commands
2319=================================
2320
2321In this section we describe the simple linker script commands.
2322
2323* Menu:
2324
2325* Entry Point::			Setting the entry point
2326* File Commands::		Commands dealing with files
2327
2328* Format Commands::		Commands dealing with object file formats
2329
2330* REGION_ALIAS::		Assign alias names to memory regions
2331* Miscellaneous Commands::	Other linker script commands
2332
2333
2334File: ld.info,  Node: Entry Point,  Next: File Commands,  Up: Simple Commands
2335
23363.4.1 Setting the Entry Point
2337-----------------------------
2338
2339The first instruction to execute in a program is called the "entry
2340point".  You can use the `ENTRY' linker script command to set the entry
2341point.  The argument is a symbol name:
2342     ENTRY(SYMBOL)
2343
2344   There are several ways to set the entry point.  The linker will set
2345the entry point by trying each of the following methods in order, and
2346stopping when one of them succeeds:
2347   * the `-e' ENTRY command-line option;
2348
2349   * the `ENTRY(SYMBOL)' command in a linker script;
2350
2351   * the value of a target specific symbol, if it is defined;  For many
2352     targets this is `start', but PE and BeOS based systems for example
2353     check a list of possible entry symbols, matching the first one
2354     found.
2355
2356   * the address of the first byte of the `.text' section, if present;
2357
2358   * The address `0'.
2359
2360
2361File: ld.info,  Node: File Commands,  Next: Format Commands,  Prev: Entry Point,  Up: Simple Commands
2362
23633.4.2 Commands Dealing with Files
2364---------------------------------
2365
2366Several linker script commands deal with files.
2367
2368`INCLUDE FILENAME'
2369     Include the linker script FILENAME at this point.  The file will
2370     be searched for in the current directory, and in any directory
2371     specified with the `-L' option.  You can nest calls to `INCLUDE'
2372     up to 10 levels deep.
2373
2374     You can place `INCLUDE' directives at the top level, in `MEMORY' or
2375     `SECTIONS' commands, or in output section descriptions.
2376
2377`INPUT(FILE, FILE, ...)'
2378`INPUT(FILE FILE ...)'
2379     The `INPUT' command directs the linker to include the named files
2380     in the link, as though they were named on the command line.
2381
2382     For example, if you always want to include `subr.o' any time you do
2383     a link, but you can't be bothered to put it on every link command
2384     line, then you can put `INPUT (subr.o)' in your linker script.
2385
2386     In fact, if you like, you can list all of your input files in the
2387     linker script, and then invoke the linker with nothing but a `-T'
2388     option.
2389
2390     In case a "sysroot prefix" is configured, and the filename starts
2391     with the `/' character, and the script being processed was located
2392     inside the "sysroot prefix", the filename will be looked for in
2393     the "sysroot prefix".  Otherwise, the linker will try to open the
2394     file in the current directory.  If it is not found, the linker
2395     will search through the archive library search path.  See the
2396     description of `-L' in *Note Command Line Options: Options.
2397
2398     If you use `INPUT (-lFILE)', `ld' will transform the name to
2399     `libFILE.a', as with the command line argument `-l'.
2400
2401     When you use the `INPUT' command in an implicit linker script, the
2402     files will be included in the link at the point at which the linker
2403     script file is included.  This can affect archive searching.
2404
2405`GROUP(FILE, FILE, ...)'
2406`GROUP(FILE FILE ...)'
2407     The `GROUP' command is like `INPUT', except that the named files
2408     should all be archives, and they are searched repeatedly until no
2409     new undefined references are created.  See the description of `-('
2410     in *Note Command Line Options: Options.
2411
2412`AS_NEEDED(FILE, FILE, ...)'
2413`AS_NEEDED(FILE FILE ...)'
2414     This construct can appear only inside of the `INPUT' or `GROUP'
2415     commands, among other filenames.  The files listed will be handled
2416     as if they appear directly in the `INPUT' or `GROUP' commands,
2417     with the exception of ELF shared libraries, that will be added only
2418     when they are actually needed.  This construct essentially enables
2419     `--as-needed' option for all the files listed inside of it and
2420     restores previous `--as-needed' resp. `--no-as-needed' setting
2421     afterwards.
2422
2423`OUTPUT(FILENAME)'
2424     The `OUTPUT' command names the output file.  Using
2425     `OUTPUT(FILENAME)' in the linker script is exactly like using `-o
2426     FILENAME' on the command line (*note Command Line Options:
2427     Options.).  If both are used, the command line option takes
2428     precedence.
2429
2430     You can use the `OUTPUT' command to define a default name for the
2431     output file other than the usual default of `a.out'.
2432
2433`SEARCH_DIR(PATH)'
2434     The `SEARCH_DIR' command adds PATH to the list of paths where `ld'
2435     looks for archive libraries.  Using `SEARCH_DIR(PATH)' is exactly
2436     like using `-L PATH' on the command line (*note Command Line
2437     Options: Options.).  If both are used, then the linker will search
2438     both paths.  Paths specified using the command line option are
2439     searched first.
2440
2441`STARTUP(FILENAME)'
2442     The `STARTUP' command is just like the `INPUT' command, except
2443     that FILENAME will become the first input file to be linked, as
2444     though it were specified first on the command line.  This may be
2445     useful when using a system in which the entry point is always the
2446     start of the first file.
2447
2448
2449File: ld.info,  Node: Format Commands,  Next: REGION_ALIAS,  Prev: File Commands,  Up: Simple Commands
2450
24513.4.3 Commands Dealing with Object File Formats
2452-----------------------------------------------
2453
2454A couple of linker script commands deal with object file formats.
2455
2456`OUTPUT_FORMAT(BFDNAME)'
2457`OUTPUT_FORMAT(DEFAULT, BIG, LITTLE)'
2458     The `OUTPUT_FORMAT' command names the BFD format to use for the
2459     output file (*note BFD::).  Using `OUTPUT_FORMAT(BFDNAME)' is
2460     exactly like using `--oformat BFDNAME' on the command line (*note
2461     Command Line Options: Options.).  If both are used, the command
2462     line option takes precedence.
2463
2464     You can use `OUTPUT_FORMAT' with three arguments to use different
2465     formats based on the `-EB' and `-EL' command line options.  This
2466     permits the linker script to set the output format based on the
2467     desired endianness.
2468
2469     If neither `-EB' nor `-EL' are used, then the output format will
2470     be the first argument, DEFAULT.  If `-EB' is used, the output
2471     format will be the second argument, BIG.  If `-EL' is used, the
2472     output format will be the third argument, LITTLE.
2473
2474     For example, the default linker script for the MIPS ELF target
2475     uses this command:
2476          OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
2477     This says that the default format for the output file is
2478     `elf32-bigmips', but if the user uses the `-EL' command line
2479     option, the output file will be created in the `elf32-littlemips'
2480     format.
2481
2482`TARGET(BFDNAME)'
2483     The `TARGET' command names the BFD format to use when reading input
2484     files.  It affects subsequent `INPUT' and `GROUP' commands.  This
2485     command is like using `-b BFDNAME' on the command line (*note
2486     Command Line Options: Options.).  If the `TARGET' command is used
2487     but `OUTPUT_FORMAT' is not, then the last `TARGET' command is also
2488     used to set the format for the output file.  *Note BFD::.
2489
2490
2491File: ld.info,  Node: REGION_ALIAS,  Next: Miscellaneous Commands,  Prev: Format Commands,  Up: Simple Commands
2492
24933.4.4 Assign alias names to memory regions
2494------------------------------------------
2495
2496Alias names can be added to existing memory regions created with the
2497*Note MEMORY:: command.  Each name corresponds to at most one memory
2498region.
2499
2500     REGION_ALIAS(ALIAS, REGION)
2501
2502   The `REGION_ALIAS' function creates an alias name ALIAS for the
2503memory region REGION.  This allows a flexible mapping of output sections
2504to memory regions.  An example follows.
2505
2506   Suppose we have an application for embedded systems which come with
2507various memory storage devices.  All have a general purpose, volatile
2508memory `RAM' that allows code execution or data storage.  Some may have
2509a read-only, non-volatile memory `ROM' that allows code execution and
2510read-only data access.  The last variant is a read-only, non-volatile
2511memory `ROM2' with read-only data access and no code execution
2512capability.  We have four output sections:
2513
2514   * `.text' program code;
2515
2516   * `.rodata' read-only data;
2517
2518   * `.data' read-write initialized data;
2519
2520   * `.bss' read-write zero initialized data.
2521
2522   The goal is to provide a linker command file that contains a system
2523independent part defining the output sections and a system dependent
2524part mapping the output sections to the memory regions available on the
2525system.  Our embedded systems come with three different memory setups
2526`A', `B' and `C':
2527Section            Variant A          Variant B          Variant C
2528.text              RAM                ROM                ROM
2529.rodata            RAM                ROM                ROM2
2530.data              RAM                RAM/ROM            RAM/ROM2
2531.bss               RAM                RAM                RAM
2532   The notation `RAM/ROM' or `RAM/ROM2' means that this section is
2533loaded into region `ROM' or `ROM2' respectively.  Please note that the
2534load address of the `.data' section starts in all three variants at the
2535end of the `.rodata' section.
2536
2537   The base linker script that deals with the output sections follows.
2538It includes the system dependent `linkcmds.memory' file that describes
2539the memory layout:
2540     INCLUDE linkcmds.memory
2541
2542     SECTIONS
2543       {
2544         .text :
2545           {
2546             *(.text)
2547           } > REGION_TEXT
2548         .rodata :
2549           {
2550             *(.rodata)
2551             rodata_end = .;
2552           } > REGION_RODATA
2553         .data : AT (rodata_end)
2554           {
2555             data_start = .;
2556             *(.data)
2557           } > REGION_DATA
2558         data_size = SIZEOF(.data);
2559         data_load_start = LOADADDR(.data);
2560         .bss :
2561           {
2562             *(.bss)
2563           } > REGION_BSS
2564       }
2565
2566   Now we need three different `linkcmds.memory' files to define memory
2567regions and alias names.  The content of `linkcmds.memory' for the three
2568variants `A', `B' and `C':
2569`A'
2570     Here everything goes into the `RAM'.
2571          MEMORY
2572            {
2573              RAM : ORIGIN = 0, LENGTH = 4M
2574            }
2575
2576          REGION_ALIAS("REGION_TEXT", RAM);
2577          REGION_ALIAS("REGION_RODATA", RAM);
2578          REGION_ALIAS("REGION_DATA", RAM);
2579          REGION_ALIAS("REGION_BSS", RAM);
2580
2581`B'
2582     Program code and read-only data go into the `ROM'.  Read-write
2583     data goes into the `RAM'.  An image of the initialized data is
2584     loaded into the `ROM' and will be copied during system start into
2585     the `RAM'.
2586          MEMORY
2587            {
2588              ROM : ORIGIN = 0, LENGTH = 3M
2589              RAM : ORIGIN = 0x10000000, LENGTH = 1M
2590            }
2591
2592          REGION_ALIAS("REGION_TEXT", ROM);
2593          REGION_ALIAS("REGION_RODATA", ROM);
2594          REGION_ALIAS("REGION_DATA", RAM);
2595          REGION_ALIAS("REGION_BSS", RAM);
2596
2597`C'
2598     Program code goes into the `ROM'.  Read-only data goes into the
2599     `ROM2'.  Read-write data goes into the `RAM'.  An image of the
2600     initialized data is loaded into the `ROM2' and will be copied
2601     during system start into the `RAM'.
2602          MEMORY
2603            {
2604              ROM : ORIGIN = 0, LENGTH = 2M
2605              ROM2 : ORIGIN = 0x10000000, LENGTH = 1M
2606              RAM : ORIGIN = 0x20000000, LENGTH = 1M
2607            }
2608
2609          REGION_ALIAS("REGION_TEXT", ROM);
2610          REGION_ALIAS("REGION_RODATA", ROM2);
2611          REGION_ALIAS("REGION_DATA", RAM);
2612          REGION_ALIAS("REGION_BSS", RAM);
2613
2614   It is possible to write a common system initialization routine to
2615copy the `.data' section from `ROM' or `ROM2' into the `RAM' if
2616necessary:
2617     #include <string.h>
2618
2619     extern char data_start [];
2620     extern char data_size [];
2621     extern char data_load_start [];
2622
2623     void copy_data(void)
2624     {
2625       if (data_start != data_load_start)
2626         {
2627           memcpy(data_start, data_load_start, (size_t) data_size);
2628         }
2629     }
2630
2631
2632File: ld.info,  Node: Miscellaneous Commands,  Prev: REGION_ALIAS,  Up: Simple Commands
2633
26343.4.5 Other Linker Script Commands
2635----------------------------------
2636
2637There are a few other linker scripts commands.
2638
2639`ASSERT(EXP, MESSAGE)'
2640     Ensure that EXP is non-zero.  If it is zero, then exit the linker
2641     with an error code, and print MESSAGE.
2642
2643`EXTERN(SYMBOL SYMBOL ...)'
2644     Force SYMBOL to be entered in the output file as an undefined
2645     symbol.  Doing this may, for example, trigger linking of additional
2646     modules from standard libraries.  You may list several SYMBOLs for
2647     each `EXTERN', and you may use `EXTERN' multiple times.  This
2648     command has the same effect as the `-u' command-line option.
2649
2650`FORCE_COMMON_ALLOCATION'
2651     This command has the same effect as the `-d' command-line option:
2652     to make `ld' assign space to common symbols even if a relocatable
2653     output file is specified (`-r').
2654
2655`INHIBIT_COMMON_ALLOCATION'
2656     This command has the same effect as the `--no-define-common'
2657     command-line option: to make `ld' omit the assignment of addresses
2658     to common symbols even for a non-relocatable output file.
2659
2660`INSERT [ AFTER | BEFORE ] OUTPUT_SECTION'
2661     This command is typically used in a script specified by `-T' to
2662     augment the default `SECTIONS' with, for example, overlays.  It
2663     inserts all prior linker script statements after (or before)
2664     OUTPUT_SECTION, and also causes `-T' to not override the default
2665     linker script.  The exact insertion point is as for orphan
2666     sections.  *Note Location Counter::.  The insertion happens after
2667     the linker has mapped input sections to output sections.  Prior to
2668     the insertion, since `-T' scripts are parsed before the default
2669     linker script, statements in the `-T' script occur before the
2670     default linker script statements in the internal linker
2671     representation of the script.  In particular, input section
2672     assignments will be made to `-T' output sections before those in
2673     the default script.  Here is an example of how a `-T' script using
2674     `INSERT' might look:
2675
2676          SECTIONS
2677          {
2678            OVERLAY :
2679            {
2680              .ov1 { ov1*(.text) }
2681              .ov2 { ov2*(.text) }
2682            }
2683          }
2684          INSERT AFTER .text;
2685
2686`NOCROSSREFS(SECTION SECTION ...)'
2687     This command may be used to tell `ld' to issue an error about any
2688     references among certain output sections.
2689
2690     In certain types of programs, particularly on embedded systems when
2691     using overlays, when one section is loaded into memory, another
2692     section will not be.  Any direct references between the two
2693     sections would be errors.  For example, it would be an error if
2694     code in one section called a function defined in the other section.
2695
2696     The `NOCROSSREFS' command takes a list of output section names.  If
2697     `ld' detects any cross references between the sections, it reports
2698     an error and returns a non-zero exit status.  Note that the
2699     `NOCROSSREFS' command uses output section names, not input section
2700     names.
2701
2702`OUTPUT_ARCH(BFDARCH)'
2703     Specify a particular output machine architecture.  The argument is
2704     one of the names used by the BFD library (*note BFD::).  You can
2705     see the architecture of an object file by using the `objdump'
2706     program with the `-f' option.
2707
2708`LD_FEATURE(STRING)'
2709     This command may be used to modify `ld' behavior.  If STRING is
2710     `"SANE_EXPR"' then absolute symbols and numbers in a script are
2711     simply treated as numbers everywhere.  *Note Expression Section::.
2712
2713
2714File: ld.info,  Node: Assignments,  Next: SECTIONS,  Prev: Simple Commands,  Up: Scripts
2715
27163.5 Assigning Values to Symbols
2717===============================
2718
2719You may assign a value to a symbol in a linker script.  This will define
2720the symbol and place it into the symbol table with a global scope.
2721
2722* Menu:
2723
2724* Simple Assignments::		Simple Assignments
2725* PROVIDE::			PROVIDE
2726* PROVIDE_HIDDEN::		PROVIDE_HIDDEN
2727* Source Code Reference::	How to use a linker script defined symbol in source code
2728
2729
2730File: ld.info,  Node: Simple Assignments,  Next: PROVIDE,  Up: Assignments
2731
27323.5.1 Simple Assignments
2733------------------------
2734
2735You may assign to a symbol using any of the C assignment operators:
2736
2737`SYMBOL = EXPRESSION ;'
2738`SYMBOL += EXPRESSION ;'
2739`SYMBOL -= EXPRESSION ;'
2740`SYMBOL *= EXPRESSION ;'
2741`SYMBOL /= EXPRESSION ;'
2742`SYMBOL <<= EXPRESSION ;'
2743`SYMBOL >>= EXPRESSION ;'
2744`SYMBOL &= EXPRESSION ;'
2745`SYMBOL |= EXPRESSION ;'
2746
2747   The first case will define SYMBOL to the value of EXPRESSION.  In
2748the other cases, SYMBOL must already be defined, and the value will be
2749adjusted accordingly.
2750
2751   The special symbol name `.' indicates the location counter.  You may
2752only use this within a `SECTIONS' command.  *Note Location Counter::.
2753
2754   The semicolon after EXPRESSION is required.
2755
2756   Expressions are defined below; see *Note Expressions::.
2757
2758   You may write symbol assignments as commands in their own right, or
2759as statements within a `SECTIONS' command, or as part of an output
2760section description in a `SECTIONS' command.
2761
2762   The section of the symbol will be set from the section of the
2763expression; for more information, see *Note Expression Section::.
2764
2765   Here is an example showing the three different places that symbol
2766assignments may be used:
2767
2768     floating_point = 0;
2769     SECTIONS
2770     {
2771       .text :
2772         {
2773           *(.text)
2774           _etext = .;
2775         }
2776       _bdata = (. + 3) & ~ 3;
2777       .data : { *(.data) }
2778     }
2779   In this example, the symbol `floating_point' will be defined as
2780zero.  The symbol `_etext' will be defined as the address following the
2781last `.text' input section.  The symbol `_bdata' will be defined as the
2782address following the `.text' output section aligned upward to a 4 byte
2783boundary.
2784
2785
2786File: ld.info,  Node: PROVIDE,  Next: PROVIDE_HIDDEN,  Prev: Simple Assignments,  Up: Assignments
2787
27883.5.2 PROVIDE
2789-------------
2790
2791In some cases, it is desirable for a linker script to define a symbol
2792only if it is referenced and is not defined by any object included in
2793the link.  For example, traditional linkers defined the symbol `etext'.
2794However, ANSI C requires that the user be able to use `etext' as a
2795function name without encountering an error.  The `PROVIDE' keyword may
2796be used to define a symbol, such as `etext', only if it is referenced
2797but not defined.  The syntax is `PROVIDE(SYMBOL = EXPRESSION)'.
2798
2799   Here is an example of using `PROVIDE' to define `etext':
2800     SECTIONS
2801     {
2802       .text :
2803         {
2804           *(.text)
2805           _etext = .;
2806           PROVIDE(etext = .);
2807         }
2808     }
2809
2810   In this example, if the program defines `_etext' (with a leading
2811underscore), the linker will give a multiple definition error.  If, on
2812the other hand, the program defines `etext' (with no leading
2813underscore), the linker will silently use the definition in the program.
2814If the program references `etext' but does not define it, the linker
2815will use the definition in the linker script.
2816
2817
2818File: ld.info,  Node: PROVIDE_HIDDEN,  Next: Source Code Reference,  Prev: PROVIDE,  Up: Assignments
2819
28203.5.3 PROVIDE_HIDDEN
2821--------------------
2822
2823Similar to `PROVIDE'.  For ELF targeted ports, the symbol will be
2824hidden and won't be exported.
2825
2826
2827File: ld.info,  Node: Source Code Reference,  Prev: PROVIDE_HIDDEN,  Up: Assignments
2828
28293.5.4 Source Code Reference
2830---------------------------
2831
2832Accessing a linker script defined variable from source code is not
2833intuitive.  In particular a linker script symbol is not equivalent to a
2834variable declaration in a high level language, it is instead a symbol
2835that does not have a value.
2836
2837   Before going further, it is important to note that compilers often
2838transform names in the source code into different names when they are
2839stored in the symbol table.  For example, Fortran compilers commonly
2840prepend or append an underscore, and C++ performs extensive `name
2841mangling'.  Therefore there might be a discrepancy between the name of
2842a variable as it is used in source code and the name of the same
2843variable as it is defined in a linker script.  For example in C a
2844linker script variable might be referred to as:
2845
2846       extern int foo;
2847
2848   But in the linker script it might be defined as:
2849
2850       _foo = 1000;
2851
2852   In the remaining examples however it is assumed that no name
2853transformation has taken place.
2854
2855   When a symbol is declared in a high level language such as C, two
2856things happen.  The first is that the compiler reserves enough space in
2857the program's memory to hold the _value_ of the symbol.  The second is
2858that the compiler creates an entry in the program's symbol table which
2859holds the symbol's _address_.  ie the symbol table contains the address
2860of the block of memory holding the symbol's value.  So for example the
2861following C declaration, at file scope:
2862
2863       int foo = 1000;
2864
2865   creates a entry called `foo' in the symbol table.  This entry holds
2866the address of an `int' sized block of memory where the number 1000 is
2867initially stored.
2868
2869   When a program references a symbol the compiler generates code that
2870first accesses the symbol table to find the address of the symbol's
2871memory block and then code to read the value from that memory block.
2872So:
2873
2874       foo = 1;
2875
2876   looks up the symbol `foo' in the symbol table, gets the address
2877associated with this symbol and then writes the value 1 into that
2878address.  Whereas:
2879
2880       int * a = & foo;
2881
2882   looks up the symbol `foo' in the symbol table, gets it address and
2883then copies this address into the block of memory associated with the
2884variable `a'.
2885
2886   Linker scripts symbol declarations, by contrast, create an entry in
2887the symbol table but do not assign any memory to them.  Thus they are
2888an address without a value.  So for example the linker script
2889definition:
2890
2891       foo = 1000;
2892
2893   creates an entry in the symbol table called `foo' which holds the
2894address of memory location 1000, but nothing special is stored at
2895address 1000.  This means that you cannot access the _value_ of a
2896linker script defined symbol - it has no value - all you can do is
2897access the _address_ of a linker script defined symbol.
2898
2899   Hence when you are using a linker script defined symbol in source
2900code you should always take the address of the symbol, and never
2901attempt to use its value.  For example suppose you want to copy the
2902contents of a section of memory called .ROM into a section called
2903.FLASH and the linker script contains these declarations:
2904
2905       start_of_ROM   = .ROM;
2906       end_of_ROM     = .ROM + sizeof (.ROM) - 1;
2907       start_of_FLASH = .FLASH;
2908
2909   Then the C source code to perform the copy would be:
2910
2911       extern char start_of_ROM, end_of_ROM, start_of_FLASH;
2912
2913       memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM);
2914
2915   Note the use of the `&' operators.  These are correct.
2916
2917
2918File: ld.info,  Node: SECTIONS,  Next: MEMORY,  Prev: Assignments,  Up: Scripts
2919
29203.6 SECTIONS Command
2921====================
2922
2923The `SECTIONS' command tells the linker how to map input sections into
2924output sections, and how to place the output sections in memory.
2925
2926   The format of the `SECTIONS' command is:
2927     SECTIONS
2928     {
2929       SECTIONS-COMMAND
2930       SECTIONS-COMMAND
2931       ...
2932     }
2933
2934   Each SECTIONS-COMMAND may of be one of the following:
2935
2936   * an `ENTRY' command (*note Entry command: Entry Point.)
2937
2938   * a symbol assignment (*note Assignments::)
2939
2940   * an output section description
2941
2942   * an overlay description
2943
2944   The `ENTRY' command and symbol assignments are permitted inside the
2945`SECTIONS' command for convenience in using the location counter in
2946those commands.  This can also make the linker script easier to
2947understand because you can use those commands at meaningful points in
2948the layout of the output file.
2949
2950   Output section descriptions and overlay descriptions are described
2951below.
2952
2953   If you do not use a `SECTIONS' command in your linker script, the
2954linker will place each input section into an identically named output
2955section in the order that the sections are first encountered in the
2956input files.  If all input sections are present in the first file, for
2957example, the order of sections in the output file will match the order
2958in the first input file.  The first section will be at address zero.
2959
2960* Menu:
2961
2962* Output Section Description::	Output section description
2963* Output Section Name::		Output section name
2964* Output Section Address::	Output section address
2965* Input Section::		Input section description
2966* Output Section Data::		Output section data
2967* Output Section Keywords::	Output section keywords
2968* Output Section Discarding::	Output section discarding
2969* Output Section Attributes::	Output section attributes
2970* Overlay Description::		Overlay description
2971
2972
2973File: ld.info,  Node: Output Section Description,  Next: Output Section Name,  Up: SECTIONS
2974
29753.6.1 Output Section Description
2976--------------------------------
2977
2978The full description of an output section looks like this:
2979     SECTION [ADDRESS] [(TYPE)] :
2980       [AT(LMA)]
2981       [ALIGN(SECTION_ALIGN)]
2982       [SUBALIGN(SUBSECTION_ALIGN)]
2983       [CONSTRAINT]
2984       {
2985         OUTPUT-SECTION-COMMAND
2986         OUTPUT-SECTION-COMMAND
2987         ...
2988       } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP]
2989
2990   Most output sections do not use most of the optional section
2991attributes.
2992
2993   The whitespace around SECTION is required, so that the section name
2994is unambiguous.  The colon and the curly braces are also required.  The
2995line breaks and other white space are optional.
2996
2997   Each OUTPUT-SECTION-COMMAND may be one of the following:
2998
2999   * a symbol assignment (*note Assignments::)
3000
3001   * an input section description (*note Input Section::)
3002
3003   * data values to include directly (*note Output Section Data::)
3004
3005   * a special output section keyword (*note Output Section Keywords::)
3006
3007
3008File: ld.info,  Node: Output Section Name,  Next: Output Section Address,  Prev: Output Section Description,  Up: SECTIONS
3009
30103.6.2 Output Section Name
3011-------------------------
3012
3013The name of the output section is SECTION.  SECTION must meet the
3014constraints of your output format.  In formats which only support a
3015limited number of sections, such as `a.out', the name must be one of
3016the names supported by the format (`a.out', for example, allows only
3017`.text', `.data' or `.bss'). If the output format supports any number
3018of sections, but with numbers and not names (as is the case for Oasys),
3019the name should be supplied as a quoted numeric string.  A section name
3020may consist of any sequence of characters, but a name which contains
3021any unusual characters such as commas must be quoted.
3022
3023   The output section name `/DISCARD/' is special; *Note Output Section
3024Discarding::.
3025
3026
3027File: ld.info,  Node: Output Section Address,  Next: Input Section,  Prev: Output Section Name,  Up: SECTIONS
3028
30293.6.3 Output Section Address
3030----------------------------
3031
3032The ADDRESS is an expression for the VMA (the virtual memory address)
3033of the output section.  This address is optional, but if it is provided
3034then the output address will be set exactly as specified.
3035
3036   If the output address is not specified then one will be chosen for
3037the section, based on the heuristic below.  This address will be
3038adjusted to fit the alignment requirement of the output section.  The
3039alignment requirement is the strictest alignment of any input section
3040contained within the output section.
3041
3042   The output section address heuristic is as follows:
3043
3044   * If an output memory REGION is set for the section then it is added
3045     to this region and its address will be the next free address in
3046     that region.
3047
3048   * If the MEMORY command has been used to create a list of memory
3049     regions then the first region which has attributes compatible with
3050     the section is selected to contain it.  The section's output
3051     address will be the next free address in that region; *Note
3052     MEMORY::.
3053
3054   * If no memory regions were specified, or none match the section then
3055     the output address will be based on the current value of the
3056     location counter.
3057
3058For example:
3059
3060     .text . : { *(.text) }
3061
3062and
3063
3064     .text : { *(.text) }
3065
3066are subtly different.  The first will set the address of the `.text'
3067output section to the current value of the location counter.  The
3068second will set it to the current value of the location counter aligned
3069to the strictest alignment of any of the `.text' input sections.
3070
3071   The ADDRESS may be an arbitrary expression; *Note Expressions::.
3072For example, if you want to align the section on a 0x10 byte boundary,
3073so that the lowest four bits of the section address are zero, you could
3074do something like this:
3075     .text ALIGN(0x10) : { *(.text) }
3076   This works because `ALIGN' returns the current location counter
3077aligned upward to the specified value.
3078
3079   Specifying ADDRESS for a section will change the value of the
3080location counter, provided that the section is non-empty.  (Empty
3081sections are ignored).
3082
3083
3084File: ld.info,  Node: Input Section,  Next: Output Section Data,  Prev: Output Section Address,  Up: SECTIONS
3085
30863.6.4 Input Section Description
3087-------------------------------
3088
3089The most common output section command is an input section description.
3090
3091   The input section description is the most basic linker script
3092operation.  You use output sections to tell the linker how to lay out
3093your program in memory.  You use input section descriptions to tell the
3094linker how to map the input files into your memory layout.
3095
3096* Menu:
3097
3098* Input Section Basics::	Input section basics
3099* Input Section Wildcards::	Input section wildcard patterns
3100* Input Section Common::	Input section for common symbols
3101* Input Section Keep::		Input section and garbage collection
3102* Input Section Example::	Input section example
3103
3104
3105File: ld.info,  Node: Input Section Basics,  Next: Input Section Wildcards,  Up: Input Section
3106
31073.6.4.1 Input Section Basics
3108............................
3109
3110An input section description consists of a file name optionally followed
3111by a list of section names in parentheses.
3112
3113   The file name and the section name may be wildcard patterns, which we
3114describe further below (*note Input Section Wildcards::).
3115
3116   The most common input section description is to include all input
3117sections with a particular name in the output section.  For example, to
3118include all input `.text' sections, you would write:
3119     *(.text)
3120   Here the `*' is a wildcard which matches any file name.  To exclude
3121a list of files from matching the file name wildcard, EXCLUDE_FILE may
3122be used to match all files except the ones specified in the
3123EXCLUDE_FILE list.  For example:
3124     *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)
3125   will cause all .ctors sections from all files except `crtend.o' and
3126`otherfile.o' to be included.
3127
3128   There are two ways to include more than one section:
3129     *(.text .rdata)
3130     *(.text) *(.rdata)
3131   The difference between these is the order in which the `.text' and
3132`.rdata' input sections will appear in the output section.  In the
3133first example, they will be intermingled, appearing in the same order as
3134they are found in the linker input.  In the second example, all `.text'
3135input sections will appear first, followed by all `.rdata' input
3136sections.
3137
3138   You can specify a file name to include sections from a particular
3139file.  You would do this if one or more of your files contain special
3140data that needs to be at a particular location in memory.  For example:
3141     data.o(.data)
3142
3143   You can also specify files within archives by writing a pattern
3144matching the archive, a colon, then the pattern matching the file, with
3145no whitespace around the colon.
3146
3147`archive:file'
3148     matches file within archive
3149
3150`archive:'
3151     matches the whole archive
3152
3153`:file'
3154     matches file but not one in an archive
3155
3156   Either one or both of `archive' and `file' can contain shell
3157wildcards.  On DOS based file systems, the linker will assume that a
3158single letter followed by a colon is a drive specifier, so `c:myfile.o'
3159is a simple file specification, not `myfile.o' within an archive called
3160`c'.  `archive:file' filespecs may also be used within an
3161`EXCLUDE_FILE' list, but may not appear in other linker script
3162contexts.  For instance, you cannot extract a file from an archive by
3163using `archive:file' in an `INPUT' command.
3164
3165   If you use a file name without a list of sections, then all sections
3166in the input file will be included in the output section.  This is not
3167commonly done, but it may by useful on occasion.  For example:
3168     data.o
3169
3170   When you use a file name which is not an `archive:file' specifier
3171and does not contain any wild card characters, the linker will first
3172see if you also specified the file name on the linker command line or
3173in an `INPUT' command.  If you did not, the linker will attempt to open
3174the file as an input file, as though it appeared on the command line.
3175Note that this differs from an `INPUT' command, because the linker will
3176not search for the file in the archive search path.
3177
3178
3179File: ld.info,  Node: Input Section Wildcards,  Next: Input Section Common,  Prev: Input Section Basics,  Up: Input Section
3180
31813.6.4.2 Input Section Wildcard Patterns
3182.......................................
3183
3184In an input section description, either the file name or the section
3185name or both may be wildcard patterns.
3186
3187   The file name of `*' seen in many examples is a simple wildcard
3188pattern for the file name.
3189
3190   The wildcard patterns are like those used by the Unix shell.
3191
3192`*'
3193     matches any number of characters
3194
3195`?'
3196     matches any single character
3197
3198`[CHARS]'
3199     matches a single instance of any of the CHARS; the `-' character
3200     may be used to specify a range of characters, as in `[a-z]' to
3201     match any lower case letter
3202
3203`\'
3204     quotes the following character
3205
3206   When a file name is matched with a wildcard, the wildcard characters
3207will not match a `/' character (used to separate directory names on
3208Unix).  A pattern consisting of a single `*' character is an exception;
3209it will always match any file name, whether it contains a `/' or not.
3210In a section name, the wildcard characters will match a `/' character.
3211
3212   File name wildcard patterns only match files which are explicitly
3213specified on the command line or in an `INPUT' command.  The linker
3214does not search directories to expand wildcards.
3215
3216   If a file name matches more than one wildcard pattern, or if a file
3217name appears explicitly and is also matched by a wildcard pattern, the
3218linker will use the first match in the linker script.  For example, this
3219sequence of input section descriptions is probably in error, because the
3220`data.o' rule will not be used:
3221     .data : { *(.data) }
3222     .data1 : { data.o(.data) }
3223
3224   Normally, the linker will place files and sections matched by
3225wildcards in the order in which they are seen during the link.  You can
3226change this by using the `SORT_BY_NAME' keyword, which appears before a
3227wildcard pattern in parentheses (e.g., `SORT_BY_NAME(.text*)').  When
3228the `SORT_BY_NAME' keyword is used, the linker will sort the files or
3229sections into ascending order by name before placing them in the output
3230file.
3231
3232   `SORT_BY_ALIGNMENT' is very similar to `SORT_BY_NAME'. The
3233difference is `SORT_BY_ALIGNMENT' will sort sections into ascending
3234order by alignment before placing them in the output file.
3235
3236   `SORT' is an alias for `SORT_BY_NAME'.
3237
3238   When there are nested section sorting commands in linker script,
3239there can be at most 1 level of nesting for section sorting commands.
3240
3241  1. `SORT_BY_NAME' (`SORT_BY_ALIGNMENT' (wildcard section pattern)).
3242     It will sort the input sections by name first, then by alignment
3243     if 2 sections have the same name.
3244
3245  2. `SORT_BY_ALIGNMENT' (`SORT_BY_NAME' (wildcard section pattern)).
3246     It will sort the input sections by alignment first, then by name
3247     if 2 sections have the same alignment.
3248
3249  3. `SORT_BY_NAME' (`SORT_BY_NAME' (wildcard section pattern)) is
3250     treated the same as `SORT_BY_NAME' (wildcard section pattern).
3251
3252  4. `SORT_BY_ALIGNMENT' (`SORT_BY_ALIGNMENT' (wildcard section
3253     pattern)) is treated the same as `SORT_BY_ALIGNMENT' (wildcard
3254     section pattern).
3255
3256  5. All other nested section sorting commands are invalid.
3257
3258   When both command line section sorting option and linker script
3259section sorting command are used, section sorting command always takes
3260precedence over the command line option.
3261
3262   If the section sorting command in linker script isn't nested, the
3263command line option will make the section sorting command to be treated
3264as nested sorting command.
3265
3266  1. `SORT_BY_NAME' (wildcard section pattern ) with `--sort-sections
3267     alignment' is equivalent to `SORT_BY_NAME' (`SORT_BY_ALIGNMENT'
3268     (wildcard section pattern)).
3269
3270  2. `SORT_BY_ALIGNMENT' (wildcard section pattern) with
3271     `--sort-section name' is equivalent to `SORT_BY_ALIGNMENT'
3272     (`SORT_BY_NAME' (wildcard section pattern)).
3273
3274   If the section sorting command in linker script is nested, the
3275command line option will be ignored.
3276
3277   If you ever get confused about where input sections are going, use
3278the `-M' linker option to generate a map file.  The map file shows
3279precisely how input sections are mapped to output sections.
3280
3281   This example shows how wildcard patterns might be used to partition
3282files.  This linker script directs the linker to place all `.text'
3283sections in `.text' and all `.bss' sections in `.bss'.  The linker will
3284place the `.data' section from all files beginning with an upper case
3285character in `.DATA'; for all other files, the linker will place the
3286`.data' section in `.data'.
3287     SECTIONS {
3288       .text : { *(.text) }
3289       .DATA : { [A-Z]*(.data) }
3290       .data : { *(.data) }
3291       .bss : { *(.bss) }
3292     }
3293
3294
3295File: ld.info,  Node: Input Section Common,  Next: Input Section Keep,  Prev: Input Section Wildcards,  Up: Input Section
3296
32973.6.4.3 Input Section for Common Symbols
3298........................................
3299
3300A special notation is needed for common symbols, because in many object
3301file formats common symbols do not have a particular input section.  The
3302linker treats common symbols as though they are in an input section
3303named `COMMON'.
3304
3305   You may use file names with the `COMMON' section just as with any
3306other input sections.  You can use this to place common symbols from a
3307particular input file in one section while common symbols from other
3308input files are placed in another section.
3309
3310   In most cases, common symbols in input files will be placed in the
3311`.bss' section in the output file.  For example:
3312     .bss { *(.bss) *(COMMON) }
3313
3314   Some object file formats have more than one type of common symbol.
3315For example, the MIPS ELF object file format distinguishes standard
3316common symbols and small common symbols.  In this case, the linker will
3317use a different special section name for other types of common symbols.
3318In the case of MIPS ELF, the linker uses `COMMON' for standard common
3319symbols and `.scommon' for small common symbols.  This permits you to
3320map the different types of common symbols into memory at different
3321locations.
3322
3323   You will sometimes see `[COMMON]' in old linker scripts.  This
3324notation is now considered obsolete.  It is equivalent to `*(COMMON)'.
3325
3326
3327File: ld.info,  Node: Input Section Keep,  Next: Input Section Example,  Prev: Input Section Common,  Up: Input Section
3328
33293.6.4.4 Input Section and Garbage Collection
3330............................................
3331
3332When link-time garbage collection is in use (`--gc-sections'), it is
3333often useful to mark sections that should not be eliminated.  This is
3334accomplished by surrounding an input section's wildcard entry with
3335`KEEP()', as in `KEEP(*(.init))' or `KEEP(SORT_BY_NAME(*)(.ctors))'.
3336
3337
3338File: ld.info,  Node: Input Section Example,  Prev: Input Section Keep,  Up: Input Section
3339
33403.6.4.5 Input Section Example
3341.............................
3342
3343The following example is a complete linker script.  It tells the linker
3344to read all of the sections from file `all.o' and place them at the
3345start of output section `outputa' which starts at location `0x10000'.
3346All of section `.input1' from file `foo.o' follows immediately, in the
3347same output section.  All of section `.input2' from `foo.o' goes into
3348output section `outputb', followed by section `.input1' from `foo1.o'.
3349All of the remaining `.input1' and `.input2' sections from any files
3350are written to output section `outputc'.
3351
3352     SECTIONS {
3353       outputa 0x10000 :
3354         {
3355         all.o
3356         foo.o (.input1)
3357         }
3358       outputb :
3359         {
3360         foo.o (.input2)
3361         foo1.o (.input1)
3362         }
3363       outputc :
3364         {
3365         *(.input1)
3366         *(.input2)
3367         }
3368     }
3369
3370
3371File: ld.info,  Node: Output Section Data,  Next: Output Section Keywords,  Prev: Input Section,  Up: SECTIONS
3372
33733.6.5 Output Section Data
3374-------------------------
3375
3376You can include explicit bytes of data in an output section by using
3377`BYTE', `SHORT', `LONG', `QUAD', or `SQUAD' as an output section
3378command.  Each keyword is followed by an expression in parentheses
3379providing the value to store (*note Expressions::).  The value of the
3380expression is stored at the current value of the location counter.
3381
3382   The `BYTE', `SHORT', `LONG', and `QUAD' commands store one, two,
3383four, and eight bytes (respectively).  After storing the bytes, the
3384location counter is incremented by the number of bytes stored.
3385
3386   For example, this will store the byte 1 followed by the four byte
3387value of the symbol `addr':
3388     BYTE(1)
3389     LONG(addr)
3390
3391   When using a 64 bit host or target, `QUAD' and `SQUAD' are the same;
3392they both store an 8 byte, or 64 bit, value.  When both host and target
3393are 32 bits, an expression is computed as 32 bits.  In this case `QUAD'
3394stores a 32 bit value zero extended to 64 bits, and `SQUAD' stores a 32
3395bit value sign extended to 64 bits.
3396
3397   If the object file format of the output file has an explicit
3398endianness, which is the normal case, the value will be stored in that
3399endianness.  When the object file format does not have an explicit
3400endianness, as is true of, for example, S-records, the value will be
3401stored in the endianness of the first input object file.
3402
3403   Note--these commands only work inside a section description and not
3404between them, so the following will produce an error from the linker:
3405     SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }
3406   whereas this will work:
3407     SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }
3408
3409   You may use the `FILL' command to set the fill pattern for the
3410current section.  It is followed by an expression in parentheses.  Any
3411otherwise unspecified regions of memory within the section (for example,
3412gaps left due to the required alignment of input sections) are filled
3413with the value of the expression, repeated as necessary.  A `FILL'
3414statement covers memory locations after the point at which it occurs in
3415the section definition; by including more than one `FILL' statement,
3416you can have different fill patterns in different parts of an output
3417section.
3418
3419   This example shows how to fill unspecified regions of memory with the
3420value `0x90':
3421     FILL(0x90909090)
3422
3423   The `FILL' command is similar to the `=FILLEXP' output section
3424attribute, but it only affects the part of the section following the
3425`FILL' command, rather than the entire section.  If both are used, the
3426`FILL' command takes precedence.  *Note Output Section Fill::, for
3427details on the fill expression.
3428
3429
3430File: ld.info,  Node: Output Section Keywords,  Next: Output Section Discarding,  Prev: Output Section Data,  Up: SECTIONS
3431
34323.6.6 Output Section Keywords
3433-----------------------------
3434
3435There are a couple of keywords which can appear as output section
3436commands.
3437
3438`CREATE_OBJECT_SYMBOLS'
3439     The command tells the linker to create a symbol for each input
3440     file.  The name of each symbol will be the name of the
3441     corresponding input file.  The section of each symbol will be the
3442     output section in which the `CREATE_OBJECT_SYMBOLS' command
3443     appears.
3444
3445     This is conventional for the a.out object file format.  It is not
3446     normally used for any other object file format.
3447
3448`CONSTRUCTORS'
3449     When linking using the a.out object file format, the linker uses an
3450     unusual set construct to support C++ global constructors and
3451     destructors.  When linking object file formats which do not support
3452     arbitrary sections, such as ECOFF and XCOFF, the linker will
3453     automatically recognize C++ global constructors and destructors by
3454     name.  For these object file formats, the `CONSTRUCTORS' command
3455     tells the linker to place constructor information in the output
3456     section where the `CONSTRUCTORS' command appears.  The
3457     `CONSTRUCTORS' command is ignored for other object file formats.
3458
3459     The symbol `__CTOR_LIST__' marks the start of the global
3460     constructors, and the symbol `__CTOR_END__' marks the end.
3461     Similarly, `__DTOR_LIST__' and `__DTOR_END__' mark the start and
3462     end of the global destructors.  The first word in the list is the
3463     number of entries, followed by the address of each constructor or
3464     destructor, followed by a zero word.  The compiler must arrange to
3465     actually run the code.  For these object file formats GNU C++
3466     normally calls constructors from a subroutine `__main'; a call to
3467     `__main' is automatically inserted into the startup code for
3468     `main'.  GNU C++ normally runs destructors either by using
3469     `atexit', or directly from the function `exit'.
3470
3471     For object file formats such as `COFF' or `ELF' which support
3472     arbitrary section names, GNU C++ will normally arrange to put the
3473     addresses of global constructors and destructors into the `.ctors'
3474     and `.dtors' sections.  Placing the following sequence into your
3475     linker script will build the sort of table which the GNU C++
3476     runtime code expects to see.
3477
3478                __CTOR_LIST__ = .;
3479                LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
3480                *(.ctors)
3481                LONG(0)
3482                __CTOR_END__ = .;
3483                __DTOR_LIST__ = .;
3484                LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
3485                *(.dtors)
3486                LONG(0)
3487                __DTOR_END__ = .;
3488
3489     If you are using the GNU C++ support for initialization priority,
3490     which provides some control over the order in which global
3491     constructors are run, you must sort the constructors at link time
3492     to ensure that they are executed in the correct order.  When using
3493     the `CONSTRUCTORS' command, use `SORT_BY_NAME(CONSTRUCTORS)'
3494     instead.  When using the `.ctors' and `.dtors' sections, use
3495     `*(SORT_BY_NAME(.ctors))' and `*(SORT_BY_NAME(.dtors))' instead of
3496     just `*(.ctors)' and `*(.dtors)'.
3497
3498     Normally the compiler and linker will handle these issues
3499     automatically, and you will not need to concern yourself with
3500     them.  However, you may need to consider this if you are using C++
3501     and writing your own linker scripts.
3502
3503
3504
3505File: ld.info,  Node: Output Section Discarding,  Next: Output Section Attributes,  Prev: Output Section Keywords,  Up: SECTIONS
3506
35073.6.7 Output Section Discarding
3508-------------------------------
3509
3510The linker will not create output sections with no contents.  This is
3511for convenience when referring to input sections that may or may not be
3512present in any of the input files.  For example:
3513     .foo : { *(.foo) }
3514   will only create a `.foo' section in the output file if there is a
3515`.foo' section in at least one input file, and if the input sections
3516are not all empty.  Other link script directives that allocate space in
3517an output section will also create the output section.
3518
3519   The linker will ignore address assignments (*note Output Section
3520Address::) on discarded output sections, except when the linker script
3521defines symbols in the output section.  In that case the linker will
3522obey the address assignments, possibly advancing dot even though the
3523section is discarded.
3524
3525   The special output section name `/DISCARD/' may be used to discard
3526input sections.  Any input sections which are assigned to an output
3527section named `/DISCARD/' are not included in the output file.
3528
3529
3530File: ld.info,  Node: Output Section Attributes,  Next: Overlay Description,  Prev: Output Section Discarding,  Up: SECTIONS
3531
35323.6.8 Output Section Attributes
3533-------------------------------
3534
3535We showed above that the full description of an output section looked
3536like this:
3537
3538     SECTION [ADDRESS] [(TYPE)] :
3539       [AT(LMA)]
3540       [ALIGN(SECTION_ALIGN)]
3541       [SUBALIGN(SUBSECTION_ALIGN)]
3542       [CONSTRAINT]
3543       {
3544         OUTPUT-SECTION-COMMAND
3545         OUTPUT-SECTION-COMMAND
3546         ...
3547       } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP]
3548
3549   We've already described SECTION, ADDRESS, and
3550OUTPUT-SECTION-COMMAND.  In this section we will describe the remaining
3551section attributes.
3552
3553* Menu:
3554
3555* Output Section Type::		Output section type
3556* Output Section LMA::		Output section LMA
3557* Forced Output Alignment::	Forced Output Alignment
3558* Forced Input Alignment::	Forced Input Alignment
3559* Output Section Constraint::   Output section constraint
3560* Output Section Region::	Output section region
3561* Output Section Phdr::		Output section phdr
3562* Output Section Fill::		Output section fill
3563
3564
3565File: ld.info,  Node: Output Section Type,  Next: Output Section LMA,  Up: Output Section Attributes
3566
35673.6.8.1 Output Section Type
3568...........................
3569
3570Each output section may have a type.  The type is a keyword in
3571parentheses.  The following types are defined:
3572
3573`NOLOAD'
3574     The section should be marked as not loadable, so that it will not
3575     be loaded into memory when the program is run.
3576
3577`DSECT'
3578`COPY'
3579`INFO'
3580`OVERLAY'
3581     These type names are supported for backward compatibility, and are
3582     rarely used.  They all have the same effect: the section should be
3583     marked as not allocatable, so that no memory is allocated for the
3584     section when the program is run.
3585
3586   The linker normally sets the attributes of an output section based on
3587the input sections which map into it.  You can override this by using
3588the section type.  For example, in the script sample below, the `ROM'
3589section is addressed at memory location `0' and does not need to be
3590loaded when the program is run.
3591     SECTIONS {
3592       ROM 0 (NOLOAD) : { ... }
3593       ...
3594     }
3595
3596
3597File: ld.info,  Node: Output Section LMA,  Next: Forced Output Alignment,  Prev: Output Section Type,  Up: Output Section Attributes
3598
35993.6.8.2 Output Section LMA
3600..........................
3601
3602Every section has a virtual address (VMA) and a load address (LMA); see
3603*Note Basic Script Concepts::.  The virtual address is specified by the
3604*note Output Section Address:: described earlier.  The load address is
3605specified by the `AT' or `AT>' keywords.  Specifying a load address is
3606optional.
3607
3608   The `AT' keyword takes an expression as an argument.  This specifies
3609the exact load address of the section.  The `AT>' keyword takes the
3610name of a memory region as an argument.  *Note MEMORY::.  The load
3611address of the section is set to the next free address in the region,
3612aligned to the section's alignment requirements.
3613
3614   If neither `AT' nor `AT>' is specified for an allocatable section,
3615the linker will use the following heuristic to determine the load
3616address:
3617
3618   * If the section has a specific VMA address, then this is used as
3619     the LMA address as well.
3620
3621   * If the section is not allocatable then its LMA is set to its VMA.
3622
3623   * Otherwise if a memory region can be found that is compatible with
3624     the current section, and this region contains at least one
3625     section, then the LMA is set so the difference between the VMA and
3626     LMA is the same as the difference between the VMA and LMA of the
3627     last section in the located region.
3628
3629   * If no memory regions have been declared then a default region that
3630     covers the entire address space is used in the previous step.
3631
3632   * If no suitable region could be found, or there was no previous
3633     section then the LMA is set equal to the VMA.
3634
3635   This feature is designed to make it easy to build a ROM image.  For
3636example, the following linker script creates three output sections: one
3637called `.text', which starts at `0x1000', one called `.mdata', which is
3638loaded at the end of the `.text' section even though its VMA is
3639`0x2000', and one called `.bss' to hold uninitialized data at address
3640`0x3000'.  The symbol `_data' is defined with the value `0x2000', which
3641shows that the location counter holds the VMA value, not the LMA value.
3642
3643     SECTIONS
3644       {
3645       .text 0x1000 : { *(.text) _etext = . ; }
3646       .mdata 0x2000 :
3647         AT ( ADDR (.text) + SIZEOF (.text) )
3648         { _data = . ; *(.data); _edata = . ;  }
3649       .bss 0x3000 :
3650         { _bstart = . ;  *(.bss) *(COMMON) ; _bend = . ;}
3651     }
3652
3653   The run-time initialization code for use with a program generated
3654with this linker script would include something like the following, to
3655copy the initialized data from the ROM image to its runtime address.
3656Notice how this code takes advantage of the symbols defined by the
3657linker script.
3658
3659     extern char _etext, _data, _edata, _bstart, _bend;
3660     char *src = &_etext;
3661     char *dst = &_data;
3662
3663     /* ROM has data at end of text; copy it.  */
3664     while (dst < &_edata)
3665       *dst++ = *src++;
3666
3667     /* Zero bss.  */
3668     for (dst = &_bstart; dst< &_bend; dst++)
3669       *dst = 0;
3670
3671
3672File: ld.info,  Node: Forced Output Alignment,  Next: Forced Input Alignment,  Prev: Output Section LMA,  Up: Output Section Attributes
3673
36743.6.8.3 Forced Output Alignment
3675...............................
3676
3677You can increase an output section's alignment by using ALIGN.
3678
3679
3680File: ld.info,  Node: Forced Input Alignment,  Next: Output Section Constraint,  Prev: Forced Output Alignment,  Up: Output Section Attributes
3681
36823.6.8.4 Forced Input Alignment
3683..............................
3684
3685You can force input section alignment within an output section by using
3686SUBALIGN.  The value specified overrides any alignment given by input
3687sections, whether larger or smaller.
3688
3689
3690File: ld.info,  Node: Output Section Constraint,  Next: Output Section Region,  Prev: Forced Input Alignment,  Up: Output Section Attributes
3691
36923.6.8.5 Output Section Constraint
3693.................................
3694
3695You can specify that an output section should only be created if all of
3696its input sections are read-only or all of its input sections are
3697read-write by using the keyword `ONLY_IF_RO' and `ONLY_IF_RW'
3698respectively.
3699
3700
3701File: ld.info,  Node: Output Section Region,  Next: Output Section Phdr,  Prev: Output Section Constraint,  Up: Output Section Attributes
3702
37033.6.8.6 Output Section Region
3704.............................
3705
3706You can assign a section to a previously defined region of memory by
3707using `>REGION'.  *Note MEMORY::.
3708
3709   Here is a simple example:
3710     MEMORY { rom : ORIGIN = 0x1000, LENGTH = 0x1000 }
3711     SECTIONS { ROM : { *(.text) } >rom }
3712
3713
3714File: ld.info,  Node: Output Section Phdr,  Next: Output Section Fill,  Prev: Output Section Region,  Up: Output Section Attributes
3715
37163.6.8.7 Output Section Phdr
3717...........................
3718
3719You can assign a section to a previously defined program segment by
3720using `:PHDR'.  *Note PHDRS::.  If a section is assigned to one or more
3721segments, then all subsequent allocated sections will be assigned to
3722those segments as well, unless they use an explicitly `:PHDR' modifier.
3723You can use `:NONE' to tell the linker to not put the section in any
3724segment at all.
3725
3726   Here is a simple example:
3727     PHDRS { text PT_LOAD ; }
3728     SECTIONS { .text : { *(.text) } :text }
3729
3730
3731File: ld.info,  Node: Output Section Fill,  Prev: Output Section Phdr,  Up: Output Section Attributes
3732
37333.6.8.8 Output Section Fill
3734...........................
3735
3736You can set the fill pattern for an entire section by using `=FILLEXP'.
3737FILLEXP is an expression (*note Expressions::).  Any otherwise
3738unspecified regions of memory within the output section (for example,
3739gaps left due to the required alignment of input sections) will be
3740filled with the value, repeated as necessary.  If the fill expression
3741is a simple hex number, ie. a string of hex digit starting with `0x'
3742and without a trailing `k' or `M', then an arbitrarily long sequence of
3743hex digits can be used to specify the fill pattern;  Leading zeros
3744become part of the pattern too.  For all other cases, including extra
3745parentheses or a unary `+', the fill pattern is the four least
3746significant bytes of the value of the expression.  In all cases, the
3747number is big-endian.
3748
3749   You can also change the fill value with a `FILL' command in the
3750output section commands; (*note Output Section Data::).
3751
3752   Here is a simple example:
3753     SECTIONS { .text : { *(.text) } =0x90909090 }
3754
3755
3756File: ld.info,  Node: Overlay Description,  Prev: Output Section Attributes,  Up: SECTIONS
3757
37583.6.9 Overlay Description
3759-------------------------
3760
3761An overlay description provides an easy way to describe sections which
3762are to be loaded as part of a single memory image but are to be run at
3763the same memory address.  At run time, some sort of overlay manager will
3764copy the overlaid sections in and out of the runtime memory address as
3765required, perhaps by simply manipulating addressing bits.  This approach
3766can be useful, for example, when a certain region of memory is faster
3767than another.
3768
3769   Overlays are described using the `OVERLAY' command.  The `OVERLAY'
3770command is used within a `SECTIONS' command, like an output section
3771description.  The full syntax of the `OVERLAY' command is as follows:
3772     OVERLAY [START] : [NOCROSSREFS] [AT ( LDADDR )]
3773       {
3774         SECNAME1
3775           {
3776             OUTPUT-SECTION-COMMAND
3777             OUTPUT-SECTION-COMMAND
3778             ...
3779           } [:PHDR...] [=FILL]
3780         SECNAME2
3781           {
3782             OUTPUT-SECTION-COMMAND
3783             OUTPUT-SECTION-COMMAND
3784             ...
3785           } [:PHDR...] [=FILL]
3786         ...
3787       } [>REGION] [:PHDR...] [=FILL]
3788
3789   Everything is optional except `OVERLAY' (a keyword), and each
3790section must have a name (SECNAME1 and SECNAME2 above).  The section
3791definitions within the `OVERLAY' construct are identical to those
3792within the general `SECTIONS' contruct (*note SECTIONS::), except that
3793no addresses and no memory regions may be defined for sections within
3794an `OVERLAY'.
3795
3796   The sections are all defined with the same starting address.  The
3797load addresses of the sections are arranged such that they are
3798consecutive in memory starting at the load address used for the
3799`OVERLAY' as a whole (as with normal section definitions, the load
3800address is optional, and defaults to the start address; the start
3801address is also optional, and defaults to the current value of the
3802location counter).
3803
3804   If the `NOCROSSREFS' keyword is used, and there any references among
3805the sections, the linker will report an error.  Since the sections all
3806run at the same address, it normally does not make sense for one
3807section to refer directly to another.  *Note NOCROSSREFS: Miscellaneous
3808Commands.
3809
3810   For each section within the `OVERLAY', the linker automatically
3811provides two symbols.  The symbol `__load_start_SECNAME' is defined as
3812the starting load address of the section.  The symbol
3813`__load_stop_SECNAME' is defined as the final load address of the
3814section.  Any characters within SECNAME which are not legal within C
3815identifiers are removed.  C (or assembler) code may use these symbols
3816to move the overlaid sections around as necessary.
3817
3818   At the end of the overlay, the value of the location counter is set
3819to the start address of the overlay plus the size of the largest
3820section.
3821
3822   Here is an example.  Remember that this would appear inside a
3823`SECTIONS' construct.
3824       OVERLAY 0x1000 : AT (0x4000)
3825        {
3826          .text0 { o1/*.o(.text) }
3827          .text1 { o2/*.o(.text) }
3828        }
3829This will define both `.text0' and `.text1' to start at address
38300x1000.  `.text0' will be loaded at address 0x4000, and `.text1' will
3831be loaded immediately after `.text0'.  The following symbols will be
3832defined if referenced: `__load_start_text0', `__load_stop_text0',
3833`__load_start_text1', `__load_stop_text1'.
3834
3835   C code to copy overlay `.text1' into the overlay area might look
3836like the following.
3837
3838       extern char __load_start_text1, __load_stop_text1;
3839       memcpy ((char *) 0x1000, &__load_start_text1,
3840               &__load_stop_text1 - &__load_start_text1);
3841
3842   Note that the `OVERLAY' command is just syntactic sugar, since
3843everything it does can be done using the more basic commands.  The above
3844example could have been written identically as follows.
3845
3846       .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
3847       PROVIDE (__load_start_text0 = LOADADDR (.text0));
3848       PROVIDE (__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0));
3849       .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
3850       PROVIDE (__load_start_text1 = LOADADDR (.text1));
3851       PROVIDE (__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1));
3852       . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
3853
3854
3855File: ld.info,  Node: MEMORY,  Next: PHDRS,  Prev: SECTIONS,  Up: Scripts
3856
38573.7 MEMORY Command
3858==================
3859
3860The linker's default configuration permits allocation of all available
3861memory.  You can override this by using the `MEMORY' command.
3862
3863   The `MEMORY' command describes the location and size of blocks of
3864memory in the target.  You can use it to describe which memory regions
3865may be used by the linker, and which memory regions it must avoid.  You
3866can then assign sections to particular memory regions.  The linker will
3867set section addresses based on the memory regions, and will warn about
3868regions that become too full.  The linker will not shuffle sections
3869around to fit into the available regions.
3870
3871   A linker script may contain at most one use of the `MEMORY' command.
3872However, you can define as many blocks of memory within it as you
3873wish.  The syntax is:
3874     MEMORY
3875       {
3876         NAME [(ATTR)] : ORIGIN = ORIGIN, LENGTH = LEN
3877         ...
3878       }
3879
3880   The NAME is a name used in the linker script to refer to the region.
3881The region name has no meaning outside of the linker script.  Region
3882names are stored in a separate name space, and will not conflict with
3883symbol names, file names, or section names.  Each memory region must
3884have a distinct name within the `MEMORY' command.  However you can add
3885later alias names to existing memory regions with the *Note
3886REGION_ALIAS:: command.
3887
3888   The ATTR string is an optional list of attributes that specify
3889whether to use a particular memory region for an input section which is
3890not explicitly mapped in the linker script.  As described in *Note
3891SECTIONS::, if you do not specify an output section for some input
3892section, the linker will create an output section with the same name as
3893the input section.  If you define region attributes, the linker will use
3894them to select the memory region for the output section that it creates.
3895
3896   The ATTR string must consist only of the following characters:
3897`R'
3898     Read-only section
3899
3900`W'
3901     Read/write section
3902
3903`X'
3904     Executable section
3905
3906`A'
3907     Allocatable section
3908
3909`I'
3910     Initialized section
3911
3912`L'
3913     Same as `I'
3914
3915`!'
3916     Invert the sense of any of the attributes that follow
3917
3918   If a unmapped section matches any of the listed attributes other than
3919`!', it will be placed in the memory region.  The `!' attribute
3920reverses this test, so that an unmapped section will be placed in the
3921memory region only if it does not match any of the listed attributes.
3922
3923   The ORIGIN is an numerical expression for the start address of the
3924memory region.  The expression must evaluate to a constant and it
3925cannot involve any symbols.  The keyword `ORIGIN' may be abbreviated to
3926`org' or `o' (but not, for example, `ORG').
3927
3928   The LEN is an expression for the size in bytes of the memory region.
3929As with the ORIGIN expression, the expression must be numerical only
3930and must evaluate to a constant.  The keyword `LENGTH' may be
3931abbreviated to `len' or `l'.
3932
3933   In the following example, we specify that there are two memory
3934regions available for allocation: one starting at `0' for 256 kilobytes,
3935and the other starting at `0x40000000' for four megabytes.  The linker
3936will place into the `rom' memory region every section which is not
3937explicitly mapped into a memory region, and is either read-only or
3938executable.  The linker will place other sections which are not
3939explicitly mapped into a memory region into the `ram' memory region.
3940
3941     MEMORY
3942       {
3943         rom (rx)  : ORIGIN = 0, LENGTH = 256K
3944         ram (!rx) : org = 0x40000000, l = 4M
3945       }
3946
3947   Once you define a memory region, you can direct the linker to place
3948specific output sections into that memory region by using the `>REGION'
3949output section attribute.  For example, if you have a memory region
3950named `mem', you would use `>mem' in the output section definition.
3951*Note Output Section Region::.  If no address was specified for the
3952output section, the linker will set the address to the next available
3953address within the memory region.  If the combined output sections
3954directed to a memory region are too large for the region, the linker
3955will issue an error message.
3956
3957   It is possible to access the origin and length of a memory in an
3958expression via the `ORIGIN(MEMORY)' and `LENGTH(MEMORY)' functions:
3959
3960       _fstack = ORIGIN(ram) + LENGTH(ram) - 4;
3961
3962
3963File: ld.info,  Node: PHDRS,  Next: VERSION,  Prev: MEMORY,  Up: Scripts
3964
39653.8 PHDRS Command
3966=================
3967
3968The ELF object file format uses "program headers", also knows as
3969"segments".  The program headers describe how the program should be
3970loaded into memory.  You can print them out by using the `objdump'
3971program with the `-p' option.
3972
3973   When you run an ELF program on a native ELF system, the system loader
3974reads the program headers in order to figure out how to load the
3975program.  This will only work if the program headers are set correctly.
3976This manual does not describe the details of how the system loader
3977interprets program headers; for more information, see the ELF ABI.
3978
3979   The linker will create reasonable program headers by default.
3980However, in some cases, you may need to specify the program headers more
3981precisely.  You may use the `PHDRS' command for this purpose.  When the
3982linker sees the `PHDRS' command in the linker script, it will not
3983create any program headers other than the ones specified.
3984
3985   The linker only pays attention to the `PHDRS' command when
3986generating an ELF output file.  In other cases, the linker will simply
3987ignore `PHDRS'.
3988
3989   This is the syntax of the `PHDRS' command.  The words `PHDRS',
3990`FILEHDR', `AT', and `FLAGS' are keywords.
3991
3992     PHDRS
3993     {
3994       NAME TYPE [ FILEHDR ] [ PHDRS ] [ AT ( ADDRESS ) ]
3995             [ FLAGS ( FLAGS ) ] ;
3996     }
3997
3998   The NAME is used only for reference in the `SECTIONS' command of the
3999linker script.  It is not put into the output file.  Program header
4000names are stored in a separate name space, and will not conflict with
4001symbol names, file names, or section names.  Each program header must
4002have a distinct name.  The headers are processed in order and it is
4003usual for them to map to sections in ascending load address order.
4004
4005   Certain program header types describe segments of memory which the
4006system loader will load from the file.  In the linker script, you
4007specify the contents of these segments by placing allocatable output
4008sections in the segments.  You use the `:PHDR' output section attribute
4009to place a section in a particular segment.  *Note Output Section
4010Phdr::.
4011
4012   It is normal to put certain sections in more than one segment.  This
4013merely implies that one segment of memory contains another.  You may
4014repeat `:PHDR', using it once for each segment which should contain the
4015section.
4016
4017   If you place a section in one or more segments using `:PHDR', then
4018the linker will place all subsequent allocatable sections which do not
4019specify `:PHDR' in the same segments.  This is for convenience, since
4020generally a whole set of contiguous sections will be placed in a single
4021segment.  You can use `:NONE' to override the default segment and tell
4022the linker to not put the section in any segment at all.
4023
4024   You may use the `FILEHDR' and `PHDRS' keywords after the program
4025header type to further describe the contents of the segment.  The
4026`FILEHDR' keyword means that the segment should include the ELF file
4027header.  The `PHDRS' keyword means that the segment should include the
4028ELF program headers themselves.  If applied to a loadable segment
4029(`PT_LOAD'), all prior loadable segments must have one of these
4030keywords.
4031
4032   The TYPE may be one of the following.  The numbers indicate the
4033value of the keyword.
4034
4035`PT_NULL' (0)
4036     Indicates an unused program header.
4037
4038`PT_LOAD' (1)
4039     Indicates that this program header describes a segment to be
4040     loaded from the file.
4041
4042`PT_DYNAMIC' (2)
4043     Indicates a segment where dynamic linking information can be found.
4044
4045`PT_INTERP' (3)
4046     Indicates a segment where the name of the program interpreter may
4047     be found.
4048
4049`PT_NOTE' (4)
4050     Indicates a segment holding note information.
4051
4052`PT_SHLIB' (5)
4053     A reserved program header type, defined but not specified by the
4054     ELF ABI.
4055
4056`PT_PHDR' (6)
4057     Indicates a segment where the program headers may be found.
4058
4059EXPRESSION
4060     An expression giving the numeric type of the program header.  This
4061     may be used for types not defined above.
4062
4063   You can specify that a segment should be loaded at a particular
4064address in memory by using an `AT' expression.  This is identical to the
4065`AT' command used as an output section attribute (*note Output Section
4066LMA::).  The `AT' command for a program header overrides the output
4067section attribute.
4068
4069   The linker will normally set the segment flags based on the sections
4070which comprise the segment.  You may use the `FLAGS' keyword to
4071explicitly specify the segment flags.  The value of FLAGS must be an
4072integer.  It is used to set the `p_flags' field of the program header.
4073
4074   Here is an example of `PHDRS'.  This shows a typical set of program
4075headers used on a native ELF system.
4076
4077     PHDRS
4078     {
4079       headers PT_PHDR PHDRS ;
4080       interp PT_INTERP ;
4081       text PT_LOAD FILEHDR PHDRS ;
4082       data PT_LOAD ;
4083       dynamic PT_DYNAMIC ;
4084     }
4085
4086     SECTIONS
4087     {
4088       . = SIZEOF_HEADERS;
4089       .interp : { *(.interp) } :text :interp
4090       .text : { *(.text) } :text
4091       .rodata : { *(.rodata) } /* defaults to :text */
4092       ...
4093       . = . + 0x1000; /* move to a new page in memory */
4094       .data : { *(.data) } :data
4095       .dynamic : { *(.dynamic) } :data :dynamic
4096       ...
4097     }
4098
4099
4100File: ld.info,  Node: VERSION,  Next: Expressions,  Prev: PHDRS,  Up: Scripts
4101
41023.9 VERSION Command
4103===================
4104
4105The linker supports symbol versions when using ELF.  Symbol versions are
4106only useful when using shared libraries.  The dynamic linker can use
4107symbol versions to select a specific version of a function when it runs
4108a program that may have been linked against an earlier version of the
4109shared library.
4110
4111   You can include a version script directly in the main linker script,
4112or you can supply the version script as an implicit linker script.  You
4113can also use the `--version-script' linker option.
4114
4115   The syntax of the `VERSION' command is simply
4116     VERSION { version-script-commands }
4117
4118   The format of the version script commands is identical to that used
4119by Sun's linker in Solaris 2.5.  The version script defines a tree of
4120version nodes.  You specify the node names and interdependencies in the
4121version script.  You can specify which symbols are bound to which
4122version nodes, and you can reduce a specified set of symbols to local
4123scope so that they are not globally visible outside of the shared
4124library.
4125
4126   The easiest way to demonstrate the version script language is with a
4127few examples.
4128
4129     VERS_1.1 {
4130     	 global:
4131     		 foo1;
4132     	 local:
4133     		 old*;
4134     		 original*;
4135     		 new*;
4136     };
4137
4138     VERS_1.2 {
4139     		 foo2;
4140     } VERS_1.1;
4141
4142     VERS_2.0 {
4143     		 bar1; bar2;
4144     	 extern "C++" {
4145     		 ns::*;
4146     		 "f(int, double)";
4147     	 };
4148     } VERS_1.2;
4149
4150   This example version script defines three version nodes.  The first
4151version node defined is `VERS_1.1'; it has no other dependencies.  The
4152script binds the symbol `foo1' to `VERS_1.1'.  It reduces a number of
4153symbols to local scope so that they are not visible outside of the
4154shared library; this is done using wildcard patterns, so that any
4155symbol whose name begins with `old', `original', or `new' is matched.
4156The wildcard patterns available are the same as those used in the shell
4157when matching filenames (also known as "globbing").  However, if you
4158specify the symbol name inside double quotes, then the name is treated
4159as literal, rather than as a glob pattern.
4160
4161   Next, the version script defines node `VERS_1.2'.  This node depends
4162upon `VERS_1.1'.  The script binds the symbol `foo2' to the version
4163node `VERS_1.2'.
4164
4165   Finally, the version script defines node `VERS_2.0'.  This node
4166depends upon `VERS_1.2'.  The scripts binds the symbols `bar1' and
4167`bar2' are bound to the version node `VERS_2.0'.
4168
4169   When the linker finds a symbol defined in a library which is not
4170specifically bound to a version node, it will effectively bind it to an
4171unspecified base version of the library.  You can bind all otherwise
4172unspecified symbols to a given version node by using `global: *;'
4173somewhere in the version script.  Note that it's slightly crazy to use
4174wildcards in a global spec except on the last version node.  Global
4175wildcards elsewhere run the risk of accidentally adding symbols to the
4176set exported for an old version.  That's wrong since older versions
4177ought to have a fixed set of symbols.
4178
4179   The names of the version nodes have no specific meaning other than
4180what they might suggest to the person reading them.  The `2.0' version
4181could just as well have appeared in between `1.1' and `1.2'.  However,
4182this would be a confusing way to write a version script.
4183
4184   Node name can be omitted, provided it is the only version node in
4185the version script.  Such version script doesn't assign any versions to
4186symbols, only selects which symbols will be globally visible out and
4187which won't.
4188
4189     { global: foo; bar; local: *; };
4190
4191   When you link an application against a shared library that has
4192versioned symbols, the application itself knows which version of each
4193symbol it requires, and it also knows which version nodes it needs from
4194each shared library it is linked against.  Thus at runtime, the dynamic
4195loader can make a quick check to make sure that the libraries you have
4196linked against do in fact supply all of the version nodes that the
4197application will need to resolve all of the dynamic symbols.  In this
4198way it is possible for the dynamic linker to know with certainty that
4199all external symbols that it needs will be resolvable without having to
4200search for each symbol reference.
4201
4202   The symbol versioning is in effect a much more sophisticated way of
4203doing minor version checking that SunOS does.  The fundamental problem
4204that is being addressed here is that typically references to external
4205functions are bound on an as-needed basis, and are not all bound when
4206the application starts up.  If a shared library is out of date, a
4207required interface may be missing; when the application tries to use
4208that interface, it may suddenly and unexpectedly fail.  With symbol
4209versioning, the user will get a warning when they start their program if
4210the libraries being used with the application are too old.
4211
4212   There are several GNU extensions to Sun's versioning approach.  The
4213first of these is the ability to bind a symbol to a version node in the
4214source file where the symbol is defined instead of in the versioning
4215script.  This was done mainly to reduce the burden on the library
4216maintainer.  You can do this by putting something like:
4217     __asm__(".symver original_foo,foo@VERS_1.1");
4218   in the C source file.  This renames the function `original_foo' to
4219be an alias for `foo' bound to the version node `VERS_1.1'.  The
4220`local:' directive can be used to prevent the symbol `original_foo'
4221from being exported. A `.symver' directive takes precedence over a
4222version script.
4223
4224   The second GNU extension is to allow multiple versions of the same
4225function to appear in a given shared library.  In this way you can make
4226an incompatible change to an interface without increasing the major
4227version number of the shared library, while still allowing applications
4228linked against the old interface to continue to function.
4229
4230   To do this, you must use multiple `.symver' directives in the source
4231file.  Here is an example:
4232
4233     __asm__(".symver original_foo,foo@");
4234     __asm__(".symver old_foo,foo@VERS_1.1");
4235     __asm__(".symver old_foo1,foo@VERS_1.2");
4236     __asm__(".symver new_foo,foo@@VERS_2.0");
4237
4238   In this example, `foo@' represents the symbol `foo' bound to the
4239unspecified base version of the symbol.  The source file that contains
4240this example would define 4 C functions: `original_foo', `old_foo',
4241`old_foo1', and `new_foo'.
4242
4243   When you have multiple definitions of a given symbol, there needs to
4244be some way to specify a default version to which external references to
4245this symbol will be bound.  You can do this with the `foo@@VERS_2.0'
4246type of `.symver' directive.  You can only declare one version of a
4247symbol as the default in this manner; otherwise you would effectively
4248have multiple definitions of the same symbol.
4249
4250   If you wish to bind a reference to a specific version of the symbol
4251within the shared library, you can use the aliases of convenience
4252(i.e., `old_foo'), or you can use the `.symver' directive to
4253specifically bind to an external version of the function in question.
4254
4255   You can also specify the language in the version script:
4256
4257     VERSION extern "lang" { version-script-commands }
4258
4259   The supported `lang's are `C', `C++', and `Java'.  The linker will
4260iterate over the list of symbols at the link time and demangle them
4261according to `lang' before matching them to the patterns specified in
4262`version-script-commands'.  The default `lang' is `C'.
4263
4264   Demangled names may contains spaces and other special characters.  As
4265described above, you can use a glob pattern to match demangled names,
4266or you can use a double-quoted string to match the string exactly.  In
4267the latter case, be aware that minor differences (such as differing
4268whitespace) between the version script and the demangler output will
4269cause a mismatch.  As the exact string generated by the demangler might
4270change in the future, even if the mangled name does not, you should
4271check that all of your version directives are behaving as you expect
4272when you upgrade.
4273
4274
4275File: ld.info,  Node: Expressions,  Next: Implicit Linker Scripts,  Prev: VERSION,  Up: Scripts
4276
42773.10 Expressions in Linker Scripts
4278==================================
4279
4280The syntax for expressions in the linker script language is identical to
4281that of C expressions.  All expressions are evaluated as integers.  All
4282expressions are evaluated in the same size, which is 32 bits if both the
4283host and target are 32 bits, and is otherwise 64 bits.
4284
4285   You can use and set symbol values in expressions.
4286
4287   The linker defines several special purpose builtin functions for use
4288in expressions.
4289
4290* Menu:
4291
4292* Constants::			Constants
4293* Symbolic Constants::          Symbolic constants
4294* Symbols::			Symbol Names
4295* Orphan Sections::		Orphan Sections
4296* Location Counter::		The Location Counter
4297* Operators::			Operators
4298* Evaluation::			Evaluation
4299* Expression Section::		The Section of an Expression
4300* Builtin Functions::		Builtin Functions
4301
4302
4303File: ld.info,  Node: Constants,  Next: Symbolic Constants,  Up: Expressions
4304
43053.10.1 Constants
4306----------------
4307
4308All constants are integers.
4309
4310   As in C, the linker considers an integer beginning with `0' to be
4311octal, and an integer beginning with `0x' or `0X' to be hexadecimal.
4312Alternatively the linker accepts suffixes of `h' or `H' for
4313hexadeciaml, `o' or `O' for octal, `b' or `B' for binary and `d' or `D'
4314for decimal.  Any integer value without a prefix or a suffix is
4315considered to be decimal.
4316
4317   In addition, you can use the suffixes `K' and `M' to scale a
4318constant by `1024' or `1024*1024' respectively.  For example, the
4319following all refer to the same quantity:
4320
4321     _fourk_1 = 4K;
4322     _fourk_2 = 4096;
4323     _fourk_3 = 0x1000;
4324     _fourk_4 = 10000o;
4325
4326   Note - the `K' and `M' suffixes cannot be used in conjunction with
4327the base suffixes mentioned above.
4328
4329
4330File: ld.info,  Node: Symbolic Constants,  Next: Symbols,  Prev: Constants,  Up: Expressions
4331
43323.10.2 Symbolic Constants
4333-------------------------
4334
4335It is possible to refer to target specific constants via the use of the
4336`CONSTANT(NAME)' operator, where NAME is one of:
4337
4338`MAXPAGESIZE'
4339     The target's maximum page size.
4340
4341`COMMONPAGESIZE'
4342     The target's default page size.
4343
4344   So for example:
4345
4346       .text ALIGN (CONSTANT (MAXPAGESIZE)) : { *(.text) }
4347
4348   will create a text section aligned to the largest page boundary
4349supported by the target.
4350
4351
4352File: ld.info,  Node: Symbols,  Next: Orphan Sections,  Prev: Symbolic Constants,  Up: Expressions
4353
43543.10.3 Symbol Names
4355-------------------
4356
4357Unless quoted, symbol names start with a letter, underscore, or period
4358and may include letters, digits, underscores, periods, and hyphens.
4359Unquoted symbol names must not conflict with any keywords.  You can
4360specify a symbol which contains odd characters or has the same name as a
4361keyword by surrounding the symbol name in double quotes:
4362     "SECTION" = 9;
4363     "with a space" = "also with a space" + 10;
4364
4365   Since symbols can contain many non-alphabetic characters, it is
4366safest to delimit symbols with spaces.  For example, `A-B' is one
4367symbol, whereas `A - B' is an expression involving subtraction.
4368
4369
4370File: ld.info,  Node: Orphan Sections,  Next: Location Counter,  Prev: Symbols,  Up: Expressions
4371
43723.10.4 Orphan Sections
4373----------------------
4374
4375Orphan sections are sections present in the input files which are not
4376explicitly placed into the output file by the linker script.  The
4377linker will still copy these sections into the output file, but it has
4378to guess as to where they should be placed.  The linker uses a simple
4379heuristic to do this.  It attempts to place orphan sections after
4380non-orphan sections of the same attribute, such as code vs data,
4381loadable vs non-loadable, etc.  If there is not enough room to do this
4382then it places at the end of the file.
4383
4384   For ELF targets, the attribute of the section includes section type
4385as well as section flag.
4386
4387   If an orphaned section's name is representable as a C identifier then
4388the linker will automatically *note PROVIDE:: two symbols:
4389__start_SECNAME and __end_SECNAME, where SECNAME is the name of the
4390section.  These indicate the start address and end address of the
4391orphaned section respectively.  Note: most section names are not
4392representable as C identifiers because they contain a `.' character.
4393
4394
4395File: ld.info,  Node: Location Counter,  Next: Operators,  Prev: Orphan Sections,  Up: Expressions
4396
43973.10.5 The Location Counter
4398---------------------------
4399
4400The special linker variable "dot" `.' always contains the current
4401output location counter.  Since the `.' always refers to a location in
4402an output section, it may only appear in an expression within a
4403`SECTIONS' command.  The `.' symbol may appear anywhere that an
4404ordinary symbol is allowed in an expression.
4405
4406   Assigning a value to `.' will cause the location counter to be
4407moved.  This may be used to create holes in the output section.  The
4408location counter may not be moved backwards inside an output section,
4409and may not be moved backwards outside of an output section if so doing
4410creates areas with overlapping LMAs.
4411
4412     SECTIONS
4413     {
4414       output :
4415         {
4416           file1(.text)
4417           . = . + 1000;
4418           file2(.text)
4419           . += 1000;
4420           file3(.text)
4421         } = 0x12345678;
4422     }
4423   In the previous example, the `.text' section from `file1' is located
4424at the beginning of the output section `output'.  It is followed by a
44251000 byte gap.  Then the `.text' section from `file2' appears, also
4426with a 1000 byte gap following before the `.text' section from `file3'.
4427The notation `= 0x12345678' specifies what data to write in the gaps
4428(*note Output Section Fill::).
4429
4430   Note: `.' actually refers to the byte offset from the start of the
4431current containing object.  Normally this is the `SECTIONS' statement,
4432whose start address is 0, hence `.' can be used as an absolute address.
4433If `.' is used inside a section description however, it refers to the
4434byte offset from the start of that section, not an absolute address.
4435Thus in a script like this:
4436
4437     SECTIONS
4438     {
4439         . = 0x100
4440         .text: {
4441           *(.text)
4442           . = 0x200
4443         }
4444         . = 0x500
4445         .data: {
4446           *(.data)
4447           . += 0x600
4448         }
4449     }
4450
4451   The `.text' section will be assigned a starting address of 0x100 and
4452a size of exactly 0x200 bytes, even if there is not enough data in the
4453`.text' input sections to fill this area.  (If there is too much data,
4454an error will be produced because this would be an attempt to move `.'
4455backwards).  The `.data' section will start at 0x500 and it will have
4456an extra 0x600 bytes worth of space after the end of the values from
4457the `.data' input sections and before the end of the `.data' output
4458section itself.
4459
4460   Setting symbols to the value of the location counter outside of an
4461output section statement can result in unexpected values if the linker
4462needs to place orphan sections.  For example, given the following:
4463
4464     SECTIONS
4465     {
4466         start_of_text = . ;
4467         .text: { *(.text) }
4468         end_of_text = . ;
4469
4470         start_of_data = . ;
4471         .data: { *(.data) }
4472         end_of_data = . ;
4473     }
4474
4475   If the linker needs to place some input section, e.g. `.rodata', not
4476mentioned in the script, it might choose to place that section between
4477`.text' and `.data'.  You might think the linker should place `.rodata'
4478on the blank line in the above script, but blank lines are of no
4479particular significance to the linker.  As well, the linker doesn't
4480associate the above symbol names with their sections.  Instead, it
4481assumes that all assignments or other statements belong to the previous
4482output section, except for the special case of an assignment to `.'.
4483I.e., the linker will place the orphan `.rodata' section as if the
4484script was written as follows:
4485
4486     SECTIONS
4487     {
4488         start_of_text = . ;
4489         .text: { *(.text) }
4490         end_of_text = . ;
4491
4492         start_of_data = . ;
4493         .rodata: { *(.rodata) }
4494         .data: { *(.data) }
4495         end_of_data = . ;
4496     }
4497
4498   This may or may not be the script author's intention for the value of
4499`start_of_data'.  One way to influence the orphan section placement is
4500to assign the location counter to itself, as the linker assumes that an
4501assignment to `.' is setting the start address of a following output
4502section and thus should be grouped with that section.  So you could
4503write:
4504
4505     SECTIONS
4506     {
4507         start_of_text = . ;
4508         .text: { *(.text) }
4509         end_of_text = . ;
4510
4511         . = . ;
4512         start_of_data = . ;
4513         .data: { *(.data) }
4514         end_of_data = . ;
4515     }
4516
4517   Now, the orphan `.rodata' section will be placed between
4518`end_of_text' and `start_of_data'.
4519
4520
4521File: ld.info,  Node: Operators,  Next: Evaluation,  Prev: Location Counter,  Up: Expressions
4522
45233.10.6 Operators
4524----------------
4525
4526The linker recognizes the standard C set of arithmetic operators, with
4527the standard bindings and precedence levels:
4528     precedence      associativity   Operators                Notes
4529     (highest)
4530     1               left            !  -  ~                  (1)
4531     2               left            *  /  %
4532     3               left            +  -
4533     4               left            >>  <<
4534     5               left            ==  !=  >  <  <=  >=
4535     6               left            &
4536     7               left            |
4537     8               left            &&
4538     9               left            ||
4539     10              right           ? :
4540     11              right           &=  +=  -=  *=  /=       (2)
4541     (lowest)
4542   Notes: (1) Prefix operators (2) *Note Assignments::.
4543
4544
4545File: ld.info,  Node: Evaluation,  Next: Expression Section,  Prev: Operators,  Up: Expressions
4546
45473.10.7 Evaluation
4548-----------------
4549
4550The linker evaluates expressions lazily.  It only computes the value of
4551an expression when absolutely necessary.
4552
4553   The linker needs some information, such as the value of the start
4554address of the first section, and the origins and lengths of memory
4555regions, in order to do any linking at all.  These values are computed
4556as soon as possible when the linker reads in the linker script.
4557
4558   However, other values (such as symbol values) are not known or needed
4559until after storage allocation.  Such values are evaluated later, when
4560other information (such as the sizes of output sections) is available
4561for use in the symbol assignment expression.
4562
4563   The sizes of sections cannot be known until after allocation, so
4564assignments dependent upon these are not performed until after
4565allocation.
4566
4567   Some expressions, such as those depending upon the location counter
4568`.', must be evaluated during section allocation.
4569
4570   If the result of an expression is required, but the value is not
4571available, then an error results.  For example, a script like the
4572following
4573     SECTIONS
4574       {
4575         .text 9+this_isnt_constant :
4576           { *(.text) }
4577       }
4578will cause the error message `non constant expression for initial
4579address'.
4580
4581
4582File: ld.info,  Node: Expression Section,  Next: Builtin Functions,  Prev: Evaluation,  Up: Expressions
4583
45843.10.8 The Section of an Expression
4585-----------------------------------
4586
4587Addresses and symbols may be section relative, or absolute.  A section
4588relative symbol is relocatable.  If you request relocatable output
4589using the `-r' option, a further link operation may change the value of
4590a section relative symbol.  On the other hand, an absolute symbol will
4591retain the same value throughout any further link operations.
4592
4593   Some terms in linker expressions are addresses.  This is true of
4594section relative symbols and for builtin functions that return an
4595address, such as `ADDR', `LOADADDR', `ORIGIN' and `SEGMENT_START'.
4596Other terms are simply numbers, or are builtin functions that return a
4597non-address value, such as `LENGTH'.  One complication is that unless
4598you set `LD_FEATURE ("SANE_EXPR")' (*note Miscellaneous Commands::),
4599numbers and absolute symbols are treated differently depending on their
4600location, for compatibility with older versions of `ld'.  Expressions
4601appearing outside an output section definition treat all numbers as
4602absolute addresses.  Expressions appearing inside an output section
4603definition treat absolute symbols as numbers.  If `LD_FEATURE
4604("SANE_EXPR")' is given, then absolute symbols and numbers are simply
4605treated as numbers everywhere.
4606
4607   In the following simple example,
4608
4609     SECTIONS
4610       {
4611         . = 0x100;
4612         __executable_start = 0x100;
4613         .data :
4614         {
4615           . = 0x10;
4616           __data_start = 0x10;
4617           *(.data)
4618         }
4619         ...
4620       }
4621
4622   both `.' and `__executable_start' are set to the absolute address
46230x100 in the first two assignments, then both `.' and `__data_start'
4624are set to 0x10 relative to the `.data' section in the second two
4625assignments.
4626
4627   For expressions involving numbers, relative addresses and absolute
4628addresses, ld follows these rules to evaluate terms:
4629
4630   * Unary operations on a relative address, and binary operations on
4631     two relative addresses in the same section or between one relative
4632     address and a number, apply the operator to the offset part of the
4633     address(es).
4634
4635   * Unary operations on an absolute address, and binary operations on
4636     one or more absolute addresses or on two relative addresses not in
4637     the same section, first convert any non-absolute term to an
4638     absolute address before applying the operator.
4639
4640   The result section of each sub-expression is as follows:
4641
4642   * An operation involving only numbers results in a number.
4643
4644   * The result of comparisons, `&&' and `||' is also a number.
4645
4646   * The result of other binary arithmetic and logical operations on two
4647     relative addresses in the same section or two absolute addresess
4648     (after above conversions) is also a number.
4649
4650   * The result of other operations on relative addresses or one
4651     relative address and a number, is a relative address in the same
4652     section as the relative operand(s).
4653
4654   * The result of other operations on absolute addresses (after above
4655     conversions) is an absolute address.
4656
4657   You can use the builtin function `ABSOLUTE' to force an expression
4658to be absolute when it would otherwise be relative.  For example, to
4659create an absolute symbol set to the address of the end of the output
4660section `.data':
4661     SECTIONS
4662       {
4663         .data : { *(.data) _edata = ABSOLUTE(.); }
4664       }
4665   If `ABSOLUTE' were not used, `_edata' would be relative to the
4666`.data' section.
4667
4668   Using `LOADADDR' also forces an expression absolute, since this
4669particular builtin function returns an absolute address.
4670
4671
4672File: ld.info,  Node: Builtin Functions,  Prev: Expression Section,  Up: Expressions
4673
46743.10.9 Builtin Functions
4675------------------------
4676
4677The linker script language includes a number of builtin functions for
4678use in linker script expressions.
4679
4680`ABSOLUTE(EXP)'
4681     Return the absolute (non-relocatable, as opposed to non-negative)
4682     value of the expression EXP.  Primarily useful to assign an
4683     absolute value to a symbol within a section definition, where
4684     symbol values are normally section relative.  *Note Expression
4685     Section::.
4686
4687`ADDR(SECTION)'
4688     Return the address (VMA) of the named SECTION.  Your script must
4689     previously have defined the location of that section.  In the
4690     following example, `start_of_output_1', `symbol_1' and `symbol_2'
4691     are assigned equivalent values, except that `symbol_1' will be
4692     relative to the `.output1' section while the other two will be
4693     absolute:
4694          SECTIONS { ...
4695            .output1 :
4696              {
4697              start_of_output_1 = ABSOLUTE(.);
4698              ...
4699              }
4700            .output :
4701              {
4702              symbol_1 = ADDR(.output1);
4703              symbol_2 = start_of_output_1;
4704              }
4705          ... }
4706
4707`ALIGN(ALIGN)'
4708`ALIGN(EXP,ALIGN)'
4709     Return the location counter (`.') or arbitrary expression aligned
4710     to the next ALIGN boundary.  The single operand `ALIGN' doesn't
4711     change the value of the location counter--it just does arithmetic
4712     on it.  The two operand `ALIGN' allows an arbitrary expression to
4713     be aligned upwards (`ALIGN(ALIGN)' is equivalent to `ALIGN(.,
4714     ALIGN)').
4715
4716     Here is an example which aligns the output `.data' section to the
4717     next `0x2000' byte boundary after the preceding section and sets a
4718     variable within the section to the next `0x8000' boundary after the
4719     input sections:
4720          SECTIONS { ...
4721            .data ALIGN(0x2000): {
4722              *(.data)
4723              variable = ALIGN(0x8000);
4724            }
4725          ... }
4726     The first use of `ALIGN' in this example specifies the
4727     location of a section because it is used as the optional ADDRESS
4728     attribute of a section definition (*note Output Section
4729     Address::).  The second use of `ALIGN' is used to defines the
4730     value of a symbol.
4731
4732     The builtin function `NEXT' is closely related to `ALIGN'.
4733
4734`ALIGNOF(SECTION)'
4735     Return the alignment in bytes of the named SECTION, if that
4736     section has been allocated.  If the section has not been allocated
4737     when this is evaluated, the linker will report an error. In the
4738     following example, the alignment of the `.output' section is
4739     stored as the first value in that section.
4740          SECTIONS{ ...
4741            .output {
4742              LONG (ALIGNOF (.output))
4743              ...
4744              }
4745          ... }
4746
4747`BLOCK(EXP)'
4748     This is a synonym for `ALIGN', for compatibility with older linker
4749     scripts.  It is most often seen when setting the address of an
4750     output section.
4751
4752`DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE)'
4753     This is equivalent to either
4754          (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1)))
4755     or
4756          (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - COMMONPAGESIZE)))
4757     depending on whether the latter uses fewer COMMONPAGESIZE sized
4758     pages for the data segment (area between the result of this
4759     expression and `DATA_SEGMENT_END') than the former or not.  If the
4760     latter form is used, it means COMMONPAGESIZE bytes of runtime
4761     memory will be saved at the expense of up to COMMONPAGESIZE wasted
4762     bytes in the on-disk file.
4763
4764     This expression can only be used directly in `SECTIONS' commands,
4765     not in any output section descriptions and only once in the linker
4766     script.  COMMONPAGESIZE should be less or equal to MAXPAGESIZE and
4767     should be the system page size the object wants to be optimized
4768     for (while still working on system page sizes up to MAXPAGESIZE).
4769
4770     Example:
4771            . = DATA_SEGMENT_ALIGN(0x10000, 0x2000);
4772
4773`DATA_SEGMENT_END(EXP)'
4774     This defines the end of data segment for `DATA_SEGMENT_ALIGN'
4775     evaluation purposes.
4776
4777            . = DATA_SEGMENT_END(.);
4778
4779`DATA_SEGMENT_RELRO_END(OFFSET, EXP)'
4780     This defines the end of the `PT_GNU_RELRO' segment when `-z relro'
4781     option is used.  Second argument is returned.  When `-z relro'
4782     option is not present, `DATA_SEGMENT_RELRO_END' does nothing,
4783     otherwise `DATA_SEGMENT_ALIGN' is padded so that EXP + OFFSET is
4784     aligned to the most commonly used page boundary for particular
4785     target.  If present in the linker script, it must always come in
4786     between `DATA_SEGMENT_ALIGN' and `DATA_SEGMENT_END'.
4787
4788            . = DATA_SEGMENT_RELRO_END(24, .);
4789
4790`DEFINED(SYMBOL)'
4791     Return 1 if SYMBOL is in the linker global symbol table and is
4792     defined before the statement using DEFINED in the script, otherwise
4793     return 0.  You can use this function to provide default values for
4794     symbols.  For example, the following script fragment shows how to
4795     set a global symbol `begin' to the first location in the `.text'
4796     section--but if a symbol called `begin' already existed, its value
4797     is preserved:
4798
4799          SECTIONS { ...
4800            .text : {
4801              begin = DEFINED(begin) ? begin : . ;
4802              ...
4803            }
4804            ...
4805          }
4806
4807`LENGTH(MEMORY)'
4808     Return the length of the memory region named MEMORY.
4809
4810`LOADADDR(SECTION)'
4811     Return the absolute LMA of the named SECTION.  (*note Output
4812     Section LMA::).
4813
4814`MAX(EXP1, EXP2)'
4815     Returns the maximum of EXP1 and EXP2.
4816
4817`MIN(EXP1, EXP2)'
4818     Returns the minimum of EXP1 and EXP2.
4819
4820`NEXT(EXP)'
4821     Return the next unallocated address that is a multiple of EXP.
4822     This function is closely related to `ALIGN(EXP)'; unless you use
4823     the `MEMORY' command to define discontinuous memory for the output
4824     file, the two functions are equivalent.
4825
4826`ORIGIN(MEMORY)'
4827     Return the origin of the memory region named MEMORY.
4828
4829`SEGMENT_START(SEGMENT, DEFAULT)'
4830     Return the base address of the named SEGMENT.  If an explicit
4831     value has been given for this segment (with a command-line `-T'
4832     option) that value will be returned; otherwise the value will be
4833     DEFAULT.  At present, the `-T' command-line option can only be
4834     used to set the base address for the "text", "data", and "bss"
4835     sections, but you can use `SEGMENT_START' with any segment name.
4836
4837`SIZEOF(SECTION)'
4838     Return the size in bytes of the named SECTION, if that section has
4839     been allocated.  If the section has not been allocated when this is
4840     evaluated, the linker will report an error.  In the following
4841     example, `symbol_1' and `symbol_2' are assigned identical values:
4842          SECTIONS{ ...
4843            .output {
4844              .start = . ;
4845              ...
4846              .end = . ;
4847              }
4848            symbol_1 = .end - .start ;
4849            symbol_2 = SIZEOF(.output);
4850          ... }
4851
4852`SIZEOF_HEADERS'
4853`sizeof_headers'
4854     Return the size in bytes of the output file's headers.  This is
4855     information which appears at the start of the output file.  You
4856     can use this number when setting the start address of the first
4857     section, if you choose, to facilitate paging.
4858
4859     When producing an ELF output file, if the linker script uses the
4860     `SIZEOF_HEADERS' builtin function, the linker must compute the
4861     number of program headers before it has determined all the section
4862     addresses and sizes.  If the linker later discovers that it needs
4863     additional program headers, it will report an error `not enough
4864     room for program headers'.  To avoid this error, you must avoid
4865     using the `SIZEOF_HEADERS' function, or you must rework your linker
4866     script to avoid forcing the linker to use additional program
4867     headers, or you must define the program headers yourself using the
4868     `PHDRS' command (*note PHDRS::).
4869
4870
4871File: ld.info,  Node: Implicit Linker Scripts,  Prev: Expressions,  Up: Scripts
4872
48733.11 Implicit Linker Scripts
4874============================
4875
4876If you specify a linker input file which the linker can not recognize as
4877an object file or an archive file, it will try to read the file as a
4878linker script.  If the file can not be parsed as a linker script, the
4879linker will report an error.
4880
4881   An implicit linker script will not replace the default linker script.
4882
4883   Typically an implicit linker script would contain only symbol
4884assignments, or the `INPUT', `GROUP', or `VERSION' commands.
4885
4886   Any input files read because of an implicit linker script will be
4887read at the position in the command line where the implicit linker
4888script was read.  This can affect archive searching.
4889
4890
4891File: ld.info,  Node: Machine Dependent,  Next: BFD,  Prev: Scripts,  Up: Top
4892
48934 Machine Dependent Features
4894****************************
4895
4896`ld' has additional features on some platforms; the following sections
4897describe them.  Machines where `ld' has no additional functionality are
4898not listed.
4899
4900* Menu:
4901
4902
4903* H8/300::                      `ld' and the H8/300
4904
4905* i960::                        `ld' and the Intel 960 family
4906
4907* ARM::				`ld' and the ARM family
4908
4909* HPPA ELF32::                  `ld' and HPPA 32-bit ELF
4910
4911* M68K::			`ld' and the Motorola 68K family
4912
4913* MMIX::			`ld' and MMIX
4914
4915* MSP430::			`ld' and MSP430
4916
4917* M68HC11/68HC12::		`ld' and the Motorola 68HC11 and 68HC12 families
4918
4919* PowerPC ELF32::		`ld' and PowerPC 32-bit ELF Support
4920
4921* PowerPC64 ELF64::		`ld' and PowerPC64 64-bit ELF Support
4922
4923* SPU ELF::			`ld' and SPU ELF Support
4924
4925* TI COFF::                     `ld' and TI COFF
4926
4927* WIN32::                       `ld' and WIN32 (cygwin/mingw)
4928
4929* Xtensa::                      `ld' and Xtensa Processors
4930
4931
4932File: ld.info,  Node: H8/300,  Next: i960,  Up: Machine Dependent
4933
49344.1 `ld' and the H8/300
4935=======================
4936
4937For the H8/300, `ld' can perform these global optimizations when you
4938specify the `--relax' command-line option.
4939
4940_relaxing address modes_
4941     `ld' finds all `jsr' and `jmp' instructions whose targets are
4942     within eight bits, and turns them into eight-bit program-counter
4943     relative `bsr' and `bra' instructions, respectively.
4944
4945_synthesizing instructions_
4946     `ld' finds all `mov.b' instructions which use the sixteen-bit
4947     absolute address form, but refer to the top page of memory, and
4948     changes them to use the eight-bit address form.  (That is: the
4949     linker turns `mov.b `@'AA:16' into `mov.b `@'AA:8' whenever the
4950     address AA is in the top page of memory).
4951
4952_bit manipulation instructions_
4953     `ld' finds all bit manipulation instructions like `band, bclr,
4954     biand, bild, bior, bist, bixor, bld, bnot, bor, bset, bst, btst,
4955     bxor' which use 32 bit and 16 bit absolute address form, but refer
4956     to the top page of memory, and changes them to use the 8 bit
4957     address form.  (That is: the linker turns `bset #xx:3,`@'AA:32'
4958     into `bset #xx:3,`@'AA:8' whenever the address AA is in the top
4959     page of memory).
4960
4961_system control instructions_
4962     `ld' finds all `ldc.w, stc.w' instructions which use the 32 bit
4963     absolute address form, but refer to the top page of memory, and
4964     changes them to use 16 bit address form.  (That is: the linker
4965     turns `ldc.w `@'AA:32,ccr' into `ldc.w `@'AA:16,ccr' whenever the
4966     address AA is in the top page of memory).
4967
4968
4969File: ld.info,  Node: i960,  Next: ARM,  Prev: H8/300,  Up: Machine Dependent
4970
49714.2 `ld' and the Intel 960 Family
4972=================================
4973
4974You can use the `-AARCHITECTURE' command line option to specify one of
4975the two-letter names identifying members of the 960 family; the option
4976specifies the desired output target, and warns of any incompatible
4977instructions in the input files.  It also modifies the linker's search
4978strategy for archive libraries, to support the use of libraries
4979specific to each particular architecture, by including in the search
4980loop names suffixed with the string identifying the architecture.
4981
4982   For example, if your `ld' command line included `-ACA' as well as
4983`-ltry', the linker would look (in its built-in search paths, and in
4984any paths you specify with `-L') for a library with the names
4985
4986     try
4987     libtry.a
4988     tryca
4989     libtryca.a
4990
4991The first two possibilities would be considered in any event; the last
4992two are due to the use of `-ACA'.
4993
4994   You can meaningfully use `-A' more than once on a command line, since
4995the 960 architecture family allows combination of target architectures;
4996each use will add another pair of name variants to search for when `-l'
4997specifies a library.
4998
4999   `ld' supports the `--relax' option for the i960 family.  If you
5000specify `--relax', `ld' finds all `balx' and `calx' instructions whose
5001targets are within 24 bits, and turns them into 24-bit program-counter
5002relative `bal' and `cal' instructions, respectively.  `ld' also turns
5003`cal' instructions into `bal' instructions when it determines that the
5004target subroutine is a leaf routine (that is, the target subroutine does
5005not itself call any subroutines).
5006
5007   The `--fix-cortex-a8' switch enables a link-time workaround for an
5008erratum in certain Cortex-A8 processors.  The workaround is enabled by
5009default if you are targeting the ARM v7-A architecture profile.  It can
5010be enabled otherwise by specifying `--fix-cortex-a8', or disabled
5011unconditionally by specifying `--no-fix-cortex-a8'.
5012
5013   The erratum only affects Thumb-2 code.  Please contact ARM for
5014further details.
5015
5016   The `--no-merge-exidx-entries' switch disables the merging of
5017adjacent exidx entries in debuginfo.
5018
5019
5020File: ld.info,  Node: M68HC11/68HC12,  Next: PowerPC ELF32,  Prev: MSP430,  Up: Machine Dependent
5021
50224.3 `ld' and the Motorola 68HC11 and 68HC12 families
5023====================================================
5024
50254.3.1 Linker Relaxation
5026-----------------------
5027
5028For the Motorola 68HC11, `ld' can perform these global optimizations
5029when you specify the `--relax' command-line option.
5030
5031_relaxing address modes_
5032     `ld' finds all `jsr' and `jmp' instructions whose targets are
5033     within eight bits, and turns them into eight-bit program-counter
5034     relative `bsr' and `bra' instructions, respectively.
5035
5036     `ld' also looks at all 16-bit extended addressing modes and
5037     transforms them in a direct addressing mode when the address is in
5038     page 0 (between 0 and 0x0ff).
5039
5040_relaxing gcc instruction group_
5041     When `gcc' is called with `-mrelax', it can emit group of
5042     instructions that the linker can optimize to use a 68HC11 direct
5043     addressing mode. These instructions consists of `bclr' or `bset'
5044     instructions.
5045
5046
50474.3.2 Trampoline Generation
5048---------------------------
5049
5050For 68HC11 and 68HC12, `ld' can generate trampoline code to call a far
5051function using a normal `jsr' instruction. The linker will also change
5052the relocation to some far function to use the trampoline address
5053instead of the function address. This is typically the case when a
5054pointer to a function is taken. The pointer will in fact point to the
5055function trampoline.
5056
5057
5058File: ld.info,  Node: ARM,  Next: HPPA ELF32,  Prev: i960,  Up: Machine Dependent
5059
50604.4 `ld' and the ARM family
5061===========================
5062
5063For the ARM, `ld' will generate code stubs to allow functions calls
5064between ARM and Thumb code.  These stubs only work with code that has
5065been compiled and assembled with the `-mthumb-interwork' command line
5066option.  If it is necessary to link with old ARM object files or
5067libraries, which have not been compiled with the -mthumb-interwork
5068option then the `--support-old-code' command line switch should be
5069given to the linker.  This will make it generate larger stub functions
5070which will work with non-interworking aware ARM code.  Note, however,
5071the linker does not support generating stubs for function calls to
5072non-interworking aware Thumb code.
5073
5074   The `--thumb-entry' switch is a duplicate of the generic `--entry'
5075switch, in that it sets the program's starting address.  But it also
5076sets the bottom bit of the address, so that it can be branched to using
5077a BX instruction, and the program will start executing in Thumb mode
5078straight away.
5079
5080   The `--use-nul-prefixed-import-tables' switch is specifying, that
5081the import tables idata4 and idata5 have to be generated with a zero
5082elememt prefix for import libraries. This is the old style to generate
5083import tables. By default this option is turned off.
5084
5085   The `--be8' switch instructs `ld' to generate BE8 format
5086executables.  This option is only valid when linking big-endian objects.
5087The resulting image will contain big-endian data and little-endian code.
5088
5089   The `R_ARM_TARGET1' relocation is typically used for entries in the
5090`.init_array' section.  It is interpreted as either `R_ARM_REL32' or
5091`R_ARM_ABS32', depending on the target.  The `--target1-rel' and
5092`--target1-abs' switches override the default.
5093
5094   The `--target2=type' switch overrides the default definition of the
5095`R_ARM_TARGET2' relocation.  Valid values for `type', their meanings,
5096and target defaults are as follows:
5097`rel'
5098     `R_ARM_REL32' (arm*-*-elf, arm*-*-eabi)
5099
5100`abs'
5101     `R_ARM_ABS32' (arm*-*-symbianelf)
5102
5103`got-rel'
5104     `R_ARM_GOT_PREL' (arm*-*-linux, arm*-*-*bsd)
5105
5106   The `R_ARM_V4BX' relocation (defined by the ARM AAELF specification)
5107enables objects compiled for the ARMv4 architecture to be
5108interworking-safe when linked with other objects compiled for ARMv4t,
5109but also allows pure ARMv4 binaries to be built from the same ARMv4
5110objects.
5111
5112   In the latter case, the switch `--fix-v4bx' must be passed to the
5113linker, which causes v4t `BX rM' instructions to be rewritten as `MOV
5114PC,rM', since v4 processors do not have a `BX' instruction.
5115
5116   In the former case, the switch should not be used, and `R_ARM_V4BX'
5117relocations are ignored.
5118
5119   Replace `BX rM' instructions identified by `R_ARM_V4BX' relocations
5120with a branch to the following veneer:
5121
5122     TST rM, #1
5123     MOVEQ PC, rM
5124     BX Rn
5125
5126   This allows generation of libraries/applications that work on ARMv4
5127cores and are still interworking safe.  Note that the above veneer
5128clobbers the condition flags, so may cause incorrect progrm behavior in
5129rare cases.
5130
5131   The `--use-blx' switch enables the linker to use ARM/Thumb BLX
5132instructions (available on ARMv5t and above) in various situations.
5133Currently it is used to perform calls via the PLT from Thumb code using
5134BLX rather than using BX and a mode-switching stub before each PLT
5135entry. This should lead to such calls executing slightly faster.
5136
5137   This option is enabled implicitly for SymbianOS, so there is no need
5138to specify it if you are using that target.
5139
5140   The `--vfp11-denorm-fix' switch enables a link-time workaround for a
5141bug in certain VFP11 coprocessor hardware, which sometimes allows
5142instructions with denorm operands (which must be handled by support
5143code) to have those operands overwritten by subsequent instructions
5144before the support code can read the intended values.
5145
5146   The bug may be avoided in scalar mode if you allow at least one
5147intervening instruction between a VFP11 instruction which uses a
5148register and another instruction which writes to the same register, or
5149at least two intervening instructions if vector mode is in use. The bug
5150only affects full-compliance floating-point mode: you do not need this
5151workaround if you are using "runfast" mode. Please contact ARM for
5152further details.
5153
5154   If you know you are using buggy VFP11 hardware, you can enable this
5155workaround by specifying the linker option `--vfp-denorm-fix=scalar' if
5156you are using the VFP11 scalar mode only, or `--vfp-denorm-fix=vector'
5157if you are using vector mode (the latter also works for scalar code).
5158The default is `--vfp-denorm-fix=none'.
5159
5160   If the workaround is enabled, instructions are scanned for
5161potentially-troublesome sequences, and a veneer is created for each
5162such sequence which may trigger the erratum. The veneer consists of the
5163first instruction of the sequence and a branch back to the subsequent
5164instruction. The original instruction is then replaced with a branch to
5165the veneer. The extra cycles required to call and return from the veneer
5166are sufficient to avoid the erratum in both the scalar and vector cases.
5167
5168   The `--no-enum-size-warning' switch prevents the linker from warning
5169when linking object files that specify incompatible EABI enumeration
5170size attributes.  For example, with this switch enabled, linking of an
5171object file using 32-bit enumeration values with another using
5172enumeration values fitted into the smallest possible space will not be
5173diagnosed.
5174
5175   The `--no-wchar-size-warning' switch prevents the linker from
5176warning when linking object files that specify incompatible EABI
5177`wchar_t' size attributes.  For example, with this switch enabled,
5178linking of an object file using 32-bit `wchar_t' values with another
5179using 16-bit `wchar_t' values will not be diagnosed.
5180
5181   The `--pic-veneer' switch makes the linker use PIC sequences for
5182ARM/Thumb interworking veneers, even if the rest of the binary is not
5183PIC.  This avoids problems on uClinux targets where `--emit-relocs' is
5184used to generate relocatable binaries.
5185
5186   The linker will automatically generate and insert small sequences of
5187code into a linked ARM ELF executable whenever an attempt is made to
5188perform a function call to a symbol that is too far away.  The
5189placement of these sequences of instructions - called stubs - is
5190controlled by the command line option `--stub-group-size=N'.  The
5191placement is important because a poor choice can create a need for
5192duplicate stubs, increasing the code sizw.  The linker will try to
5193group stubs together in order to reduce interruptions to the flow of
5194code, but it needs guidance as to how big these groups should be and
5195where they should be placed.
5196
5197   The value of `N', the parameter to the `--stub-group-size=' option
5198controls where the stub groups are placed.  If it is negative then all
5199stubs are placed after the first branch that needs them.  If it is
5200positive then the stubs can be placed either before or after the
5201branches that need them.  If the value of `N' is 1 (either +1 or -1)
5202then the linker will choose exactly where to place groups of stubs,
5203using its built in heuristics.  A value of `N' greater than 1 (or
5204smaller than -1) tells the linker that a single group of stubs can
5205service at most `N' bytes from the input sections.
5206
5207   The default, if `--stub-group-size=' is not specified, is `N = +1'.
5208
5209   Farcalls stubs insertion is fully supported for the ARM-EABI target
5210only, because it relies on object files properties not present
5211otherwise.
5212
5213
5214File: ld.info,  Node: HPPA ELF32,  Next: M68K,  Prev: ARM,  Up: Machine Dependent
5215
52164.5 `ld' and HPPA 32-bit ELF Support
5217====================================
5218
5219When generating a shared library, `ld' will by default generate import
5220stubs suitable for use with a single sub-space application.  The
5221`--multi-subspace' switch causes `ld' to generate export stubs, and
5222different (larger) import stubs suitable for use with multiple
5223sub-spaces.
5224
5225   Long branch stubs and import/export stubs are placed by `ld' in stub
5226sections located between groups of input sections.  `--stub-group-size'
5227specifies the maximum size of a group of input sections handled by one
5228stub section.  Since branch offsets are signed, a stub section may
5229serve two groups of input sections, one group before the stub section,
5230and one group after it.  However, when using conditional branches that
5231require stubs, it may be better (for branch prediction) that stub
5232sections only serve one group of input sections.  A negative value for
5233`N' chooses this scheme, ensuring that branches to stubs always use a
5234negative offset.  Two special values of `N' are recognized, `1' and
5235`-1'.  These both instruct `ld' to automatically size input section
5236groups for the branch types detected, with the same behaviour regarding
5237stub placement as other positive or negative values of `N' respectively.
5238
5239   Note that `--stub-group-size' does not split input sections.  A
5240single input section larger than the group size specified will of course
5241create a larger group (of one section).  If input sections are too
5242large, it may not be possible for a branch to reach its stub.
5243
5244
5245File: ld.info,  Node: M68K,  Next: MMIX,  Prev: HPPA ELF32,  Up: Machine Dependent
5246
52474.6 `ld' and the Motorola 68K family
5248====================================
5249
5250The `--got=TYPE' option lets you choose the GOT generation scheme.  The
5251choices are `single', `negative', `multigot' and `target'.  When
5252`target' is selected the linker chooses the default GOT generation
5253scheme for the current target.  `single' tells the linker to generate a
5254single GOT with entries only at non-negative offsets.  `negative'
5255instructs the linker to generate a single GOT with entries at both
5256negative and positive offsets.  Not all environments support such GOTs.
5257`multigot' allows the linker to generate several GOTs in the output
5258file.  All GOT references from a single input object file access the
5259same GOT, but references from different input object files might access
5260different GOTs.  Not all environments support such GOTs.
5261
5262
5263File: ld.info,  Node: MMIX,  Next: MSP430,  Prev: M68K,  Up: Machine Dependent
5264
52654.7 `ld' and MMIX
5266=================
5267
5268For MMIX, there is a choice of generating `ELF' object files or `mmo'
5269object files when linking.  The simulator `mmix' understands the `mmo'
5270format.  The binutils `objcopy' utility can translate between the two
5271formats.
5272
5273   There is one special section, the `.MMIX.reg_contents' section.
5274Contents in this section is assumed to correspond to that of global
5275registers, and symbols referring to it are translated to special
5276symbols, equal to registers.  In a final link, the start address of the
5277`.MMIX.reg_contents' section corresponds to the first allocated global
5278register multiplied by 8.  Register `$255' is not included in this
5279section; it is always set to the program entry, which is at the symbol
5280`Main' for `mmo' files.
5281
5282   Global symbols with the prefix `__.MMIX.start.', for example
5283`__.MMIX.start..text' and `__.MMIX.start..data' are special.  The
5284default linker script uses these to set the default start address of a
5285section.
5286
5287   Initial and trailing multiples of zero-valued 32-bit words in a
5288section, are left out from an mmo file.
5289
5290
5291File: ld.info,  Node: MSP430,  Next: M68HC11/68HC12,  Prev: MMIX,  Up: Machine Dependent
5292
52934.8 `ld' and MSP430
5294===================
5295
5296For the MSP430 it is possible to select the MPU architecture.  The flag
5297`-m [mpu type]' will select an appropriate linker script for selected
5298MPU type.  (To get a list of known MPUs just pass `-m help' option to
5299the linker).
5300
5301   The linker will recognize some extra sections which are MSP430
5302specific:
5303
5304``.vectors''
5305     Defines a portion of ROM where interrupt vectors located.
5306
5307``.bootloader''
5308     Defines the bootloader portion of the ROM (if applicable).  Any
5309     code in this section will be uploaded to the MPU.
5310
5311``.infomem''
5312     Defines an information memory section (if applicable).  Any code in
5313     this section will be uploaded to the MPU.
5314
5315``.infomemnobits''
5316     This is the same as the `.infomem' section except that any code in
5317     this section will not be uploaded to the MPU.
5318
5319``.noinit''
5320     Denotes a portion of RAM located above `.bss' section.
5321
5322     The last two sections are used by gcc.
5323
5324
5325File: ld.info,  Node: PowerPC ELF32,  Next: PowerPC64 ELF64,  Prev: M68HC11/68HC12,  Up: Machine Dependent
5326
53274.9 `ld' and PowerPC 32-bit ELF Support
5328=======================================
5329
5330Branches on PowerPC processors are limited to a signed 26-bit
5331displacement, which may result in `ld' giving `relocation truncated to
5332fit' errors with very large programs.  `--relax' enables the generation
5333of trampolines that can access the entire 32-bit address space.  These
5334trampolines are inserted at section boundaries, so may not themselves
5335be reachable if an input section exceeds 33M in size.  You may combine
5336`-r' and `--relax' to add trampolines in a partial link.  In that case
5337both branches to undefined symbols and inter-section branches are also
5338considered potentially out of range, and trampolines inserted.
5339
5340`--bss-plt'
5341     Current PowerPC GCC accepts a `-msecure-plt' option that generates
5342     code capable of using a newer PLT and GOT layout that has the
5343     security advantage of no executable section ever needing to be
5344     writable and no writable section ever being executable.  PowerPC
5345     `ld' will generate this layout, including stubs to access the PLT,
5346     if all input files (including startup and static libraries) were
5347     compiled with `-msecure-plt'.  `--bss-plt' forces the old BSS PLT
5348     (and GOT layout) which can give slightly better performance.
5349
5350`--secure-plt'
5351     `ld' will use the new PLT and GOT layout if it is linking new
5352     `-fpic' or `-fPIC' code, but does not do so automatically when
5353     linking non-PIC code.  This option requests the new PLT and GOT
5354     layout.  A warning will be given if some object file requires the
5355     old style BSS PLT.
5356
5357`--sdata-got'
5358     The new secure PLT and GOT are placed differently relative to other
5359     sections compared to older BSS PLT and GOT placement.  The
5360     location of `.plt' must change because the new secure PLT is an
5361     initialized section while the old PLT is uninitialized.  The
5362     reason for the `.got' change is more subtle:  The new placement
5363     allows `.got' to be read-only in applications linked with `-z
5364     relro -z now'.  However, this placement means that `.sdata' cannot
5365     always be used in shared libraries, because the PowerPC ABI
5366     accesses `.sdata' in shared libraries from the GOT pointer.
5367     `--sdata-got' forces the old GOT placement.  PowerPC GCC doesn't
5368     use `.sdata' in shared libraries, so this option is really only
5369     useful for other compilers that may do so.
5370
5371`--emit-stub-syms'
5372     This option causes `ld' to label linker stubs with a local symbol
5373     that encodes the stub type and destination.
5374
5375`--no-tls-optimize'
5376     PowerPC `ld' normally performs some optimization of code sequences
5377     used to access Thread-Local Storage.  Use this option to disable
5378     the optimization.
5379
5380
5381File: ld.info,  Node: PowerPC64 ELF64,  Next: SPU ELF,  Prev: PowerPC ELF32,  Up: Machine Dependent
5382
53834.10 `ld' and PowerPC64 64-bit ELF Support
5384==========================================
5385
5386`--stub-group-size'
5387     Long branch stubs, PLT call stubs  and TOC adjusting stubs are
5388     placed by `ld' in stub sections located between groups of input
5389     sections.  `--stub-group-size' specifies the maximum size of a
5390     group of input sections handled by one stub section.  Since branch
5391     offsets are signed, a stub section may serve two groups of input
5392     sections, one group before the stub section, and one group after
5393     it.  However, when using conditional branches that require stubs,
5394     it may be better (for branch prediction) that stub sections only
5395     serve one group of input sections.  A negative value for `N'
5396     chooses this scheme, ensuring that branches to stubs always use a
5397     negative offset.  Two special values of `N' are recognized, `1'
5398     and `-1'.  These both instruct `ld' to automatically size input
5399     section groups for the branch types detected, with the same
5400     behaviour regarding stub placement as other positive or negative
5401     values of `N' respectively.
5402
5403     Note that `--stub-group-size' does not split input sections.  A
5404     single input section larger than the group size specified will of
5405     course create a larger group (of one section).  If input sections
5406     are too large, it may not be possible for a branch to reach its
5407     stub.
5408
5409`--emit-stub-syms'
5410     This option causes `ld' to label linker stubs with a local symbol
5411     that encodes the stub type and destination.
5412
5413`--dotsyms, --no-dotsyms'
5414     These two options control how `ld' interprets version patterns in
5415     a version script.  Older PowerPC64 compilers emitted both a
5416     function descriptor symbol with the same name as the function, and
5417     a code entry symbol with the name prefixed by a dot (`.').  To
5418     properly version a function `foo', the version script thus needs
5419     to control both `foo' and `.foo'.  The option `--dotsyms', on by
5420     default, automatically adds the required dot-prefixed patterns.
5421     Use `--no-dotsyms' to disable this feature.
5422
5423`--no-tls-optimize'
5424     PowerPC64 `ld' normally performs some optimization of code
5425     sequences used to access Thread-Local Storage.  Use this option to
5426     disable the optimization.
5427
5428`--no-opd-optimize'
5429     PowerPC64 `ld' normally removes `.opd' section entries
5430     corresponding to deleted link-once functions, or functions removed
5431     by the action of `--gc-sections' or linker script `/DISCARD/'.
5432     Use this option to disable `.opd' optimization.
5433
5434`--non-overlapping-opd'
5435     Some PowerPC64 compilers have an option to generate compressed
5436     `.opd' entries spaced 16 bytes apart, overlapping the third word,
5437     the static chain pointer (unused in C) with the first word of the
5438     next entry.  This option expands such entries to the full 24 bytes.
5439
5440`--no-toc-optimize'
5441     PowerPC64 `ld' normally removes unused `.toc' section entries.
5442     Such entries are detected by examining relocations that reference
5443     the TOC in code sections.  A reloc in a deleted code section marks
5444     a TOC word as unneeded, while a reloc in a kept code section marks
5445     a TOC word as needed.  Since the TOC may reference itself, TOC
5446     relocs are also examined.  TOC words marked as both needed and
5447     unneeded will of course be kept.  TOC words without any referencing
5448     reloc are assumed to be part of a multi-word entry, and are kept or
5449     discarded as per the nearest marked preceding word.  This works
5450     reliably for compiler generated code, but may be incorrect if
5451     assembly code is used to insert TOC entries.  Use this option to
5452     disable the optimization.
5453
5454`--no-multi-toc'
5455     By default, PowerPC64 GCC generates code for a TOC model where TOC
5456     entries are accessed with a 16-bit offset from r2.  This limits the
5457     total TOC size to 64K.  PowerPC64 `ld' extends this limit by
5458     grouping code sections such that each group uses less than 64K for
5459     its TOC entries, then inserts r2 adjusting stubs between
5460     inter-group calls.  `ld' does not split apart input sections, so
5461     cannot help if a single input file has a `.toc' section that
5462     exceeds 64K, most likely from linking multiple files with `ld -r'.
5463     Use this option to turn off this feature.
5464
5465
5466File: ld.info,  Node: SPU ELF,  Next: TI COFF,  Prev: PowerPC64 ELF64,  Up: Machine Dependent
5467
54684.11 `ld' and SPU ELF Support
5469=============================
5470
5471`--plugin'
5472     This option marks an executable as a PIC plugin module.
5473
5474`--no-overlays'
5475     Normally, `ld' recognizes calls to functions within overlay
5476     regions, and redirects such calls to an overlay manager via a stub.
5477     `ld' also provides a built-in overlay manager.  This option turns
5478     off all this special overlay handling.
5479
5480`--emit-stub-syms'
5481     This option causes `ld' to label overlay stubs with a local symbol
5482     that encodes the stub type and destination.
5483
5484`--extra-overlay-stubs'
5485     This option causes `ld' to add overlay call stubs on all function
5486     calls out of overlay regions.  Normally stubs are not added on
5487     calls to non-overlay regions.
5488
5489`--local-store=lo:hi'
5490     `ld' usually checks that a final executable for SPU fits in the
5491     address range 0 to 256k.  This option may be used to change the
5492     range.  Disable the check entirely with `--local-store=0:0'.
5493
5494`--stack-analysis'
5495     SPU local store space is limited.  Over-allocation of stack space
5496     unnecessarily limits space available for code and data, while
5497     under-allocation results in runtime failures.  If given this
5498     option, `ld' will provide an estimate of maximum stack usage.
5499     `ld' does this by examining symbols in code sections to determine
5500     the extents of functions, and looking at function prologues for
5501     stack adjusting instructions.  A call-graph is created by looking
5502     for relocations on branch instructions.  The graph is then searched
5503     for the maximum stack usage path.  Note that this analysis does not
5504     find calls made via function pointers, and does not handle
5505     recursion and other cycles in the call graph.  Stack usage may be
5506     under-estimated if your code makes such calls.  Also, stack usage
5507     for dynamic allocation, e.g. alloca, will not be detected.  If a
5508     link map is requested, detailed information about each function's
5509     stack usage and calls will be given.
5510
5511`--emit-stack-syms'
5512     This option, if given along with `--stack-analysis' will result in
5513     `ld' emitting stack sizing symbols for each function.  These take
5514     the form `__stack_<function_name>' for global functions, and
5515     `__stack_<number>_<function_name>' for static functions.
5516     `<number>' is the section id in hex.  The value of such symbols is
5517     the stack requirement for the corresponding function.  The symbol
5518     size will be zero, type `STT_NOTYPE', binding `STB_LOCAL', and
5519     section `SHN_ABS'.
5520
5521
5522File: ld.info,  Node: TI COFF,  Next: WIN32,  Prev: SPU ELF,  Up: Machine Dependent
5523
55244.12 `ld''s Support for Various TI COFF Versions
5525================================================
5526
5527The `--format' switch allows selection of one of the various TI COFF
5528versions.  The latest of this writing is 2; versions 0 and 1 are also
5529supported.  The TI COFF versions also vary in header byte-order format;
5530`ld' will read any version or byte order, but the output header format
5531depends on the default specified by the specific target.
5532
5533
5534File: ld.info,  Node: WIN32,  Next: Xtensa,  Prev: TI COFF,  Up: Machine Dependent
5535
55364.13 `ld' and WIN32 (cygwin/mingw)
5537==================================
5538
5539This section describes some of the win32 specific `ld' issues.  See
5540*Note Command Line Options: Options. for detailed description of the
5541command line options mentioned here.
5542
5543_import libraries_
5544     The standard Windows linker creates and uses so-called import
5545     libraries, which contains information for linking to dll's.  They
5546     are regular static archives and are handled as any other static
5547     archive.  The cygwin and mingw ports of `ld' have specific support
5548     for creating such libraries provided with the `--out-implib'
5549     command line option.
5550
5551_exporting DLL symbols_
5552     The cygwin/mingw `ld' has several ways to export symbols for dll's.
5553
5554    _using auto-export functionality_
5555          By default `ld' exports symbols with the auto-export
5556          functionality, which is controlled by the following command
5557          line options:
5558
5559             * -export-all-symbols   [This is the default]
5560
5561             * -exclude-symbols
5562
5563             * -exclude-libs
5564
5565             * -exclude-modules-for-implib
5566
5567             * -version-script
5568
5569          When auto-export is in operation, `ld' will export all the
5570          non-local (global and common) symbols it finds in a DLL, with
5571          the exception of a few symbols known to belong to the
5572          system's runtime and libraries.  As it will often not be
5573          desirable to export all of a DLL's symbols, which may include
5574          private functions that are not part of any public interface,
5575          the command-line options listed above may be used to filter
5576          symbols out from the list for exporting.  The `--output-def'
5577          option can be used in order to see the final list of exported
5578          symbols with all exclusions taken into effect.
5579
5580          If `--export-all-symbols' is not given explicitly on the
5581          command line, then the default auto-export behavior will be
5582          _disabled_ if either of the following are true:
5583
5584             * A DEF file is used.
5585
5586             * Any symbol in any object file was marked with the
5587               __declspec(dllexport) attribute.
5588
5589    _using a DEF file_
5590          Another way of exporting symbols is using a DEF file.  A DEF
5591          file is an ASCII file containing definitions of symbols which
5592          should be exported when a dll is created.  Usually it is
5593          named `<dll name>.def' and is added as any other object file
5594          to the linker's command line.  The file's name must end in
5595          `.def' or `.DEF'.
5596
5597               gcc -o <output> <objectfiles> <dll name>.def
5598
5599          Using a DEF file turns off the normal auto-export behavior,
5600          unless the `--export-all-symbols' option is also used.
5601
5602          Here is an example of a DEF file for a shared library called
5603          `xyz.dll':
5604
5605               LIBRARY "xyz.dll" BASE=0x20000000
5606
5607               EXPORTS
5608               foo
5609               bar
5610               _bar = bar
5611               another_foo = abc.dll.afoo
5612               var1 DATA
5613               doo = foo == foo2
5614               eoo DATA == var1
5615
5616          This example defines a DLL with a non-default base address
5617          and seven symbols in the export table. The third exported
5618          symbol `_bar' is an alias for the second. The fourth symbol,
5619          `another_foo' is resolved by "forwarding" to another module
5620          and treating it as an alias for `afoo' exported from the DLL
5621          `abc.dll'. The final symbol `var1' is declared to be a data
5622          object. The `doo' symbol in export library is an alias of
5623          `foo', which gets the string name in export table `foo2'. The
5624          `eoo' symbol is an data export symbol, which gets in export
5625          table the name `var1'.
5626
5627          The optional `LIBRARY <name>' command indicates the _internal_
5628          name of the output DLL. If `<name>' does not include a suffix,
5629          the default library suffix, `.DLL' is appended.
5630
5631          When the .DEF file is used to build an application, rather
5632          than a library, the `NAME <name>' command should be used
5633          instead of `LIBRARY'. If `<name>' does not include a suffix,
5634          the default executable suffix, `.EXE' is appended.
5635
5636          With either `LIBRARY <name>' or `NAME <name>' the optional
5637          specification `BASE = <number>' may be used to specify a
5638          non-default base address for the image.
5639
5640          If neither `LIBRARY <name>' nor  `NAME <name>' is specified,
5641          or they specify an empty string, the internal name is the
5642          same as the filename specified on the command line.
5643
5644          The complete specification of an export symbol is:
5645
5646               EXPORTS
5647                 ( (  ( <name1> [ = <name2> ] )
5648                    | ( <name1> = <module-name> . <external-name>))
5649                 [ @ <integer> ] [NONAME] [DATA] [CONSTANT] [PRIVATE] [== <name3>] ) *
5650
5651          Declares `<name1>' as an exported symbol from the DLL, or
5652          declares `<name1>' as an exported alias for `<name2>'; or
5653          declares `<name1>' as a "forward" alias for the symbol
5654          `<external-name>' in the DLL `<module-name>'.  Optionally,
5655          the symbol may be exported by the specified ordinal
5656          `<integer>' alias. The optional `<name3>' is the to be used
5657          string in import/export table for the symbol.
5658
5659          The optional keywords that follow the declaration indicate:
5660
5661          `NONAME': Do not put the symbol name in the DLL's export
5662          table.  It will still be exported by its ordinal alias
5663          (either the value specified by the .def specification or,
5664          otherwise, the value assigned by the linker). The symbol
5665          name, however, does remain visible in the import library (if
5666          any), unless `PRIVATE' is also specified.
5667
5668          `DATA': The symbol is a variable or object, rather than a
5669          function.  The import lib will export only an indirect
5670          reference to `foo' as the symbol `_imp__foo' (ie, `foo' must
5671          be resolved as `*_imp__foo').
5672
5673          `CONSTANT': Like `DATA', but put the undecorated `foo' as
5674          well as `_imp__foo' into the import library. Both refer to the
5675          read-only import address table's pointer to the variable, not
5676          to the variable itself. This can be dangerous. If the user
5677          code fails to add the `dllimport' attribute and also fails to
5678          explicitly add the extra indirection that the use of the
5679          attribute enforces, the application will behave unexpectedly.
5680
5681          `PRIVATE': Put the symbol in the DLL's export table, but do
5682          not put it into the static import library used to resolve
5683          imports at link time. The symbol can still be imported using
5684          the `LoadLibrary/GetProcAddress' API at runtime or by by
5685          using the GNU ld extension of linking directly to the DLL
5686          without an import library.
5687
5688          See ld/deffilep.y in the binutils sources for the full
5689          specification of other DEF file statements
5690
5691          While linking a shared dll, `ld' is able to create a DEF file
5692          with the `--output-def <file>' command line option.
5693
5694    _Using decorations_
5695          Another way of marking symbols for export is to modify the
5696          source code itself, so that when building the DLL each symbol
5697          to be exported is declared as:
5698
5699               __declspec(dllexport) int a_variable
5700               __declspec(dllexport) void a_function(int with_args)
5701
5702          All such symbols will be exported from the DLL.  If, however,
5703          any of the object files in the DLL contain symbols decorated
5704          in this way, then the normal auto-export behavior is
5705          disabled, unless the `--export-all-symbols' option is also
5706          used.
5707
5708          Note that object files that wish to access these symbols must
5709          _not_ decorate them with dllexport.  Instead, they should use
5710          dllimport, instead:
5711
5712               __declspec(dllimport) int a_variable
5713               __declspec(dllimport) void a_function(int with_args)
5714
5715          This complicates the structure of library header files,
5716          because when included by the library itself the header must
5717          declare the variables and functions as dllexport, but when
5718          included by client code the header must declare them as
5719          dllimport.  There are a number of idioms that are typically
5720          used to do this; often client code can omit the __declspec()
5721          declaration completely.  See `--enable-auto-import' and
5722          `automatic data imports' for more information.
5723
5724_automatic data imports_
5725     The standard Windows dll format supports data imports from dlls
5726     only by adding special decorations (dllimport/dllexport), which
5727     let the compiler produce specific assembler instructions to deal
5728     with this issue.  This increases the effort necessary to port
5729     existing Un*x code to these platforms, especially for large c++
5730     libraries and applications.  The auto-import feature, which was
5731     initially provided by Paul Sokolovsky, allows one to omit the
5732     decorations to achieve a behavior that conforms to that on
5733     POSIX/Un*x platforms. This feature is enabled with the
5734     `--enable-auto-import' command-line option, although it is enabled
5735     by default on cygwin/mingw.  The `--enable-auto-import' option
5736     itself now serves mainly to suppress any warnings that are
5737     ordinarily emitted when linked objects trigger the feature's use.
5738
5739     auto-import of variables does not always work flawlessly without
5740     additional assistance.  Sometimes, you will see this message
5741
5742     "variable '<var>' can't be auto-imported. Please read the
5743     documentation for ld's `--enable-auto-import' for details."
5744
5745     The `--enable-auto-import' documentation explains why this error
5746     occurs, and several methods that can be used to overcome this
5747     difficulty.  One of these methods is the _runtime pseudo-relocs_
5748     feature, described below.
5749
5750     For complex variables imported from DLLs (such as structs or
5751     classes), object files typically contain a base address for the
5752     variable and an offset (_addend_) within the variable-to specify a
5753     particular field or public member, for instance.  Unfortunately,
5754     the runtime loader used in win32 environments is incapable of
5755     fixing these references at runtime without the additional
5756     information supplied by dllimport/dllexport decorations.  The
5757     standard auto-import feature described above is unable to resolve
5758     these references.
5759
5760     The `--enable-runtime-pseudo-relocs' switch allows these
5761     references to be resolved without error, while leaving the task of
5762     adjusting the references themselves (with their non-zero addends)
5763     to specialized code provided by the runtime environment.  Recent
5764     versions of the cygwin and mingw environments and compilers
5765     provide this runtime support; older versions do not.  However, the
5766     support is only necessary on the developer's platform; the
5767     compiled result will run without error on an older system.
5768
5769     `--enable-runtime-pseudo-relocs' is not the default; it must be
5770     explicitly enabled as needed.
5771
5772_direct linking to a dll_
5773     The cygwin/mingw ports of `ld' support the direct linking,
5774     including data symbols, to a dll without the usage of any import
5775     libraries.  This is much faster and uses much less memory than
5776     does the traditional import library method, especially when
5777     linking large libraries or applications.  When `ld' creates an
5778     import lib, each function or variable exported from the dll is
5779     stored in its own bfd, even though a single bfd could contain many
5780     exports.  The overhead involved in storing, loading, and
5781     processing so many bfd's is quite large, and explains the
5782     tremendous time, memory, and storage needed to link against
5783     particularly large or complex libraries when using import libs.
5784
5785     Linking directly to a dll uses no extra command-line switches
5786     other than `-L' and `-l', because `ld' already searches for a
5787     number of names to match each library.  All that is needed from
5788     the developer's perspective is an understanding of this search, in
5789     order to force ld to select the dll instead of an import library.
5790
5791     For instance, when ld is called with the argument `-lxxx' it will
5792     attempt to find, in the first directory of its search path,
5793
5794          libxxx.dll.a
5795          xxx.dll.a
5796          libxxx.a
5797          xxx.lib
5798          cygxxx.dll (*)
5799          libxxx.dll
5800          xxx.dll
5801
5802     before moving on to the next directory in the search path.
5803
5804     (*) Actually, this is not `cygxxx.dll' but in fact is
5805     `<prefix>xxx.dll', where `<prefix>' is set by the `ld' option
5806     `--dll-search-prefix=<prefix>'. In the case of cygwin, the
5807     standard gcc spec file includes `--dll-search-prefix=cyg', so in
5808     effect we actually search for `cygxxx.dll'.
5809
5810     Other win32-based unix environments, such as mingw or pw32, may
5811     use other `<prefix>'es, although at present only cygwin makes use
5812     of this feature.  It was originally intended to help avoid name
5813     conflicts among dll's built for the various win32/un*x
5814     environments, so that (for example) two versions of a zlib dll
5815     could coexist on the same machine.
5816
5817     The generic cygwin/mingw path layout uses a `bin' directory for
5818     applications and dll's and a `lib' directory for the import
5819     libraries (using cygwin nomenclature):
5820
5821          bin/
5822          	cygxxx.dll
5823          lib/
5824          	libxxx.dll.a   (in case of dll's)
5825          	libxxx.a       (in case of static archive)
5826
5827     Linking directly to a dll without using the import library can be
5828     done two ways:
5829
5830     1. Use the dll directly by adding the `bin' path to the link line
5831          gcc -Wl,-verbose  -o a.exe -L../bin/ -lxxx
5832
5833     However, as the dll's often have version numbers appended to their
5834     names (`cygncurses-5.dll') this will often fail, unless one
5835     specifies `-L../bin -lncurses-5' to include the version.  Import
5836     libs are generally not versioned, and do not have this difficulty.
5837
5838     2. Create a symbolic link from the dll to a file in the `lib'
5839     directory according to the above mentioned search pattern.  This
5840     should be used to avoid unwanted changes in the tools needed for
5841     making the app/dll.
5842
5843          ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a]
5844
5845     Then you can link without any make environment changes.
5846
5847          gcc -Wl,-verbose  -o a.exe -L../lib/ -lxxx
5848
5849     This technique also avoids the version number problems, because
5850     the following is perfectly legal
5851
5852          bin/
5853          	cygxxx-5.dll
5854          lib/
5855          	libxxx.dll.a -> ../bin/cygxxx-5.dll
5856
5857     Linking directly to a dll without using an import lib will work
5858     even when auto-import features are exercised, and even when
5859     `--enable-runtime-pseudo-relocs' is used.
5860
5861     Given the improvements in speed and memory usage, one might
5862     justifiably wonder why import libraries are used at all.  There
5863     are three reasons:
5864
5865     1. Until recently, the link-directly-to-dll functionality did _not_
5866     work with auto-imported data.
5867
5868     2. Sometimes it is necessary to include pure static objects within
5869     the import library (which otherwise contains only bfd's for
5870     indirection symbols that point to the exports of a dll).  Again,
5871     the import lib for the cygwin kernel makes use of this ability,
5872     and it is not possible to do this without an import lib.
5873
5874     3. Symbol aliases can only be resolved using an import lib.  This
5875     is critical when linking against OS-supplied dll's (eg, the win32
5876     API) in which symbols are usually exported as undecorated aliases
5877     of their stdcall-decorated assembly names.
5878
5879     So, import libs are not going away.  But the ability to replace
5880     true import libs with a simple symbolic link to (or a copy of) a
5881     dll, in many cases, is a useful addition to the suite of tools
5882     binutils makes available to the win32 developer.  Given the
5883     massive improvements in memory requirements during linking, storage
5884     requirements, and linking speed, we expect that many developers
5885     will soon begin to use this feature whenever possible.
5886
5887_symbol aliasing_
5888
5889    _adding additional names_
5890          Sometimes, it is useful to export symbols with additional
5891          names.  A symbol `foo' will be exported as `foo', but it can
5892          also be exported as `_foo' by using special directives in the
5893          DEF file when creating the dll.  This will affect also the
5894          optional created import library.  Consider the following DEF
5895          file:
5896
5897               LIBRARY "xyz.dll" BASE=0x61000000
5898
5899               EXPORTS
5900               foo
5901               _foo = foo
5902
5903          The line `_foo = foo' maps the symbol `foo' to `_foo'.
5904
5905          Another method for creating a symbol alias is to create it in
5906          the source code using the "weak" attribute:
5907
5908               void foo () { /* Do something.  */; }
5909               void _foo () __attribute__ ((weak, alias ("foo")));
5910
5911          See the gcc manual for more information about attributes and
5912          weak symbols.
5913
5914    _renaming symbols_
5915          Sometimes it is useful to rename exports.  For instance, the
5916          cygwin kernel does this regularly.  A symbol `_foo' can be
5917          exported as `foo' but not as `_foo' by using special
5918          directives in the DEF file. (This will also affect the import
5919          library, if it is created).  In the following example:
5920
5921               LIBRARY "xyz.dll" BASE=0x61000000
5922
5923               EXPORTS
5924               _foo = foo
5925
5926          The line `_foo = foo' maps the exported symbol `foo' to
5927          `_foo'.
5928
5929     Note: using a DEF file disables the default auto-export behavior,
5930     unless the `--export-all-symbols' command line option is used.
5931     If, however, you are trying to rename symbols, then you should list
5932     _all_ desired exports in the DEF file, including the symbols that
5933     are not being renamed, and do _not_ use the `--export-all-symbols'
5934     option.  If you list only the renamed symbols in the DEF file, and
5935     use `--export-all-symbols' to handle the other symbols, then the
5936     both the new names _and_ the original names for the renamed
5937     symbols will be exported.  In effect, you'd be aliasing those
5938     symbols, not renaming them, which is probably not what you wanted.
5939
5940_weak externals_
5941     The Windows object format, PE, specifies a form of weak symbols
5942     called weak externals.  When a weak symbol is linked and the
5943     symbol is not defined, the weak symbol becomes an alias for some
5944     other symbol.  There are three variants of weak externals:
5945        * Definition is searched for in objects and libraries,
5946          historically called lazy externals.
5947
5948        * Definition is searched for only in other objects, not in
5949          libraries.  This form is not presently implemented.
5950
5951        * No search; the symbol is an alias.  This form is not presently
5952          implemented.
5953     As a GNU extension, weak symbols that do not specify an alternate
5954     symbol are supported.  If the symbol is undefined when linking,
5955     the symbol uses a default value.
5956
5957_aligned common symbols_
5958     As a GNU extension to the PE file format, it is possible to
5959     specify the desired alignment for a common symbol.  This
5960     information is conveyed from the assembler or compiler to the
5961     linker by means of GNU-specific commands carried in the object
5962     file's `.drectve' section, which are recognized by `ld' and
5963     respected when laying out the common symbols.  Native tools will
5964     be able to process object files employing this GNU extension, but
5965     will fail to respect the alignment instructions, and may issue
5966     noisy warnings about unknown linker directives.
5967
5968
5969File: ld.info,  Node: Xtensa,  Prev: WIN32,  Up: Machine Dependent
5970
59714.14 `ld' and Xtensa Processors
5972===============================
5973
5974The default `ld' behavior for Xtensa processors is to interpret
5975`SECTIONS' commands so that lists of explicitly named sections in a
5976specification with a wildcard file will be interleaved when necessary to
5977keep literal pools within the range of PC-relative load offsets.  For
5978example, with the command:
5979
5980     SECTIONS
5981     {
5982       .text : {
5983         *(.literal .text)
5984       }
5985     }
5986
5987`ld' may interleave some of the `.literal' and `.text' sections from
5988different object files to ensure that the literal pools are within the
5989range of PC-relative load offsets.  A valid interleaving might place
5990the `.literal' sections from an initial group of files followed by the
5991`.text' sections of that group of files.  Then, the `.literal' sections
5992from the rest of the files and the `.text' sections from the rest of
5993the files would follow.
5994
5995   Relaxation is enabled by default for the Xtensa version of `ld' and
5996provides two important link-time optimizations.  The first optimization
5997is to combine identical literal values to reduce code size.  A redundant
5998literal will be removed and all the `L32R' instructions that use it
5999will be changed to reference an identical literal, as long as the
6000location of the replacement literal is within the offset range of all
6001the `L32R' instructions.  The second optimization is to remove
6002unnecessary overhead from assembler-generated "longcall" sequences of
6003`L32R'/`CALLXN' when the target functions are within range of direct
6004`CALLN' instructions.
6005
6006   For each of these cases where an indirect call sequence can be
6007optimized to a direct call, the linker will change the `CALLXN'
6008instruction to a `CALLN' instruction, remove the `L32R' instruction,
6009and remove the literal referenced by the `L32R' instruction if it is
6010not used for anything else.  Removing the `L32R' instruction always
6011reduces code size but can potentially hurt performance by changing the
6012alignment of subsequent branch targets.  By default, the linker will
6013always preserve alignments, either by switching some instructions
6014between 24-bit encodings and the equivalent density instructions or by
6015inserting a no-op in place of the `L32R' instruction that was removed.
6016If code size is more important than performance, the `--size-opt'
6017option can be used to prevent the linker from widening density
6018instructions or inserting no-ops, except in a few cases where no-ops
6019are required for correctness.
6020
6021   The following Xtensa-specific command-line options can be used to
6022control the linker:
6023
6024`--size-opt'
6025     When optimizing indirect calls to direct calls, optimize for code
6026     size more than performance.  With this option, the linker will not
6027     insert no-ops or widen density instructions to preserve branch
6028     target alignment.  There may still be some cases where no-ops are
6029     required to preserve the correctness of the code.
6030
6031
6032File: ld.info,  Node: BFD,  Next: Reporting Bugs,  Prev: Machine Dependent,  Up: Top
6033
60345 BFD
6035*****
6036
6037The linker accesses object and archive files using the BFD libraries.
6038These libraries allow the linker to use the same routines to operate on
6039object files whatever the object file format.  A different object file
6040format can be supported simply by creating a new BFD back end and adding
6041it to the library.  To conserve runtime memory, however, the linker and
6042associated tools are usually configured to support only a subset of the
6043object file formats available.  You can use `objdump -i' (*note
6044objdump: (binutils.info)objdump.) to list all the formats available for
6045your configuration.
6046
6047   As with most implementations, BFD is a compromise between several
6048conflicting requirements. The major factor influencing BFD design was
6049efficiency: any time used converting between formats is time which
6050would not have been spent had BFD not been involved. This is partly
6051offset by abstraction payback; since BFD simplifies applications and
6052back ends, more time and care may be spent optimizing algorithms for a
6053greater speed.
6054
6055   One minor artifact of the BFD solution which you should bear in mind
6056is the potential for information loss.  There are two places where
6057useful information can be lost using the BFD mechanism: during
6058conversion and during output. *Note BFD information loss::.
6059
6060* Menu:
6061
6062* BFD outline::                 How it works: an outline of BFD
6063
6064
6065File: ld.info,  Node: BFD outline,  Up: BFD
6066
60675.1 How It Works: An Outline of BFD
6068===================================
6069
6070When an object file is opened, BFD subroutines automatically determine
6071the format of the input object file.  They then build a descriptor in
6072memory with pointers to routines that will be used to access elements of
6073the object file's data structures.
6074
6075   As different information from the object files is required, BFD
6076reads from different sections of the file and processes them.  For
6077example, a very common operation for the linker is processing symbol
6078tables.  Each BFD back end provides a routine for converting between
6079the object file's representation of symbols and an internal canonical
6080format. When the linker asks for the symbol table of an object file, it
6081calls through a memory pointer to the routine from the relevant BFD
6082back end which reads and converts the table into a canonical form.  The
6083linker then operates upon the canonical form. When the link is finished
6084and the linker writes the output file's symbol table, another BFD back
6085end routine is called to take the newly created symbol table and
6086convert it into the chosen output format.
6087
6088* Menu:
6089
6090* BFD information loss::	Information Loss
6091* Canonical format::		The BFD	canonical object-file format
6092
6093
6094File: ld.info,  Node: BFD information loss,  Next: Canonical format,  Up: BFD outline
6095
60965.1.1 Information Loss
6097----------------------
6098
6099_Information can be lost during output._ The output formats supported
6100by BFD do not provide identical facilities, and information which can
6101be described in one form has nowhere to go in another format. One
6102example of this is alignment information in `b.out'. There is nowhere
6103in an `a.out' format file to store alignment information on the
6104contained data, so when a file is linked from `b.out' and an `a.out'
6105image is produced, alignment information will not propagate to the
6106output file. (The linker will still use the alignment information
6107internally, so the link is performed correctly).
6108
6109   Another example is COFF section names. COFF files may contain an
6110unlimited number of sections, each one with a textual section name. If
6111the target of the link is a format which does not have many sections
6112(e.g., `a.out') or has sections without names (e.g., the Oasys format),
6113the link cannot be done simply. You can circumvent this problem by
6114describing the desired input-to-output section mapping with the linker
6115command language.
6116
6117   _Information can be lost during canonicalization._ The BFD internal
6118canonical form of the external formats is not exhaustive; there are
6119structures in input formats for which there is no direct representation
6120internally.  This means that the BFD back ends cannot maintain all
6121possible data richness through the transformation between external to
6122internal and back to external formats.
6123
6124   This limitation is only a problem when an application reads one
6125format and writes another.  Each BFD back end is responsible for
6126maintaining as much data as possible, and the internal BFD canonical
6127form has structures which are opaque to the BFD core, and exported only
6128to the back ends. When a file is read in one format, the canonical form
6129is generated for BFD and the application. At the same time, the back
6130end saves away any information which may otherwise be lost. If the data
6131is then written back in the same format, the back end routine will be
6132able to use the canonical form provided by the BFD core as well as the
6133information it prepared earlier.  Since there is a great deal of
6134commonality between back ends, there is no information lost when
6135linking or copying big endian COFF to little endian COFF, or `a.out' to
6136`b.out'.  When a mixture of formats is linked, the information is only
6137lost from the files whose format differs from the destination.
6138
6139
6140File: ld.info,  Node: Canonical format,  Prev: BFD information loss,  Up: BFD outline
6141
61425.1.2 The BFD canonical object-file format
6143------------------------------------------
6144
6145The greatest potential for loss of information occurs when there is the
6146least overlap between the information provided by the source format,
6147that stored by the canonical format, and that needed by the destination
6148format. A brief description of the canonical form may help you
6149understand which kinds of data you can count on preserving across
6150conversions.  
6151
6152_files_
6153     Information stored on a per-file basis includes target machine
6154     architecture, particular implementation format type, a demand
6155     pageable bit, and a write protected bit.  Information like Unix
6156     magic numbers is not stored here--only the magic numbers' meaning,
6157     so a `ZMAGIC' file would have both the demand pageable bit and the
6158     write protected text bit set.  The byte order of the target is
6159     stored on a per-file basis, so that big- and little-endian object
6160     files may be used with one another.
6161
6162_sections_
6163     Each section in the input file contains the name of the section,
6164     the section's original address in the object file, size and
6165     alignment information, various flags, and pointers into other BFD
6166     data structures.
6167
6168_symbols_
6169     Each symbol contains a pointer to the information for the object
6170     file which originally defined it, its name, its value, and various
6171     flag bits.  When a BFD back end reads in a symbol table, it
6172     relocates all symbols to make them relative to the base of the
6173     section where they were defined.  Doing this ensures that each
6174     symbol points to its containing section.  Each symbol also has a
6175     varying amount of hidden private data for the BFD back end.  Since
6176     the symbol points to the original file, the private data format
6177     for that symbol is accessible.  `ld' can operate on a collection
6178     of symbols of wildly different formats without problems.
6179
6180     Normal global and simple local symbols are maintained on output,
6181     so an output file (no matter its format) will retain symbols
6182     pointing to functions and to global, static, and common variables.
6183     Some symbol information is not worth retaining; in `a.out', type
6184     information is stored in the symbol table as long symbol names.
6185     This information would be useless to most COFF debuggers; the
6186     linker has command line switches to allow users to throw it away.
6187
6188     There is one word of type information within the symbol, so if the
6189     format supports symbol type information within symbols (for
6190     example, COFF, IEEE, Oasys) and the type is simple enough to fit
6191     within one word (nearly everything but aggregates), the
6192     information will be preserved.
6193
6194_relocation level_
6195     Each canonical BFD relocation record contains a pointer to the
6196     symbol to relocate to, the offset of the data to relocate, the
6197     section the data is in, and a pointer to a relocation type
6198     descriptor. Relocation is performed by passing messages through
6199     the relocation type descriptor and the symbol pointer. Therefore,
6200     relocations can be performed on output data using a relocation
6201     method that is only available in one of the input formats. For
6202     instance, Oasys provides a byte relocation format.  A relocation
6203     record requesting this relocation type would point indirectly to a
6204     routine to perform this, so the relocation may be performed on a
6205     byte being written to a 68k COFF file, even though 68k COFF has no
6206     such relocation type.
6207
6208_line numbers_
6209     Object formats can contain, for debugging purposes, some form of
6210     mapping between symbols, source line numbers, and addresses in the
6211     output file.  These addresses have to be relocated along with the
6212     symbol information.  Each symbol with an associated list of line
6213     number records points to the first record of the list.  The head
6214     of a line number list consists of a pointer to the symbol, which
6215     allows finding out the address of the function whose line number
6216     is being described. The rest of the list is made up of pairs:
6217     offsets into the section and line numbers. Any format which can
6218     simply derive this information can pass it successfully between
6219     formats (COFF, IEEE and Oasys).
6220
6221
6222File: ld.info,  Node: Reporting Bugs,  Next: MRI,  Prev: BFD,  Up: Top
6223
62246 Reporting Bugs
6225****************
6226
6227Your bug reports play an essential role in making `ld' reliable.
6228
6229   Reporting a bug may help you by bringing a solution to your problem,
6230or it may not.  But in any case the principal function of a bug report
6231is to help the entire community by making the next version of `ld' work
6232better.  Bug reports are your contribution to the maintenance of `ld'.
6233
6234   In order for a bug report to serve its purpose, you must include the
6235information that enables us to fix the bug.
6236
6237* Menu:
6238
6239* Bug Criteria::                Have you found a bug?
6240* Bug Reporting::               How to report bugs
6241
6242
6243File: ld.info,  Node: Bug Criteria,  Next: Bug Reporting,  Up: Reporting Bugs
6244
62456.1 Have You Found a Bug?
6246=========================
6247
6248If you are not sure whether you have found a bug, here are some
6249guidelines:
6250
6251   * If the linker gets a fatal signal, for any input whatever, that is
6252     a `ld' bug.  Reliable linkers never crash.
6253
6254   * If `ld' produces an error message for valid input, that is a bug.
6255
6256   * If `ld' does not produce an error message for invalid input, that
6257     may be a bug.  In the general case, the linker can not verify that
6258     object files are correct.
6259
6260   * If you are an experienced user of linkers, your suggestions for
6261     improvement of `ld' are welcome in any case.
6262
6263
6264File: ld.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: Reporting Bugs
6265
62666.2 How to Report Bugs
6267======================
6268
6269A number of companies and individuals offer support for GNU products.
6270If you obtained `ld' from a support organization, we recommend you
6271contact that organization first.
6272
6273   You can find contact information for many support companies and
6274individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
6275
6276   Otherwise, send bug reports for `ld' to
6277`http://www.sourceware.org/bugzilla/'.
6278
6279   The fundamental principle of reporting bugs usefully is this:
6280*report all the facts*.  If you are not sure whether to state a fact or
6281leave it out, state it!
6282
6283   Often people omit facts because they think they know what causes the
6284problem and assume that some details do not matter.  Thus, you might
6285assume that the name of a symbol you use in an example does not matter.
6286Well, probably it does not, but one cannot be sure.  Perhaps the bug
6287is a stray memory reference which happens to fetch from the location
6288where that name is stored in memory; perhaps, if the name were
6289different, the contents of that location would fool the linker into
6290doing the right thing despite the bug.  Play it safe and give a
6291specific, complete example.  That is the easiest thing for you to do,
6292and the most helpful.
6293
6294   Keep in mind that the purpose of a bug report is to enable us to fix
6295the bug if it is new to us.  Therefore, always write your bug reports
6296on the assumption that the bug has not been reported previously.
6297
6298   Sometimes people give a few sketchy facts and ask, "Does this ring a
6299bell?"  This cannot help us fix a bug, so it is basically useless.  We
6300respond by asking for enough details to enable us to investigate.  You
6301might as well expedite matters by sending them to begin with.
6302
6303   To enable us to fix the bug, you should include all these things:
6304
6305   * The version of `ld'.  `ld' announces it if you start it with the
6306     `--version' argument.
6307
6308     Without this, we will not know whether there is any point in
6309     looking for the bug in the current version of `ld'.
6310
6311   * Any patches you may have applied to the `ld' source, including any
6312     patches made to the `BFD' library.
6313
6314   * The type of machine you are using, and the operating system name
6315     and version number.
6316
6317   * What compiler (and its version) was used to compile `ld'--e.g.
6318     "`gcc-2.7'".
6319
6320   * The command arguments you gave the linker to link your example and
6321     observe the bug.  To guarantee you will not omit something
6322     important, list them all.  A copy of the Makefile (or the output
6323     from make) is sufficient.
6324
6325     If we were to try to guess the arguments, we would probably guess
6326     wrong and then we might not encounter the bug.
6327
6328   * A complete input file, or set of input files, that will reproduce
6329     the bug.  It is generally most helpful to send the actual object
6330     files provided that they are reasonably small.  Say no more than
6331     10K.  For bigger files you can either make them available by FTP
6332     or HTTP or else state that you are willing to send the object
6333     file(s) to whomever requests them.  (Note - your email will be
6334     going to a mailing list, so we do not want to clog it up with
6335     large attachments).  But small attachments are best.
6336
6337     If the source files were assembled using `gas' or compiled using
6338     `gcc', then it may be OK to send the source files rather than the
6339     object files.  In this case, be sure to say exactly what version of
6340     `gas' or `gcc' was used to produce the object files.  Also say how
6341     `gas' or `gcc' were configured.
6342
6343   * A description of what behavior you observe that you believe is
6344     incorrect.  For example, "It gets a fatal signal."
6345
6346     Of course, if the bug is that `ld' gets a fatal signal, then we
6347     will certainly notice it.  But if the bug is incorrect output, we
6348     might not notice unless it is glaringly wrong.  You might as well
6349     not give us a chance to make a mistake.
6350
6351     Even if the problem you experience is a fatal signal, you should
6352     still say so explicitly.  Suppose something strange is going on,
6353     such as, your copy of `ld' is out of sync, or you have encountered
6354     a bug in the C library on your system.  (This has happened!)  Your
6355     copy might crash and ours would not.  If you told us to expect a
6356     crash, then when ours fails to crash, we would know that the bug
6357     was not happening for us.  If you had not told us to expect a
6358     crash, then we would not be able to draw any conclusion from our
6359     observations.
6360
6361   * If you wish to suggest changes to the `ld' source, send us context
6362     diffs, as generated by `diff' with the `-u', `-c', or `-p' option.
6363     Always send diffs from the old file to the new file.  If you even
6364     discuss something in the `ld' source, refer to it by context, not
6365     by line number.
6366
6367     The line numbers in our development sources will not match those
6368     in your sources.  Your line numbers would convey no useful
6369     information to us.
6370
6371   Here are some things that are not necessary:
6372
6373   * A description of the envelope of the bug.
6374
6375     Often people who encounter a bug spend a lot of time investigating
6376     which changes to the input file will make the bug go away and which
6377     changes will not affect it.
6378
6379     This is often time consuming and not very useful, because the way
6380     we will find the bug is by running a single example under the
6381     debugger with breakpoints, not by pure deduction from a series of
6382     examples.  We recommend that you save your time for something else.
6383
6384     Of course, if you can find a simpler example to report _instead_
6385     of the original one, that is a convenience for us.  Errors in the
6386     output will be easier to spot, running under the debugger will take
6387     less time, and so on.
6388
6389     However, simplification is not vital; if you do not want to do
6390     this, report the bug anyway and send us the entire test case you
6391     used.
6392
6393   * A patch for the bug.
6394
6395     A patch for the bug does help us if it is a good one.  But do not
6396     omit the necessary information, such as the test case, on the
6397     assumption that a patch is all we need.  We might see problems
6398     with your patch and decide to fix the problem another way, or we
6399     might not understand it at all.
6400
6401     Sometimes with a program as complicated as `ld' it is very hard to
6402     construct an example that will make the program follow a certain
6403     path through the code.  If you do not send us the example, we will
6404     not be able to construct one, so we will not be able to verify
6405     that the bug is fixed.
6406
6407     And if we cannot understand what bug you are trying to fix, or why
6408     your patch should be an improvement, we will not install it.  A
6409     test case will help us to understand.
6410
6411   * A guess about what the bug is or what it depends on.
6412
6413     Such guesses are usually wrong.  Even we cannot guess right about
6414     such things without first using the debugger to find the facts.
6415
6416
6417File: ld.info,  Node: MRI,  Next: GNU Free Documentation License,  Prev: Reporting Bugs,  Up: Top
6418
6419Appendix A MRI Compatible Script Files
6420**************************************
6421
6422To aid users making the transition to GNU `ld' from the MRI linker,
6423`ld' can use MRI compatible linker scripts as an alternative to the
6424more general-purpose linker scripting language described in *Note
6425Scripts::.  MRI compatible linker scripts have a much simpler command
6426set than the scripting language otherwise used with `ld'.  GNU `ld'
6427supports the most commonly used MRI linker commands; these commands are
6428described here.
6429
6430   In general, MRI scripts aren't of much use with the `a.out' object
6431file format, since it only has three sections and MRI scripts lack some
6432features to make use of them.
6433
6434   You can specify a file containing an MRI-compatible script using the
6435`-c' command-line option.
6436
6437   Each command in an MRI-compatible script occupies its own line; each
6438command line starts with the keyword that identifies the command (though
6439blank lines are also allowed for punctuation).  If a line of an
6440MRI-compatible script begins with an unrecognized keyword, `ld' issues
6441a warning message, but continues processing the script.
6442
6443   Lines beginning with `*' are comments.
6444
6445   You can write these commands using all upper-case letters, or all
6446lower case; for example, `chip' is the same as `CHIP'.  The following
6447list shows only the upper-case form of each command.
6448
6449`ABSOLUTE SECNAME'
6450`ABSOLUTE SECNAME, SECNAME, ... SECNAME'
6451     Normally, `ld' includes in the output file all sections from all
6452     the input files.  However, in an MRI-compatible script, you can
6453     use the `ABSOLUTE' command to restrict the sections that will be
6454     present in your output program.  If the `ABSOLUTE' command is used
6455     at all in a script, then only the sections named explicitly in
6456     `ABSOLUTE' commands will appear in the linker output.  You can
6457     still use other input sections (whatever you select on the command
6458     line, or using `LOAD') to resolve addresses in the output file.
6459
6460`ALIAS OUT-SECNAME, IN-SECNAME'
6461     Use this command to place the data from input section IN-SECNAME
6462     in a section called OUT-SECNAME in the linker output file.
6463
6464     IN-SECNAME may be an integer.
6465
6466`ALIGN SECNAME = EXPRESSION'
6467     Align the section called SECNAME to EXPRESSION.  The EXPRESSION
6468     should be a power of two.
6469
6470`BASE EXPRESSION'
6471     Use the value of EXPRESSION as the lowest address (other than
6472     absolute addresses) in the output file.
6473
6474`CHIP EXPRESSION'
6475`CHIP EXPRESSION, EXPRESSION'
6476     This command does nothing; it is accepted only for compatibility.
6477
6478`END'
6479     This command does nothing whatever; it's only accepted for
6480     compatibility.
6481
6482`FORMAT OUTPUT-FORMAT'
6483     Similar to the `OUTPUT_FORMAT' command in the more general linker
6484     language, but restricted to one of these output formats:
6485
6486       1. S-records, if OUTPUT-FORMAT is `S'
6487
6488       2. IEEE, if OUTPUT-FORMAT is `IEEE'
6489
6490       3. COFF (the `coff-m68k' variant in BFD), if OUTPUT-FORMAT is
6491          `COFF'
6492
6493`LIST ANYTHING...'
6494     Print (to the standard output file) a link map, as produced by the
6495     `ld' command-line option `-M'.
6496
6497     The keyword `LIST' may be followed by anything on the same line,
6498     with no change in its effect.
6499
6500`LOAD FILENAME'
6501`LOAD FILENAME, FILENAME, ... FILENAME'
6502     Include one or more object file FILENAME in the link; this has the
6503     same effect as specifying FILENAME directly on the `ld' command
6504     line.
6505
6506`NAME OUTPUT-NAME'
6507     OUTPUT-NAME is the name for the program produced by `ld'; the
6508     MRI-compatible command `NAME' is equivalent to the command-line
6509     option `-o' or the general script language command `OUTPUT'.
6510
6511`ORDER SECNAME, SECNAME, ... SECNAME'
6512`ORDER SECNAME SECNAME SECNAME'
6513     Normally, `ld' orders the sections in its output file in the order
6514     in which they first appear in the input files.  In an
6515     MRI-compatible script, you can override this ordering with the
6516     `ORDER' command.  The sections you list with `ORDER' will appear
6517     first in your output file, in the order specified.
6518
6519`PUBLIC NAME=EXPRESSION'
6520`PUBLIC NAME,EXPRESSION'
6521`PUBLIC NAME EXPRESSION'
6522     Supply a value (EXPRESSION) for external symbol NAME used in the
6523     linker input files.
6524
6525`SECT SECNAME, EXPRESSION'
6526`SECT SECNAME=EXPRESSION'
6527`SECT SECNAME EXPRESSION'
6528     You can use any of these three forms of the `SECT' command to
6529     specify the start address (EXPRESSION) for section SECNAME.  If
6530     you have more than one `SECT' statement for the same SECNAME, only
6531     the _first_ sets the start address.
6532
6533
6534File: ld.info,  Node: GNU Free Documentation License,  Next: LD Index,  Prev: MRI,  Up: Top
6535
6536Appendix B GNU Free Documentation License
6537*****************************************
6538
6539                     Version 1.3, 3 November 2008
6540
6541     Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
6542     `http://fsf.org/'
6543
6544     Everyone is permitted to copy and distribute verbatim copies
6545     of this license document, but changing it is not allowed.
6546
6547  0. PREAMBLE
6548
6549     The purpose of this License is to make a manual, textbook, or other
6550     functional and useful document "free" in the sense of freedom: to
6551     assure everyone the effective freedom to copy and redistribute it,
6552     with or without modifying it, either commercially or
6553     noncommercially.  Secondarily, this License preserves for the
6554     author and publisher a way to get credit for their work, while not
6555     being considered responsible for modifications made by others.
6556
6557     This License is a kind of "copyleft", which means that derivative
6558     works of the document must themselves be free in the same sense.
6559     It complements the GNU General Public License, which is a copyleft
6560     license designed for free software.
6561
6562     We have designed this License in order to use it for manuals for
6563     free software, because free software needs free documentation: a
6564     free program should come with manuals providing the same freedoms
6565     that the software does.  But this License is not limited to
6566     software manuals; it can be used for any textual work, regardless
6567     of subject matter or whether it is published as a printed book.
6568     We recommend this License principally for works whose purpose is
6569     instruction or reference.
6570
6571  1. APPLICABILITY AND DEFINITIONS
6572
6573     This License applies to any manual or other work, in any medium,
6574     that contains a notice placed by the copyright holder saying it
6575     can be distributed under the terms of this License.  Such a notice
6576     grants a world-wide, royalty-free license, unlimited in duration,
6577     to use that work under the conditions stated herein.  The
6578     "Document", below, refers to any such manual or work.  Any member
6579     of the public is a licensee, and is addressed as "you".  You
6580     accept the license if you copy, modify or distribute the work in a
6581     way requiring permission under copyright law.
6582
6583     A "Modified Version" of the Document means any work containing the
6584     Document or a portion of it, either copied verbatim, or with
6585     modifications and/or translated into another language.
6586
6587     A "Secondary Section" is a named appendix or a front-matter section
6588     of the Document that deals exclusively with the relationship of the
6589     publishers or authors of the Document to the Document's overall
6590     subject (or to related matters) and contains nothing that could
6591     fall directly within that overall subject.  (Thus, if the Document
6592     is in part a textbook of mathematics, a Secondary Section may not
6593     explain any mathematics.)  The relationship could be a matter of
6594     historical connection with the subject or with related matters, or
6595     of legal, commercial, philosophical, ethical or political position
6596     regarding them.
6597
6598     The "Invariant Sections" are certain Secondary Sections whose
6599     titles are designated, as being those of Invariant Sections, in
6600     the notice that says that the Document is released under this
6601     License.  If a section does not fit the above definition of
6602     Secondary then it is not allowed to be designated as Invariant.
6603     The Document may contain zero Invariant Sections.  If the Document
6604     does not identify any Invariant Sections then there are none.
6605
6606     The "Cover Texts" are certain short passages of text that are
6607     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
6608     that says that the Document is released under this License.  A
6609     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
6610     be at most 25 words.
6611
6612     A "Transparent" copy of the Document means a machine-readable copy,
6613     represented in a format whose specification is available to the
6614     general public, that is suitable for revising the document
6615     straightforwardly with generic text editors or (for images
6616     composed of pixels) generic paint programs or (for drawings) some
6617     widely available drawing editor, and that is suitable for input to
6618     text formatters or for automatic translation to a variety of
6619     formats suitable for input to text formatters.  A copy made in an
6620     otherwise Transparent file format whose markup, or absence of
6621     markup, has been arranged to thwart or discourage subsequent
6622     modification by readers is not Transparent.  An image format is
6623     not Transparent if used for any substantial amount of text.  A
6624     copy that is not "Transparent" is called "Opaque".
6625
6626     Examples of suitable formats for Transparent copies include plain
6627     ASCII without markup, Texinfo input format, LaTeX input format,
6628     SGML or XML using a publicly available DTD, and
6629     standard-conforming simple HTML, PostScript or PDF designed for
6630     human modification.  Examples of transparent image formats include
6631     PNG, XCF and JPG.  Opaque formats include proprietary formats that
6632     can be read and edited only by proprietary word processors, SGML or
6633     XML for which the DTD and/or processing tools are not generally
6634     available, and the machine-generated HTML, PostScript or PDF
6635     produced by some word processors for output purposes only.
6636
6637     The "Title Page" means, for a printed book, the title page itself,
6638     plus such following pages as are needed to hold, legibly, the
6639     material this License requires to appear in the title page.  For
6640     works in formats which do not have any title page as such, "Title
6641     Page" means the text near the most prominent appearance of the
6642     work's title, preceding the beginning of the body of the text.
6643
6644     The "publisher" means any person or entity that distributes copies
6645     of the Document to the public.
6646
6647     A section "Entitled XYZ" means a named subunit of the Document
6648     whose title either is precisely XYZ or contains XYZ in parentheses
6649     following text that translates XYZ in another language.  (Here XYZ
6650     stands for a specific section name mentioned below, such as
6651     "Acknowledgements", "Dedications", "Endorsements", or "History".)
6652     To "Preserve the Title" of such a section when you modify the
6653     Document means that it remains a section "Entitled XYZ" according
6654     to this definition.
6655
6656     The Document may include Warranty Disclaimers next to the notice
6657     which states that this License applies to the Document.  These
6658     Warranty Disclaimers are considered to be included by reference in
6659     this License, but only as regards disclaiming warranties: any other
6660     implication that these Warranty Disclaimers may have is void and
6661     has no effect on the meaning of this License.
6662
6663  2. VERBATIM COPYING
6664
6665     You may copy and distribute the Document in any medium, either
6666     commercially or noncommercially, provided that this License, the
6667     copyright notices, and the license notice saying this License
6668     applies to the Document are reproduced in all copies, and that you
6669     add no other conditions whatsoever to those of this License.  You
6670     may not use technical measures to obstruct or control the reading
6671     or further copying of the copies you make or distribute.  However,
6672     you may accept compensation in exchange for copies.  If you
6673     distribute a large enough number of copies you must also follow
6674     the conditions in section 3.
6675
6676     You may also lend copies, under the same conditions stated above,
6677     and you may publicly display copies.
6678
6679  3. COPYING IN QUANTITY
6680
6681     If you publish printed copies (or copies in media that commonly
6682     have printed covers) of the Document, numbering more than 100, and
6683     the Document's license notice requires Cover Texts, you must
6684     enclose the copies in covers that carry, clearly and legibly, all
6685     these Cover Texts: Front-Cover Texts on the front cover, and
6686     Back-Cover Texts on the back cover.  Both covers must also clearly
6687     and legibly identify you as the publisher of these copies.  The
6688     front cover must present the full title with all words of the
6689     title equally prominent and visible.  You may add other material
6690     on the covers in addition.  Copying with changes limited to the
6691     covers, as long as they preserve the title of the Document and
6692     satisfy these conditions, can be treated as verbatim copying in
6693     other respects.
6694
6695     If the required texts for either cover are too voluminous to fit
6696     legibly, you should put the first ones listed (as many as fit
6697     reasonably) on the actual cover, and continue the rest onto
6698     adjacent pages.
6699
6700     If you publish or distribute Opaque copies of the Document
6701     numbering more than 100, you must either include a
6702     machine-readable Transparent copy along with each Opaque copy, or
6703     state in or with each Opaque copy a computer-network location from
6704     which the general network-using public has access to download
6705     using public-standard network protocols a complete Transparent
6706     copy of the Document, free of added material.  If you use the
6707     latter option, you must take reasonably prudent steps, when you
6708     begin distribution of Opaque copies in quantity, to ensure that
6709     this Transparent copy will remain thus accessible at the stated
6710     location until at least one year after the last time you
6711     distribute an Opaque copy (directly or through your agents or
6712     retailers) of that edition to the public.
6713
6714     It is requested, but not required, that you contact the authors of
6715     the Document well before redistributing any large number of
6716     copies, to give them a chance to provide you with an updated
6717     version of the Document.
6718
6719  4. MODIFICATIONS
6720
6721     You may copy and distribute a Modified Version of the Document
6722     under the conditions of sections 2 and 3 above, provided that you
6723     release the Modified Version under precisely this License, with
6724     the Modified Version filling the role of the Document, thus
6725     licensing distribution and modification of the Modified Version to
6726     whoever possesses a copy of it.  In addition, you must do these
6727     things in the Modified Version:
6728
6729       A. Use in the Title Page (and on the covers, if any) a title
6730          distinct from that of the Document, and from those of
6731          previous versions (which should, if there were any, be listed
6732          in the History section of the Document).  You may use the
6733          same title as a previous version if the original publisher of
6734          that version gives permission.
6735
6736       B. List on the Title Page, as authors, one or more persons or
6737          entities responsible for authorship of the modifications in
6738          the Modified Version, together with at least five of the
6739          principal authors of the Document (all of its principal
6740          authors, if it has fewer than five), unless they release you
6741          from this requirement.
6742
6743       C. State on the Title page the name of the publisher of the
6744          Modified Version, as the publisher.
6745
6746       D. Preserve all the copyright notices of the Document.
6747
6748       E. Add an appropriate copyright notice for your modifications
6749          adjacent to the other copyright notices.
6750
6751       F. Include, immediately after the copyright notices, a license
6752          notice giving the public permission to use the Modified
6753          Version under the terms of this License, in the form shown in
6754          the Addendum below.
6755
6756       G. Preserve in that license notice the full lists of Invariant
6757          Sections and required Cover Texts given in the Document's
6758          license notice.
6759
6760       H. Include an unaltered copy of this License.
6761
6762       I. Preserve the section Entitled "History", Preserve its Title,
6763          and add to it an item stating at least the title, year, new
6764          authors, and publisher of the Modified Version as given on
6765          the Title Page.  If there is no section Entitled "History" in
6766          the Document, create one stating the title, year, authors,
6767          and publisher of the Document as given on its Title Page,
6768          then add an item describing the Modified Version as stated in
6769          the previous sentence.
6770
6771       J. Preserve the network location, if any, given in the Document
6772          for public access to a Transparent copy of the Document, and
6773          likewise the network locations given in the Document for
6774          previous versions it was based on.  These may be placed in
6775          the "History" section.  You may omit a network location for a
6776          work that was published at least four years before the
6777          Document itself, or if the original publisher of the version
6778          it refers to gives permission.
6779
6780       K. For any section Entitled "Acknowledgements" or "Dedications",
6781          Preserve the Title of the section, and preserve in the
6782          section all the substance and tone of each of the contributor
6783          acknowledgements and/or dedications given therein.
6784
6785       L. Preserve all the Invariant Sections of the Document,
6786          unaltered in their text and in their titles.  Section numbers
6787          or the equivalent are not considered part of the section
6788          titles.
6789
6790       M. Delete any section Entitled "Endorsements".  Such a section
6791          may not be included in the Modified Version.
6792
6793       N. Do not retitle any existing section to be Entitled
6794          "Endorsements" or to conflict in title with any Invariant
6795          Section.
6796
6797       O. Preserve any Warranty Disclaimers.
6798
6799     If the Modified Version includes new front-matter sections or
6800     appendices that qualify as Secondary Sections and contain no
6801     material copied from the Document, you may at your option
6802     designate some or all of these sections as invariant.  To do this,
6803     add their titles to the list of Invariant Sections in the Modified
6804     Version's license notice.  These titles must be distinct from any
6805     other section titles.
6806
6807     You may add a section Entitled "Endorsements", provided it contains
6808     nothing but endorsements of your Modified Version by various
6809     parties--for example, statements of peer review or that the text
6810     has been approved by an organization as the authoritative
6811     definition of a standard.
6812
6813     You may add a passage of up to five words as a Front-Cover Text,
6814     and a passage of up to 25 words as a Back-Cover Text, to the end
6815     of the list of Cover Texts in the Modified Version.  Only one
6816     passage of Front-Cover Text and one of Back-Cover Text may be
6817     added by (or through arrangements made by) any one entity.  If the
6818     Document already includes a cover text for the same cover,
6819     previously added by you or by arrangement made by the same entity
6820     you are acting on behalf of, you may not add another; but you may
6821     replace the old one, on explicit permission from the previous
6822     publisher that added the old one.
6823
6824     The author(s) and publisher(s) of the Document do not by this
6825     License give permission to use their names for publicity for or to
6826     assert or imply endorsement of any Modified Version.
6827
6828  5. COMBINING DOCUMENTS
6829
6830     You may combine the Document with other documents released under
6831     this License, under the terms defined in section 4 above for
6832     modified versions, provided that you include in the combination
6833     all of the Invariant Sections of all of the original documents,
6834     unmodified, and list them all as Invariant Sections of your
6835     combined work in its license notice, and that you preserve all
6836     their Warranty Disclaimers.
6837
6838     The combined work need only contain one copy of this License, and
6839     multiple identical Invariant Sections may be replaced with a single
6840     copy.  If there are multiple Invariant Sections with the same name
6841     but different contents, make the title of each such section unique
6842     by adding at the end of it, in parentheses, the name of the
6843     original author or publisher of that section if known, or else a
6844     unique number.  Make the same adjustment to the section titles in
6845     the list of Invariant Sections in the license notice of the
6846     combined work.
6847
6848     In the combination, you must combine any sections Entitled
6849     "History" in the various original documents, forming one section
6850     Entitled "History"; likewise combine any sections Entitled
6851     "Acknowledgements", and any sections Entitled "Dedications".  You
6852     must delete all sections Entitled "Endorsements."
6853
6854  6. COLLECTIONS OF DOCUMENTS
6855
6856     You may make a collection consisting of the Document and other
6857     documents released under this License, and replace the individual
6858     copies of this License in the various documents with a single copy
6859     that is included in the collection, provided that you follow the
6860     rules of this License for verbatim copying of each of the
6861     documents in all other respects.
6862
6863     You may extract a single document from such a collection, and
6864     distribute it individually under this License, provided you insert
6865     a copy of this License into the extracted document, and follow
6866     this License in all other respects regarding verbatim copying of
6867     that document.
6868
6869  7. AGGREGATION WITH INDEPENDENT WORKS
6870
6871     A compilation of the Document or its derivatives with other
6872     separate and independent documents or works, in or on a volume of
6873     a storage or distribution medium, is called an "aggregate" if the
6874     copyright resulting from the compilation is not used to limit the
6875     legal rights of the compilation's users beyond what the individual
6876     works permit.  When the Document is included in an aggregate, this
6877     License does not apply to the other works in the aggregate which
6878     are not themselves derivative works of the Document.
6879
6880     If the Cover Text requirement of section 3 is applicable to these
6881     copies of the Document, then if the Document is less than one half
6882     of the entire aggregate, the Document's Cover Texts may be placed
6883     on covers that bracket the Document within the aggregate, or the
6884     electronic equivalent of covers if the Document is in electronic
6885     form.  Otherwise they must appear on printed covers that bracket
6886     the whole aggregate.
6887
6888  8. TRANSLATION
6889
6890     Translation is considered a kind of modification, so you may
6891     distribute translations of the Document under the terms of section
6892     4.  Replacing Invariant Sections with translations requires special
6893     permission from their copyright holders, but you may include
6894     translations of some or all Invariant Sections in addition to the
6895     original versions of these Invariant Sections.  You may include a
6896     translation of this License, and all the license notices in the
6897     Document, and any Warranty Disclaimers, provided that you also
6898     include the original English version of this License and the
6899     original versions of those notices and disclaimers.  In case of a
6900     disagreement between the translation and the original version of
6901     this License or a notice or disclaimer, the original version will
6902     prevail.
6903
6904     If a section in the Document is Entitled "Acknowledgements",
6905     "Dedications", or "History", the requirement (section 4) to
6906     Preserve its Title (section 1) will typically require changing the
6907     actual title.
6908
6909  9. TERMINATION
6910
6911     You may not copy, modify, sublicense, or distribute the Document
6912     except as expressly provided under this License.  Any attempt
6913     otherwise to copy, modify, sublicense, or distribute it is void,
6914     and will automatically terminate your rights under this License.
6915
6916     However, if you cease all violation of this License, then your
6917     license from a particular copyright holder is reinstated (a)
6918     provisionally, unless and until the copyright holder explicitly
6919     and finally terminates your license, and (b) permanently, if the
6920     copyright holder fails to notify you of the violation by some
6921     reasonable means prior to 60 days after the cessation.
6922
6923     Moreover, your license from a particular copyright holder is
6924     reinstated permanently if the copyright holder notifies you of the
6925     violation by some reasonable means, this is the first time you have
6926     received notice of violation of this License (for any work) from
6927     that copyright holder, and you cure the violation prior to 30 days
6928     after your receipt of the notice.
6929
6930     Termination of your rights under this section does not terminate
6931     the licenses of parties who have received copies or rights from
6932     you under this License.  If your rights have been terminated and
6933     not permanently reinstated, receipt of a copy of some or all of
6934     the same material does not give you any rights to use it.
6935
6936 10. FUTURE REVISIONS OF THIS LICENSE
6937
6938     The Free Software Foundation may publish new, revised versions of
6939     the GNU Free Documentation License from time to time.  Such new
6940     versions will be similar in spirit to the present version, but may
6941     differ in detail to address new problems or concerns.  See
6942     `http://www.gnu.org/copyleft/'.
6943
6944     Each version of the License is given a distinguishing version
6945     number.  If the Document specifies that a particular numbered
6946     version of this License "or any later version" applies to it, you
6947     have the option of following the terms and conditions either of
6948     that specified version or of any later version that has been
6949     published (not as a draft) by the Free Software Foundation.  If
6950     the Document does not specify a version number of this License,
6951     you may choose any version ever published (not as a draft) by the
6952     Free Software Foundation.  If the Document specifies that a proxy
6953     can decide which future versions of this License can be used, that
6954     proxy's public statement of acceptance of a version permanently
6955     authorizes you to choose that version for the Document.
6956
6957 11. RELICENSING
6958
6959     "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
6960     World Wide Web server that publishes copyrightable works and also
6961     provides prominent facilities for anybody to edit those works.  A
6962     public wiki that anybody can edit is an example of such a server.
6963     A "Massive Multiauthor Collaboration" (or "MMC") contained in the
6964     site means any set of copyrightable works thus published on the MMC
6965     site.
6966
6967     "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
6968     license published by Creative Commons Corporation, a not-for-profit
6969     corporation with a principal place of business in San Francisco,
6970     California, as well as future copyleft versions of that license
6971     published by that same organization.
6972
6973     "Incorporate" means to publish or republish a Document, in whole or
6974     in part, as part of another Document.
6975
6976     An MMC is "eligible for relicensing" if it is licensed under this
6977     License, and if all works that were first published under this
6978     License somewhere other than this MMC, and subsequently
6979     incorporated in whole or in part into the MMC, (1) had no cover
6980     texts or invariant sections, and (2) were thus incorporated prior
6981     to November 1, 2008.
6982
6983     The operator of an MMC Site may republish an MMC contained in the
6984     site under CC-BY-SA on the same site at any time before August 1,
6985     2009, provided the MMC is eligible for relicensing.
6986
6987
6988ADDENDUM: How to use this License for your documents
6989====================================================
6990
6991To use this License in a document you have written, include a copy of
6992the License in the document and put the following copyright and license
6993notices just after the title page:
6994
6995       Copyright (C)  YEAR  YOUR NAME.
6996       Permission is granted to copy, distribute and/or modify this document
6997       under the terms of the GNU Free Documentation License, Version 1.3
6998       or any later version published by the Free Software Foundation;
6999       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
7000       Texts.  A copy of the license is included in the section entitled ``GNU
7001       Free Documentation License''.
7002
7003   If you have Invariant Sections, Front-Cover Texts and Back-Cover
7004Texts, replace the "with...Texts." line with this:
7005
7006         with the Invariant Sections being LIST THEIR TITLES, with
7007         the Front-Cover Texts being LIST, and with the Back-Cover Texts
7008         being LIST.
7009
7010   If you have Invariant Sections without Cover Texts, or some other
7011combination of the three, merge those two alternatives to suit the
7012situation.
7013
7014   If your document contains nontrivial examples of program code, we
7015recommend releasing these examples in parallel under your choice of
7016free software license, such as the GNU General Public License, to
7017permit their use in free software.
7018
7019
7020File: ld.info,  Node: LD Index,  Prev: GNU Free Documentation License,  Up: Top
7021
7022LD Index
7023********
7024
7025[index]
7026* Menu:
7027
7028* ":                                     Symbols.            (line    6)
7029* -(:                                    Options.            (line  696)
7030* --accept-unknown-input-arch:           Options.            (line  714)
7031* --add-needed:                          Options.            (line  738)
7032* --add-stdcall-alias:                   Options.            (line 1573)
7033* --allow-multiple-definition:           Options.            (line  984)
7034* --allow-shlib-undefined:               Options.            (line  990)
7035* --architecture=ARCH:                   Options.            (line  123)
7036* --as-needed:                           Options.            (line  724)
7037* --audit AUDITLIB:                      Options.            (line  112)
7038* --auxiliary=NAME:                      Options.            (line  255)
7039* --bank-window:                         Options.            (line 1982)
7040* --base-file:                           Options.            (line 1578)
7041* --be8:                                 ARM.                (line   28)
7042* --bss-plt:                             PowerPC ELF32.      (line   16)
7043* --build-id:                            Options.            (line 1535)
7044* --build-id=STYLE:                      Options.            (line 1535)
7045* --check-sections:                      Options.            (line  817)
7046* --copy-dt-needed-entries:              Options.            (line  829)
7047* --cref:                                Options.            (line  850)
7048* --default-imported-symver:             Options.            (line 1027)
7049* --default-script=SCRIPT:               Options.            (line  541)
7050* --default-symver:                      Options.            (line 1023)
7051* --defsym=SYMBOL=EXP:                   Options.            (line  878)
7052* --demangle[=STYLE]:                    Options.            (line  891)
7053* --depaudit AUDITLIB:                   Options.            (line  177)
7054* --disable-auto-image-base:             Options.            (line 1757)
7055* --disable-auto-import:                 Options.            (line 1892)
7056* --disable-long-section-names:          Options.            (line 1588)
7057* --disable-new-dtags:                   Options.            (line 1498)
7058* --disable-runtime-pseudo-reloc:        Options.            (line 1905)
7059* --disable-stdcall-fixup:               Options.            (line 1610)
7060* --discard-all:                         Options.            (line  587)
7061* --discard-locals:                      Options.            (line  591)
7062* --dll:                                 Options.            (line 1583)
7063* --dll-search-prefix:                   Options.            (line 1763)
7064* --dotsyms:                             PowerPC64 ELF64.    (line   33)
7065* --dynamic-linker=FILE:                 Options.            (line  904)
7066* --dynamic-list-cpp-new:                Options.            (line  809)
7067* --dynamic-list-cpp-typeinfo:           Options.            (line  813)
7068* --dynamic-list-data:                   Options.            (line  806)
7069* --dynamic-list=DYNAMIC-LIST-FILE:      Options.            (line  793)
7070* --dynamicbase:                         Options.            (line 1941)
7071* --eh-frame-hdr:                        Options.            (line 1494)
7072* --emit-relocs:                         Options.            (line  476)
7073* --emit-stack-syms:                     SPU ELF.            (line   46)
7074* --emit-stub-syms <1>:                  PowerPC ELF32.      (line   47)
7075* --emit-stub-syms <2>:                  SPU ELF.            (line   15)
7076* --emit-stub-syms:                      PowerPC64 ELF64.    (line   29)
7077* --enable-auto-image-base:              Options.            (line 1749)
7078* --enable-auto-import:                  Options.            (line 1772)
7079* --enable-extra-pe-debug:               Options.            (line 1910)
7080* --enable-long-section-names:           Options.            (line 1588)
7081* --enable-new-dtags:                    Options.            (line 1498)
7082* --enable-runtime-pseudo-reloc:         Options.            (line 1897)
7083* --enable-stdcall-fixup:                Options.            (line 1610)
7084* --entry=ENTRY:                         Options.            (line  187)
7085* --error-unresolved-symbols:            Options.            (line 1447)
7086* --exclude-all-symbols:                 Options.            (line 1664)
7087* --exclude-libs:                        Options.            (line  197)
7088* --exclude-modules-for-implib:          Options.            (line  208)
7089* --exclude-symbols:                     Options.            (line 1658)
7090* --export-all-symbols:                  Options.            (line 1634)
7091* --export-dynamic:                      Options.            (line  221)
7092* --extra-overlay-stubs:                 SPU ELF.            (line   19)
7093* --fatal-warnings:                      Options.            (line  911)
7094* --file-alignment:                      Options.            (line 1668)
7095* --filter=NAME:                         Options.            (line  276)
7096* --fix-cortex-a8:                       i960.               (line   39)
7097* --fix-v4bx:                            ARM.                (line   49)
7098* --fix-v4bx-interworking:               ARM.                (line   62)
7099* --force-dynamic:                       Options.            (line  485)
7100* --force-exe-suffix:                    Options.            (line  916)
7101* --forceinteg:                          Options.            (line 1946)
7102* --format=FORMAT:                       Options.            (line  134)
7103* --format=VERSION:                      TI COFF.            (line    6)
7104* --gc-sections:                         Options.            (line  926)
7105* --got:                                 Options.            (line 1995)
7106* --got=TYPE:                            M68K.               (line    6)
7107* --gpsize=VALUE:                        Options.            (line  309)
7108* --hash-size=NUMBER:                    Options.            (line 1507)
7109* --hash-style=STYLE:                    Options.            (line 1515)
7110* --heap:                                Options.            (line 1674)
7111* --help:                                Options.            (line  957)
7112* --image-base:                          Options.            (line 1681)
7113* --just-symbols=FILE:                   Options.            (line  508)
7114* --kill-at:                             Options.            (line 1690)
7115* --large-address-aware:                 Options.            (line 1695)
7116* --leading-underscore:                  Options.            (line 1628)
7117* --library-path=DIR:                    Options.            (line  368)
7118* --library=NAMESPEC:                    Options.            (line  335)
7119* --local-store=lo:hi:                   SPU ELF.            (line   24)
7120* --major-image-version:                 Options.            (line 1704)
7121* --major-os-version:                    Options.            (line 1709)
7122* --major-subsystem-version:             Options.            (line 1713)
7123* --merge-exidx-entries:                 i960.               (line   48)
7124* --minor-image-version:                 Options.            (line 1718)
7125* --minor-os-version:                    Options.            (line 1723)
7126* --minor-subsystem-version:             Options.            (line 1727)
7127* --mri-script=MRI-CMDFILE:              Options.            (line  158)
7128* --multi-subspace:                      HPPA ELF32.         (line    6)
7129* --nmagic:                              Options.            (line  439)
7130* --no-accept-unknown-input-arch:        Options.            (line  714)
7131* --no-add-needed:                       Options.            (line  738)
7132* --no-allow-shlib-undefined:            Options.            (line  990)
7133* --no-as-needed:                        Options.            (line  724)
7134* --no-bind:                             Options.            (line 1960)
7135* --no-check-sections:                   Options.            (line  817)
7136* --no-copy-dt-needed-entries:           Options.            (line  829)
7137* --no-define-common:                    Options.            (line  862)
7138* --no-demangle:                         Options.            (line  891)
7139* --no-dotsyms:                          PowerPC64 ELF64.    (line   33)
7140* --no-enum-size-warning:                ARM.                (line  111)
7141* --no-export-dynamic:                   Options.            (line  221)
7142* --no-fatal-warnings:                   Options.            (line  911)
7143* --no-fix-cortex-a8:                    i960.               (line   39)
7144* --no-gc-sections:                      Options.            (line  926)
7145* --no-isolation:                        Options.            (line 1953)
7146* --no-keep-memory:                      Options.            (line  969)
7147* --no-leading-underscore:               Options.            (line 1628)
7148* --no-merge-exidx-entries:              i960.               (line   48)
7149* --no-multi-toc:                        PowerPC64 ELF64.    (line   74)
7150* --no-omagic:                           Options.            (line  454)
7151* --no-opd-optimize:                     PowerPC64 ELF64.    (line   48)
7152* --no-overlays:                         SPU ELF.            (line    9)
7153* --no-print-gc-sections:                Options.            (line  948)
7154* --no-seh:                              Options.            (line 1956)
7155* --no-tls-optimize <1>:                 PowerPC ELF32.      (line   51)
7156* --no-tls-optimize:                     PowerPC64 ELF64.    (line   43)
7157* --no-toc-optimize:                     PowerPC64 ELF64.    (line   60)
7158* --no-trampoline:                       Options.            (line 1976)
7159* --no-undefined:                        Options.            (line  976)
7160* --no-undefined-version:                Options.            (line 1018)
7161* --no-warn-mismatch:                    Options.            (line 1031)
7162* --no-warn-search-mismatch:             Options.            (line 1040)
7163* --no-wchar-size-warning:               ARM.                (line  118)
7164* --no-whole-archive:                    Options.            (line 1044)
7165* --noinhibit-exec:                      Options.            (line 1048)
7166* --non-overlapping-opd:                 PowerPC64 ELF64.    (line   54)
7167* --nxcompat:                            Options.            (line 1949)
7168* --oformat=OUTPUT-FORMAT:               Options.            (line 1060)
7169* --omagic:                              Options.            (line  445)
7170* --out-implib:                          Options.            (line 1740)
7171* --output-def:                          Options.            (line 1732)
7172* --output=OUTPUT:                       Options.            (line  460)
7173* --pic-executable:                      Options.            (line 1073)
7174* --pic-veneer:                          ARM.                (line  124)
7175* --plugin:                              SPU ELF.            (line    6)
7176* --print-gc-sections:                   Options.            (line  948)
7177* --print-map:                           Options.            (line  402)
7178* --reduce-memory-overheads:             Options.            (line 1521)
7179* --relax:                               Options.            (line 1089)
7180* --relax on i960:                       i960.               (line   31)
7181* --relax on PowerPC:                    PowerPC ELF32.      (line    6)
7182* --relax on Xtensa:                     Xtensa.             (line   27)
7183* --relocatable:                         Options.            (line  489)
7184* --retain-symbols-file=FILENAME:        Options.            (line 1115)
7185* --script=SCRIPT:                       Options.            (line  532)
7186* --sdata-got:                           PowerPC ELF32.      (line   33)
7187* --section-alignment:                   Options.            (line 1915)
7188* --section-start=SECTIONNAME=ORG:       Options.            (line 1271)
7189* --secure-plt:                          PowerPC ELF32.      (line   26)
7190* --sort-common:                         Options.            (line 1213)
7191* --sort-section=alignment:              Options.            (line 1228)
7192* --sort-section=name:                   Options.            (line 1224)
7193* --split-by-file:                       Options.            (line 1232)
7194* --split-by-reloc:                      Options.            (line 1237)
7195* --stack:                               Options.            (line 1921)
7196* --stack-analysis:                      SPU ELF.            (line   29)
7197* --stats:                               Options.            (line 1250)
7198* --strip-all:                           Options.            (line  519)
7199* --strip-debug:                         Options.            (line  523)
7200* --stub-group-size:                     PowerPC64 ELF64.    (line    6)
7201* --stub-group-size=N <1>:               ARM.                (line  129)
7202* --stub-group-size=N:                   HPPA ELF32.         (line   12)
7203* --subsystem:                           Options.            (line 1928)
7204* --support-old-code:                    ARM.                (line    6)
7205* --sysroot=DIRECTORY:                   Options.            (line 1254)
7206* --target-help:                         Options.            (line  961)
7207* --target1-abs:                         ARM.                (line   32)
7208* --target1-rel:                         ARM.                (line   32)
7209* --target2=TYPE:                        ARM.                (line   37)
7210* --thumb-entry=ENTRY:                   ARM.                (line   17)
7211* --trace:                               Options.            (line  528)
7212* --trace-symbol=SYMBOL:                 Options.            (line  597)
7213* --traditional-format:                  Options.            (line 1259)
7214* --tsaware:                             Options.            (line 1966)
7215* --undefined=SYMBOL:                    Options.            (line  554)
7216* --unique[=SECTION]:                    Options.            (line  572)
7217* --unresolved-symbols:                  Options.            (line 1290)
7218* --use-blx:                             ARM.                (line   74)
7219* --use-nul-prefixed-import-tables:      ARM.                (line   23)
7220* --verbose[=NUMBER]:                    Options.            (line 1319)
7221* --version:                             Options.            (line  581)
7222* --version-script=VERSION-SCRIPTFILE:   Options.            (line 1327)
7223* --vfp11-denorm-fix:                    ARM.                (line   83)
7224* --warn-alternate-em:                   Options.            (line 1439)
7225* --warn-common:                         Options.            (line 1338)
7226* --warn-constructors:                   Options.            (line 1406)
7227* --warn-multiple-gp:                    Options.            (line 1411)
7228* --warn-once:                           Options.            (line 1425)
7229* --warn-section-align:                  Options.            (line 1429)
7230* --warn-shared-textrel:                 Options.            (line 1436)
7231* --warn-unresolved-symbols:             Options.            (line 1442)
7232* --wdmdriver:                           Options.            (line 1963)
7233* --whole-archive:                       Options.            (line 1451)
7234* --wrap=SYMBOL:                         Options.            (line 1465)
7235* -A ARCH:                               Options.            (line  122)
7236* -a KEYWORD:                            Options.            (line  105)
7237* -assert KEYWORD:                       Options.            (line  745)
7238* -b FORMAT:                             Options.            (line  134)
7239* -Bdynamic:                             Options.            (line  748)
7240* -Bgroup:                               Options.            (line  758)
7241* -Bshareable:                           Options.            (line 1206)
7242* -Bstatic:                              Options.            (line  765)
7243* -Bsymbolic:                            Options.            (line  780)
7244* -Bsymbolic-functions:                  Options.            (line  787)
7245* -c MRI-CMDFILE:                        Options.            (line  158)
7246* -call_shared:                          Options.            (line  748)
7247* -d:                                    Options.            (line  168)
7248* -dc:                                   Options.            (line  168)
7249* -dn:                                   Options.            (line  765)
7250* -dp:                                   Options.            (line  168)
7251* -dT SCRIPT:                            Options.            (line  541)
7252* -dy:                                   Options.            (line  748)
7253* -E:                                    Options.            (line  221)
7254* -e ENTRY:                              Options.            (line  187)
7255* -EB:                                   Options.            (line  248)
7256* -EL:                                   Options.            (line  251)
7257* -f NAME:                               Options.            (line  255)
7258* -F NAME:                               Options.            (line  276)
7259* -fini=NAME:                            Options.            (line  300)
7260* -g:                                    Options.            (line  306)
7261* -G VALUE:                              Options.            (line  309)
7262* -h NAME:                               Options.            (line  317)
7263* -i:                                    Options.            (line  326)
7264* -IFILE:                                Options.            (line  904)
7265* -init=NAME:                            Options.            (line  329)
7266* -L DIR:                                Options.            (line  368)
7267* -l NAMESPEC:                           Options.            (line  335)
7268* -M:                                    Options.            (line  402)
7269* -m EMULATION:                          Options.            (line  392)
7270* -Map=MAPFILE:                          Options.            (line  965)
7271* -n:                                    Options.            (line  439)
7272* -N:                                    Options.            (line  445)
7273* -no-relax:                             Options.            (line 1089)
7274* -non_shared:                           Options.            (line  765)
7275* -nostdlib:                             Options.            (line 1054)
7276* -O LEVEL:                              Options.            (line  466)
7277* -o OUTPUT:                             Options.            (line  460)
7278* -P AUDITLIB:                           Options.            (line  177)
7279* -pie:                                  Options.            (line 1073)
7280* -q:                                    Options.            (line  476)
7281* -qmagic:                               Options.            (line 1083)
7282* -Qy:                                   Options.            (line 1086)
7283* -r:                                    Options.            (line  489)
7284* -R FILE:                               Options.            (line  508)
7285* -rpath-link=DIR:                       Options.            (line 1151)
7286* -rpath=DIR:                            Options.            (line 1129)
7287* -s:                                    Options.            (line  519)
7288* -S:                                    Options.            (line  523)
7289* -shared:                               Options.            (line 1206)
7290* -soname=NAME:                          Options.            (line  317)
7291* -static:                               Options.            (line  765)
7292* -t:                                    Options.            (line  528)
7293* -T SCRIPT:                             Options.            (line  532)
7294* -Tbss=ORG:                             Options.            (line 1280)
7295* -Tdata=ORG:                            Options.            (line 1280)
7296* -Ttext-segment=ORG:                    Options.            (line 1286)
7297* -Ttext=ORG:                            Options.            (line 1280)
7298* -u SYMBOL:                             Options.            (line  554)
7299* -Ur:                                   Options.            (line  562)
7300* -V:                                    Options.            (line  581)
7301* -v:                                    Options.            (line  581)
7302* -X:                                    Options.            (line  591)
7303* -x:                                    Options.            (line  587)
7304* -Y PATH:                               Options.            (line  606)
7305* -y SYMBOL:                             Options.            (line  597)
7306* -z defs:                               Options.            (line  976)
7307* -z KEYWORD:                            Options.            (line  610)
7308* -z muldefs:                            Options.            (line  984)
7309* .:                                     Location Counter.   (line    6)
7310* /DISCARD/:                             Output Section Discarding.
7311                                                             (line   21)
7312* :PHDR:                                 Output Section Phdr.
7313                                                             (line    6)
7314* =FILLEXP:                              Output Section Fill.
7315                                                             (line    6)
7316* >REGION:                               Output Section Region.
7317                                                             (line    6)
7318* [COMMON]:                              Input Section Common.
7319                                                             (line   29)
7320* ABSOLUTE (MRI):                        MRI.                (line   33)
7321* absolute and relocatable symbols:      Expression Section. (line    6)
7322* absolute expressions:                  Expression Section. (line    6)
7323* ABSOLUTE(EXP):                         Builtin Functions.  (line   10)
7324* ADDR(SECTION):                         Builtin Functions.  (line   17)
7325* address, section:                      Output Section Address.
7326                                                             (line    6)
7327* ALIAS (MRI):                           MRI.                (line   44)
7328* ALIGN (MRI):                           MRI.                (line   50)
7329* align expression:                      Builtin Functions.  (line   38)
7330* align location counter:                Builtin Functions.  (line   38)
7331* ALIGN(ALIGN):                          Builtin Functions.  (line   38)
7332* ALIGN(EXP,ALIGN):                      Builtin Functions.  (line   38)
7333* ALIGN(SECTION_ALIGN):                  Forced Output Alignment.
7334                                                             (line    6)
7335* aligned common symbols:                WIN32.              (line  424)
7336* ALIGNOF(SECTION):                      Builtin Functions.  (line   64)
7337* allocating memory:                     MEMORY.             (line    6)
7338* architecture:                          Miscellaneous Commands.
7339                                                             (line   72)
7340* architectures:                         Options.            (line  122)
7341* archive files, from cmd line:          Options.            (line  335)
7342* archive search path in linker script:  File Commands.      (line   74)
7343* arithmetic:                            Expressions.        (line    6)
7344* arithmetic operators:                  Operators.          (line    6)
7345* ARM interworking support:              ARM.                (line    6)
7346* AS_NEEDED(FILES):                      File Commands.      (line   54)
7347* ASSERT:                                Miscellaneous Commands.
7348                                                             (line    9)
7349* assertion in linker script:            Miscellaneous Commands.
7350                                                             (line    9)
7351* assignment in scripts:                 Assignments.        (line    6)
7352* AT(LMA):                               Output Section LMA. (line    6)
7353* AT>LMA_REGION:                         Output Section LMA. (line    6)
7354* automatic data imports:                WIN32.              (line  191)
7355* back end:                              BFD.                (line    6)
7356* BASE (MRI):                            MRI.                (line   54)
7357* BE8:                                   ARM.                (line   28)
7358* BFD canonical format:                  Canonical format.   (line   11)
7359* BFD requirements:                      BFD.                (line   16)
7360* big-endian objects:                    Options.            (line  248)
7361* binary input format:                   Options.            (line  134)
7362* BLOCK(EXP):                            Builtin Functions.  (line   77)
7363* bug criteria:                          Bug Criteria.       (line    6)
7364* bug reports:                           Bug Reporting.      (line    6)
7365* bugs in ld:                            Reporting Bugs.     (line    6)
7366* BYTE(EXPRESSION):                      Output Section Data.
7367                                                             (line    6)
7368* C++ constructors, arranging in link:   Output Section Keywords.
7369                                                             (line   19)
7370* CHIP (MRI):                            MRI.                (line   58)
7371* COLLECT_NO_DEMANGLE:                   Environment.        (line   29)
7372* combining symbols, warnings on:        Options.            (line 1338)
7373* command files:                         Scripts.            (line    6)
7374* command line:                          Options.            (line    6)
7375* common allocation:                     Options.            (line  862)
7376* common allocation in linker script:    Miscellaneous Commands.
7377                                                             (line   25)
7378* common symbol placement:               Input Section Common.
7379                                                             (line    6)
7380* COMMONPAGESIZE:                        Symbolic Constants. (line   13)
7381* compatibility, MRI:                    Options.            (line  158)
7382* CONSTANT:                              Symbolic Constants. (line    6)
7383* constants in linker scripts:           Constants.          (line    6)
7384* constraints on output sections:        Output Section Constraint.
7385                                                             (line    6)
7386* CONSTRUCTORS:                          Output Section Keywords.
7387                                                             (line   19)
7388* constructors:                          Options.            (line  562)
7389* constructors, arranging in link:       Output Section Keywords.
7390                                                             (line   19)
7391* Cortex-A8 erratum workaround:          i960.               (line   39)
7392* crash of linker:                       Bug Criteria.       (line    9)
7393* CREATE_OBJECT_SYMBOLS:                 Output Section Keywords.
7394                                                             (line    9)
7395* creating a DEF file:                   WIN32.              (line  158)
7396* cross reference table:                 Options.            (line  850)
7397* cross references:                      Miscellaneous Commands.
7398                                                             (line   56)
7399* current output location:               Location Counter.   (line    6)
7400* data:                                  Output Section Data.
7401                                                             (line    6)
7402* DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE): Builtin Functions.
7403                                                             (line   82)
7404* DATA_SEGMENT_END(EXP):                 Builtin Functions.  (line  103)
7405* DATA_SEGMENT_RELRO_END(OFFSET, EXP):   Builtin Functions.  (line  109)
7406* dbx:                                   Options.            (line 1264)
7407* DEF files, creating:                   Options.            (line 1732)
7408* default emulation:                     Environment.        (line   21)
7409* default input format:                  Environment.        (line    9)
7410* DEFINED(SYMBOL):                       Builtin Functions.  (line  120)
7411* deleting local symbols:                Options.            (line  587)
7412* demangling, default:                   Environment.        (line   29)
7413* demangling, from command line:         Options.            (line  891)
7414* direct linking to a dll:               WIN32.              (line  239)
7415* discarding sections:                   Output Section Discarding.
7416                                                             (line    6)
7417* discontinuous memory:                  MEMORY.             (line    6)
7418* DLLs, creating:                        Options.            (line 1634)
7419* DLLs, linking to:                      Options.            (line 1763)
7420* dot:                                   Location Counter.   (line    6)
7421* dot inside sections:                   Location Counter.   (line   36)
7422* dot outside sections:                  Location Counter.   (line   66)
7423* dynamic linker, from command line:     Options.            (line  904)
7424* dynamic symbol table:                  Options.            (line  221)
7425* ELF program headers:                   PHDRS.              (line    6)
7426* emulation:                             Options.            (line  392)
7427* emulation, default:                    Environment.        (line   21)
7428* END (MRI):                             MRI.                (line   62)
7429* endianness:                            Options.            (line  248)
7430* entry point:                           Entry Point.        (line    6)
7431* entry point, from command line:        Options.            (line  187)
7432* entry point, thumb:                    ARM.                (line   17)
7433* ENTRY(SYMBOL):                         Entry Point.        (line    6)
7434* error on valid input:                  Bug Criteria.       (line   12)
7435* example of linker script:              Simple Example.     (line    6)
7436* exporting DLL symbols:                 WIN32.              (line   19)
7437* expression evaluation order:           Evaluation.         (line    6)
7438* expression sections:                   Expression Section. (line    6)
7439* expression, absolute:                  Builtin Functions.  (line   10)
7440* expressions:                           Expressions.        (line    6)
7441* EXTERN:                                Miscellaneous Commands.
7442                                                             (line   13)
7443* fatal signal:                          Bug Criteria.       (line    9)
7444* file name wildcard patterns:           Input Section Wildcards.
7445                                                             (line    6)
7446* FILEHDR:                               PHDRS.              (line   62)
7447* filename symbols:                      Output Section Keywords.
7448                                                             (line    9)
7449* fill pattern, entire section:          Output Section Fill.
7450                                                             (line    6)
7451* FILL(EXPRESSION):                      Output Section Data.
7452                                                             (line   39)
7453* finalization function:                 Options.            (line  300)
7454* first input file:                      File Commands.      (line   82)
7455* first instruction:                     Entry Point.        (line    6)
7456* FIX_V4BX:                              ARM.                (line   49)
7457* FIX_V4BX_INTERWORKING:                 ARM.                (line   62)
7458* FORCE_COMMON_ALLOCATION:               Miscellaneous Commands.
7459                                                             (line   20)
7460* forcing input section alignment:       Forced Input Alignment.
7461                                                             (line    6)
7462* forcing output section alignment:      Forced Output Alignment.
7463                                                             (line    6)
7464* forcing the creation of dynamic sections: Options.         (line  485)
7465* FORMAT (MRI):                          MRI.                (line   66)
7466* functions in expressions:              Builtin Functions.  (line    6)
7467* garbage collection <1>:                Options.            (line  948)
7468* garbage collection:                    Input Section Keep. (line    6)
7469* generating optimized output:           Options.            (line  466)
7470* GNU linker:                            Overview.           (line    6)
7471* GNUTARGET:                             Environment.        (line    9)
7472* GROUP(FILES):                          File Commands.      (line   47)
7473* grouping input files:                  File Commands.      (line   47)
7474* groups of archives:                    Options.            (line  696)
7475* H8/300 support:                        H8/300.             (line    6)
7476* header size:                           Builtin Functions.  (line  183)
7477* heap size:                             Options.            (line 1674)
7478* help:                                  Options.            (line  957)
7479* holes:                                 Location Counter.   (line   12)
7480* holes, filling:                        Output Section Data.
7481                                                             (line   39)
7482* HPPA multiple sub-space stubs:         HPPA ELF32.         (line    6)
7483* HPPA stub grouping:                    HPPA ELF32.         (line   12)
7484* i960 support:                          i960.               (line    6)
7485* image base:                            Options.            (line 1681)
7486* implicit linker scripts:               Implicit Linker Scripts.
7487                                                             (line    6)
7488* import libraries:                      WIN32.              (line   10)
7489* INCLUDE FILENAME:                      File Commands.      (line    9)
7490* including a linker script:             File Commands.      (line    9)
7491* including an entire archive:           Options.            (line 1451)
7492* incremental link:                      Options.            (line  326)
7493* INHIBIT_COMMON_ALLOCATION:             Miscellaneous Commands.
7494                                                             (line   25)
7495* initialization function:               Options.            (line  329)
7496* initialized data in ROM:               Output Section LMA. (line   39)
7497* input file format in linker script:    Format Commands.    (line   35)
7498* input filename symbols:                Output Section Keywords.
7499                                                             (line    9)
7500* input files in linker scripts:         File Commands.      (line   19)
7501* input files, displaying:               Options.            (line  528)
7502* input format:                          Options.            (line  134)
7503* input object files in linker scripts:  File Commands.      (line   19)
7504* input section alignment:               Forced Input Alignment.
7505                                                             (line    6)
7506* input section basics:                  Input Section Basics.
7507                                                             (line    6)
7508* input section wildcards:               Input Section Wildcards.
7509                                                             (line    6)
7510* input sections:                        Input Section.      (line    6)
7511* INPUT(FILES):                          File Commands.      (line   19)
7512* INSERT:                                Miscellaneous Commands.
7513                                                             (line   30)
7514* insert user script into default script: Miscellaneous Commands.
7515                                                             (line   30)
7516* integer notation:                      Constants.          (line    6)
7517* integer suffixes:                      Constants.          (line   15)
7518* internal object-file format:           Canonical format.   (line   11)
7519* invalid input:                         Bug Criteria.       (line   14)
7520* K and M integer suffixes:              Constants.          (line   15)
7521* KEEP:                                  Input Section Keep. (line    6)
7522* l =:                                   MEMORY.             (line   74)
7523* lazy evaluation:                       Evaluation.         (line    6)
7524* ld bugs, reporting:                    Bug Reporting.      (line    6)
7525* LD_FEATURE(STRING):                    Miscellaneous Commands.
7526                                                             (line   78)
7527* LDEMULATION:                           Environment.        (line   21)
7528* len =:                                 MEMORY.             (line   74)
7529* LENGTH =:                              MEMORY.             (line   74)
7530* LENGTH(MEMORY):                        Builtin Functions.  (line  137)
7531* library search path in linker script:  File Commands.      (line   74)
7532* link map:                              Options.            (line  402)
7533* link-time runtime library search path: Options.            (line 1151)
7534* linker crash:                          Bug Criteria.       (line    9)
7535* linker script concepts:                Basic Script Concepts.
7536                                                             (line    6)
7537* linker script example:                 Simple Example.     (line    6)
7538* linker script file commands:           File Commands.      (line    6)
7539* linker script format:                  Script Format.      (line    6)
7540* linker script input object files:      File Commands.      (line   19)
7541* linker script simple commands:         Simple Commands.    (line    6)
7542* linker scripts:                        Scripts.            (line    6)
7543* LIST (MRI):                            MRI.                (line   77)
7544* little-endian objects:                 Options.            (line  251)
7545* LOAD (MRI):                            MRI.                (line   84)
7546* load address:                          Output Section LMA. (line    6)
7547* LOADADDR(SECTION):                     Builtin Functions.  (line  140)
7548* loading, preventing:                   Output Section Type.
7549                                                             (line   22)
7550* local symbols, deleting:               Options.            (line  591)
7551* location counter:                      Location Counter.   (line    6)
7552* LONG(EXPRESSION):                      Output Section Data.
7553                                                             (line    6)
7554* M and K integer suffixes:              Constants.          (line   15)
7555* M68HC11 and 68HC12 support:            M68HC11/68HC12.     (line    6)
7556* machine architecture:                  Miscellaneous Commands.
7557                                                             (line   72)
7558* machine dependencies:                  Machine Dependent.  (line    6)
7559* mapping input sections to output sections: Input Section.  (line    6)
7560* MAX:                                   Builtin Functions.  (line  143)
7561* MAXPAGESIZE:                           Symbolic Constants. (line   10)
7562* MEMORY:                                MEMORY.             (line    6)
7563* memory region attributes:              MEMORY.             (line   34)
7564* memory regions:                        MEMORY.             (line    6)
7565* memory regions and sections:           Output Section Region.
7566                                                             (line    6)
7567* memory usage:                          Options.            (line  969)
7568* MIN:                                   Builtin Functions.  (line  146)
7569* Motorola 68K GOT generation:           M68K.               (line    6)
7570* MRI compatibility:                     MRI.                (line    6)
7571* MSP430 extra sections:                 MSP430.             (line   11)
7572* NAME (MRI):                            MRI.                (line   90)
7573* name, section:                         Output Section Name.
7574                                                             (line    6)
7575* names:                                 Symbols.            (line    6)
7576* naming the output file:                Options.            (line  460)
7577* NEXT(EXP):                             Builtin Functions.  (line  150)
7578* NMAGIC:                                Options.            (line  439)
7579* NO_ENUM_SIZE_WARNING:                  ARM.                (line  111)
7580* NO_WCHAR_SIZE_WARNING:                 ARM.                (line  118)
7581* NOCROSSREFS(SECTIONS):                 Miscellaneous Commands.
7582                                                             (line   56)
7583* NOLOAD:                                Output Section Type.
7584                                                             (line   22)
7585* not enough room for program headers:   Builtin Functions.  (line  188)
7586* o =:                                   MEMORY.             (line   69)
7587* objdump -i:                            BFD.                (line    6)
7588* object file management:                BFD.                (line    6)
7589* object files:                          Options.            (line   29)
7590* object formats available:              BFD.                (line    6)
7591* object size:                           Options.            (line  309)
7592* OMAGIC:                                Options.            (line  454)
7593* ONLY_IF_RO:                            Output Section Constraint.
7594                                                             (line    6)
7595* ONLY_IF_RW:                            Output Section Constraint.
7596                                                             (line    6)
7597* opening object files:                  BFD outline.        (line    6)
7598* operators for arithmetic:              Operators.          (line    6)
7599* options:                               Options.            (line    6)
7600* ORDER (MRI):                           MRI.                (line   95)
7601* org =:                                 MEMORY.             (line   69)
7602* ORIGIN =:                              MEMORY.             (line   69)
7603* ORIGIN(MEMORY):                        Builtin Functions.  (line  156)
7604* orphan:                                Orphan Sections.    (line    6)
7605* output file after errors:              Options.            (line 1048)
7606* output file format in linker script:   Format Commands.    (line   10)
7607* output file name in linker script:     File Commands.      (line   64)
7608* output section alignment:              Forced Output Alignment.
7609                                                             (line    6)
7610* output section attributes:             Output Section Attributes.
7611                                                             (line    6)
7612* output section data:                   Output Section Data.
7613                                                             (line    6)
7614* OUTPUT(FILENAME):                      File Commands.      (line   64)
7615* OUTPUT_ARCH(BFDARCH):                  Miscellaneous Commands.
7616                                                             (line   72)
7617* OUTPUT_FORMAT(BFDNAME):                Format Commands.    (line   10)
7618* OVERLAY:                               Overlay Description.
7619                                                             (line    6)
7620* overlays:                              Overlay Description.
7621                                                             (line    6)
7622* partial link:                          Options.            (line  489)
7623* PE import table prefixing:             ARM.                (line   23)
7624* PHDRS:                                 PHDRS.              (line   62)
7625* PIC_VENEER:                            ARM.                (line  124)
7626* position independent executables:      Options.            (line 1075)
7627* PowerPC ELF32 options:                 PowerPC ELF32.      (line   16)
7628* PowerPC GOT:                           PowerPC ELF32.      (line   33)
7629* PowerPC long branches:                 PowerPC ELF32.      (line    6)
7630* PowerPC PLT:                           PowerPC ELF32.      (line   16)
7631* PowerPC stub symbols:                  PowerPC ELF32.      (line   47)
7632* PowerPC TLS optimization:              PowerPC ELF32.      (line   51)
7633* PowerPC64 dot symbols:                 PowerPC64 ELF64.    (line   33)
7634* PowerPC64 ELF64 options:               PowerPC64 ELF64.    (line    6)
7635* PowerPC64 multi-TOC:                   PowerPC64 ELF64.    (line   74)
7636* PowerPC64 OPD optimization:            PowerPC64 ELF64.    (line   48)
7637* PowerPC64 OPD spacing:                 PowerPC64 ELF64.    (line   54)
7638* PowerPC64 stub grouping:               PowerPC64 ELF64.    (line    6)
7639* PowerPC64 stub symbols:                PowerPC64 ELF64.    (line   29)
7640* PowerPC64 TLS optimization:            PowerPC64 ELF64.    (line   43)
7641* PowerPC64 TOC optimization:            PowerPC64 ELF64.    (line   60)
7642* precedence in expressions:             Operators.          (line    6)
7643* prevent unnecessary loading:           Output Section Type.
7644                                                             (line   22)
7645* program headers:                       PHDRS.              (line    6)
7646* program headers and sections:          Output Section Phdr.
7647                                                             (line    6)
7648* program headers, not enough room:      Builtin Functions.  (line  188)
7649* program segments:                      PHDRS.              (line    6)
7650* PROVIDE:                               PROVIDE.            (line    6)
7651* PROVIDE_HIDDEN:                        PROVIDE_HIDDEN.     (line    6)
7652* PUBLIC (MRI):                          MRI.                (line  103)
7653* QUAD(EXPRESSION):                      Output Section Data.
7654                                                             (line    6)
7655* quoted symbol names:                   Symbols.            (line    6)
7656* read-only text:                        Options.            (line  439)
7657* read/write from cmd line:              Options.            (line  445)
7658* region alias:                          REGION_ALIAS.       (line    6)
7659* region names:                          REGION_ALIAS.       (line    6)
7660* REGION_ALIAS(ALIAS, REGION):           REGION_ALIAS.       (line    6)
7661* regions of memory:                     MEMORY.             (line    6)
7662* relative expressions:                  Expression Section. (line    6)
7663* relaxing addressing modes:             Options.            (line 1089)
7664* relaxing on H8/300:                    H8/300.             (line    9)
7665* relaxing on i960:                      i960.               (line   31)
7666* relaxing on M68HC11:                   M68HC11/68HC12.     (line   12)
7667* relaxing on Xtensa:                    Xtensa.             (line   27)
7668* relocatable and absolute symbols:      Expression Section. (line    6)
7669* relocatable output:                    Options.            (line  489)
7670* removing sections:                     Output Section Discarding.
7671                                                             (line    6)
7672* reporting bugs in ld:                  Reporting Bugs.     (line    6)
7673* requirements for BFD:                  BFD.                (line   16)
7674* retain relocations in final executable: Options.           (line  476)
7675* retaining specified symbols:           Options.            (line 1115)
7676* ROM initialized data:                  Output Section LMA. (line   39)
7677* round up expression:                   Builtin Functions.  (line   38)
7678* round up location counter:             Builtin Functions.  (line   38)
7679* runtime library name:                  Options.            (line  317)
7680* runtime library search path:           Options.            (line 1129)
7681* runtime pseudo-relocation:             WIN32.              (line  217)
7682* scaled integers:                       Constants.          (line   15)
7683* scommon section:                       Input Section Common.
7684                                                             (line   20)
7685* script files:                          Options.            (line  532)
7686* scripts:                               Scripts.            (line    6)
7687* search directory, from cmd line:       Options.            (line  368)
7688* search path in linker script:          File Commands.      (line   74)
7689* SEARCH_DIR(PATH):                      File Commands.      (line   74)
7690* SECT (MRI):                            MRI.                (line  109)
7691* section address:                       Output Section Address.
7692                                                             (line    6)
7693* section address in expression:         Builtin Functions.  (line   17)
7694* section alignment:                     Builtin Functions.  (line   64)
7695* section alignment, warnings on:        Options.            (line 1429)
7696* section data:                          Output Section Data.
7697                                                             (line    6)
7698* section fill pattern:                  Output Section Fill.
7699                                                             (line    6)
7700* section load address:                  Output Section LMA. (line    6)
7701* section load address in expression:    Builtin Functions.  (line  140)
7702* section name:                          Output Section Name.
7703                                                             (line    6)
7704* section name wildcard patterns:        Input Section Wildcards.
7705                                                             (line    6)
7706* section size:                          Builtin Functions.  (line  167)
7707* section, assigning to memory region:   Output Section Region.
7708                                                             (line    6)
7709* section, assigning to program header:  Output Section Phdr.
7710                                                             (line    6)
7711* SECTIONS:                              SECTIONS.           (line    6)
7712* sections, discarding:                  Output Section Discarding.
7713                                                             (line    6)
7714* segment origins, cmd line:             Options.            (line 1280)
7715* SEGMENT_START(SEGMENT, DEFAULT):       Builtin Functions.  (line  159)
7716* segments, ELF:                         PHDRS.              (line    6)
7717* shared libraries:                      Options.            (line 1208)
7718* SHORT(EXPRESSION):                     Output Section Data.
7719                                                             (line    6)
7720* SIZEOF(SECTION):                       Builtin Functions.  (line  167)
7721* SIZEOF_HEADERS:                        Builtin Functions.  (line  183)
7722* small common symbols:                  Input Section Common.
7723                                                             (line   20)
7724* SORT:                                  Input Section Wildcards.
7725                                                             (line   58)
7726* SORT_BY_ALIGNMENT:                     Input Section Wildcards.
7727                                                             (line   54)
7728* SORT_BY_NAME:                          Input Section Wildcards.
7729                                                             (line   46)
7730* SPU:                                   SPU ELF.            (line   29)
7731* SPU ELF options:                       SPU ELF.            (line    6)
7732* SPU extra overlay stubs:               SPU ELF.            (line   19)
7733* SPU local store size:                  SPU ELF.            (line   24)
7734* SPU overlay stub symbols:              SPU ELF.            (line   15)
7735* SPU overlays:                          SPU ELF.            (line    9)
7736* SPU plugins:                           SPU ELF.            (line    6)
7737* SQUAD(EXPRESSION):                     Output Section Data.
7738                                                             (line    6)
7739* stack size:                            Options.            (line 1921)
7740* standard Unix system:                  Options.            (line    7)
7741* start of execution:                    Entry Point.        (line    6)
7742* STARTUP(FILENAME):                     File Commands.      (line   82)
7743* strip all symbols:                     Options.            (line  519)
7744* strip debugger symbols:                Options.            (line  523)
7745* stripping all but some symbols:        Options.            (line 1115)
7746* STUB_GROUP_SIZE:                       ARM.                (line  129)
7747* SUBALIGN(SUBSECTION_ALIGN):            Forced Input Alignment.
7748                                                             (line    6)
7749* suffixes for integers:                 Constants.          (line   15)
7750* symbol defaults:                       Builtin Functions.  (line  120)
7751* symbol definition, scripts:            Assignments.        (line    6)
7752* symbol names:                          Symbols.            (line    6)
7753* symbol tracing:                        Options.            (line  597)
7754* symbol versions:                       VERSION.            (line    6)
7755* symbol-only input:                     Options.            (line  508)
7756* symbolic constants:                    Symbolic Constants. (line    6)
7757* symbols, from command line:            Options.            (line  878)
7758* symbols, relocatable and absolute:     Expression Section. (line    6)
7759* symbols, retaining selectively:        Options.            (line 1115)
7760* synthesizing linker:                   Options.            (line 1089)
7761* synthesizing on H8/300:                H8/300.             (line   14)
7762* TARGET(BFDNAME):                       Format Commands.    (line   35)
7763* TARGET1:                               ARM.                (line   32)
7764* TARGET2:                               ARM.                (line   37)
7765* text segment origin, cmd line:         Options.            (line 1287)
7766* thumb entry point:                     ARM.                (line   17)
7767* TI COFF versions:                      TI COFF.            (line    6)
7768* traditional format:                    Options.            (line 1259)
7769* trampoline generation on M68HC11:      M68HC11/68HC12.     (line   31)
7770* trampoline generation on M68HC12:      M68HC11/68HC12.     (line   31)
7771* unallocated address, next:             Builtin Functions.  (line  150)
7772* undefined symbol:                      Options.            (line  554)
7773* undefined symbol in linker script:     Miscellaneous Commands.
7774                                                             (line   13)
7775* undefined symbols, warnings on:        Options.            (line 1425)
7776* uninitialized data placement:          Input Section Common.
7777                                                             (line    6)
7778* unspecified memory:                    Output Section Data.
7779                                                             (line   39)
7780* usage:                                 Options.            (line  957)
7781* USE_BLX:                               ARM.                (line   74)
7782* using a DEF file:                      WIN32.              (line   57)
7783* using auto-export functionality:       WIN32.              (line   22)
7784* Using decorations:                     WIN32.              (line  162)
7785* variables, defining:                   Assignments.        (line    6)
7786* verbose[=NUMBER]:                      Options.            (line 1319)
7787* version:                               Options.            (line  581)
7788* version script:                        VERSION.            (line    6)
7789* version script, symbol versions:       Options.            (line 1327)
7790* VERSION {script text}:                 VERSION.            (line    6)
7791* versions of symbols:                   VERSION.            (line    6)
7792* VFP11_DENORM_FIX:                      ARM.                (line   83)
7793* warnings, on combining symbols:        Options.            (line 1338)
7794* warnings, on section alignment:        Options.            (line 1429)
7795* warnings, on undefined symbols:        Options.            (line 1425)
7796* weak externals:                        WIN32.              (line  407)
7797* what is this?:                         Overview.           (line    6)
7798* wildcard file name patterns:           Input Section Wildcards.
7799                                                             (line    6)
7800* Xtensa options:                        Xtensa.             (line   56)
7801* Xtensa processors:                     Xtensa.             (line    6)
7802
7803
7804
7805Tag Table:
7806Node: Top815
7807Node: Overview1600
7808Node: Invocation2714
7809Node: Options3122
7810Node: Environment93440
7811Node: Scripts95200
7812Node: Basic Script Concepts96934
7813Node: Script Format99641
7814Node: Simple Example100504
7815Node: Simple Commands103600
7816Node: Entry Point104106
7817Node: File Commands105039
7818Node: Format Commands109040
7819Node: REGION_ALIAS110996
7820Node: Miscellaneous Commands115828
7821Node: Assignments119436
7822Node: Simple Assignments119927
7823Node: PROVIDE121663
7824Node: PROVIDE_HIDDEN122868
7825Node: Source Code Reference123112
7826Node: SECTIONS126692
7827Node: Output Section Description128583
7828Node: Output Section Name129670
7829Node: Output Section Address130546
7830Node: Input Section132781
7831Node: Input Section Basics133582
7832Node: Input Section Wildcards136800
7833Node: Input Section Common141533
7834Node: Input Section Keep143015
7835Node: Input Section Example143505
7836Node: Output Section Data144473
7837Node: Output Section Keywords147250
7838Node: Output Section Discarding150819
7839Node: Output Section Attributes152000
7840Node: Output Section Type153101
7841Node: Output Section LMA154172
7842Node: Forced Output Alignment157243
7843Node: Forced Input Alignment157511
7844Node: Output Section Constraint157900
7845Node: Output Section Region158328
7846Node: Output Section Phdr158761
7847Node: Output Section Fill159425
7848Node: Overlay Description160567
7849Node: MEMORY164870
7850Node: PHDRS169205
7851Node: VERSION174459
7852Node: Expressions182552
7853Node: Constants183481
7854Node: Symbolic Constants184356
7855Node: Symbols184907
7856Node: Orphan Sections185654
7857Node: Location Counter186818
7858Node: Operators191254
7859Node: Evaluation192176
7860Node: Expression Section193540
7861Node: Builtin Functions197197
7862Node: Implicit Linker Scripts205158
7863Node: Machine Dependent205933
7864Node: H8/300206949
7865Node: i960208574
7866Node: M68HC11/68HC12210778
7867Node: ARM212232
7868Node: HPPA ELF32219744
7869Node: M68K221367
7870Node: MMIX222276
7871Node: MSP430223441
7872Node: PowerPC ELF32224490
7873Node: PowerPC64 ELF64227326
7874Node: SPU ELF231742
7875Node: TI COFF234374
7876Node: WIN32234900
7877Node: Xtensa255025
7878Node: BFD257990
7879Node: BFD outline259445
7880Node: BFD information loss260731
7881Node: Canonical format263248
7882Node: Reporting Bugs267605
7883Node: Bug Criteria268299
7884Node: Bug Reporting268998
7885Node: MRI276037
7886Node: GNU Free Documentation License280680
7887Node: LD Index305836
7888
7889End Tag Table
7890