Blame SOURCES/binutils-rh1175624.patch

d570a8
Binary files a/bfd/.elf64-ppc.c.swp and b/bfd/.elf64-ppc.c.swp differ
d570a8
diff -Nrup a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh
d570a8
--- a/ld/emulparams/elf64ppc.sh	2013-02-27 13:28:03.000000000 -0700
d570a8
+++ b/ld/emulparams/elf64ppc.sh	2015-03-27 14:03:16.832434850 -0600
d570a8
@@ -15,11 +15,8 @@ ARCH=powerpc:common64
d570a8
 MACHINE=
d570a8
 NOP=0x60000000
d570a8
 OTHER_TEXT_SECTIONS="*(.sfpr .glink)"
d570a8
-BSS_PLT=
d570a8
-OTHER_BSS_SYMBOLS="
d570a8
+OTHER_SDATA_SECTIONS="
d570a8
   .tocbss	${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.tocbss)}"
d570a8
-OTHER_PLT_RELOC_SECTIONS="
d570a8
-  .rela.tocbss	${RELOCATING-0} : { *(.rela.tocbss) }"
d570a8
 
d570a8
 if test x${RELOCATING+set} = xset; then
d570a8
   GOT="
d570a8
@@ -34,11 +31,22 @@ INITIAL_RELOC_SECTIONS="
d570a8
   .rela.opd	${RELOCATING-0} : { *(.rela.opd) }"
d570a8
 OTHER_GOT_RELOC_SECTIONS="
d570a8
   .rela.toc	${RELOCATING-0} : { *(.rela.toc) }
d570a8
+  .rela.toc1	${RELOCATING-0} : { *(.rela.toc1) }
d570a8
+  .rela.tocbss	${RELOCATING-0} : { *(.rela.tocbss) }
d570a8
   .rela.branch_lt	${RELOCATING-0} : { *(.rela.branch_lt) }"
d570a8
-OTHER_READWRITE_SECTIONS="
d570a8
-  .toc1		${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) }
d570a8
+OTHER_RELRO_SECTIONS_2="
d570a8
   .opd		${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) }
d570a8
+  .toc1		${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) }
d570a8
   .branch_lt	${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.branch_lt) }"
d570a8
+# Put .got before .data
d570a8
+DATA_GOT=" "
d570a8
+# Always make .got read-only after relocation
d570a8
+SEPARATE_GOTPLT=0
d570a8
+# Also put .sdata before .data
d570a8
+DATA_SDATA=" "
d570a8
+# and .plt/.iplt before .data
d570a8
+DATA_PLT=
d570a8
+PLT_BEFORE_GOT=" "
d570a8
 
d570a8
 # Treat a host that matches the target with the possible exception of "64"
d570a8
 # in the name as if it were native.
d570a8
diff -Nrup a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
d570a8
--- a/ld/scripttempl/elf.sc	2013-02-27 13:28:03.000000000 -0700
d570a8
+++ b/ld/scripttempl/elf.sc	2015-03-27 13:34:43.700386810 -0600
d570a8
@@ -14,6 +14,7 @@
d570a8
 #		(e.g., .PARISC.global)
d570a8
 #	OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
d570a8
 #		(e.g. PPC32 .fixup, .got[12])
d570a8
+#	OTHER_RELRO_SECTIONS_2 - as above, but after .dynamic in text segment
d570a8
 #	OTHER_BSS_SECTIONS - other than .bss .sbss ...
d570a8
 #	ATTRS_SECTIONS - at the end
d570a8
 #	OTHER_SECTIONS - at the end
d570a8
@@ -195,12 +196,12 @@ if test -z "${NO_SMALL_DATA}"; then
d570a8
 else
d570a8
   NO_SMALL_DATA=" "
d570a8
 fi
d570a8
-if test -z "${DATA_GOT}"; then
d570a8
+if test -z "${SDATA_GOT}${DATA_GOT}"; then
d570a8
   if test -n "${NO_SMALL_DATA}"; then
d570a8
     DATA_GOT=" "
d570a8
   fi
d570a8
 fi
d570a8
-if test -z "${SDATA_GOT}"; then
d570a8
+if test -z "${SDATA_GOT}${DATA_GOT}"; then
d570a8
   if test -z "${NO_SMALL_DATA}"; then
d570a8
     SDATA_GOT=" "
d570a8
   fi
d570a8
@@ -593,10 +594,16 @@ cat <
d570a8
   ${RELOCATING+${DATARELRO}}
d570a8
   ${OTHER_RELRO_SECTIONS}
d570a8
   ${TEXT_DYNAMIC-${DYNAMIC}}
d570a8
+  ${OTHER_RELRO_SECTIONS_2}
d570a8
+  ${DATA_GOT+${RELRO_NOW+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}}
d570a8
   ${DATA_GOT+${RELRO_NOW+${GOT}}}
d570a8
   ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
d570a8
   ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
d570a8
   ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
