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