So it looks like relro wasn't working for me on mips64...because I couldn't count zeros correctly: 0x1000 != 0x10000, resulting in it aligning on subpage size and protecting the relro area altered the .data and .bss segments too. Setting COMMONPAGESIZE to 0x4000 == 16K, the advertised page size on loongson appears to have everything working.
Also, since mips64 doesn't have a real hardware NX bit, splitting the .text and .rodata segments doesn't actually get us anything from a protection standpoint. So, unset PAD_NO to smoosh them back together. What I'm not sure is if the pmap would be happier with them separate: the workaround for the "R4000 EOP" bug applies to PROT_EXEC pages only, so maybe it would be better to keep them separate for that? Anyone? I'm going to leave the loongon doing the full build overnight, but it looks like it's happy with the critical parts of a partial build... Philip Index: ld/ldmain.c =================================================================== RCS file: /data/src/openbsd/src/gnu/usr.bin/binutils-2.17/ld/ldmain.c,v retrieving revision 1.10 diff -u -p -r1.10 ldmain.c --- ld/ldmain.c 10 Aug 2016 02:58:44 -0000 1.10 +++ ld/ldmain.c 10 Aug 2016 07:16:41 -0000 @@ -299,7 +299,7 @@ main (int argc, char **argv) link_info.new_dtags = FALSE; link_info.combreloc = TRUE; link_info.eh_frame_hdr = FALSE; -#if defined(__mips64__) || defined(__m88k__) +#if defined(__m88k__) link_info.relro = FALSE; #else link_info.relro = TRUE; Index: ld/emulparams/elf64btsmip_obsd.sh =================================================================== RCS file: /data/src/openbsd/src/gnu/usr.bin/binutils-2.17/ld/emulparams/elf64btsmip_obsd.sh,v retrieving revision 1.3 diff -u -p -r1.3 elf64btsmip_obsd.sh --- ld/emulparams/elf64btsmip_obsd.sh 10 Aug 2016 02:58:44 -0000 1.3 +++ ld/emulparams/elf64btsmip_obsd.sh 10 Aug 2016 07:04:26 -0000 @@ -1,7 +1,9 @@ . ${srcdir}/emulparams/elf64btsmip.sh MAXPAGESIZE=0x10000 -COMMONPAGESIZE=0x1000 +COMMONPAGESIZE=0x4000 TEXT_START_ADDR="0x10000000" . ${srcdir}/emulparams/elf_obsd.sh # XXX causes GOT oflows NO_PAD_CDTOR=y +# No nx bit, so don't bother to pad between .text and .rodata +unset PAD_RO Index: ld/emulparams/elf64ltsmip_obsd.sh =================================================================== RCS file: /data/src/openbsd/src/gnu/usr.bin/binutils-2.17/ld/emulparams/elf64ltsmip_obsd.sh,v retrieving revision 1.3 diff -u -p -r1.3 elf64ltsmip_obsd.sh --- ld/emulparams/elf64ltsmip_obsd.sh 10 Aug 2016 02:58:44 -0000 1.3 +++ ld/emulparams/elf64ltsmip_obsd.sh 10 Aug 2016 07:04:16 -0000 @@ -1,7 +1,9 @@ . ${srcdir}/emulparams/elf64ltsmip.sh MAXPAGESIZE=0x10000 -COMMONPAGESIZE=0x1000 +COMMONPAGESIZE=0x4000 TEXT_START_ADDR="0x10000000" . ${srcdir}/emulparams/elf_obsd.sh # XXX causes GOT oflows NO_PAD_CDTOR=y +# No nx bit, so don't bother to pad between .text and .rodata +unset PAD_RO