Turns out our binutils configuration for OpenBSD/powerpc is missing
some bits that are needed for Secure-PLT support. Without this, ld is
likely to crash if it sees an object file compiled with -msecure-plt.
This also nails down the way the sections are laid out in the final
executable and shared libraries. On Linux the layout varies between
the BSS-PLT and Secure-PLT ABI. This is done for relro support, but
doesn't play well with the way we've implemented W*X, which already
makes the GOT and PLT read-only.
ok?
Index: binutils-2.17/ld/emulparams/elf32ppc_obsd.sh
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/ld/emulparams/elf32ppc_obsd.sh,v
retrieving revision 1.2
diff -u -p -r1.2 elf32ppc_obsd.sh
--- binutils-2.17/ld/emulparams/elf32ppc_obsd.sh 30 Mar 2013 21:31:21
-0000 1.2
+++ binutils-2.17/ld/emulparams/elf32ppc_obsd.sh 14 Aug 2015 20:19:25
-0000
@@ -1,14 +1,7 @@
-# . ${srcdir}/emulparams/elf32ppc.sh
. ${srcdir}/emulparams/elf32ppccommon.sh
-## # Yes, we want duplicate .got and .plt sections. The linker chooses the
-## # appropriate one magically in ppc_after_open
-## DATA_GOT=
-## SDATA_GOT=
-## SEPARATE_GOTPLT=0
+# We deliberately keep the traditional OpenBSD W^X layout for both the
+# old BSS-PLT and the new Secure-PLT ABI.
BSS_PLT=
-## GOT=".got ${RELOCATING-0} : SPECIAL { *(.got) }"
-## PLT=".plt ${RELOCATING-0} : SPECIAL { *(.plt) }"
-## GOTPLT="${PLT}"
-## OTHER_TEXT_SECTIONS="*(.glink)"
-## EXTRA_EM_FILE=ppc32elf
+OTHER_TEXT_SECTIONS="*(.glink)"
+EXTRA_EM_FILE=ppc32elf
. ${srcdir}/emulparams/elf_obsd.sh