Don't hardcode .got.plt into DATA_SEGMENT_RELRO_END evaluation
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 11 Jun 2012 13:23:51 +0000 (13:23 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 11 Jun 2012 13:23:51 +0000 (13:23 +0000)
ld/

PR ld/14215
* ldexp.c (fold_name <SIZEOF, ALIGNOF>): Allow forward section
references.
* emulparams/elf32_x86_64.sh (SEPARATE_GOTPLT): Depend on size of
.got.plt.
* emulparams/elf32mb_linux.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf32tilegx.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf32tilepro.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf64tilegx.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf_i386.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf_k1om.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf_l1om.sh (SEPARATE_GOTPLT): Likewise.
* emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Likewise.

ld/testsuite/

PR ld/14215
* ld-i386/i386.exp: Run pr14215.
* ld-x86-64/x86-64.exp: Likewise.

* ld-i386/pr14215.d: New file.
* ld-i386/pr14215.s: Likewise.
* ld-x86-64/pr14215.d: Likewise.
* ld-x86-64/pr14215.s: Likewise.

18 files changed:
ld/ChangeLog
ld/emulparams/elf32_x86_64.sh
ld/emulparams/elf32mb_linux.sh
ld/emulparams/elf32tilegx.sh
ld/emulparams/elf32tilepro.sh
ld/emulparams/elf64tilegx.sh
ld/emulparams/elf_i386.sh
ld/emulparams/elf_k1om.sh
ld/emulparams/elf_l1om.sh
ld/emulparams/elf_x86_64.sh
ld/ldexp.c
ld/testsuite/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr14215.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr14215.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr14215.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr14215.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index e292ea45905eec6e9865d7e830730e9f638163c2..eb9bfbd9233c1846c797713dc89f74413d8bf456 100644 (file)
@@ -1,3 +1,19 @@
+2012-06-11  Alan Modra  <amodra@gmail.com>
+
+       PR ld/14215
+       * ldexp.c (fold_name <SIZEOF, ALIGNOF>): Allow forward section
+       references.
+       * emulparams/elf32_x86_64.sh (SEPARATE_GOTPLT): Depend on size of
+       .got.plt.
+       * emulparams/elf32mb_linux.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf32tilegx.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf32tilepro.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf64tilegx.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf_i386.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf_k1om.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf_l1om.sh (SEPARATE_GOTPLT): Likewise.
+       * emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Likewise.
+
 2012-06-07  Georg-Johann Lay  <avr@gjlay.de>
 
        PR 13697
index fb9400312b2bf54a1b95de4d2ff6d158df0b97b9..bc77c85f020eabf2cd88f6b5c4a983483bef3b9c 100644 (file)
@@ -13,7 +13,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
 LARGE_SECTIONS=yes
-SEPARATE_GOTPLT=24
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 24 ? 24 : 0"
 IREL_IN_PLT=
 
 if [ "x${host}" = "x${target}" ]; then
index 3503bb1a7a530643d27e1d100db3bc2291832c35..f26f1a0c3a8e4af3f42ff96a2fb4dbadeffe93c9 100644 (file)
@@ -13,5 +13,5 @@ TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
-SEPARATE_GOTPLT=12
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 12 ? 12 : 0"
       
index 92121e7ef273e74ec3f3e153178082cd47ec96af..faf3ee0386797f3cbca3137f5efcf590c28eb6ca 100644 (file)
@@ -16,7 +16,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_COMBRELOC_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
-SEPARATE_GOTPLT=8
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 8 ? 8 : 0"
 # Look for 32 bit target libraries in /lib32, /usr/lib32 etc., first.
 LIBPATH_SUFFIX=32
 OTHER_SECTIONS="
index 5fb4443f163745c80bc6a22640aeed1a0310e071..01d84bcff38785d56d5f0c36e1cdcad6aa43c257 100644 (file)
@@ -17,7 +17,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_COMBRELOC_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
-SEPARATE_GOTPLT=8
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 8 ? 8 : 0"
 OTHER_SECTIONS="
   /* TILEPRO architecture interrupt vector areas */
   .intrpt0 0xfc000000 : { KEEP(*(.intrpt0)) }
index 6ac9fa83ae8af5261479930cf2c39ee36532535d..51cbef7f3da19a45add823415973d659868979a5 100644 (file)
@@ -17,7 +17,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_COMBRELOC_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
-SEPARATE_GOTPLT=16
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 16 ? 16 : 0"
 OTHER_SECTIONS="
   /* TILE architecture interrupt vector areas */
   .intrpt0 0xfffffffffc000000 : { KEEP(*(.intrpt0)) }
index 2b2f910fd6ad75aaeb1a0087b229a59f9a99f7cf..665a1ad36600a195cbd20e88ae470c3f7285b6ce 100644 (file)
@@ -11,5 +11,5 @@ TEMPLATE_NAME=elf32
 GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
-SEPARATE_GOTPLT=12
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 12 ? 12 : 0"
 IREL_IN_PLT=
index d28ffc0761b9885ed18e8f2ad67f7686cdfdde2b..e77b2b0084824daeeb4f018d8f38b1c765c6ac97 100644 (file)
@@ -14,7 +14,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
 LARGE_SECTIONS=yes
-SEPARATE_GOTPLT=24
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 24 ? 24 : 0"
 
 if [ "x${host}" = "x${target}" ]; then
   case " $EMULATION_LIBPATH " in
index 80152fea304d076f3fad630e5a83749a7aa8e079..624f4b305d7c8d5242472cb9e89c18b2c1e2ff0a 100644 (file)
@@ -14,7 +14,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
 LARGE_SECTIONS=yes
-SEPARATE_GOTPLT=24
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 24 ? 24 : 0"
 
 if [ "x${host}" = "x${target}" ]; then
   case " $EMULATION_LIBPATH " in
index c38e8453ce083606f71d639bda8f961da8ab3f4e..f1b60cba884cc92eb6903a228e963466674bd02b 100644 (file)
@@ -13,7 +13,7 @@ GENERATE_SHLIB_SCRIPT=yes
 GENERATE_PIE_SCRIPT=yes
 NO_SMALL_DATA=yes
 LARGE_SECTIONS=yes
-SEPARATE_GOTPLT=24
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 24 ? 24 : 0"
 IREL_IN_PLT=
 
 if [ "x${host}" = "x${target}" ]; then
index 3bddc813e0d50b8bca8e86a52d0930cbf243ca4e..d83e274f273e9476e3ad7bf4ce1c456790466003 100644 (file)
@@ -681,7 +681,7 @@ fold_name (etree_type *tree)
                       tree, tree->name.name);
              new_number (0);
            }
