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