* ld.texinfo (-Tldata-segment): Describe.
authorAlan Modra <amodra@gmail.com>
Mon, 14 Jan 2013 13:37:10 +0000 (13:37 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 14 Jan 2013 13:37:10 +0000 (13:37 +0000)
* ldlex.h (OPTION_TLDATA_SEGMENT): New enum value.
* lexsup.c (ld_options): Add -Tldata-segment.
(parse_args): Handle OPTION_TLDATA_SEGMENT.
* scripttempl/elf.sc: Support LARGE_DATA_ADDR.

ld/ChangeLog
ld/ld.texinfo
ld/ldlex.h
ld/lexsup.c
ld/scripttempl/elf.sc

index 860f05a872c16de5c79956381fa0734c35a67004..cfbe79981edddda69fdd70e2089351f3b4308b5e 100644 (file)
@@ -1,3 +1,12 @@
+2013-01-14  Leif Ekblad <leif@rdos.net>
+           Alan Modra  <amodra@gmail.com>
+
+       * ld.texinfo (-Tldata-segment): Describe.
+       * ldlex.h (OPTION_TLDATA_SEGMENT): New enum value.
+       * lexsup.c (ld_options): Add -Tldata-segment.
+       (parse_args): Handle OPTION_TLDATA_SEGMENT.
+       * scripttempl/elf.sc: Support LARGE_DATA_ADDR.
+
 2013-01-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * deffilep.y: Remove trailing white spaces.
index 4777ad50aca710d543086bd436bea05e34701f1d..2429668728c9c535b0043a230fcdc43bbe9689f2 100644 (file)
@@ -1846,6 +1846,12 @@ 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 -Tldata-segment=@var{org}
+@item -Tldata-segment=@var{org}
+@cindex ldata segment origin, cmd line
+When creating an ELF executable or shared object for x86-64 medium memory
+model, it will set the address of the first byte of the ldata segment.
+
 @kindex --unresolved-symbols
 @item --unresolved-symbols=@var{method}
 Determine how to handle unresolved symbols.  There are four possible
index 533a55bb4117c9b699dcd03aa925e5be0068b9e4..99f4282a39218287aa69d349353c6fe1354ef3b4 100644 (file)
@@ -69,6 +69,7 @@ enum option_values
   OPTION_TTEXT,
   OPTION_TTEXT_SEGMENT,
   OPTION_TRODATA_SEGMENT,
+  OPTION_TLDATA_SEGMENT,
   OPTION_TRADITIONAL_FORMAT,
   OPTION_UR,
   OPTION_VERBOSE,
index 4fd929a6ba54f9fe3c96c990eca9d987977a2164..2f717502465f935bd1be434581c1e2d784dcacee 100644 (file)
@@ -446,6 +446,8 @@ static const struct ld_option ld_options[] =
     '\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 },
+  { {"Tldata-segment", required_argument, NULL, OPTION_TLDATA_SEGMENT},
+    '\0', N_("ADDRESS"), N_("Set address of ldata segment"), ONE_DASH },
   { {"unresolved-symbols=<method>", required_argument, NULL,
      OPTION_UNRESOLVED_SYMBOLS},
     '\0', NULL, N_("How to handle unresolved symbols.  <method> is:\n"
@@ -1199,6 +1201,9 @@ parse_args (unsigned argc, char **argv)
        case OPTION_TRODATA_SEGMENT:
          set_segment_start (".rodata-segment", optarg);
          break;
+       case OPTION_TLDATA_SEGMENT:
+         set_segment_start (".ldata-segment", optarg);
+         break;
        case OPTION_TRADITIONAL_FORMAT:
          link_info.traditional_format = TRUE;
          break;
index cf3f6d8c745fa14be34264395d7634390ee7c458..bbff2337e45f836fa626405c8c69858541879ed2 100644 (file)
@@ -608,6 +608,15 @@ cat <<EOF
   ${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
   ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+EOF
+
+LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${LARGE_DATA_ADDR-.});"
+SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_ADDR-.});"
+
+  cat <<EOF
+  ${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}}
+  ${RELOCATING+${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}}
+  ${RELOCATING+${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}}
   ${LARGE_SECTIONS}
   ${LARGE_BSS_AFTER_BSS-${LARGE_BSS}}
   ${RELOCATING+. = ALIGN(${ALIGNMENT});}