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