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