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