Reorder more powerpc64 sections again for -z relro
authorAlan Modra <amodra@gmail.com>
Tue, 20 Jan 2015 10:41:37 +0000 (21:11 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 20 Jan 2015 11:16:07 +0000 (21:46 +1030)
.toc1 is the second level TOC section used by gcc's -mminimal-toc.  It
too should be read-only after relocation.  Also, the last patch
description mentioned .sbss moving but didn't actually do that, so fix
that problem.  .tocbss (whatever that is) was before .sbss previously,
so move that one too.

* emulparams/elf64ppc.sh (OTHER_SDATA_SECTIONS): Use in place of..
(OTHER_BSS_SYMBOLS): ..this.
(OTHER_PLT_RELOC_SECTIONS): Don't define.
(OTHER_GOT_RELOC_SECTIONS): Add rela.toc1 and rela.tocbss.
(OTHER_READWRITE_SECTIONS): Don't define.  Move .toc1 to..
(OTHER_RELRO_SECTIONS_2): ..here.
* scripttempl/elf.sc: Move SBSS too when DATA_SDATA.

ld/ChangeLog
ld/emulparams/elf64ppc.sh
ld/scripttempl/elf.sc

index 4641ff06c8152d6752f5e746d7b74f62da46c113..5a97e32c64914415d1b768f9598b10762da8b1af 100644 (file)
@@ -5,6 +5,16 @@
        Display a special message for PROVIDE'd symbols that are not being
        provided.
 
+2015-01-20  Alan Modra  <amodra@gmail.com>
+
+       * emulparams/elf64ppc.sh (OTHER_SDATA_SECTIONS): Use in place of..
+       (OTHER_BSS_SYMBOLS): ..this.
+       (OTHER_PLT_RELOC_SECTIONS): Don't define.
+       (OTHER_GOT_RELOC_SECTIONS): Add rela.toc1 and rela.tocbss.
+       (OTHER_READWRITE_SECTIONS): Don't define.  Move .toc1 to..
+       (OTHER_RELRO_SECTIONS_2): ..here.
+       * scripttempl/elf.sc: Move SBSS too when DATA_SDATA.
+
 2015-01-20  Alan Modra  <amodra@gmail.com>
 
        * emulparams/elf64ppc.sh (BSS_PLT): Don't define.
index 89fc699baff34319a2e4825d6efa02e1719107c0..b805dbed93c41d5c8d3bf3ecfcdd54b24b18fec8 100644 (file)
@@ -15,10 +15,8 @@ unset SBSS_END_SYMBOLS
 unset OTHER_END_SYMBOLS
 unset OTHER_RELRO_SECTIONS
 OTHER_TEXT_SECTIONS="*(.sfpr .glink)"
-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="
@@ -33,11 +31,12 @@ 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=" "
index eb3312a452c8f2e087fe17af48e891cd5361dec5..c9c80b0cc3ed7a8df252586be1835d909428b44a 100644 (file)
@@ -582,6 +582,7 @@ cat <<EOF
   ${INITIAL_READWRITE_SECTIONS}
   ${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}}}
@@ -609,7 +610,7 @@ cat <<EOF
   ${RELOCATING+. = .;}
   ${RELOCATING+${USER_LABEL_PREFIX}__bss_start = .;}
   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
-  ${SBSS}
+  ${DATA_SDATA-${SBSS}}
   ${BSS_PLT+${PLT}}
   .${BSS_NAME}          ${RELOCATING-0} :
   {
This page took 0.026211 seconds and 4 git commands to generate.