-         else if (os->processed_vma)
+         else if (os->bfd_section != NULL)
            {
              bfd_vma val;
 
@@ -693,6 +693,8 @@ fold_name (etree_type *tree)
              
              new_number (val);
            }
+         else
+           new_number (0);
        }
       break;
 
index a37ddc11223250f21728c523de639611b066426c..ba73f8c11b0d5d1f78add81a5a8cfe56ccf55b97 100644 (file)
@@ -1,3 +1,14 @@
+2012-06-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/14215
+       * ld-i386/i386.exp: Run pr14215.
+       * ld-x86-64/x86-64.exp: Likewise.
+
+       * ld-i386/pr14215.d: New file.
+       * ld-i386/pr14215.s: Likewise.
+       * ld-x86-64/pr14215.d: Likewise.
+       * ld-x86-64/pr14215.s: Likewise.
+
 2012-06-06  Alan Modra  <amodra@gmail.com>
 
        * ld-alpha/tlsbin.rd, * ld-alpha/tlsbinr.rd, * ld-alpha/tlspic.rd,
index 47f918fa187fafcbffe5508a36b971474c1623d2..03367ca12960cb7a6d81045955dabbb9dc2289f4 100644 (file)
@@ -245,3 +245,4 @@ if { !([istarget "i?86-*-linux*"]
 run_dump_test "compressed1"
 run_dump_test "pr12627"
 run_dump_test "pr13302"
+run_dump_test "pr14215"
diff --git a/ld/testsuite/ld-i386/pr14215.d b/ld/testsuite/ld-i386/pr14215.d
new file mode 100644 (file)
index 0000000..78ec994
--- /dev/null
@@ -0,0 +1,9 @@
+#name: PR ld/14215
+#as: --32
+#ld: -melf_i386 -shared -z relro
+#readelf: -l --wide
+
+#failif
+#...
+   03     .dynamic .got .data 
+#...
diff --git a/ld/testsuite/ld-i386/pr14215.s b/ld/testsuite/ld-i386/pr14215.s
new file mode 100644 (file)
index 0000000..df0cbc2
--- /dev/null
@@ -0,0 +1,4 @@
+       .section .got
+       .space 0x2a8, 4
+       .data
+       .zero 12
diff --git a/ld/testsuite/ld-x86-64/pr14215.d b/ld/testsuite/ld-x86-64/pr14215.d
new file mode 100644 (file)
index 0000000..7d8e90d
--- /dev/null
@@ -0,0 +1,9 @@
+#name: PR ld/14215
+#as: --64
+#ld: -melf_x86_64 -shared -z relro
+#readelf: -l --wide
+
+#failif
+#...
+   03     .dynamic .got .data 
+#...
diff --git a/ld/testsuite/ld-x86-64/pr14215.s b/ld/testsuite/ld-x86-64/pr14215.s
new file mode 100644 (file)
index 0000000..281b638
--- /dev/null
@@ -0,0 +1,4 @@
+       .section .got
+       .space 0x2a8, 4
+       .data
+       .zero 24
index 7d2934f9b5213a53f0b8c11d33056e36430ae54e..b9af8dea93c53403a7aa4d36f2787fc0551a25bd 100644 (file)
@@ -208,6 +208,7 @@ run_dump_test "pr12921"
 run_dump_test "pr13947"
 run_dump_test "pr12570a"
 run_dump_test "pr12570b"
+run_dump_test "pr14215"
 
 if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
     return
This page took 0.033117 seconds and 4 git commands to generate.