[binutils-gdb] Reorder powerpc64 sections for -z relro

Alan Modra amodra@sourceware.org
Tue Jan 20 09:29:00 GMT 2015


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3e2b0f3116a46c8a9a6ffbcb5ae4847b6601467a

commit 3e2b0f3116a46c8a9a6ffbcb5ae4847b6601467a
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Jan 20 17:11:21 2015 +1030

    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.

Diff:
---
 ld/ChangeLog              | 6 ++++++
 ld/emulparams/elf64ppc.sh | 3 ++-
 ld/scripttempl/elf.sc     | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index ae0b29a..4966045 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -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
diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh
index 355e046..556fbf5 100644
--- a/ld/emulparams/elf64ppc.sh
+++ b/ld/emulparams/elf64ppc.sh
@@ -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)) }"
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index b3d95d0..07b0395 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -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}}}}



More information about the Binutils-cvs mailing list