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