From: Roland McGrath Date: Tue, 18 Dec 2012 20:42:43 +0000 (+0000) Subject: ld/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d5777a34cbf1c1497e1c76f455381a643dfd2b1;p=binutils-gdb.git ld/ * ld.texinfo (Options): Describe -Trodata-segment. * ldlex.h (enum option_values): Add OPTION_TRODATA_SEGMENT. * lexsup.c (ld_options, parse_args): Handle -Trodata-segment. * scripttempl/elf.sc (RODATA_ADDR, SHLIB_RODATA_ADDR): Wrap SEGMENT_START("rodata-segment", ...) + SIZEOF_HEADERS around the value. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 1e6b7ccfa10..4a9f308d529 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2012-12-18 Roland McGrath + + * ld.texinfo (Options): Describe -Trodata-segment. + * ldlex.h (enum option_values): Add OPTION_TRODATA_SEGMENT. + * lexsup.c (ld_options, parse_args): Handle -Trodata-segment. + * scripttempl/elf.sc (RODATA_ADDR, SHLIB_RODATA_ADDR): Wrap + SEGMENT_START("rodata-segment", ...) + SIZEOF_HEADERS around the value. + 2012-12-17 Nick Clifton * MAINTAINERS: Add copyright notice. diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 679132c6735..c7ae2a55f98 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -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} @@ -1266,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 @@ -1394,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. @@ -1837,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 @@ -2214,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, @@ -2626,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. @@ -3197,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 @@ -4775,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 @@ -5296,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 @@ -6367,12 +6374,12 @@ 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 targeting 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 +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/. @@ -6964,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. diff --git a/ld/ldlex.h b/ld/ldlex.h index 441f673ae07..533a55bb411 100644 --- a/ld/ldlex.h +++ b/ld/ldlex.h @@ -68,6 +68,7 @@ enum option_values OPTION_TDATA, OPTION_TTEXT, OPTION_TTEXT_SEGMENT, + OPTION_TRODATA_SEGMENT, OPTION_TRADITIONAL_FORMAT, OPTION_UR, OPTION_VERBOSE, diff --git a/ld/lexsup.c b/ld/lexsup.c index be8a8974b5d..35041b19b9b 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -405,13 +405,13 @@ static const struct ld_option ld_options[] = { {"pic-executable", no_argument, NULL, OPTION_PIE}, '\0', NULL, NULL, TWO_DASHES }, { {"sort-common", optional_argument, NULL, OPTION_SORT_COMMON}, - '\0', N_("[=ascending|descending]"), - N_("Sort common symbols by alignment [in specified order]"), + '\0', N_("[=ascending|descending]"), + N_("Sort common symbols by alignment [in specified order]"), TWO_DASHES }, { {"sort_common", no_argument, NULL, OPTION_SORT_COMMON}, '\0', NULL, NULL, NO_HELP }, { {"sort-section", required_argument, NULL, OPTION_SORT_SECTION}, - '\0', N_("name|alignment"), + '\0', N_("name|alignment"), N_("Sort sections by name or maximum alignment"), TWO_DASHES }, { {"spare-dynamic-tags", required_argument, NULL, OPTION_SPARE_DYNAMIC_TAGS}, '\0', N_("COUNT"), N_("How many tags to reserve in .dynamic section"), @@ -441,6 +441,8 @@ static const struct ld_option ld_options[] = '\0', N_("ADDRESS"), N_("Set address of .text section"), ONE_DASH }, { {"Ttext-segment", required_argument, NULL, OPTION_TTEXT_SEGMENT}, '\0', N_("ADDRESS"), N_("Set address of text segment"), ONE_DASH }, + { {"Trodata-segment", required_argument, NULL, OPTION_TRODATA_SEGMENT}, + '\0', N_("ADDRESS"), N_("Set address of rodata segment"), ONE_DASH }, { {"unresolved-symbols=", required_argument, NULL, OPTION_UNRESOLVED_SYMBOLS}, '\0', NULL, N_("How to handle unresolved symbols. is:\n" @@ -1191,6 +1193,9 @@ parse_args (unsigned argc, char **argv) case OPTION_TTEXT_SEGMENT: set_segment_start (".text-segment", optarg); break; + case OPTION_TRODATA_SEGMENT: + set_segment_start (".rodata-segment", optarg); + break; case OPTION_TRADITIONAL_FORMAT: link_info.traditional_format = TRUE; break; diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 72d2af70d5c..cb162e8a86b 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -492,12 +492,26 @@ cat <