This teaches readelf and objdump about PT_OPENBSD_BOOTDATA (seen in at
least the sparc64 kernel) and teaches ld about that and PT_GNU_RELRO, so
that the symbol names can be used in linker scripts.
ok?
Philip Guenther
Index: include/elf/common.h
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/include/elf/common.h,v
retrieving revision 1.5
diff -u -p -r1.5 common.h
--- include/elf/common.h 19 Jun 2016 22:57:53 -0000 1.5
+++ include/elf/common.h 10 Aug 2016 04:02:12 -0000
@@ -307,6 +307,7 @@
#define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* Fill with random data. */
#define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* Program does W^X violations */
+#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* Section for boot arguments */
/* Program segment permissions, in program header p_flags field. */
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elf.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf.c
--- bfd/elf.c 1 Aug 2016 16:40:09 -0000 1.11
+++ bfd/elf.c 10 Aug 2016 04:02:14 -0000
@@ -1087,6 +1087,7 @@ get_segment_type (unsigned int p_type)
case PT_GNU_RELRO: pt = "RELRO"; break;
case PT_OPENBSD_RANDOMIZE: pt = "OPENBSD_RANDOMIZE"; break;
case PT_OPENBSD_WXNEEDED: pt = "OPENBSD_WXNEEDED"; break;
+ case PT_OPENBSD_BOOTDATA: pt = "OPENBSD_BOOTDATA"; break;
default: pt = NULL; break;
}
return pt;
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/binutils/readelf.c,v
retrieving revision 1.11
diff -u -p -r1.11 readelf.c
--- binutils/readelf.c 19 Jun 2016 22:57:53 -0000 1.11
+++ binutils/readelf.c 10 Aug 2016 04:02:15 -0000
@@ -2390,6 +2390,8 @@ get_segment_type (unsigned long p_type)
return "OPENBSD_RANDOMIZE";
case PT_OPENBSD_WXNEEDED:
return "OPENBSD_WXNEEDED";
+ case PT_OPENBSD_BOOTDATA:
+ return "OPENBSD_BOOTDATA";
default:
if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
Index: ld/ldgram.y
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/ld/ldgram.y,v
retrieving revision 1.5
diff -u -p -r1.5 ldgram.y
--- ld/ldgram.y 28 May 2016 23:24:16 -0000 1.5
+++ ld/ldgram.y 10 Aug 2016 04:02:15 -0000
@@ -1089,10 +1089,14 @@ phdr_type:
$$ = exp_intop (0x6474e550);
else if (strcmp (s, "PT_GNU_STACK") == 0)
$$ = exp_intop (0x6474e551);
+ else if (strcmp (s, "PT_GNU_RELRO") == 0)
+ $$ = exp_intop (0x6474e552);
else if (strcmp (s, "PT_OPENBSD_RANDOMIZE") == 0)
$$ = exp_intop (0x65a3dbe6);
else if (strcmp (s, "PT_OPENBSD_WXNEEDED") == 0)
$$ = exp_intop (0x65a3dbe7);
+ else if (strcmp (s, "PT_OPENBSD_BOOTDATA") == 0)
+ $$ = exp_intop (0x65a41be6);
else
{
einfo (_("\