OSDN Git Service

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