d570a8
+  ${DATA_SDATA+${SDATA}}
d570a8
+  ${DATA_SDATA+${OTHER_SDATA_SECTIONS}}
d570a8
+  ${DATA_SDATA+${SBSS}}
d570a8
+  ${DATA_GOT+${RELRO_NOW-${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}}
d570a8
   ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
d570a8
   ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
d570a8
 
d570a8
@@ -613,17 +620,17 @@ cat <
d570a8
   ${OTHER_READWRITE_SECTIONS}
d570a8
   ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
d570a8
   ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
d570a8
-  ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}
d570a8
+  ${SDATA_GOT+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}
d570a8
   ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS+. = .; ${OTHER_GOT_SYMBOLS}}}}
d570a8
   ${SDATA_GOT+${GOT}}
d570a8
   ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
d570a8
-  ${SDATA}
d570a8
-  ${OTHER_SDATA_SECTIONS}
d570a8
+  ${DATA_SDATA-${SDATA}}
d570a8
+  ${DATA_SDATA-${OTHER_SDATA_SECTIONS}}
d570a8
   ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
d570a8
   ${RELOCATING+. = .;}
d570a8
   ${RELOCATING+${USER_LABEL_PREFIX}__bss_start = .;}
d570a8
   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
d570a8
-  ${SBSS}
d570a8
+  ${DATA_SDATA-${SBSS}}
d570a8
   ${BSS_PLT+${PLT}}
d570a8
   .${BSS_NAME}          ${RELOCATING-0} :
d570a8
   {
d570a8
diff -Nrup a/ld/testsuite/ld-powerpc/tlsexe.r b/ld/testsuite/ld-powerpc/tlsexe.r
d570a8
--- a/ld/testsuite/ld-powerpc/tlsexe.r	2013-02-27 13:28:03.000000000 -0700
d570a8
+++ b/ld/testsuite/ld-powerpc/tlsexe.r	2015-03-30 11:49:48.375693373 -0600
d570a8
@@ -68,7 +68,7 @@ Symbol table '\.dynsym' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +9 ld2
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
d570a8
 .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 _end
d570a8
 
d570a8
 Symbol table '\.symtab' contains [0-9]+ entries:
d570a8
@@ -109,7 +109,7 @@ Symbol table '\.symtab' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +9 ld1
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
d570a8
 .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 _end
d570a8
 .* TLS +GLOBAL +DEFAULT +9 gd0
d570a8
 .* TLS +GLOBAL +DEFAULT +9 ie0
d570a8
diff -Nrup a/ld/testsuite/ld-powerpc/tlsexetoc.r b/ld/testsuite/ld-powerpc/tlsexetoc.r
d570a8
--- a/ld/testsuite/ld-powerpc/tlsexetoc.r	2013-02-27 13:28:03.000000000 -0700
d570a8
+++ b/ld/testsuite/ld-powerpc/tlsexetoc.r	2015-03-30 11:50:06.585286881 -0600
d570a8
@@ -67,7 +67,7 @@ Symbol table '\.dynsym' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +UND ld
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
d570a8
 .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 _end
d570a8
 
d570a8
 Symbol table '\.symtab' contains [0-9]+ entries:
d570a8
@@ -109,7 +109,7 @@ Symbol table '\.symtab' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +9 ld1
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start
d570a8
 .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +12 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +12 _end
d570a8
 .* TLS +GLOBAL +DEFAULT +9 gd0
d570a8
 .* TLS +GLOBAL +DEFAULT +9 ie0
d570a8
diff -Nrup a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r
d570a8
--- a/ld/testsuite/ld-powerpc/tlsso.r	2013-02-27 13:28:03.000000000 -0700
d570a8
+++ b/ld/testsuite/ld-powerpc/tlsso.r	2015-03-30 11:50:38.871566156 -0600
d570a8
@@ -81,7 +81,7 @@ Symbol table '\.dynsym' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld2
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld1
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 __bss_start
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 _end
d570a8
 .* TLS +GLOBAL +DEFAULT +8 gd0
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ie0
d570a8
@@ -123,7 +123,7 @@ Symbol table '\.symtab' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld2
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld1
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 __bss_start
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 _end
d570a8
 .* TLS +GLOBAL +DEFAULT +8 gd0
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ie0
d570a8
diff -Nrup a/ld/testsuite/ld-powerpc/tlstocso.r b/ld/testsuite/ld-powerpc/tlstocso.r
d570a8
--- a/ld/testsuite/ld-powerpc/tlstocso.r	2013-02-27 13:28:03.000000000 -0700
d570a8
+++ b/ld/testsuite/ld-powerpc/tlstocso.r	2015-03-30 11:50:55.687190782 -0600
d570a8
@@ -76,7 +76,7 @@ Symbol table '\.dynsym' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld2
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld1
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 __bss_start
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 _end
d570a8
 .* TLS +GLOBAL +DEFAULT +8 gd0
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ie0
d570a8
@@ -119,7 +119,7 @@ Symbol table '\.symtab' contains [0-9]+
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld2
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ld1
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 __bss_start
d570a8
-.* NOTYPE +GLOBAL +DEFAULT +10 _edata
d570a8
+.* NOTYPE +GLOBAL +DEFAULT +11 _edata
d570a8
 .* NOTYPE +GLOBAL +DEFAULT +11 _end
d570a8
 .* TLS +GLOBAL +DEFAULT +8 gd0
d570a8
 .* TLS +GLOBAL +DEFAULT +8 ie0