X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Fld.texinfo;h=c7ae2a55f982fc3a42f919ca97e6ab99da99eae6;hb=569283d40e3546979fd7c222c61408dd107de32b;hp=732fed68418635e5cda3cc3c45174c5d618bcb44;hpb=9aec8434173e7204c66c09cfae9fd16dc18fe3c5;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 732fed6841..c7ae2a55f9 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -55,7 +55,7 @@ This file documents the @sc{gnu} linker LD version @value{VERSION}. Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 @@ -93,7 +93,7 @@ section entitled ``GNU Free Documentation License''. @vskip 0pt plus 1filll @c man begin COPYRIGHT Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free +1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -372,9 +372,9 @@ Adds @var{AUDITLIB} to the @code{DT_AUDIT} entry of the dynamic section. specified in the library. If specified multiple times @code{DT_AUDIT} will contain a colon separated list of audit interfaces to use. If the linker finds an object with an audit entry while searching for shared libraries, -it will add a corresponding @code{DT_DEPAUDIT} entry in the output file. +it will add a corresponding @code{DT_DEPAUDIT} entry in the output file. This option is only meaningful on ELF platforms supporting the rtld-audit -interface. +interface. @ifset I960 @cindex architectures @@ -472,7 +472,7 @@ Adds @var{AUDITLIB} to the @code{DT_DEPAUDIT} entry of the dynamic section. specified in the library. If specified multiple times @code{DT_DEPAUDIT} will contain a colon separated list of audit interfaces to use. This option is only meaningful on ELF platforms supporting the rtld-audit interface. -The -P option is provided for Solaris compatibility. +The -P option is provided for Solaris compatibility. @cindex entry point, from command line @kindex -e @var{entry} @@ -1024,6 +1024,11 @@ shared libraries are still allowed. @item execstack Marks the object as requiring executable stack. +@item global +This option is only meaningful when building a shared object. It makes +the symbols defined by this shared object available for symbol resolution +of subsequently loaded libraries. + @item initfirst This option is only meaningful when building a shared object. It marks the object so that its runtime initialization will occur @@ -1093,6 +1098,11 @@ Set the emulation maximum page size to @var{value}. @item common-page-size=@var{value} Set the emulation common page size to @var{value}. +@item stack-size=@var{value} +Specify a stack size for in an ELF @code{PT_GNU_STACK} segment. +Specifying zero will override any default non-zero sized +@code{PT_GNU_STACK} segment creation. + @end table Other keywords are ignored for Solaris compatibility. @@ -1256,7 +1266,7 @@ option. @kindex --no-copy-dt-needed-entries @item --copy-dt-needed-entries @itemx --no-copy-dt-needed-entries -This option affects the treatment of dynamic libraries referred to +This option affects the treatment of dynamic libraries referred to by DT_NEEDED tags @emph{inside} ELF dynamic libraries mentioned on the command line. Normally the linker won't add a DT_NEEDED tag to the output binary for each library mentioned in a DT_NEEDED tag in an @@ -1384,7 +1394,7 @@ the linker recursively marks as used any section referenced by their relocations. See @samp{--entry} and @samp{--undefined}. This option can be set when doing a partial link (enabled with option -@samp{-r}). In this case the root of symbols kept must be explicitly +@samp{-r}). In this case the root of symbols kept must be explicitly specified either by an @samp{--entry} or @samp{--undefined} option or by a @code{ENTRY} command in the linker script. @@ -1598,7 +1608,7 @@ On some platforms the @samp{--relax} option performs target specific, global optimizations that become possible when the linker resolves addressing in the program, such as relaxing address modes, synthesizing new instructions, selecting shorter version of current -instructions, and combinig constant values. +instructions, and combining constant values. On some platforms these link time global optimizations may make symbolic debugging of the resulting executable impossible. @@ -1827,6 +1837,13 @@ Same as @option{--section-start}, with @code{.bss}, @code{.data} or When creating an ELF executable or shared object, it will set the address of the first byte of the text segment. +@kindex -Trodata-segment=@var{org} +@item -Trodata-segment=@var{org} +@cindex rodata segment origin, cmd line +When creating an ELF executable or shared object for a target where +the read-only data is in its own segment separate from the executable +text, it will set the address of the first byte of the read-only data segment. + @kindex --unresolved-symbols @item --unresolved-symbols=@var{method} Determine how to handle unresolved symbols. There are four possible @@ -1884,10 +1901,10 @@ symbols marked @samp{local} in the version script will not be exported. @cindex combining symbols, warnings on @item --warn-common Warn when a common symbol is combined with another common symbol or with -a symbol definition. Unix linkers allow this somewhat sloppy practise, +a symbol definition. Unix linkers allow this somewhat sloppy practice, but linkers on some other operating systems do not. This option allows you to find potential problems from combining global symbols. -Unfortunately, some C libraries use this practise, so you may get some +Unfortunately, some C libraries use this practice, so you may get some warnings about symbols in the libraries as well as in your programs. There are three kinds of global symbols, illustrated here by C examples: @@ -2204,8 +2221,8 @@ allow their use in executable images as well, or to (probably pointlessly!) disallow it in object files, by using these two options. Executable images generated with these long section names are slightly non-standard, carrying as they do a string table, and may generate confusing output when examined -with non-GNU PE-aware tools, such as file viewers and dumpers. However, -GDB relies on the use of PE long section names to find Dwarf-2 debug +with non-GNU PE-aware tools, such as file viewers and dumpers. However, +GDB relies on the use of PE long section names to find Dwarf-2 debug information sections in an executable image at runtime, and so if neither option is specified on the command-line, @command{ld} will enable long section names, overriding the default and technically correct behaviour, @@ -2475,7 +2492,7 @@ extern_ll --> A third method of dealing with this difficulty is to abandon 'auto-import' for the offending symbol and mark it with -@code{__declspec(dllimport)}. However, in practise that +@code{__declspec(dllimport)}. However, in practice that requires using compile-time #defines to indicate whether you are building a DLL, building client code that will link to the DLL, or merely building/linking to a static library. In making the choice @@ -2616,7 +2633,7 @@ Do not bind this image. @kindex --wdmdriver @item --wdmdriver The driver uses the MS Windows Driver Model. - + @kindex --tsaware @item --tsaware The image is Terminal Server aware. @@ -3187,7 +3204,7 @@ systems come with three different memory setups @code{A}, @code{B} and @code{C}: @multitable @columnfractions .25 .25 .25 .25 @item Section @tab Variant A @tab Variant B @tab Variant C -@item .text @tab RAM @tab ROM @tab ROM +@item .text @tab RAM @tab ROM @tab ROM @item .rodata @tab RAM @tab ROM @tab ROM2 @item .data @tab RAM @tab RAM/ROM @tab RAM/ROM2 @item .bss @tab RAM @tab RAM @tab RAM @@ -3410,6 +3427,7 @@ the symbol and place it into the symbol table with a global scope. @menu * Simple Assignments:: Simple Assignments +* HIDDEN:: HIDDEN * PROVIDE:: PROVIDE * PROVIDE_HIDDEN:: PROVIDE_HIDDEN * Source Code Reference:: How to use a linker script defined symbol in source code @@ -3473,6 +3491,31 @@ the last @samp{.text} input section. The symbol @samp{_bdata} will be defined as the address following the @samp{.text} output section aligned upward to a 4 byte boundary. +@node HIDDEN +@subsection HIDDEN +@cindex HIDDEN +For ELF targeted ports, define a symbol that will be hidden and won't be +exported. The syntax is @code{HIDDEN(@var{symbol} = @var{expression})}. + +Here is the example from @ref{Simple Assignments}, rewritten to use +@code{HIDDEN}: + +@smallexample +HIDDEN(floating_point = 0); +SECTIONS +@{ + .text : + @{ + *(.text) + HIDDEN(_etext = .); + @} + HIDDEN(_bdata = (. + 3) & ~ 3); + .data : @{ *(.data) @} +@} +@end smallexample +@noindent +In this case none of the three symbols will be visible outside this module. + @node PROVIDE @subsection PROVIDE @cindex PROVIDE @@ -4038,6 +4081,10 @@ treated as nested sorting command. If the section sorting command in linker script is nested, the command line option will be ignored. +@cindex SORT_NONE +@code{SORT_NONE} disables section sorting by ignoring the command line +section sorting option. + If you ever get confused about where input sections are going, use the @samp{-M} linker option to generate a map file. The map file shows precisely how input sections are mapped to output sections. @@ -4624,7 +4671,7 @@ OVERLAY [@var{start}] : [NOCROSSREFS] [AT ( @var{ldaddr} )] Everything is optional except @code{OVERLAY} (a keyword), and each section must have a name (@var{secname1} and @var{secname2} above). The section definitions within the @code{OVERLAY} construct are identical to -those within the general @code{SECTIONS} contruct (@pxref{SECTIONS}), +those within the general @code{SECTIONS} construct (@pxref{SECTIONS}), except that no addresses and no memory regions may be defined for sections within an @code{OVERLAY}. @@ -4735,7 +4782,7 @@ Region names are stored in a separate name space, and will not conflict with symbol names, file names, or section names. Each memory region must have a distinct name within the @code{MEMORY} command. However you can add later alias names to existing memory regions with the @ref{REGION_ALIAS} -command. +command. @cindex memory region attributes The @var{attr} string is an optional list of attributes that specify @@ -5202,7 +5249,7 @@ All constants are integers. As in C, the linker considers an integer beginning with @samp{0} to be octal, and an integer beginning with @samp{0x} or @samp{0X} to be hexadecimal. Alternatively the linker accepts suffixes of @samp{h} or -@samp{H} for hexadeciaml, @samp{o} or @samp{O} for octal, @samp{b} or +@samp{H} for hexadecimal, @samp{o} or @samp{O} for octal, @samp{b} or @samp{B} for binary and @samp{d} or @samp{D} for decimal. Any integer value without a prefix or a suffix is considered to be decimal. @@ -5256,7 +5303,7 @@ The target's default page size. So for example: @smallexample - .text ALIGN (CONSTANT (MAXPAGESIZE)) : @{ *(.text) @} + .text ALIGN (CONSTANT (MAXPAGESIZE)) : @{ *(.text) @} @end smallexample will create a text section aligned to the largest page boundary @@ -5616,14 +5663,18 @@ addresses, ld follows these rules to evaluate terms: @itemize @bullet @item +Unary operations on an absolute address or number, and binary +operations on two absolute addresses or two numbers, or between one +absolute address and a number, apply the operator to the value(s). +@item Unary operations on a relative address, and binary operations on two relative addresses in the same section or between one relative address and a number, apply the operator to the offset part of the address(es). @item -Unary operations on an absolute address, and binary operations on one -or more absolute addresses or on two relative addresses not in the -same section, first convert any non-absolute term to an absolute -address before applying the operator. +Other binary operations, that is, between two relative addresses not +in the same section, or between a relative address and an absolute +address, first convert any non-absolute term to an absolute address +before applying the operator. @end itemize The result section of each sub-expression is as follows: @@ -5635,7 +5686,7 @@ An operation involving only numbers results in a number. The result of comparisons, @samp{&&} and @samp{||} is also a number. @item The result of other binary arithmetic and logical operations on two -relative addresses in the same section or two absolute addresess +relative addresses in the same section or two absolute addresses (after above conversions) is also a number. @item The result of other operations on relative addresses or one @@ -6219,7 +6270,7 @@ executing in Thumb mode straight away. @kindex --use-nul-prefixed-import-tables The @samp{--use-nul-prefixed-import-tables} switch is specifying, that the import tables idata4 and idata5 have to be generated with a zero -elememt prefix for import libraries. This is the old style to generate +element prefix for import libraries. This is the old style to generate import tables. By default this option is turned off. @cindex BE8 @@ -6277,7 +6328,7 @@ BX Rn This allows generation of libraries/applications that work on ARMv4 cores and are still interworking safe. Note that the above veneer clobbers the -condition flags, so may cause incorrect progrm behavior in rare cases. +condition flags, so may cause incorrect program behavior in rare cases. @cindex USE_BLX @kindex --use-blx @@ -6323,13 +6374,13 @@ are sufficient to avoid the erratum in both the scalar and vector cases. @cindex ARM1176 erratum workaround @kindex --fix-arm1176 @kindex --no-fix-arm1176 -The @samp{--fix-arm1176} switch enables a link-time workaround for an erratum -in certain ARM1176 processors. The workaround is enabled by default if you -are targetting ARM v6 (excluding ARM v6T2) or earlier. It can be disabled +The @samp{--fix-arm1176} switch enables a link-time workaround for an erratum +in certain ARM1176 processors. The workaround is enabled by default if you +are targeting ARM v6 (excluding ARM v6T2) or earlier. It can be disabled unconditionally by specifying @samp{--no-fix-arm1176}. -Further information is available in the ``ARM1176JZ-S and ARM1176JZF-S -Programmer Advice Notice'' available on the ARM documentaion website at: +Further information is available in the ``ARM1176JZ-S and ARM1176JZF-S +Programmer Advice Notice'' available on the ARM documentation website at: http://infocenter.arm.com/. @cindex NO_ENUM_SIZE_WARNING @@ -6364,7 +6415,7 @@ perform a function call to a symbol that is too far away. The placement of these sequences of instructions - called stubs - is controlled by the command line option @option{--stub-group-size=N}. The placement is important because a poor choice can create a need for -duplicate stubs, increasing the code sizw. The linker will try to +duplicate stubs, increasing the code size. The linker will try to group stubs together in order to reduce interruptions to the flow of code, but it needs guidance as to how big these groups should be and where they should be placed. @@ -6920,7 +6971,7 @@ When auto-export is in operation, @command{ld} will export all the non-local symbols known to belong to the system's runtime and libraries. As it will often not be desirable to export all of a DLL's symbols, which may include private functions that are not part of any public interface, the command-line -options listed above may be used to filter symbols out from the list for +options listed above may be used to filter symbols out from the list for exporting. The @samp{--output-def} option can be used in order to see the final list of exported symbols with all exclusions taken into effect.