Changeset 609 for branches/GNU/src/binutils/ld/ld.texinfo
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/ld/ld.texinfo
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 2 2 @setfilename ld.info 3 3 @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 4 @c 2001 Free Software Foundation, Inc.4 @c 2001, 2002, 2003 Free Software Foundation, Inc. 5 5 @syncodeindex ky cp 6 6 @include configdoc.texi … … 9 9 10 10 @c @smallbook 11 12 @macro gcctabopt{body} 13 @code{\body\} 14 @end macro 15 16 @c man begin NAME 17 @ifset man 18 @c Configure for the generation of man pages 19 @set UsesEnvVars 20 @set GENERIC 21 @set A29K 22 @set ARC 23 @set ARM 24 @set D10V 25 @set D30V 26 @set H8/300 27 @set H8/500 28 @set HPPA 29 @set I370 30 @set I80386 31 @set I860 32 @set I960 33 @set M32R 34 @set M68HC11 35 @set M680X0 36 @set MCORE 37 @set MIPS 38 @set MMIX 39 @set MSP430 40 @set PDP11 41 @set PJ 42 @set SH 43 @set SPARC 44 @set TIC54X 45 @set V850 46 @set VAX 47 @set WIN32 48 @set XTENSA 49 @end ifset 50 @c man end 11 51 12 52 @ifinfo … … 21 61 This file documents the @sc{gnu} linker LD version @value{VERSION}. 22 62 23 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. 63 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 64 2001, 2002, 2003 Free Software Foundation, Inc. 24 65 25 66 @ignore … … 30 71 with no Invariant Sections, with no Front-Cover Texts, and with no 31 72 Back-Cover Texts. A copy of the license is included in the 32 section entitled "GNU Free Documentation License".73 section entitled ``GNU Free Documentation License''. 33 74 34 75 Permission is granted to process this file through Tex and print the … … 64 105 65 106 @vskip 0pt plus 1filll 66 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. 67 68 Permission is granted to copy, distribute and/or modify this document 69 under the terms of the GNU Free Documentation License, Version 1.1 70 or any later version published by the Free Software Foundation; 71 with no Invariant Sections, with no Front-Cover Texts, and with no 72 Back-Cover Texts. A copy of the license is included in the 73 section entitled "GNU Free Documentation License". 107 @c man begin COPYRIGHT 108 Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 109 2002, 2003 Free Software Foundation, Inc. 110 111 Permission is granted to copy, distribute and/or modify this document 112 under the terms of the GNU Free Documentation License, Version 1.1 113 or any later version published by the Free Software Foundation; 114 with no Invariant Sections, with no Front-Cover Texts, and with no 115 Back-Cover Texts. A copy of the license is included in the 116 section entitled ``GNU Free Documentation License''. 117 @c man end 74 118 75 119 @end titlepage … … 77 121 @c FIXME: Talk about importance of *order* of args, cmds to linker! 78 122 79 @if info123 @ifnottex 80 124 @node Top 81 125 @top Using ld … … 84 128 This document is distributed under the terms of the GNU Free 85 129 Documentation License. A copy of the license is included in the 86 section entitled "GNU Free Documentation License".130 section entitled ``GNU Free Documentation License''. 87 131 88 132 @menu … … 97 141 * H8/300:: ld and the H8/300 98 142 @end ifset 99 @ifset Hitachi100 * Hitachi:: ld and other Hitachimicros143 @ifset Renesas 144 * Renesas:: ld and other Renesas micros 101 145 @end ifset 102 146 @ifset I960 103 147 * i960:: ld and the Intel 960 family 104 148 @end ifset 149 @ifset ARM 150 * ARM:: ld and the ARM family 151 @end ifset 152 @ifset HPPA 153 * HPPA ELF32:: ld and HPPA 32-bit ELF 154 @end ifset 105 155 @ifset TICOFF 106 156 * TI COFF:: ld and the TI COFF 157 @end ifset 158 @ifset WIN32 159 * Win32:: ld and WIN32 (cygwin/mingw) 160 @end ifset 161 @ifset XTENSA 162 * Xtensa:: ld and Xtensa Processors 107 163 @end ifset 108 164 @end ifclear … … 117 173 * Index:: Index 118 174 @end menu 119 @end if info175 @end ifnottex 120 176 121 177 @node Overview … … 124 180 @cindex @sc{gnu} linker 125 181 @cindex what is this? 126 @code{ld} combines a number of object and archive files, relocates 182 183 @ifset man 184 @c man begin SYNOPSIS 185 ld [@b{options}] @var{objfile} @dots{} 186 @c man end 187 188 @c man begin SEEALSO 189 ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and 190 the Info entries for @file{binutils} and 191 @file{ld}. 192 @c man end 193 @end ifset 194 195 @c man begin DESCRIPTION 196 197 @command{ld} combines a number of object and archive files, relocates 127 198 their data and ties up symbol references. Usually the last step in 128 compiling a program is to run @co de{ld}.129 130 @co de{ld} accepts Linker Command Language files written in199 compiling a program is to run @command{ld}. 200 201 @command{ld} accepts Linker Command Language files written in 131 202 a superset of AT&T's Link Editor Command Language syntax, 132 203 to provide explicit and total control over the linking process. 133 204 205 @ifset man 206 @c For the man only 207 This man page does not describe the command language; see the 208 @command{ld} entry in @code{info}, or the manual 209 ld: the GNU linker, for full details on the command language and 210 on other aspects of the GNU linker. 211 @end ifset 212 134 213 @ifclear SingleFormat 135 This version of @co de{ld} uses the general purpose BFD libraries136 to operate on object files. This allows @co de{ld} to read, combine, and214 This version of @command{ld} uses the general purpose BFD libraries 215 to operate on object files. This allows @command{ld} to read, combine, and 137 216 write object files in many different formats---for example, COFF or 138 217 @code{a.out}. Different formats may be linked together to produce any … … 143 222 linkers in providing diagnostic information. Many linkers abandon 144 223 execution immediately upon encountering an error; whenever possible, 145 @co de{ld} continues executing, allowing you to identify other errors224 @command{ld} continues executing, allowing you to identify other errors 146 225 (or, in some cases, to get an output file in spite of the error). 226 227 @c man end 147 228 148 229 @node Invocation 149 230 @chapter Invocation 150 231 151 The @sc{gnu} linker @code{ld} is meant to cover a broad range of situations, 232 @c man begin DESCRIPTION 233 234 The @sc{gnu} linker @command{ld} is meant to cover a broad range of situations, 152 235 and to be as compatible as possible with other linkers. As a result, 153 236 you have many choices to control its behavior. 237 238 @c man end 154 239 155 240 @ifset UsesEnvVars … … 165 250 @cindex command line 166 251 @cindex options 252 253 @c man begin OPTIONS 254 167 255 The linker supports a plethora of command-line options, but in actual 168 256 practice few of them are used in any particular context. 169 257 @cindex standard Unix system 170 For instance, a frequent use of @co de{ld} is to link standard Unix258 For instance, a frequent use of @command{ld} is to link standard Unix 171 259 object files on a standard, supported Unix system. On such a system, to 172 260 link a file @code{hello.o}: … … 176 264 @end smallexample 177 265 178 This tells @co de{ld} to produce a file called @var{output} as the266 This tells @command{ld} to produce a file called @var{output} as the 179 267 result of linking the file @code{/lib/crt0.o} with @code{hello.o} and 180 268 the library @code{libc.a}, which will come from the standard search 181 269 directories. (See the discussion of the @samp{-l} option below.) 182 270 183 Some of the command-line options to @co de{ld} may be specified at any271 Some of the command-line options to @command{ld} may be specified at any 184 272 point in the command line. However, options which refer to files, such 185 273 as @samp{-l} or @samp{-T}, cause the file to be read at the point at … … 203 291 message @samp{No input files}. 204 292 205 If the linker can 293 If the linker cannot recognize the format of an object file, it will 206 294 assume that it is a linker script. A script specified in this way 207 295 augments the main linker script used for the link (either the default … … 210 298 or an archive, but actually merely defines some symbol values, or uses 211 299 @code{INPUT} or @code{GROUP} to load other objects. Note that 212 specifying a script in this way should only be used to augment the main 213 linker script; if you want to use some command that logically can only 214 appear once, such as the @code{SECTIONS} or @code{MEMORY} command, you 215 must replace the default linker script using the @samp{-T} option. 300 specifying a script in this way merely augments the main linker script; 301 use the @samp{-T} option to replace the default linker script entirely. 216 302 @xref{Scripts}. 217 303 … … 223 309 For options whose names are multiple letters, either one dash or two can 224 310 precede the option name; for example, @samp{-trace-symbol} and 225 @samp{--trace-symbol} are equivalent. Note -there is one exception to311 @samp{--trace-symbol} are equivalent. Note---there is one exception to 226 312 this rule. Multiple letter options that start with a lower case 'o' can 227 313 only be preceeded by two dashes. This is to reduce confusion with the … … 237 323 accepted. 238 324 239 Note -if the linker is being invoked indirectly, via a compiler driver240 (e g@samp{gcc}) then all the linker command line options should be325 Note---if the linker is being invoked indirectly, via a compiler driver 326 (e.g. @samp{gcc}) then all the linker command line options should be 241 327 prefixed by @samp{-Wl,} (or whatever is appropriate for the particular 242 328 compiler driver) like this: … … 252 338 linker: 253 339 254 @table @ code340 @table @gcctabopt 255 341 @kindex -a@var{keyword} 256 342 @item -a@var{keyword} … … 267 353 @kindex --architecture=@var{arch} 268 354 @itemx --architecture=@var{architecture} 269 In the current release of @co de{ld}, this option is useful only for the270 Intel 960 family of architectures. In that @co de{ld} configuration, the355 In the current release of @command{ld}, this option is useful only for the 356 Intel 960 family of architectures. In that @command{ld} configuration, the 271 357 @var{architecture} argument identifies the particular architecture in 272 358 the 960 family, enabling some safeguards and modifying the 273 archive-library search path. @xref{i960,,@co de{ld} and the Intel 960359 archive-library search path. @xref{i960,,@command{ld} and the Intel 960 274 360 family}, for details. 275 361 276 Future releases of @co de{ld} may support similar functionality for362 Future releases of @command{ld} may support similar functionality for 277 363 other architecture families. 278 364 @end ifset … … 286 372 @item -b @var{input-format} 287 373 @itemx --format=@var{input-format} 288 @co de{ld} may be configured to support more than one kind of object289 file. If your @co de{ld} is configured this way, you can use the374 @command{ld} may be configured to support more than one kind of object 375 file. If your @command{ld} is configured this way, you can use the 290 376 @samp{-b} option to specify the binary format for input object files 291 that follow this option on the command line. Even when @co de{ld} is377 that follow this option on the command line. Even when @command{ld} is 292 378 configured to support alternative object formats, you don't usually need 293 to specify this, as @co de{ld} should be configured to expect as a379 to specify this, as @command{ld} should be configured to expect as a 294 380 default input format the most usual format on each machine. 295 381 @var{input-format} is a text string, the name of a particular format … … 310 396 @end ifset 311 397 You can also define the input format from a script, using the command 312 @code{TARGET}; see @ref{Format Commands}. 398 @code{TARGET}; 399 @ifclear man 400 see @ref{Format Commands}. 401 @end ifclear 313 402 @end ifclear 314 403 … … 318 407 @item -c @var{MRI-commandfile} 319 408 @itemx --mri-script=@var{MRI-commandfile} 320 For compatibility with linkers produced by MRI, @co de{ld} accepts script409 For compatibility with linkers produced by MRI, @command{ld} accepts script 321 410 files written in an alternate, restricted command language, described in 322 @ref{MRI,,MRI Compatible Script Files}. Introduce MRI script files with 411 @ifclear man 412 @ref{MRI,,MRI Compatible Script Files}. 413 @end ifclear 414 @ifset man 415 the MRI Compatible Script Files section of GNU ld documentation. 416 @end ifset 417 Introduce MRI script files with 323 418 the option @samp{-c}; use the @samp{-T} option to run linker 324 scripts written in the general-purpose @co de{ld} scripting language.325 If @var{MRI-cmdfile} does not exist, @co de{ld} looks for it in the directories419 scripts written in the general-purpose @command{ld} scripting language. 420 If @var{MRI-cmdfile} does not exist, @command{ld} looks for it in the directories 326 421 specified by any @samp{-L} options. 327 422 … … 370 465 linking the program itself. 371 466 467 You can also use the version script to control what symbols should 468 be added to the dynamic symbol table if the output format supports it. 469 See the description of @samp{--version-script} in @ref{VERSION}. 470 471 @ifclear SingleFormat 372 472 @cindex big-endian objects 373 473 @cindex endianness … … 380 480 @item -EL 381 481 Link little-endian objects. This affects the default output format. 482 @end ifclear 382 483 383 484 @kindex -f … … 420 521 @var{name}. 421 522 422 Some older linkers used the @ code{-F} option throughout a compilation523 Some older linkers used the @option{-F} option throughout a compilation 423 524 toolchain for specifying object-file format for both input and output 424 object files. The @sc{gnu} linker uses other mechanisms for this 425 purpose: the @code{-b}, @code{--format}, @code{--oformat} options, the 525 object files. 526 @ifclear SingleFormat 527 The @sc{gnu} linker uses other mechanisms for this purpose: the 528 @option{-b}, @option{--format}, @option{--oformat} options, the 426 529 @code{TARGET} command in linker scripts, and the @code{GNUTARGET} 427 environment variable. The @sc{gnu} linker will ignore the @code{-F} 428 option when not creating an ELF shared object. 530 environment variable. 531 @end ifclear 532 The @sc{gnu} linker will ignore the @option{-F} option when not 533 creating an ELF shared object. 429 534 430 535 @cindex finalization function … … 480 585 @itemx --library=@var{archive} 481 586 Add archive file @var{archive} to the list of files to link. This 482 option may be used any number of times. @co de{ld} will search its587 option may be used any number of times. @command{ld} will search its 483 588 path-list for occurrences of @code{lib@var{archive}.a} for every 484 589 @var{archive} specified. 485 590 486 On systems which support shared libraries, @co de{ld} may also search for591 On systems which support shared libraries, @command{ld} may also search for 487 592 libraries with extensions other than @code{.a}. Specifically, on ELF 488 and SunOS systems, @co de{ld} will search a directory for a library with593 and SunOS systems, @command{ld} will search a directory for a library with 489 594 an extension of @code{.so} before searching for one with an extension of 490 595 @code{.a}. By convention, a @code{.so} extension indicates a shared … … 498 603 the command line will not cause the linker to search the archive again. 499 604 500 See the @ code{-(} option for a way to force the linker to search605 See the @option{-(} option for a way to force the linker to search 501 606 archives multiple times. 502 607 … … 505 610 @ifset GENERIC 506 611 This type of archive searching is standard for Unix linkers. However, 507 if you are using @co de{ld} on AIX, note that it is different from the612 if you are using @command{ld} on AIX, note that it is different from the 508 613 behaviour of the AIX linker. 509 614 @end ifset … … 514 619 @item -L@var{searchdir} 515 620 @itemx --library-path=@var{searchdir} 516 Add path @var{searchdir} to the list of paths that @co de{ld} will search517 for archive libraries and @co de{ld} control scripts. You may use this621 Add path @var{searchdir} to the list of paths that @command{ld} will search 622 for archive libraries and @command{ld} control scripts. You may use this 518 623 option any number of times. The directories are searched in the order 519 624 in which they are specified on the command line. Directories specified 520 625 on the command line are searched before the default directories. All 521 @ code{-L} options apply to all @code{-l} options, regardless of the626 @option{-L} options apply to all @option{-l} options, regardless of the 522 627 order in which the options appear. 628 629 If @var{searchdir} begins with @code{=}, then the @code{=} will be replaced 630 by the @dfn{sysroot prefix}, a path specified when the linker is configured. 523 631 524 632 @ifset UsesEnvVars 525 633 The default set of paths searched (without being specified with 526 @samp{-L}) depends on which emulation mode @co de{ld} is using, and in634 @samp{-L}) depends on which emulation mode @command{ld} is using, and in 527 635 some cases also on how it was configured. @xref{Environment}. 528 636 @end ifset … … 578 686 @itemx --omagic 579 687 Set the text and data sections to be readable and writable. Also, do 580 not page-align the data segment. If the output format supports Unix 581 style magic numbers, mark the output as @code{OMAGIC}. 688 not page-align the data segment, and disable linking against shared 689 libraries. If the output format supports Unix style magic numbers, 690 mark the output as @code{OMAGIC}. 691 692 @kindex --no-omagic 693 @cindex OMAGIC 694 @item --no-omagic 695 This option negates most of the effects of the @option{-N} option. It 696 sets the text section to be read-only, and forces the data segment to 697 be page-aligned. Note - this option does not enable linking against 698 shared libraries. Use @option{-Bdynamic} for this. 582 699 583 700 @kindex -o @var{output} … … 586 703 @item -o @var{output} 587 704 @itemx --output=@var{output} 588 Use @var{output} as the name for the program produced by @co de{ld}; if this705 Use @var{output} as the name for the program produced by @command{ld}; if this 589 706 option is not specified, the name @file{a.out} is used by default. The 590 707 script command @code{OUTPUT} can also specify the output file name. … … 593 710 @cindex generating optimized output 594 711 @item -O @var{level} 595 If @var{level} is a numeric values greater than zero @co de{ld} optimizes712 If @var{level} is a numeric values greater than zero @command{ld} optimizes 596 713 the output. This might take significantly longer and therefore probably 597 714 should only be enabled for the final binary. … … 607 724 in larger executables. 608 725 726 This option is currently only supported on ELF platforms. 727 609 728 @cindex partial link 610 729 @cindex relocatable output … … 614 733 @itemx --relocateable 615 734 Generate relocatable output---i.e., generate an output file that can in 616 turn serve as input to @co de{ld}. This is often called @dfn{partial735 turn serve as input to @command{ld}. This is often called @dfn{partial 617 736 linking}. As a side effect, in environments that support standard Unix 618 737 magic numbers, this option also sets the output file's magic number to 619 738 @code{OMAGIC}. 620 @c ; see @ code{-N}.739 @c ; see @option{-N}. 621 740 If this option is not specified, an absolute file is produced. When 622 741 linking C++ programs, this option @emph{will not} resolve references to 623 742 constructors; to do that, use @samp{-Ur}. 743 744 When an input file does not have the same format as the output file, 745 partial linking is only supported if that input file does not contain any 746 relocations. Different output formats can have further restrictions; for 747 example some @code{a.out}-based formats do not support partial linking 748 with input files in other formats at all. 624 749 625 750 This option does the same thing as @samp{-i}. … … 635 760 programs. You may use this option more than once. 636 761 637 For compatibility with other ELF linkers, if the @ code{-R} option is762 For compatibility with other ELF linkers, if the @option{-R} option is 638 763 followed by a directory name, rather than a file name, it is treated as 639 the @ code{-rpath} option.764 the @option{-rpath} option. 640 765 641 766 @kindex -s … … 658 783 @item -t 659 784 @itemx --trace 660 Print the names of the input files as @co de{ld} processes them.785 Print the names of the input files as @command{ld} processes them. 661 786 662 787 @kindex -T @var{script} … … 666 791 @itemx --script=@var{scriptfile} 667 792 Use @var{scriptfile} as the linker script. This script replaces 668 @co de{ld}'s default linker script (rather than adding to it), so793 @command{ld}'s default linker script (rather than adding to it), so 669 794 @var{commandfile} must specify everything necessary to describe the 670 output file. You must use this option if you want to use a command 671 which can only appear once in a linker script, such as the 672 @code{SECTIONS} or @code{MEMORY} command. @xref{Scripts}. If 673 @var{scriptfile} does not exist in the current directory, @code{ld} 674 looks for it in the directories specified by any preceding @samp{-L} 675 options. Multiple @samp{-T} options accumulate. 795 output file. @xref{Scripts}. If @var{scriptfile} does not exist in 796 the current directory, @code{ld} looks for it in the directories 797 specified by any preceding @samp{-L} options. Multiple @samp{-T} 798 options accumulate. 676 799 677 800 @kindex -u @var{symbol} … … 691 814 For anything other than C++ programs, this option is equivalent to 692 815 @samp{-r}: it generates relocatable output---i.e., an output file that can in 693 turn serve as input to @co de{ld}. When linking C++ programs, @samp{-Ur}816 turn serve as input to @command{ld}. When linking C++ programs, @samp{-Ur} 694 817 @emph{does} resolve references to constructors, unlike @samp{-r}. 695 818 It does not work to use @samp{-Ur} on files that were themselves linked … … 715 838 @itemx --version 716 839 @itemx -V 717 Display the version number for @co de{ld}. The @code{-V} option also840 Display the version number for @command{ld}. The @option{-V} option also 718 841 lists the supported emulations. 719 842 … … 755 878 The recognized keywords are @code{initfirst}, @code{interpose}, 756 879 @code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen}, 757 @code{nodump}, @code{now} and @code{origin}. The other keywords are 880 @code{nodump}, @code{now}, @code{origin}, @code{combreloc}, @code{nocombreloc} 881 and @code{nocopyreloc}. 882 The other keywords are 758 883 ignored for Solaris compatibility. @code{initfirst} marks the object 759 884 to be initialized first at runtime before any other objects. … … 769 894 @code{origin} marks the object may contain $ORIGIN. 770 895 @code{defs} disallows undefined symbols. 896 @code{muldefs} allows multiple definitions. 897 @code{combreloc} combines multiple reloc sections and sorts them 898 to make dynamic symbol lookup caching possible. 899 @code{nocombreloc} disables multiple reloc sections combining. 900 @code{nocopyreloc} disables production of copy relocs. 771 901 772 902 @kindex -( … … 789 919 it only when there are unavoidable circular references between two or 790 920 more archives. 921 922 @kindex --accept-unknown-input-arch 923 @kindex --no-accept-unknown-input-arch 924 @item --accept-unknown-input-arch 925 @itemx --no-accept-unknown-input-arch 926 Tells the linker to accept input files whose architecture cannot be 927 recognised. The assumption is that the user knows what they are doing 928 and deliberately wants to link in these unknown input files. This was 929 the default behaviour of the linker, before release 2.14. The default 930 behaviour from release 2.14 onwards is to reject such input files, and 931 so the @samp{--accept-unknown-input-arch} option has been added to 932 restore the old behaviour. 791 933 792 934 @kindex -assert @var{keyword} … … 805 947 for compatibility with various systems. You may use this option 806 948 multiple times on the command line: it affects library searching for 807 @ code{-l} options which follow it.949 @option{-l} options which follow it. 808 950 809 951 @kindex -Bgroup … … 812 954 section. This causes the runtime linker to handle lookups in this 813 955 object and its dependencies to be performed only inside the group. 814 @ code{--no-undefined} is implied. This option is only meaningful on ELF956 @option{--no-undefined} is implied. This option is only meaningful on ELF 815 957 platforms which support shared libraries. 816 958 … … 827 969 variants of this option are for compatibility with various systems. You 828 970 may use this option multiple times on the command line: it affects 829 library searching for @ code{-l} options which follow it.971 library searching for @option{-l} options which follow it. 830 972 831 973 @kindex -Bsymbolic … … 860 1002 symbol is defined, the first file listed is the location of the 861 1003 definition. The remaining files contain references to the symbol. 1004 1005 @cindex common allocation 1006 @kindex --no-define-common 1007 @item --no-define-common 1008 This option inhibits the assignment of addresses to common symbols. 1009 The script command @code{INHIBIT_COMMON_ALLOCATION} has the same effect. 1010 @xref{Miscellaneous Commands}. 1011 1012 The @samp{--no-define-common} option allows decoupling 1013 the decision to assign addresses to Common symbols from the choice 1014 of the output file type; otherwise a non-Relocatable output type 1015 forces assigning addresses to Common symbols. 1016 Using @samp{--no-define-common} allows Common symbols that are referenced 1017 from a shared library to be assigned addresses only in the main program. 1018 This eliminates the unused duplicate space in the shared library, 1019 and also prevents any possible confusion over resolving to the wrong 1020 duplicate when there are many dynamic modules with specialized search 1021 paths for runtime symbol resolution. 862 1022 863 1023 @cindex symbols, from command line … … 892 1052 893 1053 @cindex dynamic linker, from command line 1054 @kindex -I@var{file} 894 1055 @kindex --dynamic-linker @var{file} 895 1056 @item --dynamic-linker @var{file} … … 907 1068 runtime to relocate any data which was statically initialized to pointer 908 1069 values. See the code in testsuite/ld-empic for details. 1070 1071 1072 @kindex --fatal-warnings 1073 @item --fatal-warnings 1074 Treat all warnings as errors. 909 1075 910 1076 @kindex --force-exe-suffix … … 948 1114 @kindex --no-keep-memory 949 1115 @item --no-keep-memory 950 @co de{ld} normally optimizes for speed over memory usage by caching the951 symbol tables of input files in memory. This option tells @co de{ld} to1116 @command{ld} normally optimizes for speed over memory usage by caching the 1117 symbol tables of input files in memory. This option tells @command{ld} to 952 1118 instead optimize for memory usage, by rereading the symbol tables as 953 necessary. This may be required if @co de{ld} runs out of memory space1119 necessary. This may be required if @command{ld} runs out of memory space 954 1120 while linking a large executable. 955 1121 … … 959 1125 @itemx -z defs 960 1126 Normally when creating a non-symbolic shared library, undefined symbols 961 are allowed and left to be resolved by the runtime loader. These options 962 disallow such undefined symbols. 1127 are allowed and left to be resolved by the runtime loader. This option 1128 disallows such undefined symbols if they come from regular object 1129 files. The switch @samp{--no-allow-shlib-undefined} controls the 1130 behaviour for shared objects being linked into the shared library. 1131 1132 @kindex --allow-multiple-definition 1133 @kindex -z muldefs 1134 @item --allow-multiple-definition 1135 @itemx -z muldefs 1136 Normally when a symbol is defined multiple times, the linker will 1137 report a fatal error. These options allow multiple definitions and the 1138 first definition will be used. 963 1139 964 1140 @kindex --allow-shlib-undefined 1141 @kindex --no-allow-shlib-undefined 965 1142 @item --allow-shlib-undefined 966 Allow undefined symbols in shared objects even when --no-undefined is 967 set. The net result will be that undefined symbols in regular objects 968 will still trigger an error, but undefined symbols in shared objects 969 will be ignored. The implementation of no_undefined makes the 970 assumption that the runtime linker will choke on undefined symbols. 971 However there is at least one system (BeOS) where undefined symbols in 972 shared libraries is normal since the kernel patches them at load time to 973 select which function is most appropriate for the current architecture. 974 I.E. dynamically select an appropriate memset function. Apparently it 975 is also normal for HPPA shared libraries to have undefined symbols. 1143 @itemx --no-allow-shlib-undefined 1144 Allow (the default) or disallow undefined symbols in shared objects. 1145 The setting of this switch overrides @samp{--no-undefined} where 1146 shared objects are concerned. Thus if @samp{--no-undefined} is set 1147 but @samp{--no-allow-shlib-undefined} is not, the net result will be 1148 that undefined symbols in regular object files will trigger an error, 1149 but undefined symbols in shared objects will be ignored. 1150 1151 The reason that @samp{--allow-shlib-undefined} is the default is that 1152 the shared object being specified at link time may not be the same one 1153 that is available at load time, so the symbols might actually be 1154 resolvable at load time. Plus there are some systems, (eg BeOS) where 1155 undefined symbols in shared libraries is normal since the kernel 1156 patches them at load time to select which function is most appropriate 1157 for the current architecture. eg. to dynamically select an appropriate 1158 memset function. Apparently it is also normal for HPPA shared 1159 libraries to have undefined symbols. 1160 1161 @kindex --no-undefined-version 1162 @item --no-undefined-version 1163 Normally when a symbol has an undefined version, the linker will ignore 1164 it. This option disallows symbols with undefined version and a fatal error 1165 will be issued instead. 976 1166 977 1167 @kindex --no-warn-mismatch 978 1168 @item --no-warn-mismatch 979 Normally @co de{ld} will give an error if you try to link together input1169 Normally @command{ld} will give an error if you try to link together input 980 1170 files that are mismatched for some reason, perhaps because they have 981 1171 been compiled for different processors or for different endiannesses. 982 This option tells @co de{ld} that it should silently permit such possible1172 This option tells @command{ld} that it should silently permit such possible 983 1173 errors. This option should only be used with care, in cases when you 984 1174 have taken some special action that ensures that the linker errors are … … 987 1177 @kindex --no-whole-archive 988 1178 @item --no-whole-archive 989 Turn off the effect of the @ code{--whole-archive} option for subsequent1179 Turn off the effect of the @option{--whole-archive} option for subsequent 990 1180 archive files. 991 1181 … … 998 1188 when it issues any error whatsoever. 999 1189 1190 @kindex -nostdlib 1191 @item -nostdlib 1192 Only search library directories explicitly specified on the 1193 command line. Library directories specified in linker scripts 1194 (including linker scripts specified on the command line) are ignored. 1195 1000 1196 @ifclear SingleFormat 1001 1197 @kindex --oformat 1002 1198 @item --oformat @var{output-format} 1003 @co de{ld} may be configured to support more than one kind of object1004 file. If your @co de{ld} is configured this way, you can use the1199 @command{ld} may be configured to support more than one kind of object 1200 file. If your @command{ld} is configured this way, you can use the 1005 1201 @samp{--oformat} option to specify the binary format for the output 1006 object file. Even when @co de{ld} is configured to support alternative1007 object formats, you don't usually need to specify this, as @co de{ld}1202 object file. Even when @command{ld} is configured to support alternative 1203 object formats, you don't usually need to specify this, as @command{ld} 1008 1204 should be configured to produce as a default output format the most 1009 1205 usual format on each machine. @var{output-format} is a text string, the … … 1031 1227 @end ifset 1032 1228 @ifset H8300 1033 @xref{H8/300,,@co de{ld} and the H8/300}.1229 @xref{H8/300,,@command{ld} and the H8/300}. 1034 1230 @end ifset 1035 1231 @ifset I960 1036 @xref{i960,, @co de{ld} and the Intel 960 family}.1232 @xref{i960,, @command{ld} and the Intel 960 family}. 1037 1233 @end ifset 1038 1234 @ifset XTENSA 1235 @xref{Xtensa,, @command{ld} and Xtensa Processors}. 1236 @end ifset 1039 1237 1040 1238 On some platforms, the @samp{--relax} option performs global … … 1079 1277 @kindex -rpath 1080 1278 Add a directory to the runtime library search path. This is used when 1081 linking an ELF executable with shared objects. All @ code{-rpath}1279 linking an ELF executable with shared objects. All @option{-rpath} 1082 1280 arguments are concatenated and passed to the runtime linker, which uses 1083 them to locate shared objects at runtime. The @ code{-rpath} option is1281 them to locate shared objects at runtime. The @option{-rpath} option is 1084 1282 also used when locating shared objects which are needed by shared 1085 1283 objects explicitly included in the link; see the description of the 1086 @ code{-rpath-link} option. If @code{-rpath} is not used when linking an1284 @option{-rpath-link} option. If @option{-rpath} is not used when linking an 1087 1285 ELF executable, the contents of the environment variable 1088 1286 @code{LD_RUN_PATH} will be used if it is defined. 1089 1287 1090 The @ code{-rpath} option may also be used on SunOS. By default, on1288 The @option{-rpath} option may also be used on SunOS. By default, on 1091 1289 SunOS, the linker will form a runtime search patch out of all the 1092 @ code{-L} options it is given. If a @code{-rpath} option is used, the1093 runtime search path will be formed exclusively using the @ code{-rpath}1094 options, ignoring the @ code{-L} options. This can be useful when using1095 gcc, which adds many @ code{-L} options which may be on NFS mounted1290 @option{-L} options it is given. If a @option{-rpath} option is used, the 1291 runtime search path will be formed exclusively using the @option{-rpath} 1292 options, ignoring the @option{-L} options. This can be useful when using 1293 gcc, which adds many @option{-L} options which may be on NFS mounted 1096 1294 filesystems. 1097 1295 1098 For compatibility with other ELF linkers, if the @ code{-R} option is1296 For compatibility with other ELF linkers, if the @option{-R} option is 1099 1297 followed by a directory name, rather than a file name, it is treated as 1100 the @ code{-rpath} option.1298 the @option{-rpath} option. 1101 1299 @end ifset 1102 1300 … … 1112 1310 non-relocatable link, it will automatically try to locate the required 1113 1311 shared library and include it in the link, if it is not included 1114 explicitly. In such a case, the @ code{-rpath-link} option1312 explicitly. In such a case, the @option{-rpath-link} option 1115 1313 specifies the first set of directories to search. The 1116 @ code{-rpath-link} option may specify a sequence of directory names1314 @option{-rpath-link} option may specify a sequence of directory names 1117 1315 either by specifying a list of names separated by colons, or by 1118 1316 appearing multiple times. … … 1127 1325 @enumerate 1128 1326 @item 1129 Any directories specified by @ code{-rpath-link} options.1327 Any directories specified by @option{-rpath-link} options. 1130 1328 @item 1131 Any directories specified by @ code{-rpath} options. The difference1132 between @ code{-rpath} and @code{-rpath-link} is that directories1133 specified by @ code{-rpath} options are included in the executable and1134 used at runtime, whereas the @ code{-rpath-link} option is only effective1329 Any directories specified by @option{-rpath} options. The difference 1330 between @option{-rpath} and @option{-rpath-link} is that directories 1331 specified by @option{-rpath} options are included in the executable and 1332 used at runtime, whereas the @option{-rpath-link} option is only effective 1135 1333 at link time. It is for the native linker only. 1136 1334 @item 1137 On an ELF system, if the @ code{-rpath} and @code{rpath-link} options1335 On an ELF system, if the @option{-rpath} and @code{rpath-link} options 1138 1336 were not used, search the contents of the environment variable 1139 1337 @code{LD_RUN_PATH}. It is for the native linker only. 1140 1338 @item 1141 On SunOS, if the @ code{-rpath} option was not used, search any1142 directories specified using @ code{-L} options.1339 On SunOS, if the @option{-rpath} option was not used, search any 1340 directories specified using @option{-L} options. 1143 1341 @item 1144 1342 For a native linker, the contents of the environment variable … … 1167 1365 Create a shared library. This is currently only supported on ELF, XCOFF 1168 1366 and SunOS platforms. On SunOS, the linker will automatically create a 1169 shared library if the @ code{-e} option is not used and there are1367 shared library if the @option{-e} option is not used and there are 1170 1368 undefined symbols in the link. 1171 1369 1172 1370 @item --sort-common 1173 1371 @kindex --sort-common 1174 This option tells @co de{ld} to sort the common symbols by size when it1372 This option tells @command{ld} to sort the common symbols by size when it 1175 1373 places them in the appropriate output sections. First come all the one 1176 byte symbols, then all the two byte s, then all the four bytes, and then1374 byte symbols, then all the two byte, then all the four byte, and then 1177 1375 everything else. This is to prevent gaps between symbols due to 1178 1376 alignment constraints. … … 1180 1378 @kindex --split-by-file 1181 1379 @item --split-by-file [@var{size}] 1182 Similar to @ code{--split-by-reloc} but creates a new output section for1380 Similar to @option{--split-by-reloc} but creates a new output section for 1183 1381 each input file when @var{size} is reached. @var{size} defaults to a 1184 1382 size of 1 if not given. … … 1205 1403 @cindex traditional format 1206 1404 @item --traditional-format 1207 For some targets, the output of @co de{ld} is different in some ways from1208 the output of some existing linker. This switch requests @co de{ld} to1405 For some targets, the output of @command{ld} is different in some ways from 1406 the output of some existing linker. This switch requests @command{ld} to 1209 1407 use the traditional format instead. 1210 1408 1211 1409 @cindex dbx 1212 For example, on SunOS, @co de{ld} combines duplicate entries in the1410 For example, on SunOS, @command{ld} combines duplicate entries in the 1213 1411 symbol string table. This can reduce the size of an output file with 1214 1412 full debugging information by over 30 percent. Unfortunately, the SunOS 1215 1413 @code{dbx} program can not read the resulting program (@code{gdb} has no 1216 trouble). The @samp{--traditional-format} switch tells @co de{ld} to not1414 trouble). The @samp{--traditional-format} switch tells @command{ld} to not 1217 1415 combine duplicate entries. 1218 1416 … … 1236 1434 @itemx -Tdata @var{org} 1237 1435 @itemx -Ttext @var{org} 1238 Use @var{org} as the starting address for---respectively---the 1239 @code{bss}, @code{data}, or the @code{text} segment of the output file. 1240 @var{org} must be a single hexadecimal integer; 1241 for compatibility with other linkers, you may omit the leading 1242 @samp{0x} usually associated with hexadecimal values. 1436 Same as --section-start, with @code{.bss}, @code{.data} or 1437 @code{.text} as the @var{sectionname}. 1243 1438 1244 1439 @kindex --verbose … … 1246 1441 @item --dll-verbose 1247 1442 @itemx --verbose 1248 Display the version number for @co de{ld} and list the linker emulations1443 Display the version number for @command{ld} and list the linker emulations 1249 1444 supported. Display which input files can and cannot be opened. Display 1250 the linker script if using a default builtin script.1445 the linker script being used by the linker. 1251 1446 1252 1447 @kindex --version-script=@var{version-scriptfile} … … 1255 1450 Specify the name of a version script to the linker. This is typically 1256 1451 used when creating shared libraries to specify additional information 1257 about the version h eirarchy for the library being created. This option1452 about the version hierarchy for the library being created. This option 1258 1453 is only meaningful on ELF platforms which support shared libraries. 1259 1454 @xref{VERSION}. 1260 1455 1261 @kindex --warn-com on1456 @kindex --warn-common 1262 1457 @cindex warnings, on combining symbols 1263 1458 @cindex combining symbols, warnings on … … 1385 1580 @item --whole-archive 1386 1581 For each archive mentioned on the command line after the 1387 @ code{--whole-archive} option, include every object file in the archive1582 @option{--whole-archive} option, include every object file in the archive 1388 1583 in the link, rather than searching the archive for the required object 1389 1584 files. This is normally used to turn an archive file into a shared … … 1392 1587 1393 1588 Two notes when using this option from gcc: First, gcc doesn't know 1394 about this option, so you have to use @ code{-Wl,-whole-archive}.1395 Second, don't forget to use @ code{-Wl,-no-whole-archive} after your1589 about this option, so you have to use @option{-Wl,-whole-archive}. 1590 Second, don't forget to use @option{-Wl,-no-whole-archive} after your 1396 1591 list of archives, because gcc will add its own list of archives to 1397 1592 your link and you may not want this flag to affect those as well. … … 1420 1615 @end smallexample 1421 1616 1422 If you link other code with this file using @ code{--wrap malloc}, then1617 If you link other code with this file using @option{--wrap malloc}, then 1423 1618 all calls to @code{malloc} will call the function @code{__wrap_malloc} 1424 1619 instead. The call to @code{__real_malloc} in @code{__wrap_malloc} will … … 1426 1621 1427 1622 You may wish to provide a @code{__real_malloc} function as well, so that 1428 links without the @ code{--wrap} option will succeed. If you do this,1623 links without the @option{--wrap} option will succeed. If you do this, 1429 1624 you should not put the definition of @code{__real_malloc} in the same 1430 1625 file as @code{__wrap_malloc}; if you do, the assembler may resolve the … … 1437 1632 This linker can create the new dynamic tags in ELF. But the older ELF 1438 1633 systems may not understand them. If you specify 1439 @ code{--enable-new-dtags}, the dynamic tags will be created as needed.1440 If you specify @ code{--disable-new-dtags}, no new dynamic tags will be1634 @option{--enable-new-dtags}, the dynamic tags will be created as needed. 1635 If you specify @option{--disable-new-dtags}, no new dynamic tags will be 1441 1636 created. By default, the new dynamic tags are not created. Note that 1442 1637 those options are only available for ELF systems. … … 1444 1639 @end table 1445 1640 1446 @subsection Options specific to i386 PE targets 1447 1448 The i386 PE linker supports the @code{-shared} option, which causes 1641 @c man end 1642 1643 @subsection Options Specific to i386 PE Targets 1644 1645 @c man begin OPTIONS 1646 1647 The i386 PE linker supports the @option{-shared} option, which causes 1449 1648 the output to be a dynamically linked library (DLL) instead of a 1450 1649 normal executable. You should name the output @code{*.dll} when you … … 1460 1659 values by either a space or an equals sign. 1461 1660 1462 @table @ code1661 @table @gcctabopt 1463 1662 1464 1663 @kindex --add-stdcall-alias … … 1466 1665 If given, symbols with a stdcall suffix (@@@var{nn}) will be exported 1467 1666 as-is and also with the suffix stripped. 1667 [This option is specific to the i386 PE targeted port of the linker] 1468 1668 1469 1669 @kindex --base-file … … 1472 1672 addresses of all the relocations needed for generating DLLs with 1473 1673 @file{dlltool}. 1674 [This is an i386 PE specific option] 1474 1675 1475 1676 @kindex --dll 1476 1677 @item --dll 1477 1678 Create a DLL instead of a regular executable. You may also use 1478 @ code{-shared} or specify a @code{LIBRARY} in a given @code{.def}1679 @option{-shared} or specify a @code{LIBRARY} in a given @code{.def} 1479 1680 file. 1681 [This option is specific to the i386 PE targeted port of the linker] 1480 1682 1481 1683 @kindex --enable-stdcall-fixup … … 1484 1686 @itemx --disable-stdcall-fixup 1485 1687 If the link finds a symbol that it cannot resolve, it will attempt to 1486 do "fuzzy linking"by looking for another defined symbol that differs1688 do ``fuzzy linking'' by looking for another defined symbol that differs 1487 1689 only in the format of the symbol name (cdecl vs stdcall) and will 1488 1690 resolve that symbol by linking to the match. For example, the … … 1492 1694 warning, since it normally should have failed to link, but sometimes 1493 1695 import libraries generated from third-party dlls may need this feature 1494 to be usable. If you specify @ code{--enable-stdcall-fixup}, this1696 to be usable. If you specify @option{--enable-stdcall-fixup}, this 1495 1697 feature is fully enabled and warnings are not printed. If you specify 1496 @ code{--disable-stdcall-fixup}, this feature is disabled and such1698 @option{--disable-stdcall-fixup}, this feature is disabled and such 1497 1699 mismatches are considered to be errors. 1700 [This option is specific to the i386 PE targeted port of the linker] 1498 1701 1499 1702 @cindex DLLs, creating … … 1506 1709 attributes, the default is to not export anything else unless this 1507 1710 option is given. Note that the symbols @code{DllMain@@12}, 1508 @code{DllEntryPoint@@0}, and @code{impure_ptr} will not be automatically 1509 exported. 1711 @code{DllEntryPoint@@0}, @code{DllMainCRTStartup@@12}, and 1712 @code{impure_ptr} will not be automatically 1713 exported. Also, symbols imported from other DLLs will not be 1714 re-exported, nor will symbols specifying the DLL's internal layout 1715 such as those beginning with @code{_head_} or ending with 1716 @code{_iname}. In addition, no symbols from @code{libgcc}, 1717 @code{libstd++}, @code{libmingw32}, or @code{crtX.o} will be exported. 1718 Symbols whose names begin with @code{__rtti_} or @code{__builtin_} will 1719 not be exported, to help with C++ DLLs. Finally, there is an 1720 extensive list of cygwin-private symbols that are not exported 1721 (obviously, this applies on when building DLLs for cygwin targets). 1722 These cygwin-excludes are: @code{_cygwin_dll_entry@@12}, 1723 @code{_cygwin_crt0_common@@8}, @code{_cygwin_noncygwin_dll_entry@@12}, 1724 @code{_fmode}, @code{_impure_ptr}, @code{cygwin_attach_dll}, 1725 @code{cygwin_premain0}, @code{cygwin_premain1}, @code{cygwin_premain2}, 1726 @code{cygwin_premain3}, and @code{environ}. 1727 [This option is specific to the i386 PE targeted port of the linker] 1510 1728 1511 1729 @kindex --exclude-symbols … … 1513 1731 Specifies a list of symbols which should not be automatically 1514 1732 exported. The symbol names may be delimited by commas or colons. 1733 [This option is specific to the i386 PE targeted port of the linker] 1734 1735 @kindex --exclude-libs 1736 @item --exclude-libs @var{lib},@var{lib},... 1737 Specifies a list of archive libraries from which symbols should not be automatically 1738 exported. The library names may be delimited by commas or colons. Specifying 1739 @code{--exclude-libs ALL} excludes symbols in all archive libraries from 1740 automatic export. Symbols explicitly listed in a .def file are still exported, 1741 regardless of this option. 1742 [This option is specific to the i386 PE targeted port of the linker] 1515 1743 1516 1744 @kindex --file-alignment … … 1519 1747 file offsets which are multiples of this number. This defaults to 1520 1748 512. 1749 [This option is specific to the i386 PE targeted port of the linker] 1521 1750 1522 1751 @cindex heap size … … 1527 1756 used as heap for this program. The default is 1Mb reserved, 4K 1528 1757 committed. 1758 [This option is specific to the i386 PE targeted port of the linker] 1529 1759 1530 1760 @cindex image base … … 1537 1767 other dlls. The default is 0x400000 for executables, and 0x10000000 1538 1768 for dlls. 1769 [This option is specific to the i386 PE targeted port of the linker] 1539 1770 1540 1771 @kindex --kill-at … … 1542 1773 If given, the stdcall suffixes (@@@var{nn}) will be stripped from 1543 1774 symbols before they are exported. 1775 [This option is specific to the i386 PE targeted port of the linker] 1544 1776 1545 1777 @kindex --major-image-version 1546 1778 @item --major-image-version @var{value} 1547 Sets the major number of the "image version". Defaults to 1. 1779 Sets the major number of the ``image version''. Defaults to 1. 1780 [This option is specific to the i386 PE targeted port of the linker] 1548 1781 1549 1782 @kindex --major-os-version 1550 1783 @item --major-os-version @var{value} 1551 Sets the major number of the "os version". Defaults to 4. 1784 Sets the major number of the ``os version''. Defaults to 4. 1785 [This option is specific to the i386 PE targeted port of the linker] 1552 1786 1553 1787 @kindex --major-subsystem-version 1554 1788 @item --major-subsystem-version @var{value} 1555 Sets the major number of the "subsystem version". Defaults to 4. 1789 Sets the major number of the ``subsystem version''. Defaults to 4. 1790 [This option is specific to the i386 PE targeted port of the linker] 1556 1791 1557 1792 @kindex --minor-image-version 1558 1793 @item --minor-image-version @var{value} 1559 Sets the minor number of the "image version". Defaults to 0. 1794 Sets the minor number of the ``image version''. Defaults to 0. 1795 [This option is specific to the i386 PE targeted port of the linker] 1560 1796 1561 1797 @kindex --minor-os-version 1562 1798 @item --minor-os-version @var{value} 1563 Sets the minor number of the "os version". Defaults to 0. 1799 Sets the minor number of the ``os version''. Defaults to 0. 1800 [This option is specific to the i386 PE targeted port of the linker] 1564 1801 1565 1802 @kindex --minor-subsystem-version 1566 1803 @item --minor-subsystem-version @var{value} 1567 Sets the minor number of the "subsystem version". Defaults to 0. 1804 Sets the minor number of the ``subsystem version''. Defaults to 0. 1805 [This option is specific to the i386 PE targeted port of the linker] 1568 1806 1569 1807 @cindex DEF files, creating … … 1576 1814 library with @code{dlltool} or may be used as a reference to 1577 1815 automatically or implicitly exported symbols. 1816 [This option is specific to the i386 PE targeted port of the linker] 1817 1818 @cindex DLLs, creating 1819 @kindex --out-implib 1820 @item --out-implib @var{file} 1821 The linker will create the file @var{file} which will contain an 1822 import lib corresponding to the DLL the linker is generating. This 1823 import lib (which should be called @code{*.dll.a} or @code{*.a} 1824 may be used to link clients against the generated DLL; this behavior 1825 makes it possible to skip a separate @code{dlltool} import library 1826 creation step. 1827 [This option is specific to the i386 PE targeted port of the linker] 1828 1829 @kindex --enable-auto-image-base 1830 @item --enable-auto-image-base 1831 Automatically choose the image base for DLLs, unless one is specified 1832 using the @code{--image-base} argument. By using a hash generated 1833 from the dllname to create unique image bases for each DLL, in-memory 1834 collisions and relocations which can delay program execution are 1835 avoided. 1836 [This option is specific to the i386 PE targeted port of the linker] 1837 1838 @kindex --disable-auto-image-base 1839 @item --disable-auto-image-base 1840 Do not automatically generate a unique image base. If there is no 1841 user-specified image base (@code{--image-base}) then use the platform 1842 default. 1843 [This option is specific to the i386 PE targeted port of the linker] 1844 1845 @cindex DLLs, linking to 1846 @kindex --dll-search-prefix 1847 @item --dll-search-prefix @var{string} 1848 When linking dynamically to a dll without an import library, 1849 search for @code{<string><basename>.dll} in preference to 1850 @code{lib<basename>.dll}. This behavior allows easy distinction 1851 between DLLs built for the various "subplatforms": native, cygwin, 1852 uwin, pw, etc. For instance, cygwin DLLs typically use 1853 @code{--dll-search-prefix=cyg}. 1854 [This option is specific to the i386 PE targeted port of the linker] 1855 1856 @kindex --enable-auto-import 1857 @item --enable-auto-import 1858 Do sophisticated linking of @code{_symbol} to @code{__imp__symbol} for 1859 DATA imports from DLLs, and create the necessary thunking symbols when 1860 building the import libraries with those DATA exports. This generally 1861 will 'just work' -- but sometimes you may see this message: 1862 1863 "variable '<var>' can't be auto-imported. Please read the 1864 documentation for ld's @code{--enable-auto-import} for details." 1865 1866 This message occurs when some (sub)expression accesses an address 1867 ultimately given by the sum of two constants (Win32 import tables only 1868 allow one). Instances where this may occur include accesses to member 1869 fields of struct variables imported from a DLL, as well as using a 1870 constant index into an array variable imported from a DLL. Any 1871 multiword variable (arrays, structs, long long, etc) may trigger 1872 this error condition. However, regardless of the exact data type 1873 of the offending exported variable, ld will always detect it, issue 1874 the warning, and exit. 1875 1876 There are several ways to address this difficulty, regardless of the 1877 data type of the exported variable: 1878 1879 One way is to use --enable-runtime-pseudo-reloc switch. This leaves the task 1880 of adjusting references in your client code for runtime environment, so 1881 this method works only when runtime environtment supports this feature. 1882 1883 A second solution is to force one of the 'constants' to be a variable -- 1884 that is, unknown and un-optimizable at compile time. For arrays, 1885 there are two possibilities: a) make the indexee (the array's address) 1886 a variable, or b) make the 'constant' index a variable. Thus: 1887 1888 @example 1889 extern type extern_array[]; 1890 extern_array[1] --> 1891 @{ volatile type *t=extern_array; t[1] @} 1892 @end example 1893 1894 or 1895 1896 @example 1897 extern type extern_array[]; 1898 extern_array[1] --> 1899 @{ volatile int t=1; extern_array[t] @} 1900 @end example 1901 1902 For structs (and most other multiword data types) the only option 1903 is to make the struct itself (or the long long, or the ...) variable: 1904 1905 @example 1906 extern struct s extern_struct; 1907 extern_struct.field --> 1908 @{ volatile struct s *t=&extern_struct; t->field @} 1909 @end example 1910 1911 or 1912 1913 @example 1914 extern long long extern_ll; 1915 extern_ll --> 1916 @{ volatile long long * local_ll=&extern_ll; *local_ll @} 1917 @end example 1918 1919 A third method of dealing with this difficulty is to abandon 1920 'auto-import' for the offending symbol and mark it with 1921 @code{__declspec(dllimport)}. However, in practice that 1922 requires using compile-time #defines to indicate whether you are 1923 building a DLL, building client code that will link to the DLL, or 1924 merely building/linking to a static library. In making the choice 1925 between the various methods of resolving the 'direct address with 1926 constant offset' problem, you should consider typical real-world usage: 1927 1928 Original: 1929 @example 1930 --foo.h 1931 extern int arr[]; 1932 --foo.c 1933 #include "foo.h" 1934 void main(int argc, char **argv)@{ 1935 printf("%d\n",arr[1]); 1936 @} 1937 @end example 1938 1939 Solution 1: 1940 @example 1941 --foo.h 1942 extern int arr[]; 1943 --foo.c 1944 #include "foo.h" 1945 void main(int argc, char **argv)@{ 1946 /* This workaround is for win32 and cygwin; do not "optimize" */ 1947 volatile int *parr = arr; 1948 printf("%d\n",parr[1]); 1949 @} 1950 @end example 1951 1952 Solution 2: 1953 @example 1954 --foo.h 1955 /* Note: auto-export is assumed (no __declspec(dllexport)) */ 1956 #if (defined(_WIN32) || defined(__CYGWIN__)) && \ 1957 !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC)) 1958 #define FOO_IMPORT __declspec(dllimport) 1959 #else 1960 #define FOO_IMPORT 1961 #endif 1962 extern FOO_IMPORT int arr[]; 1963 --foo.c 1964 #include "foo.h" 1965 void main(int argc, char **argv)@{ 1966 printf("%d\n",arr[1]); 1967 @} 1968 @end example 1969 1970 A fourth way to avoid this problem is to re-code your 1971 library to use a functional interface rather than a data interface 1972 for the offending variables (e.g. set_foo() and get_foo() accessor 1973 functions). 1974 [This option is specific to the i386 PE targeted port of the linker] 1975 1976 @kindex --disable-auto-import 1977 @item --disable-auto-import 1978 Do not attempt to do sophisticalted linking of @code{_symbol} to 1979 @code{__imp__symbol} for DATA imports from DLLs. 1980 [This option is specific to the i386 PE targeted port of the linker] 1981 1982 @kindex --enable-runtime-pseudo-reloc 1983 @item --enable-runtime-pseudo-reloc 1984 If your code contains expressions described in --enable-auto-import section, 1985 that is, DATA imports from DLL with non-zero offset, this switch will create 1986 a vector of 'runtime pseudo relocations' which can be used by runtime 1987 environment to adjust references to such data in your client code. 1988 [This option is specific to the i386 PE targeted port of the linker] 1989 1990 @kindex --disable-runtime-pseudo-reloc 1991 @item --disable-runtime-pseudo-reloc 1992 Do not create pseudo relocations for non-zero offset DATA imports from 1993 DLLs. This is the default. 1994 [This option is specific to the i386 PE targeted port of the linker] 1995 1996 @kindex --enable-extra-pe-debug 1997 @item --enable-extra-pe-debug 1998 Show additional debug info related to auto-import symbol thunking. 1999 [This option is specific to the i386 PE targeted port of the linker] 1578 2000 1579 2001 @kindex --section-alignment … … 1581 2003 Sets the section alignment. Sections in memory will always begin at 1582 2004 addresses which are a multiple of this number. Defaults to 0x1000. 2005 [This option is specific to the i386 PE targeted port of the linker] 1583 2006 1584 2007 @cindex stack size … … 1587 2010 @itemx --stack @var{reserve},@var{commit} 1588 2011 Specify the amount of memory to reserve (and optionally commit) to be 1589 used as stack for this program. The default is 32Mb reserved, 4K2012 used as stack for this program. The default is 2Mb reserved, 4K 1590 2013 committed. 2014 [This option is specific to the i386 PE targeted port of the linker] 1591 2015 1592 2016 @kindex --subsystem … … 1598 2022 @code{console}, and @code{posix}. You may optionally set the 1599 2023 subsystem version also. 2024 [This option is specific to the i386 PE targeted port of the linker] 1600 2025 1601 2026 @end table 2027 2028 @c man end 1602 2029 1603 2030 @ifset UsesEnvVars … … 1605 2032 @section Environment Variables 1606 2033 1607 You can change the behavior of @code{ld} with the environment variables 1608 @code{GNUTARGET}, @code{LDEMULATION}, and @code{COLLECT_NO_DEMANGLE}. 1609 2034 @c man begin ENVIRONMENT 2035 2036 You can change the behavior of @command{ld} with the environment variables 2037 @ifclear SingleFormat 2038 @code{GNUTARGET}, 2039 @end ifclear 2040 @code{LDEMULATION} and @code{COLLECT_NO_DEMANGLE}. 2041 2042 @ifclear SingleFormat 1610 2043 @kindex GNUTARGET 1611 2044 @cindex default input format … … 1613 2046 use @samp{-b} (or its synonym @samp{--format}). Its value should be one 1614 2047 of the BFD names for an input format (@pxref{BFD}). If there is no 1615 @code{GNUTARGET} in the environment, @co de{ld} uses the natural format2048 @code{GNUTARGET} in the environment, @command{ld} uses the natural format 1616 2049 of the target. If @code{GNUTARGET} is set to @code{default} then BFD 1617 2050 attempts to discover the input format by examining binary input files; … … 1621 2054 BFD on each system places the conventional format for that system first 1622 2055 in the search-list, so ambiguities are resolved in favor of convention. 2056 @end ifclear 1623 2057 1624 2058 @kindex LDEMULATION … … 1632 2066 variable is not defined, the default emulation depends upon how the 1633 2067 linker was configured. 1634 @end ifset1635 2068 1636 2069 @kindex COLLECT_NO_DEMANGLE … … 1642 2075 may be overridden by the @samp{--demangle} and @samp{--no-demangle} 1643 2076 options. 2077 2078 @c man end 2079 @end ifset 1644 2080 1645 2081 @node Scripts … … 1845 2281 1846 2282 @node Entry Point 1847 @subsection Setting the entry point2283 @subsection Setting the Entry Point 1848 2284 @kindex ENTRY(@var{symbol}) 1849 2285 @cindex start of execution … … 1874 2310 1875 2311 @node File Commands 1876 @subsection Commands dealing with files2312 @subsection Commands Dealing with Files 1877 2313 @cindex linker script file commands 1878 2314 Several linker script commands deal with files. … … 1884 2320 Include the linker script @var{filename} at this point. The file will 1885 2321 be searched for in the current directory, and in any directory specified 1886 with the @ code{-L} option. You can nest calls to @code{INCLUDE} up to2322 with the @option{-L} option. You can nest calls to @code{INCLUDE} up to 1887 2323 10 levels deep. 1888 2324 … … 1903 2339 script, and then invoke the linker with nothing but a @samp{-T} option. 1904 2340 1905 The linker will first try to open the file in the current directory. If 1906 it is not found, the linker will search through the archive library 1907 search path. See the description of @samp{-L} in @ref{Options,,Command 1908 Line Options}. 1909 1910 If you use @samp{INPUT (-l@var{file})}, @code{ld} will transform the 2341 In case a @dfn{sysroot prefix} is configured, and the filename starts 2342 with the @samp{/} character, and the script being processed was 2343 located inside the @dfn{sysroot prefix}, the filename will be looked 2344 for in the @dfn{sysroot prefix}. Otherwise, the linker will try to 2345 open the file in the current directory. If it is not found, the 2346 linker will search through the archive library search path. See the 2347 description of @samp{-L} in @ref{Options,,Command Line Options}. 2348 2349 If you use @samp{INPUT (-l@var{file})}, @command{ld} will transform the 1911 2350 name to @code{lib@var{file}.a}, as with the command line argument 1912 2351 @samp{-l}. … … 1943 2382 @cindex search path in linker script 1944 2383 The @code{SEARCH_DIR} command adds @var{path} to the list of paths where 1945 @co de{ld} looks for archive libraries. Using2384 @command{ld} looks for archive libraries. Using 1946 2385 @code{SEARCH_DIR(@var{path})} is exactly like using @samp{-L @var{path}} 1947 2386 on the command line (@pxref{Options,,Command Line Options}). If both … … 1961 2400 @ifclear SingleFormat 1962 2401 @node Format Commands 1963 @subsection Commands dealing with object file formats2402 @subsection Commands Dealing with Object File Formats 1964 2403 A couple of linker script commands deal with object file formats. 1965 2404 … … 1971 2410 The @code{OUTPUT_FORMAT} command names the BFD format to use for the 1972 2411 output file (@pxref{BFD}). Using @code{OUTPUT_FORMAT(@var{bfdname})} is 1973 exactly like using @samp{- oformat @var{bfdname}} on the command line2412 exactly like using @samp{--oformat @var{bfdname}} on the command line 1974 2413 (@pxref{Options,,Command Line Options}). If both are used, the command 1975 2414 line option takes precedence. … … 2008 2447 2009 2448 @node Miscellaneous Commands 2010 @subsection Other linker script commands2449 @subsection Other Linker Script Commands 2011 2450 There are a few other linker scripts commands. 2012 2451 … … 2031 2470 @cindex common allocation in linker script 2032 2471 This command has the same effect as the @samp{-d} command-line option: 2033 to make @co de{ld} assign space to common symbols even if a relocatable2472 to make @command{ld} assign space to common symbols even if a relocatable 2034 2473 output file is specified (@samp{-r}). 2474 2475 @item INHIBIT_COMMON_ALLOCATION 2476 @kindex INHIBIT_COMMON_ALLOCATION 2477 @cindex common allocation in linker script 2478 This command has the same effect as the @samp{--no-define-common} 2479 command-line option: to make @code{ld} omit the assignment of addresses 2480 to common symbols even for a non-relocatable output file. 2035 2481 2036 2482 @item NOCROSSREFS(@var{section} @var{section} @dots{}) 2037 2483 @kindex NOCROSSREFS(@var{sections}) 2038 2484 @cindex cross references 2039 This command may be used to tell @co de{ld} to issue an error about any2485 This command may be used to tell @command{ld} to issue an error about any 2040 2486 references among certain output sections. 2041 2487 … … 2047 2493 2048 2494 The @code{NOCROSSREFS} command takes a list of output section names. If 2049 @co de{ld} detects any cross references between the sections, it reports2495 @command{ld} detects any cross references between the sections, it reports 2050 2496 an error and returns a non-zero exit status. Note that the 2051 2497 @code{NOCROSSREFS} command uses output section names, not input section … … 2124 2570 _etext = .; 2125 2571 @} 2126 _bdata = (. + 3) & ~ 4;2572 _bdata = (. + 3) & ~ 3; 2127 2573 .data : @{ *(.data) @} 2128 2574 @} … … 2168 2614 2169 2615 @node SECTIONS 2170 @section SECTIONS command2616 @section SECTIONS Command 2171 2617 @kindex SECTIONS 2172 2618 The @code{SECTIONS} command tells the linker how to map input sections … … 2225 2671 2226 2672 @node Output Section Description 2227 @subsection Output section description2673 @subsection Output Section Description 2228 2674 The full description of an output section looks like this: 2229 2675 @smallexample … … 2258 2704 2259 2705 @node Output Section Name 2260 @subsection Output section name2706 @subsection Output Section Name 2261 2707 @cindex name, section 2262 2708 @cindex section name … … 2276 2722 2277 2723 @node Output Section Address 2278 @subsection Output section address2724 @subsection Output Section Description 2279 2725 @cindex address, section 2280 2726 @cindex section address … … 2323 2769 2324 2770 @node Input Section 2325 @subsection Input section description2771 @subsection Input Section Description 2326 2772 @cindex input sections 2327 2773 @cindex mapping input sections to output sections … … 2342 2788 2343 2789 @node Input Section Basics 2344 @subsubsection Input section basics2790 @subsubsection Input Section Basics 2345 2791 @cindex input section basics 2346 2792 An input section description consists of a file name optionally followed … … 2375 2821 The difference between these is the order in which the @samp{.text} and 2376 2822 @samp{.rdata} input sections will appear in the output section. In the 2377 first example, they will be intermingled. In the second example, all 2823 first example, they will be intermingled, appearing in the same order as 2824 they are found in the linker input. In the second example, all 2378 2825 @samp{.text} input sections will appear first, followed by all 2379 2826 @samp{.rdata} input sections. … … 2402 2849 2403 2850 @node Input Section Wildcards 2404 @subsubsection Input section wildcard patterns2851 @subsubsection Input Section Wildcard Patterns 2405 2852 @cindex input section wildcards 2406 2853 @cindex wildcard file name patterns … … 2479 2926 2480 2927 @node Input Section Common 2481 @subsubsection Input section for common symbols2928 @subsubsection Input Section for Common Symbols 2482 2929 @cindex common symbol placement 2483 2930 @cindex uninitialized data placement … … 2515 2962 2516 2963 @node Input Section Keep 2517 @subsubsection Input section and garbage collection2964 @subsubsection Input Section and Garbage Collection 2518 2965 @cindex KEEP 2519 2966 @cindex garbage collection … … 2525 2972 2526 2973 @node Input Section Example 2527 @subsubsection Input section example2974 @subsubsection Input Section Example 2528 2975 The following example is a complete linker script. It tells the linker 2529 2976 to read all of the sections from file @file{all.o} and place them at the … … 2544 2991 foo.o (.input1) 2545 2992 @} 2993 @end group 2994 @group 2546 2995 outputb : 2547 2996 @{ … … 2549 2998 foo1.o (.input1) 2550 2999 @} 3000 @end group 3001 @group 2551 3002 outputc : 2552 3003 @{ … … 2559 3010 2560 3011 @node Output Section Data 2561 @subsection Output section data3012 @subsection Output Section Data 2562 3013 @cindex data 2563 3014 @cindex section data … … 2599 3050 endianness of the first input object file. 2600 3051 2601 Note -these commands only work inside a section description and not3052 Note---these commands only work inside a section description and not 2602 3053 between them, so the following will produce an error from the linker: 2603 3054 @smallexample … … 2616 3067 otherwise unspecified regions of memory within the section (for example, 2617 3068 gaps left due to the required alignment of input sections) are filled 2618 with the two least significant bytesof the expression, repeated as3069 with the value of the expression, repeated as 2619 3070 necessary. A @code{FILL} statement covers memory locations after the 2620 3071 point at which it occurs in the section definition; by including more … … 2623 3074 2624 3075 This example shows how to fill unspecified regions of memory with the 2625 value @samp{0x90 90}:2626 @smallexample 2627 FILL(0x9090 )3076 value @samp{0x90}: 3077 @smallexample 3078 FILL(0x90909090) 2628 3079 @end smallexample 2629 3080 2630 3081 The @code{FILL} command is similar to the @samp{=@var{fillexp}} output 2631 section attribute (@pxref{Output Section Fill}), but it only affects the3082 section attribute, but it only affects the 2632 3083 part of the section following the @code{FILL} command, rather than the 2633 3084 entire section. If both are used, the @code{FILL} command takes 2634 precedence. 3085 precedence. @xref{Output Section Fill}, for details on the fill 3086 expression. 2635 3087 2636 3088 @node Output Section Keywords 2637 @subsection Output section keywords3089 @subsection Output Section Keywords 2638 3090 There are a couple of keywords which can appear as output section 2639 3091 commands. … … 2714 3166 2715 3167 @node Output Section Discarding 2716 @subsection Output section discarding3168 @subsection Output Section Discarding 2717 3169 @cindex discarding sections 2718 3170 @cindex sections, discarding … … 2738 3190 2739 3191 @node Output Section Attributes 2740 @subsection Output section attributes3192 @subsection Output Section Attributes 2741 3193 @cindex output section attributes 2742 3194 We showed above that the full description of an output section looked … … 2765 3217 2766 3218 @node Output Section Type 2767 @subsubsection Output section type3219 @subsubsection Output Section Type 2768 3220 Each output section may have a type. The type is a keyword in 2769 3221 parentheses. The following types are defined: … … 2802 3254 2803 3255 @node Output Section LMA 2804 @subsubsection Output section LMA3256 @subsubsection Output Section LMA 2805 3257 @kindex AT>@var{lma_region} 2806 3258 @kindex AT(@var{lma}) … … 2867 3319 2868 3320 @node Output Section Region 2869 @subsubsection Output section region3321 @subsubsection Output Section Region 2870 3322 @kindex >@var{region} 2871 3323 @cindex section, assigning to memory region … … 2883 3335 2884 3336 @node Output Section Phdr 2885 @subsubsection Output section phdr3337 @subsubsection Output Section Phdr 2886 3338 @kindex :@var{phdr} 2887 3339 @cindex section, assigning to program header … … 2903 3355 2904 3356 @node Output Section Fill 2905 @subsubsection Output section fill3357 @subsubsection Output Section Fill 2906 3358 @kindex =@var{fillexp} 2907 3359 @cindex section fill pattern … … 2911 3363 (@pxref{Expressions}). Any otherwise unspecified regions of memory 2912 3364 within the output section (for example, gaps left due to the required 2913 alignment of input sections) will be filled with the two least 2914 significant bytes of the value, repeated as necessary. 3365 alignment of input sections) will be filled with the value, repeated as 3366 necessary. If the fill expression is a simple hex number, ie. a string 3367 of hex digit starting with @samp{0x} and without a trailing @samp{k} or @samp{M}, then 3368 an arbitrarily long sequence of hex digits can be used to specify the 3369 fill pattern; Leading zeros become part of the pattern too. For all 3370 other cases, including extra parentheses or a unary @code{+}, the fill 3371 pattern is the four least significant bytes of the value of the 3372 expression. In all cases, the number is big-endian. 2915 3373 2916 3374 You can also change the fill value with a @code{FILL} command in the 2917 output section commands; see @ref{Output Section Data}.3375 output section commands; (@pxref{Output Section Data}). 2918 3376 2919 3377 Here is a simple example: 2920 3378 @smallexample 2921 3379 @group 2922 SECTIONS @{ .text : @{ *(.text) @} =0x9090 @}3380 SECTIONS @{ .text : @{ *(.text) @} =0x90909090 @} 2923 3381 @end group 2924 3382 @end smallexample 2925 3383 2926 3384 @node Overlay Description 2927 @subsection Overlay description3385 @subsection Overlay Description 2928 3386 @kindex OVERLAY 2929 3387 @cindex overlays … … 3039 3497 3040 3498 @node MEMORY 3041 @section MEMORY command3499 @section MEMORY Command 3042 3500 @kindex MEMORY 3043 3501 @cindex memory regions … … 3358 3816 The script binds the symbol @samp{foo1} to @samp{VERS_1.1}. It reduces 3359 3817 a number of symbols to local scope so that they are not visible outside 3360 of the shared library. 3818 of the shared library; this is done using wildcard patterns, so that any 3819 symbol whose name begins with @samp{old}, @samp{original}, or @samp{new} 3820 is matched. The wildcard patterns available are the same as those used 3821 in the shell when matching filenames (also known as ``globbing''). 3361 3822 3362 3823 Next, the version script defines node @samp{VERS_1.2}. This node … … 3371 3832 specifically bound to a version node, it will effectively bind it to an 3372 3833 unspecified base version of the library. You can bind all otherwise 3373 unspecified symbols to a given version node by using @samp{global: * }3834 unspecified symbols to a given version node by using @samp{global: *;} 3374 3835 somewhere in the version script. 3375 3836 … … 3378 3839 could just as well have appeared in between @samp{1.1} and @samp{1.2}. 3379 3840 However, this would be a confusing way to write a version script. 3841 3842 Node name can be omited, provided it is the only version node 3843 in the version script. Such version script doesn't assign any versions to 3844 symbols, only selects which symbols will be globally visible out and which 3845 won't. 3846 3847 @smallexample 3848 @{ global: foo; bar; local: *; @}; 3849 @end smallexample 3380 3850 3381 3851 When you link an application against a shared library that has versioned … … 3412 3882 be an alias for @samp{foo} bound to the version node @samp{VERS_1.1}. 3413 3883 The @samp{local:} directive can be used to prevent the symbol 3414 @samp{original_foo} from being exported. 3884 @samp{original_foo} from being exported. A @samp{.symver} directive 3885 takes precedence over a version script. 3415 3886 3416 3887 The second GNU extension is to allow multiple versions of the same … … 3444 3915 If you wish to bind a reference to a specific version of the symbol 3445 3916 within the shared library, you can use the aliases of convenience 3446 (i.e. @samp{old_foo}), or you can use the @samp{.symver} directive to3917 (i.e., @samp{old_foo}), or you can use the @samp{.symver} directive to 3447 3918 specifically bind to an external version of the function in question. 3919 3920 You can also specify the language in the version script: 3921 3922 @smallexample 3923 VERSION extern "lang" @{ version-script-commands @} 3924 @end smallexample 3925 3926 The supported @samp{lang}s are @samp{C}, @samp{C++}, and @samp{Java}. 3927 The linker will iterate over the list of symbols at the link time and 3928 demangle them according to @samp{lang} before matching them to the 3929 patterns specified in @samp{version-script-commands}. 3448 3930 3449 3931 @node Expressions … … 3489 3971 constant by 3490 3972 @c TEXI2ROFF-KILL 3491 @if info3973 @ifnottex 3492 3974 @c END TEXI2ROFF-KILL 3493 3975 @code{1024} or @code{1024*1024} 3494 3976 @c TEXI2ROFF-KILL 3495 @end if info3977 @end ifnottex 3496 3978 @tex 3497 3979 ${\rm 1024}$ or ${\rm 1024}^2$ … … 3500 3982 respectively. For example, the following all refer to the same quantity: 3501 3983 @smallexample 3502 3503 3504 3984 _fourk_1 = 4K; 3985 _fourk_2 = 4096; 3986 _fourk_3 = 0x1000; 3505 3987 @end smallexample 3506 3988 … … 3517 3999 keyword by surrounding the symbol name in double quotes: 3518 4000 @smallexample 3519 3520 4001 "SECTION" = 9; 4002 "with a space" = "also with a space" + 10; 3521 4003 @end smallexample 3522 4004 … … 3552 4034 . += 1000; 3553 4035 file3(.text) 3554 @} = 0x1234 ;4036 @} = 0x12345678; 3555 4037 @} 3556 4038 @end smallexample … … 3560 4042 followed by a 1000 byte gap. Then the @samp{.text} section from 3561 4043 @file{file2} appears, also with a 1000 byte gap following before the 3562 @samp{.text} section from @file{file3}. The notation @samp{= 0x1234 }4044 @samp{.text} section from @file{file3}. The notation @samp{= 0x12345678} 3563 4045 specifies what data to write in the gaps (@pxref{Output Section Fill}). 3564 4046 … … 3566 4048 Note: @code{.} actually refers to the byte offset from the start of the 3567 4049 current containing object. Normally this is the @code{SECTIONS} 3568 statement, who esstart address is 0, hence @code{.} can be used as an4050 statement, whose start address is 0, hence @code{.} can be used as an 3569 4051 absolute address. If @code{.} is used inside a section description 3570 4052 however, it refers to the byte offset from the start of that section, … … 3605 4087 the standard bindings and precedence levels: 3606 4088 @c TEXI2ROFF-KILL 3607 @if info4089 @ifnottex 3608 4090 @c END TEXI2ROFF-KILL 3609 4091 @smallexample … … 3627 4109 (2) @xref{Assignments}. 3628 4110 @c TEXI2ROFF-KILL 3629 @end if info4111 @end ifnottex 3630 4112 @tex 3631 4113 \vskip \baselineskip … … 3790 4272 @cindex align location counter 3791 4273 Return the location counter (@code{.}) aligned to the next @var{exp} 3792 boundary. @var{exp} must be an expression whose value is a power of 3793 two. This is equivalent to 3794 @smallexample 3795 (. + @var{exp} - 1) & ~(@var{exp} - 1) 3796 @end smallexample 3797 4274 boundary. 3798 4275 @code{ALIGN} doesn't change the value of the location counter---it just 3799 4276 does arithmetic on it. Here is an example which aligns the output … … 3824 4301 scripts. It is most often seen when setting the address of an output 3825 4302 section. 4303 4304 @item DATA_SEGMENT_ALIGN(@var{maxpagesize}, @var{commonpagesize}) 4305 @kindex DATA_SEGMENT_ALIGN(@var{maxpagesize}, @var{commonpagesize}) 4306 This is equivalent to either 4307 @smallexample 4308 (ALIGN(@var{maxpagesize}) + (. & (@var{maxpagesize} - 1))) 4309 @end smallexample 4310 or 4311 @smallexample 4312 (ALIGN(@var{maxpagesize}) + (. & (@var{maxpagesize} - @var{commonpagesize}))) 4313 @end smallexample 4314 @noindent 4315 depending on whether the latter uses fewer @var{commonpagesize} sized pages 4316 for the data segment (area between the result of this expression and 4317 @code{DATA_SEGMENT_END}) than the former or not. 4318 If the latter form is used, it means @var{commonpagesize} bytes of runtime 4319 memory will be saved at the expense of up to @var{commonpagesize} wasted 4320 bytes in the on-disk file. 4321 4322 This expression can only be used directly in @code{SECTIONS} commands, not in 4323 any output section descriptions and only once in the linker script. 4324 @var{commonpagesize} should be less or equal to @var{maxpagesize} and should 4325 be the system page size the object wants to be optimized for (while still 4326 working on system page sizes up to @var{maxpagesize}). 4327 4328 @noindent 4329 Example: 4330 @smallexample 4331 . = DATA_SEGMENT_ALIGN(0x10000, 0x2000); 4332 @end smallexample 4333 4334 @item DATA_SEGMENT_END(@var{exp}) 4335 @kindex DATA_SEGMENT_END(@var{exp}) 4336 This defines the end of data segment for @code{DATA_SEGMENT_ALIGN} 4337 evaluation purposes. 4338 4339 @smallexample 4340 . = DATA_SEGMENT_END(.); 4341 @end smallexample 3826 4342 3827 4343 @item DEFINED(@var{symbol}) … … 3938 4454 3939 4455 @cindex machine dependencies 3940 @co de{ld} has additional features on some platforms; the following3941 sections describe them. Machines where @co de{ld} has no additional4456 @command{ld} has additional features on some platforms; the following 4457 sections describe them. Machines where @command{ld} has no additional 3942 4458 functionality are not listed. 3943 4459 3944 4460 @menu 3945 * H8/300:: @code{ld} and the H8/300 3946 * i960:: @code{ld} and the Intel 960 family 3947 * ARM:: @code{ld} and the ARM family 3948 * HPPA ELF32:: @code{ld} and HPPA 32-bit ELF 4461 @ifset H8300 4462 * H8/300:: @command{ld} and the H8/300 4463 @end ifset 4464 @ifset I960 4465 * i960:: @command{ld} and the Intel 960 family 4466 @end ifset 4467 @ifset ARM 4468 * ARM:: @command{ld} and the ARM family 4469 @end ifset 4470 @ifset HPPA 4471 * HPPA ELF32:: @command{ld} and HPPA 32-bit ELF 4472 @end ifset 4473 @ifset MMIX 4474 * MMIX:: @command{ld} and MMIX 4475 @end ifset 4476 @ifset MSP430 4477 * MSP430:: @command{ld} and MSP430 4478 @end ifset 3949 4479 @ifset TICOFF 3950 * TI COFF:: @code{ld} and TI COFF 4480 * TI COFF:: @command{ld} and TI COFF 4481 @end ifset 4482 @ifset WIN32 4483 * WIN32:: @command{ld} and WIN32 (cygwin/mingw) 4484 @end ifset 4485 @ifset XTENSA 4486 * Xtensa:: @command{ld} and Xtensa Processors 3951 4487 @end ifset 3952 4488 @end menu 3953 4489 @end ifset 3954 4490 3955 @c FIXME! This could use @raisesections/@lowersections, but there seems to be a conflict3956 @c between those and node-defaulting.3957 4491 @ifset H8300 3958 4492 @ifclear GENERIC … … 3961 4495 3962 4496 @node H8/300 3963 @section @co de{ld} and the H8/3004497 @section @command{ld} and the H8/300 3964 4498 3965 4499 @cindex H8/300 support 3966 For the H8/300, @co de{ld} can perform these global optimizations when4500 For the H8/300, @command{ld} can perform these global optimizations when 3967 4501 you specify the @samp{--relax} command-line option. 3968 4502 … … 3970 4504 @cindex relaxing on H8/300 3971 4505 @item relaxing address modes 3972 @co de{ld} finds all @code{jsr} and @code{jmp} instructions whose4506 @command{ld} finds all @code{jsr} and @code{jmp} instructions whose 3973 4507 targets are within eight bits, and turns them into eight-bit 3974 4508 program-counter relative @code{bsr} and @code{bra} instructions, … … 3978 4512 @item synthesizing instructions 3979 4513 @c FIXME: specifically mov.b, or any mov instructions really? 3980 @co de{ld} finds all @code{mov.b} instructions which use the4514 @command{ld} finds all @code{mov.b} instructions which use the 3981 4515 sixteen-bit absolute address form, but refer to the top 3982 4516 page of memory, and changes them to use the eight-bit address form. … … 3992 4526 3993 4527 @ifclear GENERIC 3994 @ifset Hitachi4528 @ifset Renesas 3995 4529 @c This stuff is pointless to say unless you're especially concerned 3996 @c with Hitachichips; don't enable it for generic case, please.3997 @node Hitachi3998 @chapter @co de{ld} and other Hitachi chips3999 4000 @co de{ld} also supports the H8/300H, the H8/500, and the Hitachi SH. No4001 special features, commands, or command-line options are required for 4002 these chips.4530 @c with Renesas chips; don't enable it for generic case, please. 4531 @node Renesas 4532 @chapter @command{ld} and Other Renesas Chips 4533 4534 @command{ld} also supports the Renesas (formerly Hitachi) H8/300H, 4535 H8/500, and SH chips. No special features, commands, or command-line 4536 options are required for these chips. 4003 4537 @end ifset 4004 4538 @end ifclear … … 4010 4544 4011 4545 @node i960 4012 @section @co de{ld} and the Intel 960 family4546 @section @command{ld} and the Intel 960 Family 4013 4547 4014 4548 @cindex i960 support … … 4022 4556 search loop names suffixed with the string identifying the architecture. 4023 4557 4024 For example, if your @co de{ld} command line included @w{@samp{-ACA}} as4558 For example, if your @command{ld} command line included @w{@samp{-ACA}} as 4025 4559 well as @w{@samp{-ltry}}, the linker would look (in its built-in search 4026 4560 paths, and in any paths you specify with @samp{-L}) for a library with … … 4045 4579 specifies a library. 4046 4580 4047 @cindex @ code{--relax} on i9604581 @cindex @option{--relax} on i960 4048 4582 @cindex relaxing on i960 4049 @co de{ld} supports the @samp{--relax} option for the i960 family. If4050 you specify @samp{--relax}, @co de{ld} finds all @code{balx} and4583 @command{ld} supports the @samp{--relax} option for the i960 family. If 4584 you specify @samp{--relax}, @command{ld} finds all @code{balx} and 4051 4585 @code{calx} instructions whose targets are within 24 bits, and turns 4052 4586 them into 24-bit program-counter relative @code{bal} and @code{cal} 4053 instructions, respectively. @co de{ld} also turns @code{cal}4587 instructions, respectively. @command{ld} also turns @code{cal} 4054 4588 instructions into @code{bal} instructions when it determines that the 4055 4589 target subroutine is a leaf routine (that is, the target subroutine does … … 4061 4595 @end ifset 4062 4596 4597 @ifset ARM 4063 4598 @ifclear GENERIC 4064 4599 @raisesections … … 4066 4601 4067 4602 @node ARM 4068 @section @co de{ld}'s support for interworking between ARM and Thumb code4603 @section @command{ld}'s Support for Interworking Between ARM and Thumb Code 4069 4604 4070 4605 @cindex ARM interworking support 4071 4606 @kindex --support-old-code 4072 For the ARM, @co de{ld} will generate code stubs to allow functions calls4607 For the ARM, @command{ld} will generate code stubs to allow functions calls 4073 4608 betweem ARM and Thumb code. These stubs only work with code that has 4074 4609 been compiled and assembled with the @samp{-mthumb-interwork} command … … 4090 4625 executing in Thumb mode straight away. 4091 4626 4627 @ifclear GENERIC 4628 @lowersections 4629 @end ifclear 4630 @end ifset 4631 4632 @ifset HPPA 4633 @ifclear GENERIC 4634 @raisesections 4635 @end ifclear 4636 4092 4637 @node HPPA ELF32 4093 @section @co de{ld} and HPPA 32-bit ELF support4638 @section @command{ld} and HPPA 32-bit ELF Support 4094 4639 @cindex HPPA multiple sub-space stubs 4095 4640 @kindex --multi-subspace 4096 When generating a shared library, @co de{ld} will by default generate4641 When generating a shared library, @command{ld} will by default generate 4097 4642 import stubs suitable for use with a single sub-space application. 4098 The @samp{--multi-subspace} switch causes @co de{ld} to generate export4643 The @samp{--multi-subspace} switch causes @command{ld} to generate export 4099 4644 stubs, and different (larger) import stubs suitable for use with 4100 4645 multiple sub-spaces. … … 4102 4647 @cindex HPPA stub grouping 4103 4648 @kindex --stub-group-size=@var{N} 4104 Long branch stubs and import/export stubs are placed by @co de{ld} in4649 Long branch stubs and import/export stubs are placed by @command{ld} in 4105 4650 stub sections located between groups of input sections. 4106 4651 @samp{--stub-group-size} specifies the maximum size of a group of input … … 4113 4658 branches to stubs always use a negative offset. Two special values of 4114 4659 @samp{N} are recognized, @samp{1} and @samp{-1}. These both instruct 4115 @co de{ld} to automatically size input section groups for the branch types4660 @command{ld} to automatically size input section groups for the branch types 4116 4661 detected, with the same behaviour regarding stub placement as other 4117 4662 positive or negative values of @samp{N} respectively. … … 4122 4667 large, it may not be possible for a branch to reach its stub. 4123 4668 4669 @ifclear GENERIC 4670 @lowersections 4671 @end ifclear 4672 @end ifset 4673 4674 @ifset MMIX 4675 @ifclear GENERIC 4676 @raisesections 4677 @end ifclear 4678 4679 @node MMIX 4680 @section @code{ld} and MMIX 4681 For MMIX, there is a choice of generating @code{ELF} object files or 4682 @code{mmo} object files when linking. The simulator @code{mmix} 4683 understands the @code{mmo} format. The binutils @code{objcopy} utility 4684 can translate between the two formats. 4685 4686 There is one special section, the @samp{.MMIX.reg_contents} section. 4687 Contents in this section is assumed to correspond to that of global 4688 registers, and symbols referring to it are translated to special symbols, 4689 equal to registers. In a final link, the start address of the 4690 @samp{.MMIX.reg_contents} section corresponds to the first allocated 4691 global register multiplied by 8. Register @code{$255} is not included in 4692 this section; it is always set to the program entry, which is at the 4693 symbol @code{Main} for @code{mmo} files. 4694 4695 Symbols with the prefix @code{__.MMIX.start.}, for example 4696 @code{__.MMIX.start..text} and @code{__.MMIX.start..data} are special; 4697 there must be only one each, even if they are local. The default linker 4698 script uses these to set the default start address of a section. 4699 4700 Initial and trailing multiples of zero-valued 32-bit words in a section, 4701 are left out from an mmo file. 4702 4703 @ifclear GENERIC 4704 @lowersections 4705 @end ifclear 4706 @end ifset 4707 4708 @ifset MSP430 4709 @ifclear GENERIC 4710 @raisesections 4711 @end ifclear 4712 4713 @node MSP430 4714 @section @code{ld} and MSP430 4715 For the MSP430 it is possible to select the MPU architecture. The flag @samp{-m [mpu type]} 4716 will select an appropriate linker script for selected MPU type. (To get a list of known MPUs 4717 just pass @samp{-m help} option to the linker). 4718 4719 @cindex MSP430 extra sections 4720 The linker will recognize some extra sections which are MSP430 specific: 4721 4722 @table @code 4723 @item @samp{.vectors} 4724 Defines a portion of ROM where interrupt vectors located. 4725 4726 @item @samp{.bootloader} 4727 Defines the bootloader portion of the ROM (if applicable). Any code 4728 in this section will be uploaded to the MPU. 4729 4730 @item @samp{.infomem} 4731 Defines an information memory section (if applicable). Any code in 4732 this section will be uploaded to the MPU. 4733 4734 @item @samp{.infomemnobits} 4735 This is the same as the @samp{.infomem} section except that any code 4736 in this section will not be uploaded to the MPU. 4737 4738 @item @samp{.noinit} 4739 Denotes a portion of RAM located above @samp{.bss} section. 4740 4741 The last two sections are used by gcc. 4742 @end table 4743 4744 @ifclear GENERIC 4745 @lowersections 4746 @end ifclear 4747 @end ifset 4748 4124 4749 @ifset TICOFF 4750 @ifclear GENERIC 4751 @raisesections 4752 @end ifclear 4753 4125 4754 @node TI COFF 4126 @section @co de{ld}'s support for various TI COFF versions4755 @section @command{ld}'s Support for Various TI COFF Versions 4127 4756 @cindex TI COFF versions 4128 4757 @kindex --format=@var{version} … … 4130 4759 TI COFF versions. The latest of this writing is 2; versions 0 and 1 are 4131 4760 also supported. The TI COFF versions also vary in header byte-order 4132 format; @co de{ld} will read any version or byte order, but the output4761 format; @command{ld} will read any version or byte order, but the output 4133 4762 header format depends on the default specified by the specific target. 4134 @end ifset4135 4763 4136 4764 @ifclear GENERIC 4137 4765 @lowersections 4138 4766 @end ifclear 4767 @end ifset 4768 4769 @ifset WIN32 4770 @ifclear GENERIC 4771 @raisesections 4772 @end ifclear 4773 4774 @node WIN32 4775 @section @command{ld} and WIN32 (cygwin/mingw) 4776 4777 This section describes some of the win32 specific @command{ld} issues. 4778 See @ref{Options,,Command Line Options} for detailed decription of the 4779 command line options mentioned here. 4780 4781 @table @emph 4782 @cindex import libraries 4783 @item import libraries 4784 The standard Windows linker creates and uses so-called import 4785 libraries, which contains information for linking to dll's. They are 4786 regular static archives and are handled as any other static 4787 archive. The cygwin and mingw ports of @command{ld} have specific 4788 support for creating such libraries provided with the 4789 @samp{--out-implib} command line option. 4790 4791 @item exporting DLL symbols 4792 @cindex exporting DLL symbols 4793 The cygwin/mingw @command{ld} has several ways to export symbols for dll's. 4794 4795 @table @emph 4796 @item using auto-export functionality 4797 @cindex using auto-export functionality 4798 By default @command{ld} exports symbols with the auto-export functionality, 4799 which is controlled by the following command line options: 4800 4801 @itemize 4802 @item --export-all-symbols [This is the default] 4803 @item --exclude-symbols 4804 @item --exclude-libs 4805 @end itemize 4806 4807 If, however, @samp{--export-all-symbols} is not given explicitly on the 4808 command line, then the default auto-export behavior will be @emph{disabled} 4809 if either of the following are true: 4810 4811 @itemize 4812 @item A DEF file is used. 4813 @item Any symbol in any object file was marked with the __declspec(dllexport) attribute. 4814 @end itemize 4815 4816 @item using a DEF file 4817 @cindex using a DEF file 4818 Another way of exporting symbols is using a DEF file. A DEF file is 4819 an ASCII file containing definitions of symbols which should be 4820 exported when a dll is created. Usually it is named @samp{<dll 4821 name>.def} and is added as any other object file to the linker's 4822 command line. The file's name must end in @samp{.def} or @samp{.DEF}. 4823 4824 @example 4825 gcc -o <output> <objectfiles> <dll name>.def 4826 @end example 4827 4828 Using a DEF file turns off the normal auto-export behavior, unless the 4829 @samp{--export-all-symbols} option is also used. 4830 4831 Here is an example of a DEF file for a shared library called @samp{xyz.dll}: 4832 4833 @example 4834 LIBRARY "xyz.dll" BASE=0x10000000 4835 4836 EXPORTS 4837 foo 4838 bar 4839 _bar = bar 4840 @end example 4841 4842 This example defines a base address and three symbols. The third 4843 symbol is an alias for the second. For the complete format 4844 specification see ld/deffilep.y in the binutils sources. 4845 4846 @cindex creating a DEF file 4847 While linking a shared dll, @command{ld} is able to create a DEF file 4848 with the @samp{--output-def <file>} command line option. 4849 4850 @item Using decorations 4851 @cindex Using decorations 4852 Another way of marking symbols for export is to modify the source code 4853 itself, so that when building the DLL each symbol to be exported is 4854 declared as: 4855 4856 @example 4857 __declspec(dllexport) int a_variable 4858 __declspec(dllexport) void a_function(int with_args) 4859 @end example 4860 4861 All such symbols will be exported from the DLL. If, however, 4862 any of the object files in the DLL contain symbols decorated in 4863 this way, then the normal auto-export behavior is disabled, unless 4864 the @samp{--export-all-symbols} option is also used. 4865 4866 Note that object files that wish to access these symbols must @emph{not} 4867 decorate them with dllexport. Instead, they should use dllimport, 4868 instead: 4869 4870 @example 4871 __declspec(dllimport) int a_variable 4872 __declspec(dllimport) void a_function(int with_args) 4873 @end example 4874 4875 This complicates the structure of library header files, because 4876 when included by the library itself the header must declare the 4877 variables and functions as dllexport, but when included by client 4878 code the header must declare them as dllimport. There are a number 4879 of idioms that are typically used to do this; often client code can 4880 omit the __declspec() declaration completely. See 4881 @samp{--enable-auto-import} and @samp{automatic data imports} for more 4882 imformation. 4883 @end table 4884 4885 @cindex automatic data imports 4886 @item automatic data imports 4887 The standard Windows dll format supports data imports from dlls only 4888 by adding special decorations (dllimport/dllexport), which let the 4889 compiler produce specific assembler instructions to deal with this 4890 issue. This increases the effort necessary to port existing Un*x 4891 code to these platforms, especially for large 4892 c++ libraries and applications. The auto-import feature, which was 4893 initially provided by Paul Sokolovsky, allows one to omit the 4894 decorations to archieve a behavior that conforms to that on POSIX/Un*x 4895 platforms. This feature is enabled with the @samp{--enable-auto-import} 4896 command-line option, although it is enabled by default on cygwin/mingw. 4897 The @samp{--enable-auto-import} option itself now serves mainly to 4898 suppress any warnings that are ordinarily emitted when linked objects 4899 trigger the feature's use. 4900 4901 auto-import of variables does not always work flawlessly without 4902 additional assistance. Sometimes, you will see this message 4903 4904 "variable '<var>' can't be auto-imported. Please read the 4905 documentation for ld's @code{--enable-auto-import} for details." 4906 4907 The @samp{--enable-auto-import} documentation explains why this error 4908 occurs, and several methods that can be used to overcome this difficulty. 4909 One of these methods is the @emph{runtime pseudo-relocs} feature, described 4910 below. 4911 4912 @cindex runtime pseudo-relocation 4913 For complex variables imported from DLLs (such as structs or classes), 4914 object files typically contain a base address for the variable and an 4915 offset (@emph{addend}) within the variable--to specify a particular 4916 field or public member, for instance. Unfortunately, the runtime loader used 4917 in win32 environments is incapable of fixing these references at runtime 4918 without the additional information supplied by dllimport/dllexport decorations. 4919 The standard auto-import feature described above is unable to resolve these 4920 references. 4921 4922 The @samp{--enable-runtime-pseudo-relocs} switch allows these references to 4923 be resolved without error, while leaving the task of adjusting the references 4924 themselves (with their non-zero addends) to specialized code provided by the 4925 runtime environment. Recent versions of the cygwin and mingw environments and 4926 compilers provide this runtime support; older versions do not. However, the 4927 support is only necessary on the developer's platform; the compiled result will 4928 run without error on an older system. 4929 4930 @samp{--enable-runtime-pseudo-relocs} is not the default; it must be explicitly 4931 enabled as needed. 4932 4933 @cindex direct linking to a dll 4934 @item direct linking to a dll 4935 The cygwin/mingw ports of @command{ld} support the direct linking, 4936 including data symbols, to a dll without the usage of any import 4937 libraries. This is much faster and uses much less memory than does the 4938 traditional import library method, expecially when linking large 4939 libraries or applications. When @command{ld} creates an import lib, each 4940 function or variable exported from the dll is stored in its own bfd, even 4941 though a single bfd could contain many exports. The overhead involved in 4942 storing, loading, and processing so many bfd's is quite large, and explains the 4943 tremendous time, memory, and storage needed to link against particularly 4944 large or complex libraries when using import libs. 4945 4946 Linking directly to a dll uses no extra command-line switches other than 4947 @samp{-L} and @samp{-l}, because @command{ld} already searches for a number 4948 of names to match each library. All that is needed from the developer's 4949 perspective is an understanding of this search, in order to force ld to 4950 select the dll instead of an import library. 4951 4952 4953 For instance, when ld is called with the argument @samp{-lxxx} it will attempt 4954 to find, in the first directory of its search path, 4955 4956 @example 4957 libxxx.dll.a 4958 xxx.dll.a 4959 libxxx.a 4960 cygxxx.dll (*) 4961 libxxx.dll 4962 xxx.dll 4963 @end example 4964 4965 before moving on to the next directory in the search path. 4966 4967 (*) Actually, this is not @samp{cygxxx.dll} but in fact is @samp{<prefix>xxx.dll}, 4968 where @samp{<prefix>} is set by the @command{ld} option 4969 @samp{--dll-search-prefix=<prefix>}. In the case of cygwin, the standard gcc spec 4970 file includes @samp{--dll-search-prefix=cyg}, so in effect we actually search for 4971 @samp{cygxxx.dll}. 4972 4973 Other win32-based unix environments, such as mingw or pw32, may use other 4974 @samp{<prefix>}es, although at present only cygwin makes use of this feature. It 4975 was originally intended to help avoid name conflicts among dll's built for the 4976 various win32/un*x environments, so that (for example) two versions of a zlib dll 4977 could coexist on the same machine. 4978 4979 The generic cygwin/mingw path layout uses a @samp{bin} directory for 4980 applications and dll's and a @samp{lib} directory for the import 4981 libraries (using cygwin nomenclature): 4982 4983 @example 4984 bin/ 4985 cygxxx.dll 4986 lib/ 4987 libxxx.dll.a (in case of dll's) 4988 libxxx.a (in case of static archive) 4989 @end example 4990 4991 Linking directly to a dll without using the import library can be 4992 done two ways: 4993 4994 1. Use the dll directly by adding the @samp{bin} path to the link line 4995 @example 4996 gcc -Wl,-verbose -o a.exe -L../bin/ -lxxx 4997 @end example 4998 4999 However, as the dll's often have version numbers appended to their names 5000 (@samp{cygncurses-5.dll}) this will often fail, unless one specifies 5001 @samp{-L../bin -lncurses-5} to include the version. Import libs are generally 5002 not versioned, and do not have this difficulty. 5003 5004 2. Create a symbolic link from the dll to a file in the @samp{lib} 5005 directory according to the above mentioned search pattern. This 5006 should be used to avoid unwanted changes in the tools needed for 5007 making the app/dll. 5008 5009 @example 5010 ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a] 5011 @end example 5012 5013 Then you can link without any make environment changes. 5014 5015 @example 5016 gcc -Wl,-verbose -o a.exe -L../lib/ -lxxx 5017 @end example 5018 5019 This technique also avoids the version number problems, because the following is 5020 perfectly legal 5021 5022 @example 5023 bin/ 5024 cygxxx-5.dll 5025 lib/ 5026 libxxx.dll.a -> ../bin/cygxxx-5.dll 5027 @end example 5028 5029 Linking directly to a dll without using an import lib will work 5030 even when auto-import features are exercised, and even when 5031 @samp{--enable-runtime-pseudo-relocs} is used. 5032 5033 Given the improvements in speed and memory usage, one might justifiably 5034 wonder why import libraries are used at all. There are two reasons: 5035 5036 1. Until recently, the link-directly-to-dll functionality did @emph{not} 5037 work with auto-imported data. 5038 5039 2. Sometimes it is necessary to include pure static objects within the 5040 import library (which otherwise contains only bfd's for indirection 5041 symbols that point to the exports of a dll). Again, the import lib 5042 for the cygwin kernel makes use of this ability, and it is not 5043 possible to do this without an import lib. 5044 5045 So, import libs are not going away. But the ability to replace 5046 true import libs with a simple symbolic link to (or a copy of) 5047 a dll, in most cases, is a useful addition to the suite of tools 5048 binutils makes available to the win32 developer. Given the 5049 massive improvements in memory requirements during linking, storage 5050 requirements, and linking speed, we expect that many developers 5051 will soon begin to use this feature whenever possible. 5052 5053 @item symbol aliasing 5054 @table @emph 5055 @item adding additional names 5056 Sometimes, it is useful to export symbols with additional names. 5057 A symbol @samp{foo} will be exported as @samp{foo}, but it can also be 5058 exported as @samp{_foo} by using special directives in the DEF file 5059 when creating the dll. This will affect also the optional created 5060 import library. Consider the following DEF file: 5061 5062 @example 5063 LIBRARY "xyz.dll" BASE=0x61000000 5064 5065 EXPORTS 5066 foo 5067 _foo = foo 5068 @end example 5069 5070 The line @samp{_foo = foo} maps the symbol @samp{foo} to @samp{_foo}. 5071 5072 Another method for creating a symbol alias is to create it in the 5073 source code using the "weak" attribute: 5074 5075 @example 5076 void foo () @{ /* Do something. */; @} 5077 void _foo () __attribute__ ((weak, alias ("foo"))); 5078 @end example 5079 5080 See the gcc manual for more information about attributes and weak 5081 symbols. 5082 5083 @item renaming symbols 5084 Sometimes it is useful to rename exports. For instance, the cygwin 5085 kernel does this regularly. A symbol @samp{_foo} can be exported as 5086 @samp{foo} but not as @samp{_foo} by using special directives in the 5087 DEF file. (This will also affect the import library, if it is 5088 created). In the following example: 5089 5090 @example 5091 LIBRARY "xyz.dll" BASE=0x61000000 5092 5093 EXPORTS 5094 _foo = foo 5095 @end example 5096 5097 The line @samp{_foo = foo} maps the exported symbol @samp{foo} to 5098 @samp{_foo}. 5099 @end table 5100 5101 Note: using a DEF file disables the default auto-export behavior, 5102 unless the @samp{--export-all-symbols} command line option is used. 5103 If, however, you are trying to rename symbols, then you should list 5104 @emph{all} desired exports in the DEF file, including the symbols 5105 that are not being renamed, and do @emph{not} use the 5106 @samp{--export-all-symbols} option. If you list only the 5107 renamed symbols in the DEF file, and use @samp{--export-all-symbols} 5108 to handle the other symbols, then the both the new names @emph{and} 5109 the original names for the the renamed symbols will be exported. 5110 In effect, you'd be aliasing those symbols, not renaming them, 5111 which is probably not what you wanted. 5112 @end table 5113 5114 @ifclear GENERIC 5115 @lowersections 5116 @end ifclear 5117 @end ifset 5118 5119 @ifset XTENSA 5120 @ifclear GENERIC 5121 @raisesections 5122 @end ifclear 5123 5124 @node Xtensa 5125 @section @code{ld} and Xtensa Processors 5126 5127 @cindex Xtensa processors 5128 The default @command{ld} behavior for Xtensa processors is to interpret 5129 @code{SECTIONS} commands so that lists of explicitly named sections in a 5130 specification with a wildcard file will be interleaved when necessary to 5131 keep literal pools within the range of PC-relative load offsets. For 5132 example, with the command: 5133 5134 @smallexample 5135 SECTIONS 5136 @{ 5137 .text : @{ 5138 *(.literal .text) 5139 @} 5140 @} 5141 @end smallexample 5142 5143 @noindent 5144 @command{ld} may interleave some of the @code{.literal} 5145 and @code{.text} sections from different object files to ensure that the 5146 literal pools are within the range of PC-relative load offsets. A valid 5147 interleaving might place the @code{.literal} sections from an initial 5148 group of files followed by the @code{.text} sections of that group of 5149 files. Then, the @code{.literal} sections from the rest of the files 5150 and the @code{.text} sections from the rest of the files would follow. 5151 The non-interleaved order can still be specified as: 5152 5153 @smallexample 5154 SECTIONS 5155 @{ 5156 .text : @{ 5157 *(.literal) *(.text) 5158 @} 5159 @} 5160 @end smallexample 5161 5162 @cindex @code{--relax} on Xtensa 5163 @cindex relaxing on Xtensa 5164 @kindex --no-relax 5165 The Xtensa version of @command{ld} enables the @option{--relax} option by 5166 default to attempt to reduce space in the output image by combining 5167 literals with identical values. It also provides the 5168 @option{--no-relax} option to disable this optimization. When enabled, 5169 the relaxation algorithm ensures that a literal will only be merged with 5170 another literal when the new merged literal location is within the 5171 offset range of all of its uses. 5172 5173 The relaxation mechanism will also attempt to optimize 5174 assembler-generated ``longcall'' sequences of 5175 @code{L32R}/@code{CALLX@var{n}} when the target is known to fit into a 5176 @code{CALL@var{n}} instruction encoding. The current optimization 5177 converts the sequence into @code{NOP}/@code{CALL@var{n}} and removes the 5178 literal referenced by the @code{L32R} instruction. 5179 5180 @ifclear GENERIC 5181 @lowersections 5182 @end ifclear 5183 @end ifset 4139 5184 4140 5185 @ifclear SingleFormat … … 4176 5221 4177 5222 @node BFD outline 4178 @section How it works: an outline of BFD5223 @section How It Works: An Outline of BFD 4179 5224 @cindex opening object files 4180 5225 @include bfdsumm.texi … … 4183 5228 @node Reporting Bugs 4184 5229 @chapter Reporting Bugs 4185 @cindex bugs in @co de{ld}4186 @cindex reporting bugs in @co de{ld}4187 4188 Your bug reports play an essential role in making @co de{ld} reliable.5230 @cindex bugs in @command{ld} 5231 @cindex reporting bugs in @command{ld} 5232 5233 Your bug reports play an essential role in making @command{ld} reliable. 4189 5234 4190 5235 Reporting a bug may help you by bringing a solution to your problem, or 4191 5236 it may not. But in any case the principal function of a bug report is 4192 to help the entire community by making the next version of @co de{ld}5237 to help the entire community by making the next version of @command{ld} 4193 5238 work better. Bug reports are your contribution to the maintenance of 4194 @co de{ld}.5239 @command{ld}. 4195 5240 4196 5241 In order for a bug report to serve its purpose, you must include the … … 4203 5248 4204 5249 @node Bug Criteria 4205 @section Have you found a bug?5250 @section Have You Found a Bug? 4206 5251 @cindex bug criteria 4207 5252 … … 4214 5259 @item 4215 5260 If the linker gets a fatal signal, for any input whatever, that is a 4216 @co de{ld} bug. Reliable linkers never crash.5261 @command{ld} bug. Reliable linkers never crash. 4217 5262 4218 5263 @cindex error on valid input 4219 5264 @item 4220 If @co de{ld} produces an error message for valid input, that is a bug.5265 If @command{ld} produces an error message for valid input, that is a bug. 4221 5266 4222 5267 @cindex invalid input 4223 5268 @item 4224 If @co de{ld} does not produce an error message for invalid input, that5269 If @command{ld} does not produce an error message for invalid input, that 4225 5270 may be a bug. In the general case, the linker can not verify that 4226 5271 object files are correct. … … 4228 5273 @item 4229 5274 If you are an experienced user of linkers, your suggestions for 4230 improvement of @co de{ld} are welcome in any case.5275 improvement of @command{ld} are welcome in any case. 4231 5276 @end itemize 4232 5277 4233 5278 @node Bug Reporting 4234 @section How to report bugs5279 @section How to Report Bugs 4235 5280 @cindex bug reports 4236 @cindex @co de{ld} bugs, reporting5281 @cindex @command{ld} bugs, reporting 4237 5282 4238 5283 A number of companies and individuals offer support for @sc{gnu} 4239 products. If you obtained @co de{ld} from a support organization, we5284 products. If you obtained @command{ld} from a support organization, we 4240 5285 recommend you contact that organization first. 4241 5286 … … 4244 5289 distribution. 4245 5290 4246 Otherwise, send bug reports for @co de{ld} to5291 Otherwise, send bug reports for @command{ld} to 4247 5292 @samp{bug-binutils@@gnu.org}. 4248 5293 … … 4253 5298 Often people omit facts because they think they know what causes the 4254 5299 problem and assume that some details do not matter. Thus, you might 4255 assume that the name of a symbol you use in an example does not matter. 4256 Well, probably it does not, but one cannot be sure. Perhaps the bug is 4257 a stray memory reference which happens to fetch from the location where 4258 that name is stored in memory; perhaps, if the name were different, the 4259 contents of that location would fool the linker into doing the right 4260 thing despite the bug. Play it safe and give a specific, complete 4261 example. That is the easiest thing for you to do, and the most helpful. 4262 4263 Keep in mind that the purpose of a bug report is to enable us to fix the bug if 4264 it is new to us. Therefore, always write your bug reports on the assumption 4265 that the bug has not been reported previously. 5300 assume that the name of a symbol you use in an example does not 5301 matter. Well, probably it does not, but one cannot be sure. Perhaps 5302 the bug is a stray memory reference which happens to fetch from the 5303 location where that name is stored in memory; perhaps, if the name 5304 were different, the contents of that location would fool the linker 5305 into doing the right thing despite the bug. Play it safe and give a 5306 specific, complete example. That is the easiest thing for you to do, 5307 and the most helpful. 5308 5309 Keep in mind that the purpose of a bug report is to enable us to fix 5310 the bug if it is new to us. Therefore, always write your bug reports 5311 on the assumption that the bug has not been reported previously. 4266 5312 4267 5313 Sometimes people give a few sketchy facts and ask, ``Does this ring a 4268 bell?'' Th ose bug reports are useless, and we urge everyone to4269 @emph{refuse to respond to them} except to chide the sender to report 4270 bugs properly.5314 bell?'' This cannot help us fix a bug, so it is basically useless. We 5315 respond by asking for enough details to enable us to investigate. 5316 You might as well expedite matters by sending them to begin with. 4271 5317 4272 5318 To enable us to fix the bug, you should include all these things: … … 4274 5320 @itemize @bullet 4275 5321 @item 4276 The version of @co de{ld}. @code{ld} announces it if you start it with5322 The version of @command{ld}. @command{ld} announces it if you start it with 4277 5323 the @samp{--version} argument. 4278 5324 4279 5325 Without this, we will not know whether there is any point in looking for 4280 the bug in the current version of @co de{ld}.5326 the bug in the current version of @command{ld}. 4281 5327 4282 5328 @item 4283 Any patches you may have applied to the @co de{ld} source, including any5329 Any patches you may have applied to the @command{ld} source, including any 4284 5330 patches made to the @code{BFD} library. 4285 5331 … … 4289 5335 4290 5336 @item 4291 What compiler (and its version) was used to compile @co de{ld}---e.g.5337 What compiler (and its version) was used to compile @command{ld}---e.g. 4292 5338 ``@code{gcc-2.7}''. 4293 5339 … … 4303 5349 @item 4304 5350 A complete input file, or set of input files, that will reproduce the 4305 bug. It is generally most helpful to send the actual object files, 4306 uuencoded if necessary to get them through the mail system. Making them 4307 available for anonymous FTP is not as good, but may be the only 4308 reasonable choice for large object files. 5351 bug. It is generally most helpful to send the actual object files 5352 provided that they are reasonably small. Say no more than 10K. For 5353 bigger files you can either make them available by FTP or HTTP or else 5354 state that you are willing to send the object file(s) to whomever 5355 requests them. (Note - your email will be going to a mailing list, so 5356 we do not want to clog it up with large attachments). But small 5357 attachments are best. 4309 5358 4310 5359 If the source files were assembled using @code{gas} or compiled using … … 4318 5367 incorrect. For example, ``It gets a fatal signal.'' 4319 5368 4320 Of course, if the bug is that @co de{ld} gets a fatal signal, then we5369 Of course, if the bug is that @command{ld} gets a fatal signal, then we 4321 5370 will certainly notice it. But if the bug is incorrect output, we might 4322 5371 not notice unless it is glaringly wrong. You might as well not give us … … 4325 5374 Even if the problem you experience is a fatal signal, you should still 4326 5375 say so explicitly. Suppose something strange is going on, such as, your 4327 copy of @co de{ld} is out of synch, or you have encountered a bug in the5376 copy of @command{ld} is out of synch, or you have encountered a bug in the 4328 5377 C library on your system. (This has happened!) Your copy might crash 4329 5378 and ours would not. If you told us to expect a crash, then when ours … … 4333 5382 4334 5383 @item 4335 If you wish to suggest changes to the @co de{ld} source, send us context5384 If you wish to suggest changes to the @command{ld} source, send us context 4336 5385 diffs, as generated by @code{diff} with the @samp{-u}, @samp{-c}, or 4337 5386 @samp{-p} option. Always send diffs from the old file to the new file. 4338 If you even discuss something in the @co de{ld} source, refer to it by5387 If you even discuss something in the @command{ld} source, refer to it by 4339 5388 context, not by line number. 4340 5389 … … 4374 5423 to fix the problem another way, or we might not understand it at all. 4375 5424 4376 Sometimes with a program as complicated as @co de{ld} it is very hard to5425 Sometimes with a program as complicated as @command{ld} it is very hard to 4377 5426 construct an example that will make the program follow a certain path 4378 5427 through the code. If you do not send us the example, we will not be … … 4394 5443 @appendix MRI Compatible Script Files 4395 5444 @cindex MRI compatibility 4396 To aid users making the transition to @sc{gnu} @co de{ld} from the MRI4397 linker, @co de{ld} can use MRI compatible linker scripts as an5445 To aid users making the transition to @sc{gnu} @command{ld} from the MRI 5446 linker, @command{ld} can use MRI compatible linker scripts as an 4398 5447 alternative to the more general-purpose linker scripting language 4399 5448 described in @ref{Scripts}. MRI compatible linker scripts have a much 4400 5449 simpler command set than the scripting language otherwise used with 4401 @co de{ld}. @sc{gnu} @code{ld} supports the most commonly used MRI5450 @command{ld}. @sc{gnu} @command{ld} supports the most commonly used MRI 4402 5451 linker commands; these commands are described here. 4403 5452 … … 4412 5461 command line starts with the keyword that identifies the command (though 4413 5462 blank lines are also allowed for punctuation). If a line of an 4414 MRI-compatible script begins with an unrecognized keyword, @co de{ld}5463 MRI-compatible script begins with an unrecognized keyword, @command{ld} 4415 5464 issues a warning message, but continues processing the script. 4416 5465 … … 4425 5474 @item ABSOLUTE @var{secname} 4426 5475 @itemx ABSOLUTE @var{secname}, @var{secname}, @dots{} @var{secname} 4427 Normally, @co de{ld} includes in the output file all sections from all5476 Normally, @command{ld} includes in the output file all sections from all 4428 5477 the input files. However, in an MRI-compatible script, you can use the 4429 5478 @code{ABSOLUTE} command to restrict the sections that will be present in … … 4480 5529 @item LIST @var{anything}@dots{} 4481 5530 Print (to the standard output file) a link map, as produced by the 4482 @co de{ld} command-line option @samp{-M}.5531 @command{ld} command-line option @samp{-M}. 4483 5532 4484 5533 The keyword @code{LIST} may be followed by anything on the … … 4489 5538 @itemx LOAD @var{filename}, @var{filename}, @dots{} @var{filename} 4490 5539 Include one or more object file @var{filename} in the link; this has the 4491 same effect as specifying @var{filename} directly on the @co de{ld}5540 same effect as specifying @var{filename} directly on the @command{ld} 4492 5541 command line. 4493 5542 4494 5543 @cindex @code{NAME} (MRI) 4495 5544 @item NAME @var{output-name} 4496 @var{output-name} is the name for the program produced by @co de{ld}; the5545 @var{output-name} is the name for the program produced by @command{ld}; the 4497 5546 MRI-compatible command @code{NAME} is equivalent to the command-line 4498 5547 option @samp{-o} or the general script language command @code{OUTPUT}. … … 4501 5550 @item ORDER @var{secname}, @var{secname}, @dots{} @var{secname} 4502 5551 @itemx ORDER @var{secname} @var{secname} @var{secname} 4503 Normally, @co de{ld} orders the sections in its output file in the5552 Normally, @command{ld} orders the sections in its output file in the 4504 5553 order in which they first appear in the input files. In an MRI-compatible 4505 5554 script, you can override this ordering with the @code{ORDER} command. The … … 4524 5573 @end table 4525 5574 4526 @node GNU Free Documentation License 4527 @appendix GNU Free Documentation License 4528 @cindex GNU Free Documentation License 4529 4530 GNU Free Documentation License 4531 4532 Version 1.1, March 2000 4533 4534 Copyright (C) 2000 Free Software Foundation, Inc. 4535 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 4536 4537 Everyone is permitted to copy and distribute verbatim copies 4538 of this license document, but changing it is not allowed. 4539 4540 4541 0. PREAMBLE 4542 4543 The purpose of this License is to make a manual, textbook, or other 4544 written document "free" in the sense of freedom: to assure everyone 4545 the effective freedom to copy and redistribute it, with or without 4546 modifying it, either commercially or noncommercially. Secondarily, 4547 this License preserves for the author and publisher a way to get 4548 credit for their work, while not being considered responsible for 4549 modifications made by others. 4550 4551 This License is a kind of "copyleft", which means that derivative 4552 works of the document must themselves be free in the same sense. It 4553 complements the GNU General Public License, which is a copyleft 4554 license designed for free software. 4555 4556 We have designed this License in order to use it for manuals for free 4557 software, because free software needs free documentation: a free 4558 program should come with manuals providing the same freedoms that the 4559 software does. But this License is not limited to software manuals; 4560 it can be used for any textual work, regardless of subject matter or 4561 whether it is published as a printed book. We recommend this License 4562 principally for works whose purpose is instruction or reference. 4563 4564 4565 1. APPLICABILITY AND DEFINITIONS 4566 4567 This License applies to any manual or other work that contains a 4568 notice placed by the copyright holder saying it can be distributed 4569 under the terms of this License. The "Document", below, refers to any 4570 such manual or work. Any member of the public is a licensee, and is 4571 addressed as "you". 4572 4573 A "Modified Version" of the Document means any work containing the 4574 Document or a portion of it, either copied verbatim, or with 4575 modifications and/or translated into another language. 4576 4577 A "Secondary Section" is a named appendix or a front-matter section of 4578 the Document that deals exclusively with the relationship of the 4579 publishers or authors of the Document to the Document's overall subject 4580 (or to related matters) and contains nothing that could fall directly 4581 within that overall subject. (For example, if the Document is in part a 4582 textbook of mathematics, a Secondary Section may not explain any 4583 mathematics.) The relationship could be a matter of historical 4584 connection with the subject or with related matters, or of legal, 4585 commercial, philosophical, ethical or political position regarding 4586 them. 4587 4588 The "Invariant Sections" are certain Secondary Sections whose titles 4589 are designated, as being those of Invariant Sections, in the notice 4590 that says that the Document is released under this License. 4591 4592 The "Cover Texts" are certain short passages of text that are listed, 4593 as Front-Cover Texts or Back-Cover Texts, in the notice that says that 4594 the Document is released under this License. 4595 4596 A "Transparent" copy of the Document means a machine-readable copy, 4597 represented in a format whose specification is available to the 4598 general public, whose contents can be viewed and edited directly and 4599 straightforwardly with generic text editors or (for images composed of 4600 pixels) generic paint programs or (for drawings) some widely available 4601 drawing editor, and that is suitable for input to text formatters or 4602 for automatic translation to a variety of formats suitable for input 4603 to text formatters. A copy made in an otherwise Transparent file 4604 format whose markup has been designed to thwart or discourage 4605 subsequent modification by readers is not Transparent. A copy that is 4606 not "Transparent" is called "Opaque". 4607 4608 Examples of suitable formats for Transparent copies include plain 4609 ASCII without markup, Texinfo input format, LaTeX input format, SGML 4610 or XML using a publicly available DTD, and standard-conforming simple 4611 HTML designed for human modification. Opaque formats include 4612 PostScript, PDF, proprietary formats that can be read and edited only 4613 by proprietary word processors, SGML or XML for which the DTD and/or 4614 processing tools are not generally available, and the 4615 machine-generated HTML produced by some word processors for output 4616 purposes only. 4617 4618 The "Title Page" means, for a printed book, the title page itself, 4619 plus such following pages as are needed to hold, legibly, the material 4620 this License requires to appear in the title page. For works in 4621 formats which do not have any title page as such, "Title Page" means 4622 the text near the most prominent appearance of the work's title, 4623 preceding the beginning of the body of the text. 4624 4625 4626 2. VERBATIM COPYING 4627 4628 You may copy and distribute the Document in any medium, either 4629 commercially or noncommercially, provided that this License, the 4630 copyright notices, and the license notice saying this License applies 4631 to the Document are reproduced in all copies, and that you add no other 4632 conditions whatsoever to those of this License. You may not use 4633 technical measures to obstruct or control the reading or further 4634 copying of the copies you make or distribute. However, you may accept 4635 compensation in exchange for copies. If you distribute a large enough 4636 number of copies you must also follow the conditions in section 3. 4637 4638 You may also lend copies, under the same conditions stated above, and 4639 you may publicly display copies. 4640 4641 4642 3. COPYING IN QUANTITY 4643 4644 If you publish printed copies of the Document numbering more than 100, 4645 and the Document's license notice requires Cover Texts, you must enclose 4646 the copies in covers that carry, clearly and legibly, all these Cover 4647 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on 4648 the back cover. Both covers must also clearly and legibly identify 4649 you as the publisher of these copies. The front cover must present 4650 the full title with all words of the title equally prominent and 4651 visible. You may add other material on the covers in addition. 4652 Copying with changes limited to the covers, as long as they preserve 4653 the title of the Document and satisfy these conditions, can be treated 4654 as verbatim copying in other respects. 4655 4656 If the required texts for either cover are too voluminous to fit 4657 legibly, you should put the first ones listed (as many as fit 4658 reasonably) on the actual cover, and continue the rest onto adjacent 4659 pages. 4660 4661 If you publish or distribute Opaque copies of the Document numbering 4662 more than 100, you must either include a machine-readable Transparent 4663 copy along with each Opaque copy, or state in or with each Opaque copy 4664 a publicly-accessible computer-network location containing a complete 4665 Transparent copy of the Document, free of added material, which the 4666 general network-using public has access to download anonymously at no 4667 charge using public-standard network protocols. If you use the latter 4668 option, you must take reasonably prudent steps, when you begin 4669 distribution of Opaque copies in quantity, to ensure that this 4670 Transparent copy will remain thus accessible at the stated location 4671 until at least one year after the last time you distribute an Opaque 4672 copy (directly or through your agents or retailers) of that edition to 4673 the public. 4674 4675 It is requested, but not required, that you contact the authors of the 4676 Document well before redistributing any large number of copies, to give 4677 them a chance to provide you with an updated version of the Document. 4678 4679 4680 4. MODIFICATIONS 4681 4682 You may copy and distribute a Modified Version of the Document under 4683 the conditions of sections 2 and 3 above, provided that you release 4684 the Modified Version under precisely this License, with the Modified 4685 Version filling the role of the Document, thus licensing distribution 4686 and modification of the Modified Version to whoever possesses a copy 4687 of it. In addition, you must do these things in the Modified Version: 4688 4689 A. Use in the Title Page (and on the covers, if any) a title distinct 4690 from that of the Document, and from those of previous versions 4691 (which should, if there were any, be listed in the History section 4692 of the Document). You may use the same title as a previous version 4693 if the original publisher of that version gives permission. 4694 B. List on the Title Page, as authors, one or more persons or entities 4695 responsible for authorship of the modifications in the Modified 4696 Version, together with at least five of the principal authors of the 4697 Document (all of its principal authors, if it has less than five). 4698 C. State on the Title page the name of the publisher of the 4699 Modified Version, as the publisher. 4700 D. Preserve all the copyright notices of the Document. 4701 E. Add an appropriate copyright notice for your modifications 4702 adjacent to the other copyright notices. 4703 F. Include, immediately after the copyright notices, a license notice 4704 giving the public permission to use the Modified Version under the 4705 terms of this License, in the form shown in the Addendum below. 4706 G. Preserve in that license notice the full lists of Invariant Sections 4707 and required Cover Texts given in the Document's license notice. 4708 H. Include an unaltered copy of this License. 4709 I. Preserve the section entitled "History", and its title, and add to 4710 it an item stating at least the title, year, new authors, and 4711 publisher of the Modified Version as given on the Title Page. If 4712 there is no section entitled "History" in the Document, create one 4713 stating the title, year, authors, and publisher of the Document as 4714 given on its Title Page, then add an item describing the Modified 4715 Version as stated in the previous sentence. 4716 J. Preserve the network location, if any, given in the Document for 4717 public access to a Transparent copy of the Document, and likewise 4718 the network locations given in the Document for previous versions 4719 it was based on. These may be placed in the "History" section. 4720 You may omit a network location for a work that was published at 4721 least four years before the Document itself, or if the original 4722 publisher of the version it refers to gives permission. 4723 K. In any section entitled "Acknowledgements" or "Dedications", 4724 preserve the section's title, and preserve in the section all the 4725 substance and tone of each of the contributor acknowledgements 4726 and/or dedications given therein. 4727 L. Preserve all the Invariant Sections of the Document, 4728 unaltered in their text and in their titles. Section numbers 4729 or the equivalent are not considered part of the section titles. 4730 M. Delete any section entitled "Endorsements". Such a section 4731 may not be included in the Modified Version. 4732 N. Do not retitle any existing section as "Endorsements" 4733 or to conflict in title with any Invariant Section. 4734 4735 If the Modified Version includes new front-matter sections or 4736 appendices that qualify as Secondary Sections and contain no material 4737 copied from the Document, you may at your option designate some or all 4738 of these sections as invariant. To do this, add their titles to the 4739 list of Invariant Sections in the Modified Version's license notice. 4740 These titles must be distinct from any other section titles. 4741 4742 You may add a section entitled "Endorsements", provided it contains 4743 nothing but endorsements of your Modified Version by various 4744 parties--for example, statements of peer review or that the text has 4745 been approved by an organization as the authoritative definition of a 4746 standard. 4747 4748 You may add a passage of up to five words as a Front-Cover Text, and a 4749 passage of up to 25 words as a Back-Cover Text, to the end of the list 4750 of Cover Texts in the Modified Version. Only one passage of 4751 Front-Cover Text and one of Back-Cover Text may be added by (or 4752 through arrangements made by) any one entity. If the Document already 4753 includes a cover text for the same cover, previously added by you or 4754 by arrangement made by the same entity you are acting on behalf of, 4755 you may not add another; but you may replace the old one, on explicit 4756 permission from the previous publisher that added the old one. 4757 4758 The author(s) and publisher(s) of the Document do not by this License 4759 give permission to use their names for publicity for or to assert or 4760 imply endorsement of any Modified Version. 4761 4762 4763 5. COMBINING DOCUMENTS 4764 4765 You may combine the Document with other documents released under this 4766 License, under the terms defined in section 4 above for modified 4767 versions, provided that you include in the combination all of the 4768 Invariant Sections of all of the original documents, unmodified, and 4769 list them all as Invariant Sections of your combined work in its 4770 license notice. 4771 4772 The combined work need only contain one copy of this License, and 4773 multiple identical Invariant Sections may be replaced with a single 4774 copy. If there are multiple Invariant Sections with the same name but 4775 different contents, make the title of each such section unique by 4776 adding at the end of it, in parentheses, the name of the original 4777 author or publisher of that section if known, or else a unique number. 4778 Make the same adjustment to the section titles in the list of 4779 Invariant Sections in the license notice of the combined work. 4780 4781 In the combination, you must combine any sections entitled "History" 4782 in the various original documents, forming one section entitled 4783 "History"; likewise combine any sections entitled "Acknowledgements", 4784 and any sections entitled "Dedications". You must delete all sections 4785 entitled "Endorsements." 4786 4787 4788 6. COLLECTIONS OF DOCUMENTS 4789 4790 You may make a collection consisting of the Document and other documents 4791 released under this License, and replace the individual copies of this 4792 License in the various documents with a single copy that is included in 4793 the collection, provided that you follow the rules of this License for 4794 verbatim copying of each of the documents in all other respects. 4795 4796 You may extract a single document from such a collection, and distribute 4797 it individually under this License, provided you insert a copy of this 4798 License into the extracted document, and follow this License in all 4799 other respects regarding verbatim copying of that document. 4800 4801 4802 7. AGGREGATION WITH INDEPENDENT WORKS 4803 4804 A compilation of the Document or its derivatives with other separate 4805 and independent documents or works, in or on a volume of a storage or 4806 distribution medium, does not as a whole count as a Modified Version 4807 of the Document, provided no compilation copyright is claimed for the 4808 compilation. Such a compilation is called an "aggregate", and this 4809 License does not apply to the other self-contained works thus compiled 4810 with the Document, on account of their being thus compiled, if they 4811 are not themselves derivative works of the Document. 4812 4813 If the Cover Text requirement of section 3 is applicable to these 4814 copies of the Document, then if the Document is less than one quarter 4815 of the entire aggregate, the Document's Cover Texts may be placed on 4816 covers that surround only the Document within the aggregate. 4817 Otherwise they must appear on covers around the whole aggregate. 4818 4819 4820 8. TRANSLATION 4821 4822 Translation is considered a kind of modification, so you may 4823 distribute translations of the Document under the terms of section 4. 4824 Replacing Invariant Sections with translations requires special 4825 permission from their copyright holders, but you may include 4826 translations of some or all Invariant Sections in addition to the 4827 original versions of these Invariant Sections. You may include a 4828 translation of this License provided that you also include the 4829 original English version of this License. In case of a disagreement 4830 between the translation and the original English version of this 4831 License, the original English version will prevail. 4832 4833 4834 9. TERMINATION 4835 4836 You may not copy, modify, sublicense, or distribute the Document except 4837 as expressly provided for under this License. Any other attempt to 4838 copy, modify, sublicense or distribute the Document is void, and will 4839 automatically terminate your rights under this License. However, 4840 parties who have received copies, or rights, from you under this 4841 License will not have their licenses terminated so long as such 4842 parties remain in full compliance. 4843 4844 4845 10. FUTURE REVISIONS OF THIS LICENSE 4846 4847 The Free Software Foundation may publish new, revised versions 4848 of the GNU Free Documentation License from time to time. Such new 4849 versions will be similar in spirit to the present version, but may 4850 differ in detail to address new problems or concerns. See 4851 http://www.gnu.org/copyleft/. 4852 4853 Each version of the License is given a distinguishing version number. 4854 If the Document specifies that a particular numbered version of this 4855 License "or any later version" applies to it, you have the option of 4856 following the terms and conditions either of that specified version or 4857 of any later version that has been published (not as a draft) by the 4858 Free Software Foundation. If the Document does not specify a version 4859 number of this License, you may choose any version ever published (not 4860 as a draft) by the Free Software Foundation. 4861 4862 4863 ADDENDUM: How to use this License for your documents 4864 4865 To use this License in a document you have written, include a copy of 4866 the License in the document and put the following copyright and 4867 license notices just after the title page: 4868 4869 @smallexample 4870 Copyright (c) YEAR YOUR NAME. 4871 Permission is granted to copy, distribute and/or modify this document 4872 under the terms of the GNU Free Documentation License, Version 1.1 4873 or any later version published by the Free Software Foundation; 4874 with the Invariant Sections being LIST THEIR TITLES, with the 4875 Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. 4876 A copy of the license is included in the section entitled "GNU 4877 Free Documentation License". 4878 @end smallexample 4879 4880 If you have no Invariant Sections, write "with no Invariant Sections" 4881 instead of saying which ones are invariant. If you have no 4882 Front-Cover Texts, write "no Front-Cover Texts" instead of 4883 "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. 4884 4885 If your document contains nontrivial examples of program code, we 4886 recommend releasing these examples in parallel under your choice of 4887 free software license, such as the GNU General Public License, 4888 to permit their use in free software. 5575 @include fdl.texi 4889 5576 4890 5577 @node Index … … 4911 5598 @contents 4912 5599 @bye 4913 4914 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.