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