Reorder powerpc64 sections for -z relro

More sections can be read-only after relocation.  .opd is an obvious
candidate.

	* emulparams/elf64ppc.sh (OTHER_READWRITE_SECTIONS): Move .opd to..
	(OTHER_RELRO_SECTIONS_2): ..here, new define.
	* scripttempl/elf.sc: Add OTHER_RELRO_SECTIONS_2.
This commit is contained in:
Alan Modra 2015-01-20 17:11:21 +10:30
parent 03d5b77300
commit 3e2b0f3116
3 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2015-01-20 Alan Modra <amodra@gmail.com>
* emulparams/elf64ppc.sh (OTHER_READWRITE_SECTIONS): Move .opd to..
(OTHER_RELRO_SECTIONS_2): ..here, new define.
* scripttempl/elf.sc: Add OTHER_RELRO_SECTIONS_2.
2015-01-19 Alan Modra <amodra@gmail.com>
PR ld/17615

View File

@ -37,5 +37,6 @@ OTHER_GOT_RELOC_SECTIONS="
.rela.branch_lt ${RELOCATING-0} : { *(.rela.branch_lt) }"
OTHER_READWRITE_SECTIONS="
.toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) }
.opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) }
.branch_lt ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.branch_lt) }"
OTHER_RELRO_SECTIONS_2="
.opd ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { KEEP (*(.opd)) }"

View File

@ -20,6 +20,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
@ -572,6 +573,7 @@ cat <<EOF
${RELOCATING+${DATARELRO}}
${OTHER_RELRO_SECTIONS}
${TEXT_DYNAMIC-${DYNAMIC}}
${OTHER_RELRO_SECTIONS_2}
${DATA_GOT+${RELRO_NOW+${GOT}}}
${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}