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