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