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